本文整理匯總了PHP中AuthLDAP::Dropdown方法的典型用法代碼示例。如果您正苦於以下問題:PHP AuthLDAP::Dropdown方法的具體用法?PHP AuthLDAP::Dropdown怎麽用?PHP AuthLDAP::Dropdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AuthLDAP
的用法示例。
在下文中一共展示了AuthLDAP::Dropdown方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ldapChooseDirectory
/** Form to choose a ldap server
*
* @param $target target page for the form
*
* @return nothing
**/
static function ldapChooseDirectory($target)
{
global $DB;
$query = "SELECT *\n FROM `glpi_authldaps`\n WHERE `is_active` = '1'\n ORDER BY `name` ASC";
$result = $DB->query($query);
if ($DB->numrows($result) == 1) {
//If only one server, do not show the choose ldap server window
$ldap = $DB->fetch_assoc($result);
$_SESSION["ldap_server"] = $ldap["id"];
Html::redirect($_SERVER['PHP_SELF']);
}
echo "<div class='center'>";
echo "<form action='{$target}' method=\"post\">";
echo "<p>" . __('Please choose LDAP directory to import users from') . "</p>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('LDAP directory choice') . "</th></tr>";
//If more than one ldap server
if ($DB->numrows($result) > 1) {
echo "<tr class='tab_bg_2'><td class='center'>" . __('Name') . "</td>";
echo "<td class='center'>";
AuthLDAP::Dropdown(array('name' => 'ldap_server', 'display_emptychoice' => false, 'comment' => true, 'condition' => "`is_active`='1'"));
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td class='center' colspan='2'>";
echo "<input class='submit' type='submit' name='ldap_showusers' value=\"" . _sx('button', 'Post') . "\"></td></tr>";
} else {
//No ldap server
echo "<tr class='tab_bg_2'>" . "<td class='center' colspan='2'>" . __('No LDAP directory defined in GLPI') . "</td></tr>";
}
echo "</table>";
Html::closeForm();
echo "</div>";
}