99 lines
1.8 KiB
PHP
99 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Fonctions utiles au plugin GamuTable
|
|
*
|
|
* @plugin GamuTable
|
|
* @copyright 2020
|
|
* @author tofulm
|
|
* @licence GNU/GPL
|
|
* @package SPIP\Gamutable\Fonctions
|
|
*/
|
|
|
|
if (!defined("_ECRIRE_INC_VERSION")) {
|
|
return;
|
|
}
|
|
include_spip("inc/vite");
|
|
|
|
|
|
if (!function_exists('tsEnDate')) {
|
|
/**
|
|
* retour la date d'un timestamp
|
|
*
|
|
* @param $ts
|
|
*
|
|
* @return string
|
|
*/
|
|
function tsEnDate($ts) {
|
|
$ts = intval($ts);
|
|
return date('Y-m-d H:i:s', $ts);
|
|
}
|
|
}
|
|
|
|
function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) {
|
|
if ($num) {
|
|
$num = "_deux";
|
|
}
|
|
|
|
$html = <<<EOJS
|
|
<script type="text/javascript">
|
|
id = "$id_objet";
|
|
if (id === 'maj' || !id) {
|
|
if (typeof app !== 'undefined') {
|
|
app.rechargerJson(id);
|
|
}
|
|
if (typeof app_deux !== 'undefined') {
|
|
app_deux.rechargerJson(id);
|
|
}
|
|
} else {
|
|
id = parseInt(id);
|
|
if (id > 0 && id < 9999999999) {
|
|
if (typeof app$num !== 'undefined') {
|
|
app$num.rechargerJson(id);
|
|
}
|
|
}
|
|
if (id === 9999999999) {
|
|
if (typeof app$num !== 'undefined') {
|
|
app$num.rechargerJson();
|
|
}
|
|
}
|
|
}
|
|
$.modalboxclose();
|
|
delete id;
|
|
</script>
|
|
EOJS;
|
|
return $html;
|
|
}
|
|
|
|
function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) {
|
|
if ($num) {
|
|
$num = "_deux";
|
|
}
|
|
|
|
$html = <<<EOJS
|
|
<script type="text/javascript">
|
|
id = "$id_objet";
|
|
if (id === 'maj' || !id) {
|
|
if (typeof app !== 'undefined') {
|
|
app.rechargerJson(id);
|
|
}
|
|
if (typeof app_deux !== 'undefined') {
|
|
app_deux.rechargerJson(id);
|
|
}
|
|
} else {
|
|
id = parseInt(id);
|
|
if (id > 0 && id < 9999999999) {
|
|
if (typeof app$num !== 'undefined') {
|
|
app$num.rechargerJson(id);
|
|
}
|
|
}
|
|
if (id === 9999999999) {
|
|
if (typeof app$num !== 'undefined') {
|
|
app$num.rechargerJson();
|
|
}
|
|
}
|
|
}
|
|
delete id;
|
|
</script>
|
|
EOJS;
|
|
return $html;
|
|
}
|