本文整理汇总了PHP中Dropdown::showAdvanceDateRestrictionSwitch方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showAdvanceDateRestrictionSwitch方法的具体用法?PHP Dropdown::showAdvanceDateRestrictionSwitch怎么用?PHP Dropdown::showAdvanceDateRestrictionSwitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showAdvanceDateRestrictionSwitch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showUserImportForm
/**
* @param $authldap AuthLDAP object
**/
static function showUserImportForm(AuthLDAP $authldap)
{
global $DB;
//Get data related to entity (directory and ldap filter)
$authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
echo "<div class='center'>";
echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4' class='middle'><div class='relative'>";
echo "<span>" . ($_SESSION['ldap_import']['mode'] ? __('Synchronizing already imported users') : __('Import new users'));
// Expert interface allow user to override configuration.
// If not coming from the ticket form, then give expert/simple link
if ((Config::canUpdate() || Entity::canUpdate()) && !isset($_SESSION['ldap_import']['no_expert_mode'])) {
echo "</span> <span class='floatright'><a href='" . $_SERVER['PHP_SELF'] . "?action=" . $_SESSION['ldap_import']['action'] . "&mode=" . $_SESSION['ldap_import']['mode'];
if ($_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE) {
echo "&interface=" . self::EXPERT_INTERFACE . "'>" . __('Expert mode') . "</a>";
} else {
echo "&interface=" . self::SIMPLE_INTERFACE . "'>" . __('Simple mode') . "</a>";
}
} else {
$_SESSION['ldap_import']['interface'] = self::SIMPLE_INTERFACE;
}
echo "</span></div>";
echo "</th></tr>";
switch ($_SESSION['ldap_import']['interface']) {
case self::EXPERT_INTERFACE:
//If more than one directory configured
//Display dropdown ldap servers
if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) {
if (self::getNumberOfServers() > 1) {
echo "<tr class='tab_bg_2'><td>" . __('LDAP directory choice') . "</td>";
echo "<td colspan='3'>";
self::dropdown(array('name' => 'authldaps_id', 'value' => $_SESSION['ldap_import']['authldaps_id'], 'condition' => "`is_active` = '1'", 'display_emptychoice' => false));
echo " <input class='submit' type='submit' name='change_directory'\n value=\"" . _sx('button', 'To change') . "\">";
echo "</td></tr>";
}
echo "<tr class='tab_bg_2'><td>" . __('BaseDN') . "</td><td colspan='3'>";
echo "<input type='text' class='form-control' name='basedn' value=\"" . $_SESSION['ldap_import']['basedn'] . "\" size='90' " . (!$_SESSION['ldap_import']['basedn'] ? "disabled" : "") . ">";
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Search filter for users') . "</td><td colspan='3'>";
echo "<input type='text' class='form-control' name='ldap_filter' value=\"" . $_SESSION['ldap_import']['ldap_filter'] . "\" size='90'>";
echo "</td></tr>";
}
break;
//case self::SIMPLE_INTERFACE :
//case self::SIMPLE_INTERFACE :
default:
//If multi-entity mode and more than one entity visible
//else no need to select entity
if (Session::isMultiEntitiesMode() && count($_SESSION['glpiactiveentities']) > 1) {
echo "<tr class='tab_bg_2'><td>" . __('Select the desired entity') . "</td>" . "<td colspan='3'>";
Entity::dropdown(array('value' => $_SESSION['ldap_import']['entities_id'], 'entity' => $_SESSION['glpiactiveentities'], 'on_change' => 'submit()'));
echo "</td></tr>";
} else {
//Only one entity is active, store it
echo "<tr><td><input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'></td></tr>";
}
if (isset($_SESSION['ldap_import']['begin_date']) && !empty($_SESSION['ldap_import']['begin_date']) || isset($_SESSION['ldap_import']['end_date']) && !empty($_SESSION['ldap_import']['end_date'])) {
$enabled = 1;
} else {
$enabled = 0;
}
Dropdown::showAdvanceDateRestrictionSwitch($enabled);
echo "<table class='tab_cadre_fixe'>";
if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) {
$field_counter = 0;
$fields = array('login_field' => __('Login'), 'email1_field' => __('Email'), 'email2_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '2'), 'email3_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '3'), 'email4_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '4'), 'realname_field' => __('Surname'), 'firstname_field' => __('First name'), 'phone_field' => __('Phone'), 'phone2_field' => __('Phone 2'), 'mobile_field' => __('Mobile phone'), 'title_field' => _x('person', 'Title'), 'category_field' => __('Category'), 'picture_field' => __('Picture'));
$available_fields = array();
foreach ($fields as $field => $label) {
if (isset($authldap->fields[$field]) && $authldap->fields[$field] != '') {
$available_fields[$field] = $label;
}
}
echo "<tr><th colspan='4'>" . __('Search criteria for users') . "</th></tr>";
foreach ($available_fields as $field => $label) {
if ($field_counter == 0) {
echo "<tr class='tab_bg_1'>";
}
echo "<td>{$label}</td><td>";
$field_counter++;
echo "<input type='text' class='form-control' name='criterias[{$field}]' value='" . (isset($_SESSION['ldap_import']['criterias'][$field]) ? $_SESSION['ldap_import']['criterias'][$field] : '') . "'>";
echo "</td>";
if ($field_counter == 2) {
echo "</tr>";
$field_counter = 0;
}
}
if ($field_counter > 0) {
while ($field_counter < 2) {
echo "<td colspan='2'></td>";
$field_counter++;
}
$field_counter = 0;
echo "</tr>";
}
}
break;
//.........这里部分代码省略.........
示例2: showUserImportForm
static function showUserImportForm(AuthLDAP $authldap)
{
global $DB, $LANG;
//Get data related to entity (directory and ldap filter)
$authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']);
echo "<div class='center'>";
echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4' class='middle'><div class='relative'>";
echo "<span>" . ($_SESSION['ldap_import']['mode'] ? $LANG['ldap'][1] : $LANG['ldap'][2]);
// Expert interface allow user to override configuration.
// If not coming from the ticket form, then give expert/simple link
if ((haveRight('config', 'w') || haveRight('entity', 'w')) && !isset($_SESSION['ldap_import']['no_expert_mode'])) {
echo "</span> <span class='ldap_right'>" . $LANG['common'][65] . " : ";
echo "<a href='" . $_SERVER['PHP_SELF'] . "?action=" . $_SESSION['ldap_import']['action'] . "&mode=" . $_SESSION['ldap_import']['mode'] . "&interface=" . ($_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE ? self::EXPERT_INTERFACE : self::SIMPLE_INTERFACE) . "'>" . ($_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE ? $LANG['ldap'][39] : $LANG['ldap'][40]) . "</a>";
} else {
$_SESSION['ldap_import']['interface'] = self::SIMPLE_INTERFACE;
}
echo "</span></div>";
echo "</th></tr>";
switch ($_SESSION['ldap_import']['interface']) {
case self::EXPERT_INTERFACE:
//If more than one directory configured
//Display dropdown ldap servers
if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) {
if (self::getNumberOfServers() > 1) {
echo "<tr class='tab_bg_2'><td>" . $LANG['ldap'][4] . "</td><td colspan='3'>";
Dropdown::show('AuthLdap', array('name' => 'authldaps_id', 'value' => $_SESSION['ldap_import']['authldaps_id'], 'condition' => "`is_active` = '1'", 'display_emptychoice' => false));
echo " <input class='submit' type='submit' name='change_directory'\n value=\"" . $LANG['ldap'][41] . "\">";
echo "</td></tr>";
}
echo "<tr class='tab_bg_2'><td>Basedn</td><td colspan='3'>";
echo "<input type='text' name='basedn' value=\"" . $_SESSION['ldap_import']['basedn'] . "\" size='90' " . (!$_SESSION['ldap_import']['basedn'] ? "disabled" : "") . ">";
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . $LANG['setup'][263] . "</td><td colspan='3'>";
echo "<input type='text' name='ldap_filter' value=\"" . $_SESSION['ldap_import']['ldap_filter'] . "\" size='90'>";
echo "</td></tr>";
}
break;
//case self::SIMPLE_INTERFACE :
//case self::SIMPLE_INTERFACE :
default:
//If multi-entity mode and more than one entity visible
//else no need to select entity
if (isMultiEntitiesMode() && count($_SESSION['glpiactiveentities']) > 1) {
echo "<tr class='tab_bg_2'><td>" . $LANG['entity'][10] . "</td><td colspan='3'>";
Dropdown::show('Entity', array('value' => $_SESSION['ldap_import']['entities_id'], 'entity' => $_SESSION['glpiactiveentities'], 'auto_submit' => 1));
echo "</td></tr>";
} else {
//Only one entity is active, store it
echo "<tr><td><input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'></td></tr>";
}
if (isset($_SESSION['ldap_import']['days']) && $_SESSION['ldap_import']['days']) {
$enabled = 1;
} else {
$enabled = 0;
}
Dropdown::showAdvanceDateRestrictionSwitch($enabled);
echo "<table class='tab_cadre_fixe'>";
if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) {
$field_counter = 0;
$fields = array('login_field' => $LANG['login'][6], 'email_field' => $LANG['setup'][14], 'realname_field' => $LANG['common'][48], 'firstname_field' => $LANG['common'][43], 'phone_field' => $LANG['help'][35], 'phone2_field' => $LANG['help'][35] . " 2", 'mobile_field' => $LANG['common'][42], 'title_field' => $LANG['users'][1], 'category_field' => $LANG['users'][2]);
$available_fields = array();
foreach ($fields as $field => $label) {
if (isset($authldap->fields[$field]) && $authldap->fields[$field] != '') {
$available_fields[$field] = $label;
}
}
echo "<tr><th colspan='4'>" . $LANG['ldap'][38] . "</th></tr>";
foreach ($available_fields as $field => $label) {
if ($field_counter == 0) {
echo "<tr class='tab_bg_1'>";
}
echo "<td>{$label}</td><td>";
$field_counter++;
echo "<input type='text' name='criterias[{$field}]' value='" . (isset($_SESSION['ldap_import']['criterias'][$field]) ? $_SESSION['ldap_import']['criterias'][$field] : '') . "'>";
echo "</td>";
if ($field_counter == 2) {
echo "</tr>";
$field_counter = 0;
}
}
if ($field_counter > 0) {
while ($field_counter < 2) {
echo "<td colspan='2'></td>";
$field_counter++;
}
$field_counter = 0;
echo "</tr>";
}
}
break;
}
if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) {
if ($_SESSION['ldap_import']['authldaps_id']) {
echo "<tr class='tab_bg_2'><td colspan='4' class='center'>";
echo "<input class='submit' type='submit' name='search' value=\"" . $LANG['buttons'][0] . "\">";
echo "</td></tr>";
} else {
echo "<tr class='tab_bg_2'><td colspan='4' class='center'>" . $LANG['ldap'][42] . "</td></tr>";
//.........这里部分代码省略.........