コード例 #1
0
 function showFormReplicatesConfig($ID, $target)
 {
     global $LANG, $DB;
     AuthLdapReplicate::addNewReplicateForm($target, $ID);
     $sql = "SELECT *\n              FROM `glpi_authldapreplicates`\n              WHERE `authldaps_id` = '{$ID}'\n              ORDER BY `name`";
     $result = $DB->query($sql);
     if ($DB->numrows($result) > 0) {
         echo "<br>";
         $canedit = haveRight("config", "w");
         echo "<form action='{$target}' method='post' name='ldap_replicates_form'\n                id='ldap_replicates_form'>";
         echo "<div class='center'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<input type='hidden' name='id' value='{$ID}'>";
         echo "<tr><th colspan='4'>" . $LANG['ldap'][18] . "</th></tr>";
         if (isset($_SESSION["LDAP_TEST_MESSAGE"])) {
             echo "<tr class='tab_bg_2'><td class='center' colspan=4>";
             echo $_SESSION["LDAP_TEST_MESSAGE"];
             echo "</td></tr>";
             unset($_SESSION["LDAP_TEST_MESSAGE"]);
         }
         echo "<tr class='tab_bg_2'><td></td>";
         echo "<td class='center b'>" . $LANG['common'][16] . "</td>";
         echo "<td class='center b'>" . $LANG['ldap'][18] . "</td><td class='center'></td></tr>";
         while ($ldap_replicate = $DB->fetch_array($result)) {
             echo "<tr class='tab_bg_1'><td class='center' width='10'>";
             if (isset($_GET["select"]) && $_GET["select"] == "all") {
                 $sel = "checked";
             }
             $sel = "";
             echo "<input type='checkbox' name='item[" . $ldap_replicate["id"] . "]' value='1' {$sel}>";
             echo "</td>";
             echo "<td class='center'>" . $ldap_replicate["name"] . "</td>";
             echo "<td class='center'>" . $ldap_replicate["host"] . "&nbsp;: " . $ldap_replicate["port"];
             echo "</td><td class='center'>";
             echo "<input type='submit' name='test_ldap_replicate[" . $ldap_replicate["id"] . "]'\n                  class='submit' value='" . $LANG['buttons'][50] . "'></td>";
             echo "</tr>";
         }
         echo "</table>";
         openArrowMassive("ldap_replicates_form", true);
         closeArrowMassive('delete_replicate', $LANG['buttons'][6]);
         echo "</div></form>";
     }
 }
