function getHTML($groupe, $id) { asort($groupe[0]); asort($groupe[1]); $retour = "<table class='tab_cadre_fixe'>"; $retour .= "<tr>"; $retour .= "<th colspan=\"2\">Gestion des groupes de l'ordinateur</th>"; $retour .= "</tr>"; $retour .= "<tr>"; $retour .= "<td><table width=\"430px\"><TH>Membre de</TH></table></td>"; $retour .= "<td><table width=\"430px\"><TH>Groupes disponibles</TH></table></td>"; $retour .= "</tr>"; $retour .= "<tr>"; $retour .= "<td>"; $retour .= "<div style=\"height: 200px; width: 450px; overflow-y: scroll; overflow-x: hidden\" name=\"groupeOrdinateur\">"; $retour .= "<table width=\"430px\">"; foreach ($groupe[0] as $groupeOrdi) { $retour .= "<TR>"; $retour .= "<TD width=\"400px\" align=\"right\">{$groupeOrdi}</TD>"; $retour .= "<TD width=\"30px\"><button id=\"btn-suppGroupe\" onclick=\"change('supp','{$groupeOrdi}','{$id}')\"><img alt='' title=\"Retirer\" src='" . getHttpPath() . "/pics/right.png'></button></TD>"; $retour .= "</TR>"; } $retour .= "</table>"; $retour .= "</div>"; $retour .= "</td>"; $retour .= "<td>"; $retour .= "<div style=\"height: 200px; width: 450px; overflow-y: scroll; overflow-x: hidden\" name=\"groupeAD\">"; $retour .= "<table width=\"430px\">"; foreach ($groupe[1] as $groupeLDAP) { $retour .= "<TR>"; $retour .= "<TD width=\"30px\"><button id=\"btn-addGroupe\" onclick=\"change('add','{$groupeLDAP}','{$id}')\"><img alt='' title=\"Ajouter\" src='" . getHttpPath() . "/pics/left.png'></button></TD>"; $retour .= "<TD width=\"400px\">{$groupeLDAP}</TD>"; $retour .= "</TR>"; } $retour .= "</table>"; $retour .= "</div>"; $retour .= "</td>"; $retour .= "</tr>"; $retour .= "<tr>"; $retour .= "<td colspan=\"2\" align=\"center\">"; $retour .= "<button id=\"btn-log\" onclick=\"log()\"><img alt='' title=\"Historique\" src='" . getHttpPath() . "/pics/reservation-3.png'>Historique</button></TD>"; $retour .= "</td>"; $retour .= "</tr>"; $retour .= "</table>"; echo $retour; }
// définition de l'emplacement de la bibliothèque define('SMARTY_DIR', $cheminSmarty . "/libs/"); // instanciation de la class Smarty require_once SMARTY_DIR . 'Smarty.class.php'; $smarty = new Smarty(); // définition des dossiers Smarty $smarty->template_dir = $cheminSmarty . "/templates/"; $smarty->compile_dir = $cheminSmarty . "/templates_c/"; $smarty->config_dir = $cheminSmarty . "/configs/"; $smarty->cache_dir = $cheminSmarty . "/cache/"; define('GLPI_ROOT', str_replace("/plugins/twins/", "", getAbsolutePath())); include GLPI_ROOT . "/inc/includes.php"; $id = $_GET['id']; $twins = new PluginTwinsTwins(); $smarty->assign('historique', $twins->getHistorique($id)); $smarty->assign('httpPath', getHttpPath()); $smarty->display('historique.tpl'); /** * Récupère le chemin absolue de l'instance glpi * @return String : le chemin absolue (racine principale) */ function getAbsolutePath() { return str_replace("popup/twins.popup.php", "", $_SERVER['SCRIPT_FILENAME']); } /** * Récupère le chemin http absolu de l'application glpi * @return string : le chemin http absolue de l'application */ function getHttpPath() {
$smarty->config_dir = $cheminSmarty . "/configs/"; $smarty->cache_dir = $cheminSmarty . "/cache/"; //Instanciation de la class config $config = new PluginGroupeadConfig(); //Gestion des images $actualiserOption['title'] = "Modifier"; $actualiserOption['alt'] = "Modifier"; $menuaddOption['title'] = "Ajouter AD"; $menuaddOption['alt'] = "Ajouter AD"; $smarty->assign('actualiserIMG', HTML::image(getHttpPath() . 'pics/actualiser.png', $actualiserOption)); $smarty->assign('menuaddIMG', HTML::image(getHttpPath() . 'pics/menu_add.png', $menuaddOption)); //Envoie des variables à Smarty $smarty->assign('infoAD', $config->getAD()); $smarty->assign('httpPath', getHttpPath()); //$smarty->assign('absolutePath', getAbsolutePath()); $smarty->assign('targetCSS', getHttpPath() . "plugins/groupead/css/groupead.css"); //Affichage de l'entête GLPI HTML::header('Configuration Plugin GroupeAD'); //Affichage du plugin $smarty->display('config.tpl'); //Affichage du pied de page GLPI HTML::footer(); //========================================================================// /** * Récupère le chemin absolue de l'instance glpi * @return String : le chemin absolue (racine principale) */ function getAbsolutePath() { return str_replace("plugins/groupead/front/config.form.php", "", $_SERVER['SCRIPT_FILENAME']); }
$smarty->compile_dir = $cheminSmarty . "/templates_c/"; $smarty->config_dir = $cheminSmarty . "/configs/"; $smarty->cache_dir = $cheminSmarty . "/cache/"; //Instanciation de la class config $config = new PluginTwinsConfig(); //Gestion des images $actualiserOption['title'] = "Modifier"; $actualiserOption['alt'] = "Modifier"; $menuaddOption['title'] = "Ajouter AD"; $menuaddOption['alt'] = "Ajouter AD"; $smarty->assign('actualiserIMG', HTML::image(getHttpPath() . 'pics/actualiser.png', $actualiserOption)); $smarty->assign('menuaddIMG', HTML::image(getHttpPath() . 'pics/menu_add.png', $menuaddOption)); //Envoie des variables à Smarty $smarty->assign('infoAD', $config->getAD()); $smarty->assign('httpPath', getHttpPath()); $smarty->assign('targetCSS', getHttpPath() . "plugins/twins/css/twins.css"); //Affichage de l'entête GLPI HTML::header('Configuration Plugin Twins'); //Affichage du plugin $smarty->display('config.tpl'); //Affichage du pied de page GLPI HTML::footer(); //========================================================================// /** * Récupère le chemin absolue de l'instance glpi * @return String : le chemin absolue (racine principale) */ function getAbsolutePath() { return str_replace("plugins/twins/front/config.form.php", "", $_SERVER['SCRIPT_FILENAME']); }
//Envoie des variables à Smarty $smarty->assign('ajoutInfo', $ajoutInfo); $smarty->assign('infoAdministrative', $config->getInfoAdministrative()); $smarty->assign('supp_ids', array(1, 0)); $smarty->assign('supp_names', array('Oui', 'Non')); $smarty->assign('infoStatut', $config->getStatutListe()); $smarty->assign('infoAD', $config->getAD()); $smarty->assign('targetForm', getHttpPath() . "plugins/reforme/front/config.form.php"); $smarty->assign('endform', HTML::closeForm(false)); $smarty->assign('testIMG', HTML::image(getHttpPath() . "plugins/reforme/images/test.png", $testOption)); $smarty->assign('logoIMG', HTML::image(getHttpPath() . "plugins/reforme/images/logo.png", $logoOption)); $smarty->assign('actualiserIMG', HTML::image(getHttpPath() . 'pics/actualiser.png', $actualiserOption)); $smarty->assign('menuaddIMG', HTML::image(getHttpPath() . 'pics/menu_add.png', $menuaddOption)); $smarty->assign('targetCSS', getHttpPath() . "plugins/reforme/css/reforme.css"); $smarty->assign('targetConfigAjax', getHttpPath() . "plugins/reforme/ajax/config.ajax.php"); $smarty->assign('addstatut', getHttpPath() . "front/state.php"); //Affichage de l'entête GLPI HTML::header('Configuration Plugin Reforme'); //Affichage du plugin $smarty->display('config.tpl'); //Affichage du pied de page GLPI HTML::footer(); //========================================================================// /** * Récupère le chemin absolue de l'instance glpi * @return String : le chemin absolue (racine principale) */ function getAbsolutePath() { return str_replace("plugins/reforme/front/config.form.php", "", $_SERVER['SCRIPT_FILENAME']); }
/** * Fonction de mise en forme pour la gestion des groupes * @param array $groupe * @return string HTML pour ajax */ function getVueGestionGroupe($groupe, $id) { $groupeString = null; if ($groupe != "") { foreach ($groupe[0] as $groupeOrdi) { $groupeString .= $groupeOrdi . ","; } $groupeString = substr($groupeString, 0, -1); $groupeString .= "|"; foreach ($groupe[1] as $groupeAD) { $groupeString .= $groupeAD . ","; } $groupeString = substr($groupeString, 0, -1); $retour = "<div id=\"txtHint\">"; $retour .= "<table class='tab_cadre_fixe'>"; $retour .= "<tr>"; $retour .= "<th colspan=\"2\">Gestion des groupes de l'ordinateur</th>"; $retour .= "</tr>"; $retour .= "<tr>"; $retour .= "<td><table width=\"430px\"><TH>Membre de</TH></table></td>"; $retour .= "<td><table width=\"430px\"><TH>Groupes disponibles</TH></table></td>"; $retour .= "</tr>"; $retour .= "<tr>"; $retour .= "<td>"; $retour .= "<div style=\"height: 200px; width: 450px; overflow-y: scroll; overflow-x: hidden\" name=\"groupeOrdinateur\">"; $retour .= "<table width=\"430px\">"; foreach ($groupe[0] as $groupeOrdi) { $retour .= "<TR>"; $retour .= "<TD width=\"400px\">{$groupeOrdi}</TD>"; $retour .= "<TD width=\"30px\"><button id=\"btn-suppGroupe\" onclick=\"change('supp','{$groupeString}','{$groupeOrdi}','{$id}')\"><img alt='' title=\"Retirer\" src='" . getHttpPath() . "/pics/right.png'></button></TD>"; $retour .= "</TR>"; } $retour .= "</table>"; $retour .= "</div>"; $retour .= "</td>"; $retour .= "<td>"; $retour .= "<div style=\"height: 200px; width: 450px; overflow-y: scroll; overflow-x: hidden\" name=\"groupeAD\">"; $retour .= "<table width=\"430px\">"; foreach ($groupe[1] as $groupeLDAP) { $retour .= "<TR>"; $retour .= "<TD width=\"30px\"><button id=\"btn-addGroupe\" onclick=\"change('add','{$groupeString}','{$groupeLDAP}','{$id}')\"><img alt='' title=\"Ajouter\" src='" . getHttpPath() . "/pics/left.png'></button></TD>"; $retour .= "<TD width=\"400px\">{$groupeLDAP}</TD>"; $retour .= "</TR>"; } $retour .= "</table>"; $retour .= "</div>"; $retour .= "</td>"; $retour .= "</tr>"; } $retour .= "<tr><td colspan='4' align=\"center\">"; $retour .= "<button rel=tooltip title=\"Valider\" id=\"btn-valider\" onclick=\"cloner('cloner')\">"; $retour .= "<img alt='' title=\"Valider\" src='" . getHttpPath() . "pics/ok.png'>"; $retour .= "</td></tr>"; $retour .= "</table></div>"; $retour .= "<input type=\"hidden\" id=\"groupe\" value=\"" . $groupeString . "\">"; return $retour; }