本文整理汇总了PHP中Dropdown::showLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showLanguages方法的具体用法?PHP Dropdown::showLanguages怎么用?PHP Dropdown::showLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showLanguages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: choose_language
function choose_language()
{
echo "<form action='install.php' method='post'>";
echo "<p class='center'>";
Dropdown::showLanguages("language", array('value' => "en_GB"));
echo "</p>";
echo "";
echo "<p class='submit'><input type='hidden' name='install' value='lang_select'>";
echo "<input type='submit' name='submit' class='submit' value='OK'></p>";
Html::closeForm();
}
示例2: choose_language
function choose_language()
{
global $CFG_GLPI;
echo "<form action='install.php' method='post'>";
echo "<p class='center'>";
// fix missing param for js drodpown
$CFG_GLPI['ajax_limit_count'] = 15;
Dropdown::showLanguages("language", array('value' => "en_GB"));
echo "</p>";
echo "";
echo "<p class='submit'><input type='hidden' name='install' value='lang_select'>";
echo "<input type='submit' name='submit' class='submit' value='OK'></p>";
Html::closeForm();
}
示例3: testShowLanguages
/**
* @covers Dropdown::showLanguages
*/
public function testShowLanguages()
{
$opt = ['display_emptychoice' => true, 'display' => false];
$out = Dropdown::showLanguages('dropfoo', $opt);
$this->assertContains("name='dropfoo'", $out);
$this->assertContains("value='' selected", $out);
$this->assertNotContains("value='0'", $out);
$this->assertContains("value='fr_FR'", $out);
$opt = ['display' => false, 'value' => 'cs_CZ', 'rand' => '1234'];
$out = Dropdown::showLanguages('language', $opt);
$this->assertNotContains("value=''", $out);
$this->assertNotContains("value='0'", $out);
$this->assertContains("name='language' id='dropdown_language1234", $out);
$this->assertContains("value='cs_CZ' selected", $out);
$this->assertContains("value='fr_FR'", $out);
}
示例4: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$this->check(-1, 'w');
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Name');
echo " :</td>";
echo "<td>";
echo '<input type="text" name="name" value="' . $this->fields["name"] . '" size="54"/>';
echo "</td>";
echo "</td><td>";
echo __('Active');
echo " :</td><td>";
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Description');
echo " :</td>";
echo "<td>";
echo "<textarea name='content' cols='55' rows='6'>";
echo $this->fields["content"];
echo "</textarea>";
echo "</td></td>";
echo "<td>";
echo __('Select Language');
echo "</td><td>";
if ($this->fields["language"]) {
Dropdown::showLanguages("language", array('value' => $this->fields["language"]));
} else {
Dropdown::showLanguages("language", array('value' => $_SESSION['glpilanguage']));
}
echo "</td></tr>";
echo '<tr><td>' . $LANG['plugin_formcreator']["cat"][3] . '</td><td>';
PluginFormcreatorCat::getSelectCat($ID, $this->fields["cat"]);
echo '</td></tr>';
$this->showFormButtons($options);
$this->addDivForTabs();
}
示例5: showFormUserPrefs
/**
* Print the config form for default user prefs
*
* @param $data array containing datas
* (CFG_GLPI for global config / glpi_users fields for user prefs)
*
* @return Nothing (display)
**/
function showFormUserPrefs($data = array())
{
global $DB, $CFG_GLPI;
$oncentral = $_SESSION["glpiactiveprofile"]["interface"] == "central";
$userpref = false;
$url = Toolbox::getItemTypeFormURL(__CLASS__);
if (array_key_exists('last_login', $data)) {
$userpref = true;
if ($data["id"] === Session::getLoginUserID()) {
$url = $CFG_GLPI['root_doc'] . "/front/preference.php";
} else {
$url = $CFG_GLPI['root_doc'] . "/front/user.form.php";
}
}
echo "<form name='form' action='{$url}' method='post'>";
// Only set id for user prefs
if ($userpref) {
echo "<input type='hidden' name='id' value='" . $data['id'] . "'>";
}
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Personalization') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td width='30%'>" . ($userpref ? __('Language') : __('Default language')) . "</td>";
echo "<td width='20%'>";
if (Config::canUpdate() || !GLPI_DEMO_MODE) {
Dropdown::showLanguages("language", array('value' => $data["language"]));
} else {
echo " ";
}
echo "<td width='30%'>" . __('Date format') . "</td>";
echo "<td width='20%'>";
$date_formats = array(0 => __('YYYY-MM-DD'), 1 => __('DD-MM-YYYY'), 2 => __('MM-DD-YYYY'));
Dropdown::showFromArray('date_format', $date_formats, array('value' => $data["date_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Results to display by page') . "</td><td>";
// Limit using global config
$value = $data['list_limit'] < $CFG_GLPI['list_limit_max'] ? $data['list_limit'] : $CFG_GLPI['list_limit_max'];
Dropdown::showNumber('list_limit', array('value' => $value, 'min' => 5, 'max' => $CFG_GLPI['list_limit_max'], 'step' => 5));
echo "</td>";
echo "<td>" . __('Number format') . "</td>";
$values = array(0 => '1 234.56', 1 => '1,234.56', 2 => '1 234,56', 3 => '1234.56', 4 => '1234,56');
echo "<td>";
Dropdown::showFromArray('number_format', $values, array('value' => $data["number_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Display order of surnames firstnames') . "</td><td>";
$values = array(User::REALNAME_BEFORE => __('Surname, First name'), User::FIRSTNAME_BEFORE => __('First name, Surname'));
Dropdown::showFromArray('names_format', $values, array('value' => $data["names_format"]));
echo "</td>";
echo "<td>" . __("Color palette") . "</td><td>";
$themes_files = scandir(GLPI_ROOT . "/css/palettes/");
echo "<select name='palette' id='theme-selector'>";
foreach ($themes_files as $key => $file) {
if (strpos($file, ".css") !== false) {
$name = substr($file, 0, -4);
$selected = "";
if ($data["palette"] == $name) {
$selected = "selected='selected'";
}
echo "<option value='{$name}' {$selected}>" . ucfirst($name) . "</option>";
}
}
echo Html::scriptBlock("\n function formatThemes(theme) {\n return \" <img src='../css/palettes/previews/\" + theme.text.toLowerCase() + \".png'/>\"\n + \" \" + theme.text;\n }\n \$(\"#theme-selector\").select2({\n formatResult: formatThemes,\n formatSelection: formatThemes,\n width: '100%',\n escapeMarkup: function(m) { return m; }\n });\n ");
echo "</select>";
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . __('Display the complete name in tree dropdowns') . "</td><td>";
Dropdown::showYesNo('use_flat_dropdowntree', $data["use_flat_dropdowntree"]);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
if (!$userpref || $CFG_GLPI['show_count_on_tabs'] != -1) {
echo "<td>" . __('Display counts in tabs') . "</td><td>";
$values = array(0 => __('No'), 1 => __('Yes'));
if (!$userpref) {
$values[-1] = __('Never');
}
Dropdown::showFromArray('show_count_on_tabs', $values, array('value' => $data["show_count_on_tabs"]));
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "</tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . __('Show GLPI ID') . "</td><td>";
Dropdown::showYesNo("is_ids_visible", $data["is_ids_visible"]);
echo "</td>";
//.........这里部分代码省略.........
示例6: showForm
function showForm($ID, $options)
{
global $DB, $CFG_GLPI;
if (!Config::canUpdate()) {
return false;
}
$notificationtemplates_id = -1;
if (isset($options['notificationtemplates_id'])) {
$notificationtemplates_id = $options['notificationtemplates_id'];
}
if ($this->getFromDB($ID)) {
$notificationtemplates_id = $this->getField('notificationtemplates_id');
}
$this->initForm($ID, $options);
$template = new NotificationTemplate();
$template->getFromDB($notificationtemplates_id);
Html::initEditorSystem('content_html');
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . NotificationTemplate::getTypeName() . "</td>";
echo "<td colspan='2'><a href='" . Toolbox::getItemTypeFormURL('NotificationTemplate') . "?id=" . $notificationtemplates_id . "'>" . $template->getField('name') . "</a>";
echo "</td><td>";
$rand = mt_rand();
Ajax::createIframeModalWindow("tags" . $rand, $CFG_GLPI['root_doc'] . "/front/notification.tags.php?sub_type=" . $template->getField('itemtype'));
echo "<a class='vsubmit' href='#' onClick=\"" . Html::jsGetElementbyID("tags" . $rand) . ".dialog('open');\">" . __('Show list of available tags') . "</a>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . "</td><td colspan='3'>";
//Get all used languages
$used = self::getAllUsedLanguages($notificationtemplates_id);
if ($ID > 0) {
if (isset($used[$this->getField('language')])) {
unset($used[$this->getField('language')]);
}
}
Dropdown::showLanguages("language", array('display_emptychoice' => true, 'value' => $this->fields['language'], 'used' => $used));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Subject') . "</td>";
echo "<td colspan='3'>";
Html::autocompletionTextField($this, 'subject', array('size' => 100));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>";
_e('Email text body');
echo "<br>" . __('(leave the field empty for a generation from HTML)');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_text' >" . $this->fields["content_text"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
_e('Email HTML body');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_html'>" . $this->fields["content_html"];
echo "</textarea>";
echo "<input type='hidden' name='notificationtemplates_id' value='" . $template->getField('id') . "'>";
echo "</td></tr>";
$this->showFormButtons($options);
return true;
}
示例7: showForm
/**
* Display translation form
*
* @param $ID field (default -1)
* @param $options array
*/
function showForm($ID = -1, $options = array())
{
global $CFG_GLPI;
if (isset($options['parent']) && !empty($options['parent'])) {
$item = $options['parent'];
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
$options['itemtype'] = get_class($item);
$options['items_id'] = $item->getID();
// Create item
$this->check(-1, CREATE, $options);
}
$rand = mt_rand();
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . "</td>";
echo "<td>";
echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>";
echo "<input type='hidden' name='itemtype' value='" . get_class($item) . "'>";
if ($ID > 0) {
echo "<input type='hidden' name='language' value='" . $this->fields['language'] . "'>";
echo Dropdown::getLanguageName($this->fields['language']);
} else {
$rand = Dropdown::showLanguages("language", array('display_none' => false, 'value' => $_SESSION['glpilanguage']));
$params = array('language' => '__VALUE__', 'itemtype' => get_class($item), 'items_id' => $item->getID());
Ajax::updateItemOnSelectEvent("dropdown_language{$rand}", "span_fields", $CFG_GLPI["root_doc"] . "/ajax/updateTranslationFields.php", $params);
}
echo "</td><td colspan='2'> </td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Field') . "</td>";
echo "<td>";
if ($ID > 0) {
echo "<input type='hidden' name='field' value='" . $this->fields['field'] . "'>";
$searchOption = $item->getSearchOptionByField('field', $this->fields['field']);
echo $searchOption['name'];
} else {
echo "<span id='span_fields' name='span_fields'>";
self::dropdownFields($item, $_SESSION['glpilanguage']);
echo "</span>";
}
echo "</td>";
echo "<td>" . __('Value') . "</td>";
echo "<td><input type='text' name='value' value=\"" . $this->fields['value'] . "\" size='50'>";
echo "</td>";
echo "</tr>\n";
$this->showFormButtons($options);
return true;
}
示例8: showForm
/**
* Show the Form edit form the the adminsitrator in the config page
*
* @param Array $options Optional options
*
* @return NULL Nothing, just display the form
*/
public function showForm($ID, $options = array())
{
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo '<tr class="tab_bg_1">';
echo '<td width="20%"><strong>' . __('Name') . ' <span class="red">*</span></strong></td>';
echo '<td width="30%"><input type="text" name="name" value="' . $this->fields["name"] . '" size="35"/></td>';
echo '<td width="20%"><strong>' . __('Active') . ' <span class="red">*</span></strong></td>';
echo '<td width="30%">';
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_2">';
echo '<td><strong>' . __('Category') . ' <span class="red">*</span></strong></td>';
echo '<td>';
PluginFormcreatorCategory::dropdown(array('name' => 'plugin_formcreator_categories_id', 'value' => $ID != 0 ? $this->fields["plugin_formcreator_categories_id"] : 0));
echo '</td>';
echo '<td>' . __('Direct access on homepage', 'formcreator') . '</td>';
echo '<td>';
Dropdown::showYesNo("helpdesk_home", $this->fields["helpdesk_home"]);
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_1">';
echo '<td>' . __('Description') . '</td>';
echo '<td><input type="text" name="description" value="' . $this->fields['description'] . '" size="35" /></td>';
echo '<td>' . __('Language') . '</td>';
echo '<td>';
Dropdown::showLanguages('language', array('value' => $ID != 0 ? $this->fields['language'] : $_SESSION['glpilanguage'], 'display_emptychoice' => true, 'emptylabel' => '--- ' . __('All langages', 'formcreator') . ' ---'));
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_1">';
echo '<td>' . _n('Header', 'Headers', 1, 'formcreator') . '</td>';
echo '<td colspan="3"><textarea name="content" cols="124" rows="10">' . $this->fields["content"] . '</textarea></td>';
Html::initEditorSystem('content');
echo '</tr>';
echo '<tr class="tab_bg_2">';
echo '<td>' . __('Need to be validate?', 'formcreator') . '</td>';
echo '<td>';
Dropdown::showYesNo("validation_required", $this->fields["validation_required"], -1, array('on_change' => 'changeValidators(this.value)'));
echo '</td>';
echo '<td><label for="validators" id="label_validators">' . __('Available validators', 'formcreator') . '</label></td>';
echo '<td>';
$validators = array();
$query = "SELECT `users_id`\n FROM `glpi_plugin_formcreator_formvalidators`\n WHERE `forms_id` = '" . $this->getID() . "'";
$result = $GLOBALS['DB']->query($query);
while (list($id) = $GLOBALS['DB']->fetch_array($result)) {
$validators[] = $id;
}
// Si le formulaire est récursif, on authorise les validateurs des sous-entités
// Sinon uniquement les validateurs de l'entité du formulaire
if ($this->isRecursive()) {
$entites = getSonsOf('glpi_entities', $this->getEntityID());
} else {
$entites = $this->getEntityID();
}
$subentities = getEntitiesRestrictRequest("", 'pu', "", $entites, true, true);
$query = "SELECT u.`id`, u.`name`, u.`realname`\n FROM `glpi_users` u\n INNER JOIN `glpi_profiles_users` pu ON u.`id` = pu.`users_id`\n INNER JOIN `glpi_profiles` p ON p.`id` = pu.`profiles_id`\n INNER JOIN `glpi_profilerights` pr ON p.`id` = pr.`profiles_id`\n WHERE pr.`name` = 'ticketvalidation'\n AND (\n pr.`rights` & " . TicketValidation::VALIDATEREQUEST . " = " . TicketValidation::VALIDATEREQUEST . "\n OR pr.`rights` & " . TicketValidation::VALIDATEINCIDENT . " = " . TicketValidation::VALIDATEINCIDENT . ")\n AND {$subentities}\n GROUP BY u.`id`\n ORDER BY u.`name`";
$result = $GLOBALS['DB']->query($query);
echo '<div id="validators_block" style="width: 100%">';
echo '<select name="_validators[]" size="4" style="width: 100%" multiple id="validators">';
while ($user = $GLOBALS['DB']->fetch_assoc($result)) {
echo '<option value="' . $user['id'] . '"';
if (in_array($user['id'], $validators)) {
echo ' selected="selected"';
}
echo '>' . $user['name'] . '</option>';
}
echo '</select>';
echo '</div>';
echo '<script type="text/javascript">
function changeValidators(value) {
if (value == 1) {
document.getElementById("label_validators").style.display = "inline";
document.getElementById("validators_block").style.display = "block";
} else {
document.getElementById("label_validators").style.display = "none";
document.getElementById("validators_block").style.display = "none";
}
}
changeValidators(' . $this->fields["validation_required"] . ');
</script>';
echo '</td>';
echo '</tr>';
echo '</td>';
echo '</tr>';
$this->showFormButtons($options);
}
示例9: showFormUserPrefs
/**
* Print the config form for default user prefs
*
* @param $data array containing datas
* (CFG_GLPI for global config / glpi_users fields for user prefs)
*
* @return Nothing (display)
**/
function showFormUserPrefs($data = array())
{
global $DB, $CFG_GLPI;
$oncentral = $_SESSION["glpiactiveprofile"]["interface"] == "central";
$userpref = false;
$url = Toolbox::getItemTypeFormURL(__CLASS__);
if (array_key_exists('last_login', $data)) {
$userpref = true;
if ($data["id"] === Session::getLoginUserID()) {
$url = $CFG_GLPI['root_doc'] . "/front/preference.php";
} else {
$url = $CFG_GLPI['root_doc'] . "/front/user.form.php";
}
}
echo "<form name='form' action='{$url}' method='post'>";
echo "<div class='center' id='tabsbody'>";
echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __('Personalization') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . ($userpref ? __('Language') : __('Default language')) . "</td>";
echo "<td>";
if (Session::haveRight("config", "w") || !GLPI_DEMO_MODE) {
Dropdown::showLanguages("language", array('value' => $data["language"]));
} else {
echo " ";
}
echo "<td>" . __('Date format') . "</td>";
echo "<td>";
$date_formats = array(0 => __('YYYY-MM-DD'), 1 => __('DD-MM-YYYY'), 2 => __('MM-DD-YYYY'));
Dropdown::showFromArray('date_format', $date_formats, array('value' => $data["date_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Results to display by page') . "</td><td>";
// Limit using global config
Dropdown::showInteger('list_limit', $data['list_limit'] < $CFG_GLPI['list_limit_max'] ? $data['list_limit'] : $CFG_GLPI['list_limit_max'], 5, $CFG_GLPI['list_limit_max'], 5);
echo "</td>";
echo "<td>" . __('Number format') . "</td>";
$values = array(0 => '1 234.56', 1 => '1,234.56', 2 => '1 234,56');
echo "<td>";
Dropdown::showFromArray('number_format', $values, array('value' => $data["number_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . __('Default characters limit in dropdowns') . "</td><td>";
Dropdown::showInteger('dropdown_chars_limit', $data["dropdown_chars_limit"], 20, 100);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "<td>" . __('Display order of surnames firstnames') . "</td><td>";
$values = array(User::REALNAME_BEFORE => __('Surname, First name'), User::FIRSTNAME_BEFORE => __('First name, Surname'));
Dropdown::showFromArray('names_format', $values, array('value' => $data["names_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . __('Display the complete name in tree dropdowns') . "</td><td>";
Dropdown::showYesNo('use_flat_dropdowntree', $data["use_flat_dropdowntree"]);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
if (!$userpref || $CFG_GLPI['show_count_on_tabs'] != -1) {
echo "<td>" . __('Display counts in tabs') . "</td><td>";
$values = array(0 => __('No'), 1 => __('Yes'));
if (!$userpref) {
$values[-1] = __('Never');
}
Dropdown::showFromArray('show_count_on_tabs', $values, array('value' => $data["show_count_on_tabs"]));
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "</tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . __('Show GLPI ID') . "</td><td>";
Dropdown::showYesNo("is_ids_visible", $data["is_ids_visible"]);
echo "</td>";
} else {
echo "<td colspan='2'></td>";
}
echo "<td>" . __('CSV delimiter') . "</td><td>";
$values = array(';' => ';', ',' => ',');
Dropdown::showFromArray('csv_delimiter', $values, array('value' => $data["csv_delimiter"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Notifications for my changes') . "</td><td>";
Dropdown::showYesNo("notification_to_myself", $data["notification_to_myself"]);
echo "</td>";
if ($oncentral) {
echo "<td>" . __('Results to display on home page') . "</td><td>";
//.........这里部分代码省略.........
示例10: getValueToSelect
//.........这里部分代码省略.........
case "date":
case "date_delay":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('min', 'max', 'maybeempty', 'showyear');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateField($name, $options);
case "datetime":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
$options['with_time'] = true;
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('mindate', 'maxdate', 'mintime', 'maxtime', 'maybeempty', 'timestep');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateTimeField($name, $options);
case "timestamp":
$copytooption = array('addfirstminutes', 'emptylabel', 'inhours', 'max', 'min', 'step', 'toadd', 'display_emptychoice');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Dropdown::showTimeStamp($name, $options);
case "itemlink":
// Do not use dropdown if wanted to select string value instead of ID
if (isset($options['itemlink_as_string']) && $options['itemlink_as_string']) {
break;
}
case "dropdown":
$copytooption = array('condition', 'displaywith', 'emptylabel', 'right', 'toadd');
$options['name'] = $name;
$options['value'] = $value;
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
if (!isset($options['entity'])) {
$options['entity'] = $_SESSION['glpiactiveentities'];
}
$itemtype = getItemTypeForTable($searchoptions['table']);
return $itemtype::dropdown($options);
case "right":
return Profile::dropdownRights(Profile::getRightsFor($searchoptions['rightclass']), $name, $value, array('multiple' => false, 'display' => false));
case "itemtypename":
if (isset($searchoptions['itemtype_list'])) {
$options['types'] = $CFG_GLPI[$searchoptions['itemtype_list']];
}
$copytooption = array('types');
$options['value'] = $value;
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
if (isset($options['types'])) {
return Dropdown::showItemTypes($name, $options['types'], $options);
}
return false;
case "language":
$copytooption = array('emptylabel', 'display_emptychoice');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Dropdown::showLanguages($name, $options);
}
// Get specific display if available
$itemtype = getItemTypeForTable($searchoptions['table']);
if ($item = getItemForItemtype($itemtype)) {
$specific = $item->getSpecificValueToSelect($searchoptions['field'], $name, $values, $options);
if (strlen($specific)) {
return $specific;
}
}
}
// default case field text
$this->fields[$name] = $value;
return Html::autocompletionTextField($this, $name, $options);
}
示例11: showForm
function showForm($ID, $options)
{
global $DB, $LANG, $CFG_GLPI;
if (!haveRight("config", "w")) {
return false;
}
if (empty($ID)) {
if ($this->getEmpty()) {
$notificationtemplates_id = $options['notificationtemplates_id'];
}
} else {
if ($this->getFromDB($ID)) {
$notificationtemplates_id = $this->getField('notificationtemplates_id');
}
}
$canedit = haveRight("config", "w");
$template = new NotificationTemplate();
$template->getFromDB($notificationtemplates_id);
initEditorSystem('content_html');
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . $template->getTypeName() . "</td>";
echo "<td colspan='2'><a href='" . getItemTypeFormURL('NotificationTemplate') . "?id=" . $notificationtemplates_id . "'>" . $template->getField('name') . "</a>";
echo "</td><td><a href='#' onClick=\"var w=window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=list_notificationtags&sub_type=" . $template->getField('itemtype') . "' ,\n 'glpipopup', 'height=400, width=1000, top=100, left=100," . " scrollbars=yes' );w.focus();\">" . $LANG['mailing'][138] . "</a></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['setup'][41] . " :</td><td colspan='3'>";
//Get all used languages
$used = self::getAllUsedLanguages($notificationtemplates_id);
if ($ID > 0) {
if (isset($used[$this->getField('language')])) {
unset($used[$this->getField('language')]);
}
}
Dropdown::showLanguages("language", array('display_none' => true, 'value' => $this->fields['language'], 'used' => $used));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . $LANG['knowbase'][14] . " :</td>";
echo "<td colspan='3'>";
echo "<input type='text' name='subject'size='100' value='" . $this->fields["subject"] . "'>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>";
echo $LANG['mailing'][115] . ' ' . $LANG['mailing'][117] . " :<br>(" . $LANG['mailing'][128] . ")";
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_text' >" . $this->fields["content_text"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['mailing'][115] . ' ' . $LANG['mailing'][116] . " :</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_html'>" . $this->fields["content_html"];
echo "</textarea>";
echo "<input type='hidden' name='notificationtemplates_id' value='" . $template->getField('id') . "'>";
echo "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例12: showForm
function showForm($ID, $options)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight("config", "w")) {
return false;
}
$notificationtemplates_id = -1;
if (isset($options['notificationtemplates_id'])) {
$notificationtemplates_id = $options['notificationtemplates_id'];
}
if ($this->getFromDB($ID)) {
$notificationtemplates_id = $this->getField('notificationtemplates_id');
}
$this->initForm($ID, $options);
$template = new NotificationTemplate();
$template->getFromDB($notificationtemplates_id);
Html::initEditorSystem('content_html');
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . NotificationTemplate::getTypeName() . "</td>";
echo "<td colspan='2'><a href='" . Toolbox::getItemTypeFormURL('NotificationTemplate') . "?id=" . $notificationtemplates_id . "'>" . $template->getField('name') . "</a>";
echo "</td><td>" . "<a class='vsubmit' href='#' onClick=\"var w=window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=list_notificationtags&sub_type=" . $template->getField('itemtype') . "' ,'glpipopup', 'height=400, width=1000, top=100, " . "left=100, scrollbars=yes' );w.focus();\">" . __('Show list of available tags') . "</a>" . "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . "</td><td colspan='3'>";
//Get all used languages
$used = self::getAllUsedLanguages($notificationtemplates_id);
if ($ID > 0) {
if (isset($used[$this->getField('language')])) {
unset($used[$this->getField('language')]);
}
}
Dropdown::showLanguages("language", array('display_emptychoice' => true, 'value' => $this->fields['language'], 'used' => $used));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Subject') . "</td>";
echo "<td colspan='3'>";
echo "<input type='text' name='subject'size='100' value='" . $this->fields["subject"] . "'>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>";
_e('Email text body');
echo "<br>" . __('(leave the field empty for a generation from HTML)');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_text' >" . $this->fields["content_text"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
_e('Email HTML body');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_html'>" . $this->fields["content_html"];
echo "</textarea>";
echo "<input type='hidden' name='notificationtemplates_id' value='" . $template->getField('id') . "'>";
echo "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例13: showForm
/**
* Display translation form
*
* @param string $itemtype Item type
* @param int $items_id Item ID
* @param innt $id Translation ID (defaults to -1)
*/
function showForm($itemtype, $items_id, $id = -1)
{
global $CFG_GLPI;
if ($id > 0) {
$this->check($id, READ);
} else {
// Create item
$this->check(-1, CREATE);
}
$this->showFormHeader();
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . " :</td>";
echo "<td>";
echo "<input type='hidden' name='plugin_fields_itemtype' value='{$itemtype}'>";
echo "<input type='hidden' name='plugin_fields_items_id' value='{$items_id}'>";
if ($id > 0) {
echo Dropdown::getLanguageName($this->fields['language']);
} else {
Dropdown::showLanguages("language", array('display_none' => false, 'value' => $_SESSION['glpilanguage'], 'used' => self::getAlreadyTranslatedForItem($itemtype, $items_id)));
}
echo "</td><td colspan='2'> </td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td><label for='label'>" . __('Label') . "</label></td>";
echo "<td colspan='3'>";
echo "<input type='text' name='label' id='label' value='{$this->fields["label"]}'/>";
echo "</td></tr>\n";
$this->showFormButtons();
return true;
}
示例14: showForm
/**
* Show the Form edit form the the adminsitrator in the config page
*
* @param Array $options Optional options
*
* @return NULL Nothing, just display the form
*/
public function showForm($ID, $options = array())
{
$this->initForm($ID, $options);
$this->showTabs($options);
$this->showFormHeader($options);
echo '<tr class="tab_bg_1">';
echo '<td><strong>' . __('Name') . ' <span class="red">*</span></strong></td>';
echo '<td><input type="text" name="name" value="' . $this->fields["name"] . '" size="54"/></td>';
echo '<td><strong>' . __('Active') . ' <span class="red">*</span></strong></td>';
echo '<td>';
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_2">';
echo '<td><strong>' . __('Category') . ' <span class="red">*</span></strong></td>';
echo '<td>';
PluginFormcreatorCategory::dropdown(array('name' => 'plugin_formcreator_categories_id', 'value' => $ID != 0 ? $this->fields["plugin_formcreator_categories_id"] : 1));
echo '</td>';
echo '<td>' . __('Direct access on homepage', 'formcreator') . '</td>';
echo '<td>';
Dropdown::showYesNo("helpdesk_home", $this->fields["helpdesk_home"]);
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_1">';
echo '<td>' . __('Description') . '</td>';
echo '<td><input type="text" name="description" value="' . $this->fields['description'] . '" size="54" /></td>';
echo '<td>' . __('Language') . '</td>';
echo '<td>';
Dropdown::showLanguages('language', array('value' => $ID != 0 ? $this->fields['language'] : $_SESSION['glpilanguage'], 'display_emptychoice' => true, 'emptylabel' => '--- ' . __('All langages', 'formcreator') . ' ---'));
echo '</td>';
echo '</tr>';
echo '<tr class="tab_bg_1">';
echo '<td>' . _n('Header', 'Headers', 1, 'formcreator') . '</td>';
echo '<td colspan="3"><textarea name="content" cols="115" rows="10">' . $this->fields["content"] . '</textarea></td>';
Html::initEditorSystem('content');
echo '</tr>';
$this->showFormButtons($options);
$this->addDivForTabs();
}
示例15: showFormUserPrefs
/**
* Print the config form for default user prefs
*
* @param $data array containing datas
* (CFG_GLPI for global config / glpi_users fields for user prefs)
*
* @return Nothing (display)
**/
function showFormUserPrefs($data = array())
{
global $DB, $LANG, $CFG_GLPI;
$oncentral = $_SESSION["glpiactiveprofile"]["interface"] == "central";
$userpref = false;
$url = getItemTypeFormURL(__CLASS__);
if (array_key_exists('last_login', $data)) {
$userpref = true;
if ($data["id"] === getLoginUserID()) {
$url = $CFG_GLPI['root_doc'] . "/front/preference.php";
} else {
$url = $CFG_GLPI['root_doc'] . "/front/user.form.php";
}
}
echo "<form name='form' action='{$url}' method='post'>";
echo "<div class='center' id='tabsbody'>";
echo "<input type='hidden' name='id' value='" . $data["id"] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . $LANG['setup'][6] . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . $LANG['setup'][111] . " :</td><td>";
// Limit using global config
Dropdown::showInteger('list_limit', $data['list_limit'] < $CFG_GLPI['list_limit_max'] ? $data['list_limit'] : $CFG_GLPI['list_limit_max'], 5, $CFG_GLPI['list_limit_max'], 5);
echo "</td><td>" . $LANG['setup'][128] . " :</td>";
echo "<td>";
$date_formats = array(0 => $LANG['calendar'][0], 1 => $LANG['calendar'][1], 2 => $LANG['calendar'][2]);
Dropdown::showFromArray('date_format', $date_formats, array('value' => $data["date_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . $LANG['setup'][112] . " :</td><td>";
Dropdown::showInteger('dropdown_chars_limit', $data["dropdown_chars_limit"], 20, 100);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "<td>" . $LANG['setup'][150] . " :</td>";
$values = array(0 => '1 234.56', 1 => '1,234.56', 2 => '1 234,56');
echo "<td>";
Dropdown::showFromArray('number_format', $values, array('value' => $data["number_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . $LANG['setup'][132] . " :</td><td>";
Dropdown::showYesNo('use_flat_dropdowntree', $data["use_flat_dropdowntree"]);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "<td>" . $LANG['setup'][10] . " :</td><td>";
$values = array(REALNAME_BEFORE => $LANG['common'][48] . " " . $LANG['common'][43], FIRSTNAME_BEFORE => $LANG['common'][43] . " " . $LANG['common'][48]);
Dropdown::showFromArray('names_format', $values, array('value' => $data["names_format"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td colspan='2'></td>";
echo "<td>" . $LANG['setup'][7] . " :</td><td>";
$values = array(';' => ';', ',' => ',');
Dropdown::showFromArray('csv_delimiter', $values, array('value' => $data["csv_delimiter"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
if ($oncentral) {
echo "<td>" . $LANG['setup'][129] . " :</td><td>";
Dropdown::showYesNo("is_ids_visible", $data["is_ids_visible"]);
echo "</td>";
} else {
echo "<td colspan='2'></td>";
}
echo "<td>" . ($userpref ? $LANG['setup'][41] : $LANG['setup'][113]) . " :</td><td>";
if (haveRight("config", "w") || !GLPI_DEMO_MODE) {
Dropdown::showLanguages("language", array('value' => $data["language"]));
} else {
echo " ";
}
echo "</td></tr>";
if ($oncentral) {
echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['title'][24] . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . $LANG['setup'][39] . " :</td><td>";
Dropdown::showYesNo("followup_private", $data["followup_private"]);
echo "</td><td> " . $LANG['setup'][110] . " :</td><td>";
Dropdown::showYesNo("show_jobs_at_login", $data["show_jobs_at_login"]);
echo " </td></tr>";
echo "<tr class='tab_bg_2'><td>" . $LANG['setup'][40] . " :</td><td>";
Dropdown::showYesNo("task_private", $data["task_private"]);
echo "</td><td> " . $LANG['job'][44] . " :</td><td>";
Dropdown::show('RequestType', array('value' => $data["default_requesttypes_id"], 'name' => "default_requesttypes_id"));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . $LANG['setup'][114] . " :</td>";
echo "<td colspan='3'>";
echo "<table><tr>";
echo "<td bgcolor='" . $data["priority_1"] . "'>1 : ";
//.........这里部分代码省略.........