コード例 #2
0
 function showFormReplicatesConfig()
 {
     global $DB;
     $ID = $this->getField('id');
     $target = $this->getFormURL();
     $rand = mt_rand();
     AuthLdapReplicate::addNewReplicateForm($target, $ID);
     $sql = "SELECT *\n              FROM `glpi_authldapreplicates`\n              WHERE `authldaps_id` = '{$ID}'\n              ORDER BY `name`";
     $result = $DB->query($sql);
     if (($nb = $DB->numrows($result)) > 0) {
         echo "<br>";
         $canedit = Config::canUpdate();
         echo "<div class='center'>";
         Html::openMassiveActionsForm('massAuthLdapReplicate' . $rand);
         $massiveactionparams = array('num_displayed' => $nb, 'container' => 'massAuthLdapReplicate' . $rand);
         Html::showMassiveActions($massiveactionparams);
         echo "<input type='hidden' name='id' value='{$ID}'>";
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr class='noHover'>" . "<th colspan='4'>" . __('List of LDAP directory replicates') . "</th></tr>";
         if (isset($_SESSION["LDAP_TEST_MESSAGE"])) {
             echo "<tr class='tab_bg_2'><td class='center' colspan='4'>";
             echo $_SESSION["LDAP_TEST_MESSAGE"];
             echo "</td></tr>";
             unset($_SESSION["LDAP_TEST_MESSAGE"]);
         }
         $header_begin = "<tr>";
         $header_top = "<th>" . Html::getCheckAllAsCheckbox('massAuthLdapReplicate' . $rand) . "</th>";
         $header_bottom = "<th>" . Html::getCheckAllAsCheckbox('massAuthLdapReplicate' . $rand) . "</th>";
         $header_end = "<th class='center b'>" . __('Name') . "</th>";
         $header_end .= "<th class='center b'>" . _n('Replicate', 'Replicates', 1) . "</th>" . "<th class='center'></th></tr>";
         echo $header_begin . $header_top . $header_end;
         while ($ldap_replicate = $DB->fetch_assoc($result)) {
             echo "<tr class='tab_bg_1'><td class='center' width='10'>";
             Html::showMassiveActionCheckBox('AuthLdapReplicate', $ldap_replicate["id"]);
             echo "</td>";
             echo "<td class='center'>" . $ldap_replicate["name"] . "</td>";
             echo "<td class='center'>" . sprintf(__('%1$s: %2$s'), $ldap_replicate["host"], $ldap_replicate["port"]);
             echo "</td>";
             echo "<td class='center'>";
             Html::showSimpleForm(Toolbox::getItemTypeFormURL(self::getType()), 'test_ldap_replicate', _sx('button', 'Test'), array('id' => $ID, 'ldap_replicate_id' => $ldap_replicate["id"]));
             echo "</td></tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
         echo "</table>";
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
         echo "</div>";
     }
 }
コード例 #3
0
ファイル: authldap.class.php プロジェクト: gaforeror/glpi
 function showFormReplicatesConfig()
 {
     global $DB;
     $ID = $this->getField('id');
     $target = $this->getFormURL();
     $rand = mt_rand();
     AuthLdapReplicate::addNewReplicateForm($target, $ID);
     $sql = "SELECT *\n              FROM `glpi_authldapreplicates`\n              WHERE `authldaps_id` = '{$ID}'\n              ORDER BY `name`";
     $result = $DB->query($sql);
     if (($nb = $DB->numrows($result)) > 0) {
         echo "<br>";
         $canedit = Session::haveRight("config", "w");
         Html::openMassiveActionsForm('massAuthLdapReplicate' . $rand);
         echo "<div class='center'>";
         $massiveactionparams = array('num_displayed' => $nb);
         Html::showMassiveActions('AuthLdapReplicate', $massiveactionparams);
         echo "<table class='tab_cadre_fixe'>";
         echo "<input type='hidden' name='id' value='{$ID}'>";
         echo "<tr><th colspan='4'>" . __('List of LDAP directory replicates') . "</th></tr>";
         if (isset($_SESSION["LDAP_TEST_MESSAGE"])) {
             echo "<tr class='tab_bg_2'><td class='center' colspan='4'>";
             echo $_SESSION["LDAP_TEST_MESSAGE"];
             echo "</td></tr>";
             unset($_SESSION["LDAP_TEST_MESSAGE"]);
         }
         echo "<tr class='tab_bg_2'>";
         echo "<th>" . Html::getCheckAllAsCheckbox('massAuthLdapReplicate' . $rand) . "</th>";
         echo "<th class='center b'>" . __('Name') . "</th>";
         echo "<th class='center b'>" . __('List of LDAP directory replicates') . "</th>" . "<th class='center'></th></tr>";
         while ($ldap_replicate = $DB->fetch_assoc($result)) {
             echo "<tr class='tab_bg_1'><td class='center' width='10'>";
             Html::showMassiveActionCheckBox('AuthLdapReplicate', $ldap_replicate["id"]);
             echo "</td>";
             echo "<td class='center'>" . $ldap_replicate["name"] . "</td>";
             echo "<td class='center'>" . sprintf(__('%1$s: %2$s'), $ldap_replicate["host"], $ldap_replicate["port"]);
             echo "</td><td class='center'>";
             echo "<input type='submit' name='test_ldap_replicate[" . $ldap_replicate["id"] . "]'\n                  class='submit' value='" . __s('Test') . "'></td>";
             echo "</tr>";
         }
         echo "</table>";
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions('AuthLdapReplicate', $massiveactionparams);
         echo "</div>";
         Html::closeForm();
     }
 }