本文整理汇总了PHP中Dropdown::getDropdownArrayNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::getDropdownArrayNames方法的具体用法?PHP Dropdown::getDropdownArrayNames怎么用?PHP Dropdown::getDropdownArrayNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::getDropdownArrayNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMyForm
/**
* Print the user preference form
*
* @param $target form target
* @param $ID integer Id of the user
*
* @return boolean : user found
**/
function showMyForm($target, $ID)
{
global $CFG_GLPI, $PLUGIN_HOOKS;
// Affiche un formulaire User
if ($ID != Session::getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) {
return false;
}
if ($this->getFromDB($ID)) {
$authtype = $this->getAuthMethodsByID();
$extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"]));
// No autocopletion :
$save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"];
$CFG_GLPI["use_ajax_autocompletion"] = false;
echo "<div class='center'>";
echo "<form method='post' name='user_manager' action='" . $target . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . sprintf(__('%1$s: %2$s'), __('Login'), $this->fields["name"]);
echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>";
echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>";
echo "</th></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Surname') . "</td><td>";
if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) {
echo $this->fields["realname"];
} else {
Html::autocompletionTextField($this, "realname");
}
echo "</td>";
//do some rights verification
if (!$extauth && Session::haveRight("password_update", "1")) {
echo "<td>" . __('Password') . "</td>";
echo "<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\"return passwordCheck();\">";
echo "</td></tr>";
} else {
echo "<td colspan='2'></tr>";
}
echo "<tr class='tab_bg_1'><td>" . __('First name') . "</td><td>";
if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) {
echo $this->fields["firstname"];
} else {
Html::autocompletionTextField($this, "firstname");
}
echo "</td>";
if (!$extauth && Session::haveRight("password_update", "1")) {
echo "<td>" . __('Password confirmation') . "</td>";
echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>";
echo "</td></tr>";
} else {
echo "<td colspan='2'></tr>";
}
echo "<tr class='tab_bg_1'><td class='top'>" . _n('Email', 'Emails', 2);
UserEmail::showAddEmailButton($this);
echo "</td><td>";
UserEmail::showForUser($this);
echo "</td>";
if (!$extauth && Session::haveRight("password_update", "1")) {
echo "<td>" . __('Password security policy') . "</td>";
echo "<td>";
Config::displayPasswordSecurityChecks();
echo "</td>";
} else {
echo "<td colspan='2'>";
}
echo "</tr>";
echo "<tr class='tab_bg_1'><td>" . __('Mobile phone') . " :</td><td>";
if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {
echo $this->fields["mobile"];
} else {
Html::autocompletionTextField($this, "mobile");
}
echo "</td>";
if (!GLPI_DEMO_MODE) {
echo "<td>" . __('Language') . "</td><td>";
// Use session variable because field in table may be null if same of the global config
Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"]));
} else {
echo "<td colspan='2'> ";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Phone') . "</td><td>";
if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {
echo $this->fields["phone"];
} else {
Html::autocompletionTextField($this, "phone");
}
echo "</td>";
if (count($_SESSION['glpiprofiles']) > 1) {
echo "<td>" . __('Default profile') . "</td><td>";
$options = array(0 => Dropdown::EMPTY_VALUE);
$options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
} else {
echo "<td colspan='2'> ";
//.........这里部分代码省略.........
示例2: showMyForm
/**
* Print the user preference form
*
* @param $target form target
* @param $ID Integer : Id of the user
*
* @return boolean : user found
**/
function showMyForm($target, $ID)
{
global $CFG_GLPI, $LANG, $PLUGIN_HOOKS;
// Affiche un formulaire User
if ($ID != getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) {
return false;
}
if ($this->getFromDB($ID)) {
$authtype = $this->getAuthMethodsByID();
$extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"]));
// No autocopletion :
$save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"];
$CFG_GLPI["use_ajax_autocompletion"] = false;
echo "<div class='center'>";
echo "<form method='post' name='user_manager' action='" . $target . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . $LANG['setup'][18] . " : " . $this->fields["name"];
echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>";
echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>";
echo "</th></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][48] . " :</td><td>";
if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) {
echo $this->fields["realname"];
} else {
autocompletionTextField($this, "realname");
}
echo "</td>";
//do some rights verification
if (!$extauth && haveRight("password_update", "1")) {
echo "<td>" . $LANG['setup'][19] . " :</td>";
echo "<td><input type='password' name='password' value='' size='30' autocomplete='off'>";
echo "</td></tr>";
} else {
echo "<td colspan='2'></tr>";
}
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][43] . " :</td><td>";
if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) {
echo $this->fields["firstname"];
} else {
autocompletionTextField($this, "firstname");
}
echo "</td>";
if (!$extauth && haveRight("password_update", "1")) {
echo "<td>" . $LANG['setup'][20] . " :</td>";
echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>";
echo "</td></tr>";
} else {
echo "<td colspan='2'></tr>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][14] . " :</td><td>";
if ($extauth && isset($authtype['email_field']) && !empty($authtype['email_field'])) {
echo $this->fields["email"];
} else {
autocompletionTextField($this, "email", array('name' => "email_form"));
if (!NotificationMail::isUserAddressValid($this->fields["email"])) {
echo "<br><span class='red'>" . $LANG['mailing'][110] . "</span>";
}
}
echo "</td>";
if (!GLPI_DEMO_MODE) {
echo "<td>" . $LANG['setup'][41] . " :</td><td>";
/// Use sesion variable because field in table may be null if same of the global config
Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"]));
} else {
echo "<td colspan='2'> ";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['common'][42] . " :</td><td>";
if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) {
echo $this->fields["mobile"];
} else {
autocompletionTextField($this, "mobile");
}
echo "</td>";
if (count($_SESSION['glpiprofiles']) > 1) {
echo "<td>" . $LANG['profiles'][13] . " :</td><td>";
$options = array(0 => DROPDOWN_EMPTY_VALUE);
$options += Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id']));
Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"]));
} else {
echo "<td colspan='2'> ";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['help'][35] . " :</td><td>";
if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) {
echo $this->fields["phone"];
} else {
autocompletionTextField($this, "phone");
}
echo "</td>";
if (!GLPI_DEMO_MODE && count($_SESSION['glpiactiveentities']) > 1) {
//.........这里部分代码省略.........