本文整理汇总了PHP中Toolbox::append_params方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::append_params方法的具体用法?PHP Toolbox::append_params怎么用?PHP Toolbox::append_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::append_params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createModalWindow
/**
* Create modal window
* After display it using $name.show()
* May be constraint to a predefined html item setting renderTo options
*
* @since version 0.84
*
* @param $name name of the js object
* @param $url URL to display in modal
* @param $options array of possible options:
* - width (default 800)
* - height (default 400)
* - modal : is a modal window ? (default true)
* - container : specify a html element to render (default empty to html.body)
* - title : window title (default empty)
**/
static function createModalWindow($name, $url, $options = array())
{
$param = array('width' => 800, 'height' => 400, 'modal' => true, 'container' => '', 'title' => '', 'extraparams' => array());
if (count($options)) {
foreach ($options as $key => $val) {
if (isset($param[$key])) {
$param[$key] = $val;
}
}
}
echo "<script type='text/javascript'>";
echo "var {$name}=new Ext.Window({\n layout:'fit',\n width:" . $param['width'] . ",\n height:" . $param['height'] . ",\n closeAction:'hide',\n modal: " . ($param['modal'] ? 'true' : 'false') . ",\n " . (!empty($param['container']) ? "renderTo: '" . $param['container'] . "'," : '') . "\n autoScroll: true,\n title: \"" . addslashes($param['title']) . "\",\n autoLoad: {url: '{$url}',\n scripts: true,\n nocache: true";
if (is_array($param['extraparams']) && count($param['extraparams'])) {
echo ", params: '" . Toolbox::append_params($param['extraparams']) . "'";
}
echo "}";
echo " }); ";
echo "</script>";
}
示例2: helpHeader
//.........这里部分代码省略.........
}
// Suivi ticket
if (Session::haveRight("observe_ticket", "1") || Session::haveRight("create_ticket", "1")) {
echo "<li id='menu3'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', 2) . "</a>";
echo "</li>";
}
// Reservation
if (Session::haveRight("reservation_helpdesk", "1")) {
echo "<li id='menu4'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', 2) . "\" class='itemP'>" . _n('Reservation', 'Reservations', 2) . "</a>";
echo "</li>";
}
// FAQ
if (Session::haveRight("faq", "r")) {
echo "<li id='menu5' >";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
echo "</li>";
}
// PLUGINS
$plugins = array();
if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
if ($active) {
$plugins[$plugin] = Plugin::getInfo($plugin);
}
}
}
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 "<a href='#' title=\"" . __s('Plugins') . "\" 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 "</ul>";
echo "<div class='sep'></div>";
echo "</div>";
// End navigation bar
// End headline
///Le sous menu contextuel 1
echo "<div id='c_ssmenu1'> </div>";
// Le fil d ariane
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::haveRight('validate_incident', 1) || Session::haveRight('validate_request', 1)) {
$opt = array();
$opt['reset'] = 'reset';
$opt['field'][0] = 55;
// validation status
$opt['searchtype'][0] = 'equals';
$opt['contains'][0] = 'waiting';
$opt['link'][0] = 'AND';
$opt['field'][1] = 59;
// validation aprobator
$opt['searchtype'][1] = 'equals';
$opt['contains'][1] = Session::getLoginUserID();
$opt['link'][1] = 'AND';
$url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&');
$pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'></a>";
echo "<li>{$pic_validate}</li>\n";
}
echo "<li> </li>";
if (Session::haveRight('create_ticket', 1) && strpos($_SERVER['PHP_SELF'], "ticket")) {
echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"></a></li>";
}
echo "<li> </li>";
/// Bookmark load
echo "<li>";
echo "<a href='#' onClick=\"var w=window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=load_bookmark' ,'glpibookmarks', 'height=400, width=600, " . "top=100, left=100, scrollbars=yes' );w.focus();\">";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark.png' title=\"" . __s('Load a bookmark') . "\" alt=\"" . __s('Load a bookmark') . "\">";
echo "</a></li>";
// check user id : header used for display messages when session logout
if (Session::getLoginUserID()) {
self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
}
echo "</ul></div>";
echo "</div>";
// fin header
echo "<div id='page' >";
// call static function callcron() every 5min
CronTask::callCron();
self::displayMessageAfterRedirect();
}
示例3: showForContract
/**
* Print the HTML array for Items linked to current contract
*
* @since version 0.84
*
* @param $contract Contract object
*
* @return Nothing (display)
**/
static function showForContract(Contract $contract)
{
global $DB, $CFG_GLPI;
$instID = $contract->fields['id'];
if (!$contract->can($instID, READ)) {
return false;
}
$canedit = $contract->can($instID, UPDATE);
$rand = mt_rand();
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_contracts_items`\n WHERE `glpi_contracts_items`.`contracts_id` = '{$instID}'\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
$data = array();
$totalnb = 0;
$used = array();
for ($i = 0; $i < $number; $i++) {
$itemtype = $DB->result($result, $i, "itemtype");
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
if ($item->canView()) {
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `{$itemtable}`.*,\n `glpi_contracts_items`.`id` AS IDD,\n `glpi_entities`.`id` AS entity\n FROM `glpi_contracts_items`,\n `{$itemtable}`";
if ($itemtype != 'Entity') {
$query .= " LEFT JOIN `glpi_entities`\n ON (`{$itemtable}`.`entities_id`=`glpi_entities`.`id`) ";
}
$query .= " WHERE `{$itemtable}`.`id` = `glpi_contracts_items`.`items_id`\n AND `glpi_contracts_items`.`itemtype` = '{$itemtype}'\n AND `glpi_contracts_items`.`contracts_id` = '{$instID}'";
if ($item->maybeTemplate()) {
$query .= " AND `{$itemtable}`.`is_template` = '0'";
}
$query .= getEntitiesRestrictRequest(" AND", $itemtable, '', '', $item->maybeRecursive()) . "\n ORDER BY `glpi_entities`.`completename`, `{$itemtable}`.`name`";
$result_linked = $DB->query($query);
$nb = $DB->numrows($result_linked);
if ($nb > $_SESSION['glpilist_limit']) {
$opt = array('order' => 'ASC', 'is_deleted' => 0, 'reset' => 'reset', 'start' => 0, 'sort' => 80, 'criteria' => array(0 => array('value' => '$$$$' . $instID, 'searchtype' => 'contains', 'field' => 29)));
$url = $item::getSearchURL();
$url .= strpos($url, '?') ? '&' : '?';
$url .= Toolbox::append_params($opt);
$link = "<a href='{$url}'>" . __('Device list') . "</a>";
$data[$itemtype] = array('longlist' => true, 'name' => sprintf(__('%1$s: %2$s'), $item->getTypeName($nb), $nb), 'link' => $link);
} else {
if ($nb > 0) {
$data[$itemtype] = array();
while ($objdata = $DB->fetch_assoc($result_linked)) {
$data[$itemtype][$objdata['id']] = $objdata;
$used[$itemtype][$objdata['id']] = $objdata['id'];
}
}
}
$totalnb += $nb;
}
}
if ($canedit && ($contract->fields['max_links_allowed'] == 0 || $contract->fields['max_links_allowed'] > $totalnb)) {
echo "<div class='firstbloc'>";
echo "<form name='contract_form{$rand}' id='contract_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add an item') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
Dropdown::showSelectItemFromItemtypes(array('itemtypes' => $CFG_GLPI["contract_types"], 'entity_restrict' => $contract->fields['is_recursive'] ? getSonsOf('glpi_entities', $contract->fields['entities_id']) : $contract->fields['entities_id'], 'checkright' => true, 'used' => $used));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "<input type='hidden' name='contracts_id' value='{$instID}'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $totalnb) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $totalnb) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Type') . "</th>";
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Name') . "</th>";
$header_end .= "<th>" . __('Serial number') . "</th>";
$header_end .= "<th>" . __('Inventory number') . "</th>";
$header_end .= "<th>" . __('Status') . "</th>";
$header_end .= "</tr>";
//.........这里部分代码省略.........
示例4: showSummary
static function showSummary()
{
global $DB, $CFG_GLPI;
$state_type = $CFG_GLPI["state_types"];
$states = array();
foreach ($state_type as $key => $itemtype) {
if ($item = getItemForItemtype($itemtype)) {
if (!$item->canView()) {
unset($state_type[$key]);
} else {
$table = getTableForItemType($itemtype);
$query = "SELECT `states_id`, COUNT(*) AS cpt\n FROM `{$table}` " . getEntitiesRestrictRequest("WHERE", $table) . "\n AND `is_deleted` = '0'\n AND `is_template` = '0'\n GROUP BY `states_id`";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_assoc($result)) {
$states[$data["states_id"]][$itemtype] = $data["cpt"];
}
}
}
}
}
}
if (count($states)) {
// Produce headline
echo "<div class='center'><table class='tab_cadrehov'><tr>";
// Type
echo "<th>" . __('Status') . "</th>";
foreach ($state_type as $key => $itemtype) {
if ($item = getItemForItemtype($itemtype)) {
echo "<th>" . $item->getTypeName(Session::getPluralNumber()) . "</th>";
$total[$itemtype] = 0;
} else {
unset($state_type[$key]);
}
}
echo "<th>" . __('Total') . "</th>";
echo "</tr>";
$query = "SELECT *\n FROM `glpi_states` " . getEntitiesRestrictRequest("WHERE", "glpi_states", '', '', true) . "\n ORDER BY `completename`";
$result = $DB->query($query);
// No state
$tot = 0;
echo "<tr class='tab_bg_2'><td>---</td>";
foreach ($state_type as $itemtype) {
echo "<td class='numeric'>";
if (isset($states[0][$itemtype])) {
echo $states[0][$itemtype];
$total[$itemtype] += $states[0][$itemtype];
$tot += $states[0][$itemtype];
} else {
echo " ";
}
echo "</td>";
}
echo "<td class='numeric b'>{$tot}</td></tr>";
while ($data = $DB->fetch_assoc($result)) {
$tot = 0;
echo "<tr class='tab_bg_2'><td class='b'>";
$opt = array('reset' => 'reset', 'sort' => 1, 'start' => 0, 'criteria' => array('0' => array('value' => '$$$$' . $data['id'], 'searchtype' => 'contains', 'field' => 31)));
echo "<a href='" . $CFG_GLPI['root_doc'] . "/front/allassets.php?" . Toolbox::append_params($opt, '&') . "'>" . $data["completename"] . "</a></td>";
foreach ($state_type as $itemtype) {
echo "<td class='numeric'>";
if (isset($states[$data["id"]][$itemtype])) {
echo $states[$data["id"]][$itemtype];
$total[$itemtype] += $states[$data["id"]][$itemtype];
$tot += $states[$data["id"]][$itemtype];
} else {
echo " ";
}
echo "</td>";
}
echo "<td class='numeric b'>{$tot}</td>";
echo "</tr>";
}
echo "<tr class='tab_bg_2'><td class='center b'>" . __('Total') . "</td>";
$tot = 0;
foreach ($state_type as $itemtype) {
echo "<td class='numeric b'>" . $total[$itemtype] . "</td>";
$tot += $total[$itemtype];
}
echo "<td class='numeric b'>{$tot}</td></tr>";
echo "</table></div>";
} else {
echo "<div class='center b'>" . __('No item found') . "</div>";
}
}
示例5: showCentralSpecificList
static function showCentralSpecificList($type)
{
global $CFG_GLPI, $DB;
if (!Session::haveRight("ticket", Ticket::READALL) && !Session::haveRight("ticket", Ticket::READASSIGN) && !Session::haveRight("ticket", CREATE) && !Session::haveRight("ticketvalidation", TicketValidation::VALIDATEREQUEST & TicketValidation::VALIDATEINCIDENT)) {
return false;
}
$groups = implode("','", $_SESSION['glpigroups']);
$numrows = 0;
$is_deleted = " `glpi_tickets`.`is_deleted` = 0 ";
if ($type == "notold") {
$title = __("Tickets to follow (climbed)", "escalade");
$status = CommonITILObject::INCOMING . ", " . CommonITILObject::PLANNED . ", " . CommonITILObject::ASSIGNED . ", " . CommonITILObject::WAITING;
$search_assign = " `glpi_plugin_escalade_histories`.`groups_id` IN ('{$groups}')\n AND (`glpi_groups_tickets`.`groups_id` NOT IN ('{$groups}')\n OR `glpi_groups_tickets`.`groups_id` IS NULL)";
$query_join = "LEFT JOIN `glpi_plugin_escalade_histories`\n ON (`glpi_tickets`.`id` = `glpi_plugin_escalade_histories`.`tickets_id`)\n LEFT JOIN `glpi_groups_tickets`\n ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id`\n AND `glpi_groups_tickets`.`type`=2)";
} else {
$title = __("Tickets to close (climbed)", "escalade");
$status = CommonITILObject::SOLVED;
$search_assign = " (`glpi_groups_tickets`.`groups_id` IN ('{$groups}'))";
$query_join = "LEFT JOIN `glpi_groups_tickets`\n ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id`\n AND `glpi_groups_tickets`.`type`=2)";
}
$query = "SELECT DISTINCT `glpi_tickets`.`id`\n FROM `glpi_tickets`\n LEFT JOIN `glpi_tickets_users`\n ON (`glpi_tickets`.`id` = `glpi_tickets_users`.`tickets_id`)";
$query .= $query_join;
$query .= "WHERE {$is_deleted} AND ( {$search_assign} )\n AND (`status` IN ({$status}))" . getEntitiesRestrictRequest("AND", "glpi_tickets");
$query .= " ORDER BY glpi_tickets.date_mod DESC";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
if (!$numrows) {
return;
}
$query .= " LIMIT 0, 5";
$result = $DB->query($query);
$number = $DB->numrows($result);
//show central list
if ($numrows > 0) {
//construct link to ticket list
$options['reset'] = 'reset';
$options['criteria'][0]['field'] = 12;
// status
$options['criteria'][0]['searchtype'] = 'equals';
if ($type == 'notold') {
$options['criteria'][0]['value'] = 'notold';
} else {
if ($type == 'solved') {
$options['criteria'][0]['value'] = 5;
}
}
$options['criteria'][0]['link'] = 'AND';
if ($type == 'notold') {
$options['criteria'][1]['field'] = 1881;
// groups_id_assign for escalade history
$options['criteria'][1]['searchtype'] = 'equals';
$options['criteria'][1]['value'] = 'mygroups';
$options['criteria'][1]['link'] = 'AND';
}
$options['criteria'][2]['field'] = 8;
// groups_id_assign
if ($type == 'notold') {
$options['criteria'][2]['searchtype'] = 'notequals';
} else {
$options['criteria'][2]['searchtype'] = 'equals';
}
$options['criteria'][2]['value'] = 'mygroups';
$options['criteria'][2]['link'] = 'AND';
echo "<table class='tab_cadrehov' id='pluginEscaladeCentralList'>";
echo "<tr><th colspan='5'>";
echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&') . "\">" . Html::makeTitle($title, $number, $numrows) . "</a>";
echo "</th></tr>";
if ($number) {
echo "<tr>";
echo "<th></th>";
echo "<th>" . __('Requester') . "</th>";
echo "<th>" . __('Associated element') . "</th>";
echo "<th>" . __('Description') . "</th></tr>";
for ($i = 0; $i < $number; $i++) {
$ID = $DB->result($result, $i, "id");
Ticket::showVeryShort($ID, 'Ticket$2');
}
}
echo "</table>";
echo "<br />";
}
}
示例6: giveItem
//.........这里部分代码省略.........
case pow(2, Alert::END) + pow(2, Alert::NOTICE):
return __('End + Notice');
}
return "";
case "glpi_tickets_tickets.tickets_id_1":
$out = "";
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$split2 = explode("\$\$\$\$", $data[$NAME . $num . "_2"]);
$displayed = array();
for ($k = 0; $k < count($split); $k++) {
$linkid = $split[$k] == $data['id'] ? $split2[$k] : $split[$k];
if ($linkid > 0 && !isset($displayed[$linkid])) {
$text = "<a ";
$text .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id={$linkid}\">";
$text .= Dropdown::getDropdownName('glpi_tickets', $linkid) . "</a>";
if (count($displayed)) {
$out .= "<br>";
}
$displayed[$linkid] = $linkid;
$out .= $text;
}
}
return $out;
case "glpi_problems.count":
if ($data[$NAME . $num] > 0 && Session::haveRight("problem", Problem::READALL)) {
if ($itemtype == 'ITILCategory') {
$options['field'][0] = 7;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = $data['id'];
$options['link'][0] = 'AND';
}
$options['reset'] = 'reset';
$out = "<a id='problem{$itemtype}" . $data['id'] . "' ";
$out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/problem.php?" . Toolbox::append_params($options, '&') . "\">";
$out .= $data[$NAME . $num] . "</a>";
} else {
$out = $data[$NAME . $num];
}
return $out;
case "glpi_tickets.count":
if ($data[$NAME . $num] > 0 && Session::haveRight("ticket", Ticket::READALL)) {
if ($itemtype == 'User') {
$options['field'][0] = 4;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = $data['id'];
$options['link'][0] = 'AND';
$options['field'][1] = 22;
$options['searchtype'][1] = 'equals';
$options['contains'][1] = $data['id'];
$options['link'][1] = 'OR';
$options['field'][2] = 5;
$options['searchtype'][2] = 'equals';
$options['contains'][2] = $data['id'];
$options['link'][2] = 'OR';
} else {
if ($itemtype == 'ITILCategory') {
$options['field'][0] = 7;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = $data['id'];
$options['link'][0] = 'AND';
} else {
$options['field'][0] = 12;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = 'all';
$options['link'][0] = 'AND';
$options['itemtype2'][0] = $itemtype;
示例7: showTabs
/**
* Show onglets
*
* @param $options array of parameters to add to URLs and ajax
* - withtemplate is a template view ?
*
* @return Nothing ()
**/
function showTabs($options = array())
{
global $CFG_GLPI;
// for objects not in table like central
if (isset($this->fields['id'])) {
$ID = $this->fields['id'];
} else {
$ID = 0;
}
$target = $_SERVER['PHP_SELF'];
$extraparamhtml = "";
$extraparam = "";
$withtemplate = "";
if (is_array($options) && count($options)) {
if (isset($options['withtemplate'])) {
$withtemplate = $options['withtemplate'];
}
$extraparamhtml = "&" . Toolbox::append_params($options, '&');
$extraparam = "&" . Toolbox::append_params($options);
// foreach ($options as $key => $val) {
// // Do not include id options
// if (($key[0] != '_') && ($key != 'id')) {
// $extraparamhtml .= "&$key=$val";
// $extraparam .= "&$key=$val";
// }
// }
}
if (empty($withtemplate) && !$this->isNewID($ID) && $this->getType() && $this->displaylist) {
$glpilistitems =& $_SESSION['glpilistitems'][$this->getType()];
$glpilisttitle =& $_SESSION['glpilisttitle'][$this->getType()];
$glpilisturl =& $_SESSION['glpilisturl'][$this->getType()];
if (empty($glpilisturl)) {
$glpilisturl = $this->getSearchURL();
}
echo "<div id='menu_navigate'>";
$next = $prev = $first = $last = -1;
$current = false;
if (is_array($glpilistitems)) {
$current = array_search($ID, $glpilistitems);
if ($current !== false) {
if (isset($glpilistitems[$current + 1])) {
$next = $glpilistitems[$current + 1];
}
if (isset($glpilistitems[$current - 1])) {
$prev = $glpilistitems[$current - 1];
}
$first = $glpilistitems[0];
if ($first == $ID) {
$first = -1;
}
$last = $glpilistitems[count($glpilistitems) - 1];
if ($last == $ID) {
$last = -1;
}
}
}
$cleantarget = HTML::cleanParametersURL($target);
echo "<ul>";
// echo "<li><a href=\"javascript:showHideDiv('tabsbody','tabsbodyimg','".$CFG_GLPI["root_doc"].
// "/pics/deplier_down.png','".$CFG_GLPI["root_doc"]."/pics/deplier_up.png')\">";
// echo "<img alt='' name='tabsbodyimg' src=\"".$CFG_GLPI["root_doc"]."/pics/deplier_up.png\">";
// echo "</a></li>";
echo "<li><a href=\"javascript:toggleTableDisplay('mainformtable','tabsbodyimg','" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png','" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png')\">";
echo "<img alt='' name='tabsbodyimg' src=\"" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png\">";
echo "</a></li>";
echo "<li><a href=\"" . $glpilisturl . "\">";
if ($glpilisttitle) {
if (Toolbox::strlen($glpilisttitle) > $_SESSION['glpidropdown_chars_limit']) {
$glpilisttitle = Toolbox::substr($glpilisttitle, 0, $_SESSION['glpidropdown_chars_limit']) . "…";
}
echo $glpilisttitle;
} else {
_e('List');
}
echo "</a></li>";
if ($first >= 0) {
echo "<li><a href='{$cleantarget}?id={$first}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('First') . "\" title=\"" . __s('First') . "\"></a></li>";
} else {
echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/first_off.png' alt=\"" . __s('First') . "\" title=\"" . __s('First') . "\"></li>";
}
if ($prev >= 0) {
echo "<li><a href='{$cleantarget}?id={$prev}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\"></a></li>";
} else {
echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/left_off.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\"></li>";
}
if ($current !== false) {
echo "<li>" . ($current + 1) . "/" . count($glpilistitems) . "</li>";
}
if ($next >= 0) {
echo "<li><a href='{$cleantarget}?id={$next}{$extraparamhtml}'><img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\"></a></li>";
} else {
echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/right_off.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\"></li>";
//.........这里部分代码省略.........
示例8: __s
// status
$options2['criteria'][1]['searchtype'] = 'equals';
$options2['criteria'][1]['value'] = 'notold';
$options2['criteria'][1]['link'] = 'AND';
$options2['reset'] = 'reset';
$url = $ticket->getSearchURL() . "?" . Toolbox::append_params($options2, '&');
echo " <a href='{$url}' title=\"" . __s('Processing') . "\" target='_blank'>(";
printf(__('%1$s: %2$s'), __('Processing'), $ticket->countActiveObjectsForTechGroup($_POST['groups_id_assign']));
echo ")</a>";
} else {
if (isset($_POST['suppliers_id_assign']) && $_POST['suppliers_id_assign'] > 0) {
$ticket = new Ticket();
$options2['criteria'][0]['field'] = 6;
// suppliers_id assign
$options2['criteria'][0]['searchtype'] = 'equals';
$options2['criteria'][0]['value'] = $_POST['suppliers_id_assign'];
$options2['criteria'][0]['link'] = 'AND';
$options2['criteria'][1]['field'] = 12;
// status
$options2['criteria'][1]['searchtype'] = 'equals';
$options2['criteria'][1]['value'] = 'notold';
$options2['criteria'][1]['link'] = 'AND';
$options2['reset'] = 'reset';
$url = $ticket->getSearchURL() . "?" . Toolbox::append_params($options2, '&');
//TRANS: %d is number of objects for the user
echo " <a href='{$url}' title=\"" . __s('Processing') . "\" target='_blank'>(";
printf(__('%1$s: %2$s'), __('Processing'), $ticket->countActiveObjectsForSupplier($_POST['suppliers_id_assign']));
echo ")</a>";
}
}
}
示例9: giveItem
//.........这里部分代码省略.........
$split = explode("\$\$\$\$", $data[$NAME . $num]);
$out = '';
foreach ($split as $val) {
$out .= (empty($out) ? '' : '<br>') . Infocom::getAmortTypeName($val);
}
return $out;
case "glpi_infocoms.alert":
if ($data[$NAME . $num] == pow(2, Alert::END)) {
return $LANG['financial'][80];
}
return "";
case "glpi_contracts.alert":
switch ($data[$NAME . $num]) {
case pow(2, Alert::END):
return $LANG['buttons'][32];
case pow(2, Alert::NOTICE):
return $LANG['financial'][10];
case pow(2, Alert::END) + pow(2, Alert::NOTICE):
return $LANG['buttons'][32] . " + " . $LANG['financial'][10];
}
return "";
case "glpi_tickets.count":
if ($data[$NAME . $num] > 0 && Session::haveRight("ticket", Ticket::READALL)) {
$options['field'][0] = 12;
$options['searchtype'][0] = 'equals';
$options['contains'][0] = 'all';
$options['link'][0] = 'AND';
$options['itemtype2'][0] = $itemtype;
$options['field2'][0] = self::getOptionNumber($itemtype, 'name');
$options['searchtype2'][0] = 'equals';
$options['contains2'][0] = $data['id'];
$options['link2'][0] = 'AND';
$options['reset'] = 'reset';
$out = "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options) . "\" data-back='false'>";
$out .= $data[$NAME . $num];
$out .= "</a>";
} else {
$out = $data[$NAME . $num];
}
return $out;
case "glpi_softwarelicenses.number":
if ($data[$NAME . $num . "_2"] == -1) {
return $LANG['software'][4];
}
if (empty($data[$NAME . $num])) {
return 0;
}
return $data[$NAME . $num];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$NAME . $num], $data[$NAME . $num . "_2"], 1, $data[$NAME . $num . "_3"] . $data[$NAME . $num . "_4"]);
case "glpi_reservationitems.comment":
if (empty($data[$NAME . $num])) {
return "<a title='" . $LANG['reservation'][22] . "'\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' data-back='false'>" . $LANG['common'][49] . "</a>";
}
return "<a title='" . $LANG['reservation'][22] . "'\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' data-back='false'>" . resume_text($data[$NAME . $num]) . "</a>";
case 'glpi_notifications.mode':
return Notification::getMode($data[$NAME . $num]);
case 'glpi_notifications.event':
$item = NotificationTarget::getInstanceByType($data['itemtype']);
if ($item) {
$events = $item->getAllEvents();
return $events[$data[$NAME . $num]];
}
return '';
case 'glpi_crontasks.description':
$tmp = new CronTask();
示例10: showCentralSpecificList
static function showCentralSpecificList($type)
{
global $CFG_GLPI, $DB;
if (!Session::haveRight("show_all_ticket", "1") && !Session::haveRight("show_assign_ticket", "1") && !Session::haveRight("create_ticket", "1") && !Session::haveRight("validate_ticket", "1")) {
return false;
}
$groups = implode("','", $_SESSION['glpigroups']);
$numrows = 0;
$is_deleted = " `glpi_tickets`.`is_deleted` = 0 ";
if ($type == "notold") {
$title = __("Tickets to follow (climbed)", "escalade");
$status = CommonITILObject::INCOMING . ", " . CommonITILObject::PLANNED . ", " . CommonITILObject::ASSIGNED . ", " . CommonITILObject::WAITING;
$search_assign = " `glpi_plugin_escalade_histories`.`groups_id` IN ('{$groups}')\n AND (`glpi_groups_tickets`.`groups_id` NOT IN ('{$groups}')\n OR `glpi_groups_tickets`.`groups_id` IS NULL)";
$query_join = "LEFT JOIN `glpi_plugin_escalade_histories`\n ON (`glpi_tickets`.`id` = `glpi_plugin_escalade_histories`.`tickets_id`)\n LEFT JOIN `glpi_groups_tickets`\n ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id` \n AND `glpi_groups_tickets`.`type`=2)";
} else {
$title = __("Tickets to close (climbed)", "escalade");
$status = CommonITILObject::SOLVED;
$search_assign = " (`glpi_groups_tickets`.`groups_id` IN ('{$groups}'))";
$query_join = "LEFT JOIN `glpi_groups_tickets`\n ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id` \n AND `glpi_groups_tickets`.`type`=2)";
}
$query = "SELECT DISTINCT `glpi_tickets`.`id`\n FROM `glpi_tickets`\n LEFT JOIN `glpi_tickets_users`\n ON (`glpi_tickets`.`id` = `glpi_tickets_users`.`tickets_id`)";
$query .= $query_join;
$query .= "WHERE {$is_deleted} AND ( {$search_assign} )\n AND (`status` IN ({$status}))" . getEntitiesRestrictRequest("AND", "glpi_tickets");
$query .= " ORDER BY glpi_tickets.date_mod DESC";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
if (!$numrows) {
return;
}
$query .= " LIMIT 0, 5";
$result = $DB->query($query);
$number = $DB->numrows($result);
//show central list
if ($numrows > 0) {
//construct link to ticket list
$options['reset'] = 'reset';
$num = 0;
foreach ($_SESSION['glpigroups'] as $gID) {
$options['field'][$num] = 8;
if ($type == "notold") {
$options['searchtype'][$num] = 'notequals';
$options['contains'][$num] = $gID;
$options['link'][$num] = $num == 0 ? 'AND' : 'OR';
$num++;
$options['field'][$num] = 1881;
//see hook.php, function ..._getAddSearchOptions
}
$options['searchtype'][$num] = 'equals';
$options['contains'][$num] = $gID;
if ($type == "notold") {
$options['link'][$num] = 'AND';
} else {
$options['link'][$num] = $num == 0 ? 'AND' : 'OR';
}
$num++;
$options['field'][$num] = 12;
// status
$options['searchtype'][$num] = 'equals';
$options['contains'][$num] = $type;
$options['link'][$num] = 'AND';
$num++;
}
echo "<table><tr><td class='top' width='450px'>";
echo "<table class='tab_cadrehov' id='pluginEscaladeCentralList' style='width:420px'>";
echo "<tr><th colspan='5'>";
echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&') . "\">" . Html::makeTitle($title, $number, $numrows) . "</a>";
echo "</a>";
echo "</th></tr>";
if ($number) {
echo "<tr><th></th>";
echo "<th>" . __('Requester') . "</th>";
echo "<th>" . __('Associated element') . "</th>";
echo "<th>" . __('Description') . "</th></tr>";
for ($i = 0; $i < $number; $i++) {
$ID = $DB->result($result, $i, "id");
Ticket::showVeryShort($ID, 'Ticket$2');
}
}
echo "</table>";
echo "</td></tr></table>";
}
}
示例11: showResult
public function showResult($output_type, $limit = 0, $params = array())
{
global $DB;
$arrayRet = $this->execQuery($_REQUEST);
$result = $arrayRet['query_result'];
$query = $arrayRet['query'];
$nbtot = $result ? $DB->numrows($result) : 0;
if ($limit) {
$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
if ($start >= $nbtot) {
$start = 0;
}
if ($start > 0 || $start + $limit < $nbtot) {
$result = $DB->query($query . " LIMIT {$start},{$limit}");
}
} else {
$start = 0;
}
$nbCols = $DB->num_fields($result);
$nbrows = $DB->numrows($result);
$groupByRackName = true;
if (isset($_REQUEST['groupByRackName']) && $_REQUEST['groupByRackName'] == "on") {
$groupByRackName = false;
}
$title = date("d/m/Y H:i");
if ($nbtot == 0) {
echo "<div class='center'><font class='red b'>" . __("No item found") . "</font></div>";
Html::footer();
} else {
if ($output_type == Search::HTML_OUTPUT) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th>{$title}</th></tr>\n";
echo "<tr class='tab_bg_2 center'><td class='center'>";
$parameters = null;
$parameters .= Toolbox::append_params($_REQUEST, '&');
$this->printPager($start, $nbtot, $_SERVER["PHP_SELF"], $parameters, 'PluginRacksRack');
}
}
if ($nbtot > 0) {
if ($output_type == Search::HTML_OUTPUT) {
echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
}
echo Search::showHeader($output_type, $nbrows, $nbCols, true);
echo Search::showNewLine($output_type);
$showAllFieds = true;
$listFields = array();
$cptField = 0;
$showAllFieds = (!isset($_REQUEST['cb_object_name']) || $_REQUEST['cb_object_name'] != "on") && (!isset($_REQUEST['cb_object_location']) || $_REQUEST['cb_object_location'] != "on") && (!isset($_REQUEST['cb_group']) || $_REQUEST['cb_group'] != "on") && (!isset($_REQUEST['cb_manufacturer']) || $_REQUEST['cb_manufacturer'] != "on") && (!isset($_REQUEST['cb_model']) || $_REQUEST['cb_model'] != "on") && (!isset($_REQUEST['cb_serial_number']) || $_REQUEST['cb_serial_number'] != "on");
$num = 1;
$cptRow = 1;
if (!$showAllFieds) {
$this->showTitle($output_type, $num, __("Bay name", "racks"), 'name', false, $params);
$cptField++;
$this->showTitle($output_type, $num, __("Location"), 'location', false, $params);
$cptField++;
$this->showTitle($output_type, $num, _n("Place", "Places", 1, "racks"), 'roomlocation', false, $params);
$cptField++;
$this->showTitle($output_type, $num, __("U", "racks"), 'u', false, $params);
$cptField++;
$this->showTitle($output_type, $num, __("Front", "racks") . " / " . _x('Rack enclosure', 'Back', 'racks'), 'front_rear', false, $params);
$cptField++;
if (isset($_REQUEST['cb_object_name']) && $_REQUEST['cb_object_name'] == "on") {
$listFields['object_name'] = $_REQUEST['cb_object_name'];
$this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false, $params);
$cptField++;
}
// Lieu
if (isset($_REQUEST['cb_object_location']) && $_REQUEST['cb_object_location'] == "on") {
$listFields['object_location'] = $_REQUEST['cb_object_location'];
$this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false, $params);
$cptField++;
}
// Groupe
if (isset($_REQUEST['cb_group']) && $_REQUEST['cb_group'] == "on") {
$listFields['group'] = $_REQUEST['cb_group'];
$this->showTitle($output_type, $num, __("Group"), 'group', false, $params);
$cptField++;
}
// Fabricant
if (isset($_REQUEST['cb_manufacturer']) && $_REQUEST['cb_manufacturer'] == "on") {
$listFields['manufacturer'] = $_REQUEST['cb_manufacturer'];
$this->showTitle($output_type, $num, __("Manufacturer"), 'manufacturer', false, $params);
$cptField++;
}
// Modèle
if (isset($_REQUEST['cb_model']) && $_REQUEST['cb_model'] == "on") {
$listFields['model'] = $_REQUEST['cb_model'];
$this->showTitle($output_type, $num, __("Model"), 'model', false, $params);
$cptField++;
}
// Numéro de série
if (isset($_REQUEST['cb_serial_number']) && $_REQUEST['cb_serial_number'] == "on") {
$listFields['serial_number'] = $_REQUEST['cb_serial_number'];
$this->showTitle($output_type, $num, __("Serial number"), 'group', false, $params);
$cptField++;
}
} else {
$this->showTitle($output_type, $num, __("Bay name", "racks"), 'rack_name', false, $params);
$listFields['rack_name'] = true;
$this->showTitle($output_type, $num, __("Location"), 'location', false, $params);
//.........这里部分代码省略.........
示例12: show
public static function show($ID, $from_helpdesk)
{
global $LANG, $CFG_GLPI, $DB;
//$logged = $_SESSION['glpiID'];
if (!isset($_REQUEST['session'])) {
$IDO = Session::getLoginUserID();
} else {
$IDO = $_REQUEST['session'];
}
$logged = $ID;
/*
echo $logged."logged2 ";
echo Session::getLoginUserID()."session ";
*/
if (isset($_REQUEST['id'])) {
$ID = $_REQUEST['id'];
$_SESSION["glpiID"] = $_REQUEST['id'];
$query = "SELECT `profiles_id` AS id\nFROM `glpi_profiles_users`\nWHERE `users_id` = " . $IDO . "\nORDER BY `glpi_profiles_users`.`profiles_id` DESC";
$result = $DB->query($query);
$cont = $DB->numrows($result);
$profile = $DB->fetch_assoc($result);
} else {
$ID = $_SESSION['glpiID'];
$_SESSION['glpiID'] = $_SESSION['glpiID'];
$query = "SELECT `profiles_id` AS id\nFROM `glpi_profiles_users`\nWHERE `users_id` = " . $IDO . "\nORDER BY `glpi_profiles_users`.`profiles_id` DESC";
$result = $DB->query($query);
$cont = $DB->numrows($result);
$profile = $DB->fetch_assoc($result);
}
/*
echo $ID."id ";
echo $_SESSION['glpiID']."glpiid ";
echo $_SESSION['logged']."logged ";
echo $logged."logged2 ";
*/
if (!Session::haveRight("ticket", CREATE)) {
return false;
}
if (Session::haveRight('validate_ticket', 1)) {
// if (Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST, TicketValidation::VALIDATEINCIDENT))) {
$opt = array();
$opt['reset'] = 'reset';
$opt['field'][0] = 55;
// validation status
$opt['searchtype'][0] = 'equals';
$opt['contains'][0] = 'waiting';
$opt['link'][0] = 'AND';
$opt['field'][1] = 59;
// validation aprobator
$opt['searchtype'][1] = 'equals';
$opt['contains'][1] = Session::getLoginUserID();
//$opt['contains'][1] = $ID;
$opt['link'][1] = 'AND';
$url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&');
if (TicketValidation::getNumberTicketsToValidate(Session::getLoginUserID()) > 0) {
//if (TicketValidation::getNumberTicketsToValidate( $ID >0) {
echo "<a href='{$url_validate}' title=\"" . $LANG['validation'][15] . "\"\n alt=\"" . $LANG['validation'][15] . "\">" . $LANG['validation'][33] . "</a><br><br>";
}
}
// Stevenes Donato
//email user
$query = "SELECT gu.id, ge.email, gu.`firstname`, gu.`realname`, gu.`name`\n FROM `glpi_users` gu, glpi_useremails ge\n WHERE gu.`id` = '{$ID}'\n\t\t\t\t\t AND ge.users_id = gu.id ";
$result = $DB->query($query);
$email = $DB->result($result, 0, "email");
$user_name = $DB->result($result, 0, "firstname") . " ";
$user_sname = $DB->result($result, 0, "realname");
//categories
$query_cat = "SELECT id, completename\n\t\t\t\t\t\t\tFROM `glpi_itilcategories` \n\t\t\t\t\t\t\tWHERE `is_helpdeskvisible` = 1";
$result_cat = $DB->query($query_cat);
$itilcategories_id = $DB->fetch_assoc($result_cat);
$sql_user = "\n\t\tSELECT DISTINCT glpi_users.`id` AS id , glpi_users.`firstname` AS name, glpi_users.`realname` AS sname\n\t\tFROM `glpi_users`\n\t\tWHERE glpi_users.is_deleted = 0\n\t\tORDER BY `glpi_users`.`firstname` ASC ";
$result_user = $DB->query($sql_user);
$user = $DB->fetch_assoc($result_user);
// Get saved data from a back system
$use_email_notification = 1;
if ($email == "") {
$use_email_notification = 0;
}
$itemtype = 0;
$items_id = "";
$content = "";
$title = "";
//$itilcategories_id = 0;
$urgency = 3;
if (isset($_SESSION["helpdeskSaved"]["use_email_notification"])) {
$use_email_notification = stripslashes($_SESSION["helpdeskSaved"]["use_email_notification"]);
}
if (isset($_SESSION["helpdeskSaved"]["email"])) {
$email = stripslashes($_SESSION["helpdeskSaved"]["user_email"]);
}
if (isset($_SESSION["helpdeskSaved"]["itemtype"])) {
$itemtype = stripslashes($_SESSION["helpdeskSaved"]["itemtype"]);
}
if (isset($_SESSION["helpdeskSaved"]["items_id"])) {
$items_id = stripslashes($_SESSION["helpdeskSaved"]["items_id"]);
}
if (isset($_SESSION["helpdeskSaved"]["content"])) {
$content = cleanPostForTextArea($_SESSION["helpdeskSaved"]["content"]);
}
if (isset($_SESSION["helpdeskSaved"]["name"])) {
//.........这里部分代码省略.........
示例13: getMenu
//.........这里部分代码省略.........
$menu['inventory']['content']['state']['shortcut'] = 'n';
$menu['inventory']['content']['state']['icon'] = 'icons/list.png';
$menu['inventory']['content']['state']['page'] = '/front/search.php?itemtype=state&menu=inventory&ssmenu=state';
$menu['inventory']['content']['state']['links']['search'] = '/front/states.php';
$menu['inventory']['content']['state']['links']['summary'] = '/front/states.php?synthese=yes';
}
// ASSISTANCE
$menu['maintain']['title'] = $LANG['title'][24];
$menu['maintain']['default'] = '/front/ticket.php';
$menu['maintain']['icon'] = 'icons/assistance.png';
// if (Session::haveRight("observe_ticket","1") || Session::haveRight("show_all_ticket","1") || Session::haveRight("create_ticket","1")) {
if (Session::haveRight("ticket", CREATE) || Session::haveRight("ticket", UPDATE)) {
//if (Session::haveRight("ticket",CREATE) ) {
$menu['maintain']['content']['ticket']['title'] = $LANG['Menu'][5];
$menu['maintain']['content']['ticket']['icon'] = 'icons/ticket.png';
$menu['maintain']['content']['ticket']['shortcut'] = 't';
$menu['maintain']['content']['ticket']['page'] = '/front/search.php?itemtype=ticket&menu=maintain&ssmenu=ticket';
$menu['maintain']['content']['ticket']['links']['search'] = '/front/ticket.php';
$menu['maintain']['content']['ticket']['links']['search'] = '/front/ticket.php';
if (Session::haveRight('ticket', Ticket::READALL)) {
$opt = array();
$opt['reset'] = 'reset';
$opt['field'][0] = 55;
// validation status
$opt['searchtype'][0] = 'equals';
$opt['contains'][0] = 'waiting';
$opt['link'][0] = 'AND';
$opt['field'][1] = 59;
// validation aprobator
$opt['searchtype'][1] = 'equals';
$opt['contains'][1] = Session::getLoginUserID();
$opt['link'][1] = 'AND';
$pic_validate = "<img title=\"" . $LANG['validation'][15] . "\" alt=\"" . $LANG['validation'][15] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'>";
$menu['maintain']['content']['ticket']['links'][$pic_validate] = '/front/ticket.php?' . Toolbox::append_params($opt, '&');
}
}
if (Session::haveRight("ticket", CREATE) || Session::haveRight("ticket", Ticket::READALL)) {
$menu['maintain']['content']['helpdesk']['title'] = $LANG['job'][13];
$menu['maintain']['content']['helpdesk']['icon'] = 'icons/ticket.png';
$menu['maintain']['content']['helpdesk']['shortcut'] = 'c';
$menu['maintain']['content']['helpdesk']['page'] = '/front/helpdesk.php';
$menu['maintain']['content']['ticket']['links']['add'] = '/front/ticket.form.php';
}
if (Session::haveRight("planning", CREATE) || Session::haveRight("planning", Ticket::READALL)) {
$menu['maintain']['content']['planning']['title'] = __('Planning');
//$LANG['Menu'][29];
$menu['maintain']['content']['planning']['shortcut'] = 'l';
$menu['maintain']['content']['planning']['icon'] = 'icons/planning.png';
$menu['maintain']['content']['planning']['page'] = '/front/planning.php';
$menu['maintain']['content']['planning']['links']['search'] = '/front/planning.php';
$menu['maintain']['content']['planning']['external'] = true;
}
if (Session::haveRight("statistic", "1")) {
$menu['maintain']['content']['stat']['title'] = $LANG['Menu'][13];
$menu['maintain']['content']['stat']['shortcut'] = '1';
$menu['maintain']['content']['stat']['icon'] = 'icons/charts.png';
$menu['maintain']['content']['stat']['page'] = '/front/stat.php';
}
// FINANCIAL
if (Session::haveRight("budget", READ)) {
$menu['financial']['content']['budget']['title'] = $LANG['financial'][110];
$menu['financial']['content']['budget']['shortcut'] = 'n';
$menu['financial']['content']['budget']['icon'] = 'icons/euro.png';
$menu['financial']['content']['budget']['page'] = '/front/search.php?itemtype=budget&menu=financial&ssmenu=budget';
$menu['financial']['content']['budget']['links']['search'] = '/front/budget.php';
if (Session::haveRight("contract", UPDATE)) {
示例14: load
/**
* load a bookmark
*
* @param $ID ID of the bookmark
* @param $opener boolean load bookmark in opener window ? false -> current window
* (true by default)
*
* @return nothing
**/
function load($ID, $opener = true)
{
global $CFG_GLPI;
if ($params = $this->getParameters($ID)) {
$url = $CFG_GLPI['root_doc'] . "/" . rawurldecode($this->fields["path"]);
$url .= "?" . Toolbox::append_params($params);
if ($opener) {
echo "<script type='text/javascript' >\n";
echo "window.parent.location.href='{$url}';";
echo "</script>";
exit;
} else {
Html::redirect($url);
}
}
}
示例15: showInfocoms
/**
* Print the HTML array for infocoms linked
*
*@return Nothing (display)
*
**/
function showInfocoms()
{
global $DB, $CFG_GLPI;
$instID = $this->fields['id'];
if (!$this->can($instID, READ)) {
return false;
}
$query = "SELECT DISTINCT `itemtype`\n FROM `glpi_infocoms`\n WHERE `suppliers_id` = '{$instID}'\n AND `itemtype` NOT IN ('ConsumableItem', 'CartridgeItem', 'Software')\n ORDER BY `itemtype`";
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<div class='spaced'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>";
Html::printPagerForm();
echo "</th><th colspan='3'>";
if ($DB->numrows($result) == 0) {
_e('No associated item');
} else {
echo _n('Associated item', 'Associated items', $DB->numrows($result));
}
echo "</th></tr>";
echo "<tr><th>" . __('Type') . "</th>";
echo "<th>" . __('Entity') . "</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Serial number') . "</th>";
echo "<th>" . __('Inventory number') . "</th>";
echo "</tr>";
$num = 0;
for ($i = 0; $i < $number; $i++) {
$itemtype = $DB->result($result, $i, "itemtype");
if (!($item = getItemForItemtype($itemtype))) {
continue;
}
if ($item->canView()) {
$linktype = $itemtype;
$linkfield = 'id';
$itemtable = getTableForItemType($itemtype);
$query = "SELECT `glpi_infocoms`.`entities_id`, `name`, `{$itemtable}`.*\n FROM `glpi_infocoms`\n INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`) ";
// Set $linktype for entity restriction AND link to search engine
if ($itemtype == 'Cartridge') {
$query .= "INNER JOIN `glpi_cartridgeitems`\n ON (`glpi_cartridgeitems`.`id`=`glpi_cartridges`.`cartridgeitems_id`) ";
$linktype = 'CartridgeItem';
$linkfield = 'cartridgeitems_id';
}
if ($itemtype == 'Consumable') {
$query .= "INNER JOIN `glpi_consumableitems`\n ON (`glpi_consumableitems`.`id`=`glpi_consumables`.`consumableitems_id`) ";
$linktype = 'ConsumableItem';
$linkfield = 'consumableitems_id';
}
$linktable = getTableForItemType($linktype);
$query .= "WHERE `glpi_infocoms`.`itemtype` = '{$itemtype}'\n AND `glpi_infocoms`.`suppliers_id` = '{$instID}'" . getEntitiesRestrictRequest(" AND", $linktable) . "\n ORDER BY `glpi_infocoms`.`entities_id`,\n `{$linktable}`.`name`";
$result_linked = $DB->query($query);
$nb = $DB->numrows($result_linked);
// Set $linktype for link to search engine pnly
if ($itemtype == 'SoftwareLicense' && $nb > $_SESSION['glpilist_limit']) {
$linktype = 'Software';
$linkfield = 'softwares_id';
}
$link_item = new $linktype();
if ($nb > $_SESSION['glpilist_limit']) {
echo "<tr class='tab_bg_1'>";
$title = $item->getTypeName($nb);
if ($nb > 0) {
$title = sprintf(__('%1$s: %2$s'), $title, $nb);
}
echo "<td class='center'>" . $title . "</td>";
echo "<td class='center' colspan='2'>";
$opt = array('order' => 'ASC', 'is_deleted' => 0, 'reset' => 'reset', 'start' => 0, 'sort' => 80, 'criteria' => array(0 => array('value' => '$$$$' . $instID, 'searchtype' => 'contains', 'field' => 53)));
$link = $linktype::getSearchURL();
$link .= strpos($link, '?') ? '&' : '?';
echo "<a href='{$link}" . Toolbox::append_params($opt) . "'>" . __('Device list') . "</a></td>";
echo "<td class='center'>-</td><td class='center'>-</td></tr>";
} else {
if ($nb) {
for ($prem = true; $data = $DB->fetch_assoc($result_linked); $prem = false) {
$name = $data["name"];
if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data["id"]);
}
$link = $link_item->getFormURLWithID($data[$linkfield]);
$name = "<a href='{$link}'>" . $name . "</a>";
echo "<tr class='tab_bg_1'>";
if ($prem) {
$title = $item->getTypeName($nb);
if ($nb > 0) {
$title = sprintf(__('%1$s: %2$s'), $title, $nb);
}
echo "<td class='center top' rowspan='{$nb}'>" . $title . "</td>";
}
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "</td>";
echo "<td class='center";
echo (isset($data['is_deleted']) && $data['is_deleted'] ? " tab_bg_2_2'" : "'") . ">";
echo $name . "</td>";
echo "<td class='center'>" . (isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
echo "<td class='center'>" . (isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
//.........这里部分代码省略.........