本文整理汇总了PHP中Dropdown::getLanguageName方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::getLanguageName方法的具体用法?PHP Dropdown::getLanguageName怎么用?PHP Dropdown::getLanguageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::getLanguageName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: header
//.........这里部分代码省略.........
echo "<div id='c_logo'>";
echo Html::link('', $CFG_GLPI["root_doc"] . "/front/central.php", array('accesskey' => '1', 'title' => __('Home')));
echo "</div>";
/// Prefs / Logout link
echo "<div id='c_preference' >";
echo "<ul>";
echo "<li id='deconnexion'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/logout.php";
/// logout witout noAuto login for extauth
if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
echo "?noAUTO=1";
}
echo "' title=\"" . __s('Logout') . "\">";
echo "<span id='logout_icon' title=\"" . __s('Logout') . "\" alt=\"" . __s('Logout') . "\" class='button-icon' />";
echo "</a>";
echo "</li>\n";
echo "<li id='preferences_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">";
echo "<span id='preferences_icon' title=\"" . __s('My settings') . "\" alt=\"" . __s('My settings') . "\" class='button-icon' /></span>";
// check user id : header used for display messages when session logout
if (Session::getLoginUserID()) {
echo "<span id='myname'>";
echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
echo "</span>";
}
echo "</a></li>";
/// Bookmark load
echo "<li id='bookmark_link'>";
Ajax::createIframeModalWindow('loadbookmark', $CFG_GLPI["root_doc"] . "/front/bookmark.php?action=load", array('title' => __('Load a bookmark'), 'reloadonclose' => true));
echo "<a href='#' onClick=\"" . Html::jsGetElementbyID('loadbookmark') . ".dialog('open');\">";
echo "<span id='bookmark_icon' title=\"" . __s('Load a bookmark') . "\" alt=\"" . __s('Load a bookmark') . "\" class='button-icon' />";
echo "</a></li>";
echo "<li id='help_link'><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . "<span id='help_icon' title=\"" . __s('Help') . "\" alt=\"" . __s('Help') . "\" class='button-icon' />";
"</a></li>";
echo "<li id='language_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php?forcetab=User\$1' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\">" . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
/// Search engine
echo "<li id='c_recherche'>\n";
if ($CFG_GLPI['allow_search_global']) {
echo "<form method='get' action='" . $CFG_GLPI["root_doc"] . "/front/search.php'>\n";
echo "<span id='champRecherche'><input size='15' type='text' name='globalsearch'\n placeholder='" . __s('Search') . "'>";
echo "</span>";
Html::closeForm();
}
echo "</li>";
echo "</ul>";
echo "</div>\n";
echo "</div>";
///Main menu
echo "<div id='c_menu'>";
echo "<ul id='menu'>";
// Get object-variables and build the navigation-elements
$i = 1;
foreach ($menu as $part => $data) {
if (isset($data['content']) && count($data['content'])) {
$menu_class = "";
if (isset($menu[$sector]) && $menu[$sector]['title'] == $data['title']) {
$menu_class = "active";
}
echo "<li id='menu{$i}' class='{$menu_class}' onmouseover=\"javascript:menuAff('menu{$i}','menu');\" >";
$link = "#";
if (isset($data['default']) && !empty($data['default'])) {
$link = $CFG_GLPI["root_doc"] . $data['default'];
}
if (Toolbox::strlen($data['title']) > 14) {
$data['title'] = Toolbox::substr($data['title'], 0, 14) . "...";
}
echo "<a href='{$link}' class='itemP'>" . $data['title'] . "</a>";
示例3: helpHeader
//.........这里部分代码省略.........
if (isset($plugins) && count($plugins) > 0) {
$list = array();
foreach ($plugins as $key => $val) {
$list[$key] = $val["name"];
}
asort($list);
//echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
echo "<li id='menu5'>";
echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
// default none
echo "<ul class='ssmenu'>";
// list menu item
foreach ($list as $key => $val) {
$link = "";
if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
$link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
}
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
}
echo "</ul></li>";
}
echo "<div class='sep'></div>";
echo '</ul>';
echo '<ul class="nav navbar-nav navbar-right">';
$sql_photo2 = "SELECT picture\n\t\t\t\t\t\t\t\tFROM glpi_users\n\t\t\t\t\t\t\t\tWHERE id = " . $_SESSION["glpiID"] . " ";
$res_photo2 = $DB->query($sql_photo2);
$pic2 = $DB->result($res_photo2, 0, 'picture');
$photo_url2 = User::getURLForPicture($pic2);
echo '<li class="dropdown">';
echo '<a href="#" style="padding:0px; margin:0px;" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><img src="' . $photo_url2 . '" class="avatar" alt="" title="' . formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20) . '" /></a>';
echo "<ul class=\"dropdown-menu\" role=\"menu\">";
echo "<li><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\"><i class='fa fa-question-circle'></i> " . __('Help') . "</a></li>";
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\"><i class='fa fa-cog'></i> " . __('My settings') . "</a></li>";
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\"><i class='fa fa-flag'></i> " . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
echo "<li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/front/logout.php";
// logout witout noAuto login for extauth
if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
echo "?noAUTO=1";
}
echo "' title=\"" . __s('Logout') . "\"><i class='fa fa-lock'></i> " . __('Logout') . "</a>";
// check user id : header used for display messages when session logout
if (Session::getLoginUserID()) {
//echo " (";
// echo formatUserName (0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
// echo ")";
}
echo "</li>\n";
echo "</ul>";
echo ' </li>';
echo '
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav> ';
echo '<nav class="navbar navbar-default nav2" style="margin-top: -20px;">';
// Display item
echo "<div id='c_ssmenu2'>";
echo "<ul>";
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "></a></li>";
echo "<li> </li>";
if (Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST, TicketValidation::VALIDATEINCIDENT))) {
$opt = array();
$opt['reset'] = 'reset';
$opt['criteria'][0]['field'] = 55;
// validation status
$opt['criteria'][0]['searchtype'] = 'equals';
示例4: header
//.........这里部分代码省略.........
$menu['config']['content']['link']['links']['add'] = "/front/link.form.php";
}
}
if (Session::haveRight("config", "w")) {
$menu['config']['content']['plugins']['title'] = __('Plugins');
$menu['config']['content']['plugins']['page'] = '/front/plugin.php';
}
// Special items
$menu['preference']['title'] = __('My settings');
$menu['preference']['default'] = '/front/preference.php';
$already_used_shortcut = array('1');
echo "<div id='header'>";
echo "<div id='c_logo'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' accesskey='1' title=\"" . __s('Home') . "\">";
echo "</a></div>";
/// Prefs / Logout link
echo "<div id='c_preference' >";
echo "<ul>";
echo "<li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/logout.php";
/// logout witout noAuto login for extauth
if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
echo "?noAUTO=1";
}
echo "' title=\"" . __s('Logout') . "\">" . __('Logout') . "</a>";
// check user id : header used for display messages when session logout
if (Session::getLoginUserID()) {
echo " (";
echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
echo ")";
}
echo "</li>\n";
echo "<li><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . __('Help') . "</a></li>";
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">" . __('My settings') . "</a></li>";
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\">" . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
echo "</ul>";
echo "<div class='sep'></div>";
echo "</div>\n";
/// Search engine
echo "<div id='c_recherche' >\n";
if ($CFG_GLPI['allow_search_global']) {
echo "<form method='get' action='" . $CFG_GLPI["root_doc"] . "/front/search.php'>\n";
echo "<div id='boutonRecherche'>";
echo "<input type='image' src='" . $CFG_GLPI["root_doc"] . "/pics/search.png' value='OK'\n title=\"" . _sx('button', 'Post') . "\" alt=\"" . _sx('button', 'Post') . "\"></div>";
echo "<div id='champRecherche'><input size='15' type='text' name='globalsearch'\n value='" . __s('Search') . "' onfocus=\"this.value='';\">";
echo "</div>";
Html::closeForm();
}
//echo "</div>";
echo "<div class='sep'></div>\n";
echo "</div>";
///Main menu
echo "<div id='c_menu'>";
echo "<ul id='menu'>";
// Get object-variables and build the navigation-elements
$i = 1;
foreach ($menu as $part => $data) {
if (isset($data['content']) && count($data['content'])) {
echo "<li id='menu{$i}' onmouseover=\"javascript:menuAff('menu{$i}','menu');\" >";
$link = "#";
if (isset($data['default']) && !empty($data['default'])) {
$link = $CFG_GLPI["root_doc"] . $data['default'];
}
if (Toolbox::strlen($data['title']) > 14) {
$data['title'] = Toolbox::substr($data['title'], 0, 14) . "...";
}
echo "<a href='{$link}' class='itemP'>" . $data['title'] . "</a>";
示例5: getSpecificValueToDisplay
/**
* Define how to display a specific value in search result table
*
* @param String $field Name of the field as define in $this->getSearchOptions()
* @param Mixed $values The value as it is stored in DB
* @param Array $options Options (optional)
* @return Mixed Value to be displayed
*/
public static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'is_active':
if ($values[$field] == 0) {
$output = '<div style="text-align: center"><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/inactive.png"
height="16" width="16"
alt="' . __('Inactive') . '"
title="' . __('Inactive') . '" /></div>';
} else {
$output = '<div style="text-align: center"><img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/active.png"
height="16" width="16"
alt="' . __('Active') . '"
title="' . __('Active') . '" /></div>';
}
return $output;
break;
case 'access_rights':
switch ($values[$field]) {
case self::ACCESS_PUBLIC:
return __('Public access', 'formcreator');
break;
case self::ACCESS_PRIVATE:
return __('Private access', 'formcreator');
break;
case self::ACCESS_RESTRICTED:
return __('Restricted access', 'formcreator');
break;
}
return '';
break;
case 'language':
if (empty($values[$field])) {
return __('All langages', 'formcreator');
} else {
return Dropdown::getLanguageName($values[$field]);
}
break;
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例6: 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 {
// Create item
$options['itemtype'] = get_class($item);
$options['knowbaseitems_id'] = $item->getID();
$this->check(-1, CREATE, $options);
}
Html::initEditorSystem('answer');
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . " :</td>";
echo "<td>";
echo "<input type='hidden' name='knowbaseitems_id' value='" . $item->getID() . "'>";
if ($ID > 0) {
echo Dropdown::getLanguageName($this->fields['language']);
} else {
Dropdown::showLanguages("language", array('display_none' => false, 'value' => $_SESSION['glpilanguage'], 'used' => self::getAlreadyTranslatedForItem($item)));
}
echo "</td><td colspan='2'> </td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Subject') . "</td>";
echo "<td colspan='3'>";
echo "<textarea cols='100' rows='1' name='name'>" . $this->fields["name"] . "</textarea>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Content') . "</td>";
echo "<td colspan='3'>";
echo "<textarea cols='100' rows='30' id='answer' name='answer'>" . $this->fields["answer"];
echo "</textarea>";
echo "</td></tr>\n";
$this->showFormButtons($options);
return true;
}
示例7: 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;
}