static function showItems($target, $date1, $date2, $start) { global $DB, $CFG_GLPI, $LANG; $view_entities = Session::isMultiEntitiesMode(); if ($view_entities) { $entities = getAllDatasFromTable('glpi_entities'); } $output_type = Search::HTML_OUTPUT; if (isset($_GET["display_type"])) { $output_type = $_GET["display_type"]; } if (empty($date2)) { $date2 = date("Y-m-d"); } $date2 .= " 23:59:59"; // 1 an par defaut if (empty($date1)) { $date1 = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1)); } $date1 .= " 00:00:00"; $query = "SELECT `itemtype`, `items_id`, COUNT(*) AS NB\n FROM `glpi_tickets`\n WHERE `date` <= '{$date2}'\n AND `date` >= '{$date1}' " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n AND `itemtype` <> ''\n AND `items_id` > 0\n GROUP BY `itemtype`, `items_id`\n ORDER BY NB DESC"; $result = $DB->query($query); $numrows = $DB->numrows($result); if ($numrows > 0) { $end_display = $start + $_SESSION['plugin_mobile']['rows_limit']; if (isset($_GET['export_all'])) { $end_display = $numrows; } echo PluginMobileSearch::showHeader($output_type, $end_display - $start + 1, 2, 1); $header_num = 1; echo "<div data-type='horizontal' data-role='controlgroup' class='mobile_list_header'>"; echo PluginMobileSearch::showHeaderItem($output_type, $LANG['common'][1], $header_num, '#', 0, '', 3); if ($view_entities) { echo PluginMobileSearch::showHeaderItem($output_type, $LANG['entity'][0], $header_num, '#', 0, '', 3); } echo PluginMobileSearch::showHeaderItem($output_type, $LANG['stats'][13], $header_num, '#', 0, '', 3); echo "</div>"; echo PluginMobileSearch::showEndLine($output_type); $DB->data_seek($result, $start); $i = $start; if (isset($_GET['export_all'])) { $start = 0; } for ($i = $start; $i < $numrows && $i < $end_display; $i++) { $item_num = 1; // Get data and increment loop variables $data = $DB->fetch_assoc($result); if (!class_exists($data["itemtype"])) { continue; } $item = new $data["itemtype"](); if ($item->getFromDB($data["items_id"])) { echo PluginMobileSearch::showNewLine($output_type, $i % 2); echo PluginMobileSearch::showItem($output_type, $item->getTypeName() . " - " . $item->getNameID(), $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""), 3); if ($view_entities) { $ent = $item->getEntityID(); if ($ent == 0) { $ent = $LANG['entity'][2]; } else { $ent = $entities[$ent]['completename']; } echo PluginMobileSearch::showItem($output_type, $ent, $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""), 3); } echo PluginMobileSearch::showItem($output_type, $data["NB"], $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""), 3); } } echo PluginMobileSearch::showFooter($output_type); if ($output_type == Search::HTML_OUTPUT) { self::displayFooterNavBar($target, $numrows); } } }
public function displayItem($ID, $itemtype) { global $LANG, $CFG_GLPI, $ID; $welcome = " "; if (class_exists($itemtype)) { $classname = ucfirst($itemtype); $obj = new $classname(); $welcome = $obj->getTypeName() . " (" . $_REQUEST['id'] . ")"; } $table = $obj->getTable(); //saveActiveProfileAndApplyRead(); $common = new PluginMobileCommon(); $common->displayHeader($welcome, "search.php?menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&itemtype={$itemtype}", '', '', 'item'); echo "<form action='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/item.form.php?menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&itemtype={$itemtype}&id={$ID}" . "' method='post'>"; if (largeScreen() && DISPLAYLEFTPANEL) { //if (true) { //if (false) { /*ob_start(); $obj->showForm($ID); $out = ob_get_contents(); ob_end_clean(); //delete script $out = preg_replace('/((<[\s\/]*script\b[^>]*>)([^>]*)(<\/script>))/i', '', $out); //hide tooltips $out = preg_replace('/(<a id=\'tooltip[^>])(.*?)(<\/a>)/', '', $out); $out = preg_replace('/(<img id=\'tooltip[^>])(.*?)(>)/', '', $out); //parse menu navigate $out = preg_replace('/(<a)(.*?)(search\.php[^>])(.*?)(<\/a> \:)/', '', $out); $out = preg_replace('/(item\.php\?id=[0-9]*)/', '$0'."&menu=".$_GET['menu']."&ssmenu=".$_GET['ssmenu']."&itemtype=$itemtype", $out); $out = preg_replace('/(<a[^.]*showHideDiv[^>])(.*?)(<\/a>)/', '', $out); preg_match_all('/(<div id=\'menu_navigate[^>])(.*?)(<\/div>)/', $out, $matches); $out = preg_replace('/(<div id=\'menu_navigate[^>])(.*?)(<\/div>)/', '', $out); //show select in native $out = str_replace('<select', "<select data-native-menu='true'", $out); $common->displayTabBar($matches[0]); ob_start(); $this->showButtons($itemtype, $ID); $buttons_form = ob_get_contents(); ob_end_clean(); $out .= $buttons_form; echo $out;*/ $savecolslimit = $_SESSION['plugin_mobile']['cols_limit']; $saverowslimit = $_SESSION['plugin_mobile']['rows_limit']; $_SESSION['plugin_mobile']['cols_limit'] = 1; $_SESSION['plugin_mobile']['rows_limit'] = 50; $_GET['showheader'] = false; echo "<div class='ui-grid-a' style='position:relative;'>"; echo "<div id='left_panel' class='ui-block-a'>"; echo "<div data-role='header' data-backbtn='false' data-theme='a' data-id='TabBar'>"; echo "<div data-theme='c' class='ui-btn-right' style='top:0' data-position='inline'>"; echo "<a data-role='button' data-theme='c'>test</a>"; echo "</div></div>"; echo "<div style='height:600px;'>"; PluginMobileSearch::manageGetValues($itemtype); //Search::manageParams($itemtype); $numrows = PluginMobileSearch::show(ucfirst($itemtype)); echo "</div>"; echo "</div>"; echo "<div class='ui-block-b' id='right_panel'>"; PluginMobileTab::displayTabBar(); echo "<div style='height:570px;'>"; $_SESSION['plugin_mobile']['cols_limit'] = $savecolslimit; $_SESSION['plugin_mobile']['rows_limit'] = $saverowslimit; } else { PluginMobileTab::displayTabBar(); } $obj->getFromDB($ID); $p['itemtype'] = $_REQUEST['itemtype']; //$p['itemtype'] = ''; $p['id'] = false; $p['return_fields'] = array(); $p['show_label'] = true; $p['show_name'] = true; foreach ($params as $key => $value) { $p[$key] = $value; } if (largeScreen()) { $obj = $this->removeBlacklistedField($obj); $nb_items = count($obj->fields); $tmp = array_chunk($obj->fields, ceil($nb_items / 2), true); $fields1 = $tmp[1]; $fields2 = $tmp[0]; $params1 = array('data' => $fields1, 'options' => $p, 'searchOptions' => $obj->getSearchOptions(), 'itemtype' => $itemtype); $params2 = $params1; $params2['data'] = $fields2; $this->getLabels($params1, $labels1); $this->getLabels($params2, $labels2); //echo $fields1 ."<br>"; //echo count($labels2)."<br>"; echo "<div class='ui-grid-a' id='tablet-grid'>"; echo "<div class='ui-block-a'>"; $this->showList($labels1, $itemtype); echo "</div>"; echo "<div class='ui-block-b'>"; $this->showList($labels2, $itemtype); echo "</div>"; echo "</div>"; } else { $params = array('data' => $obj->fields, 'options' => $p, 'searchOptions' => $obj->getSearchOptions(), 'itemtype' => $itemtype); $this->getLabels($params, $labels); unset($labels['id']); $this->showList($labels, $itemtype); } if (editMode()) { $this->showButtons($itemtype, $ID); } if (largeScreen() && DISPLAYLEFTPANEL) { echo "</div></div></div>"; } // restoreActiveProfile(); //Close Form //echo "</form>"; Html::closeForm(); $common->displayFooter(); }
This file is part of GLPI. GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- // Entry menu case define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; $itemtype = $_GET['itemtype']; $common = new PluginMobileCommon(); $common->displayCommonHtmlHeader(); $common->displayPopHeader($LANG['buttons'][0], 'searchbox'); PluginMobileSearch::showGenericSearch($itemtype, $_GET); $common->displayPopFooter(); $common->displayFooter();
static function giveItem($itemtype, $ID, array $data, $num, $meta = 0, array $addobjectparams = array()) { global $CFG_GLPI, $LANG, $PLUGIN_HOOKS; $searchopt =& Search::getOptions($itemtype); if (isset($CFG_GLPI["union_search_type"][$itemtype]) && $CFG_GLPI["union_search_type"][$itemtype] == $searchopt[$ID]["table"]) { return PluginMobileSearch::giveItem($data["TYPE"], $ID, $data, $num, $meta); } // Plugin can override core definition for its type if ($plug = isPluginItemType($itemtype)) { $function = 'plugin_' . $plug['plugin'] . '_giveItem'; if (function_exists($function)) { $out = $function($itemtype, $ID, $data, $num); if (!empty($out)) { return $out; } } } $NAME = "ITEM_"; if ($meta) { $NAME = "META_"; } $table = $searchopt[$ID]["table"]; $field = $searchopt[$ID]["field"]; $linkfield = $searchopt[$ID]["linkfield"]; switch ($table . '.' . $field) { case "glpi_users_validation.name": case "glpi_users.name": // USER search case if ($itemtype != 'User' && isset($searchopt[$ID]["forcegroupby"]) && $searchopt[$ID]["forcegroupby"]) { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; $added = array(); for ($k = 0; $k < count($split); $k++) { if ($split[$k] > 0) { if ($count_display) { $out .= "<br>"; } $count_display++; if ($itemtype == 'Ticket') { $userdata = getUserNameMobile($split[$k], 2); $out .= $userdata['name'] . " "; } else { $out .= getUserNameMobile($split[$k], 1); } } } return $out; } else { if (!empty($linkfield)) { $toadd = ''; if ($itemtype == 'Ticket' && $data[$NAME . $num . "_3"] > 0) { $userdata = getUserNameMobile($data[$NAME . $num . "_3"], 2); $toadd = " "; } //Stevenes $name1 = explode("\$\$", $data[$NAME . $num]); // return $name1['0'].' ('.$name1['1'].')'; $link_user = $_SESSION['mobileSearchLastLink'] = "<a href=" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/item.php?itemtype=user&menu=admin&ssmenu=user&id=" . $name1['1'] . ">" . $name1['0'] . " (" . $name1['1'] . ")</a>"; return $link_user; // return formatUserNameMobile($data[$NAME.$num."_3"],$data[$NAME.$num],$data[$NAME.$num."_2"], $data[$NAME.$num."_4"],1).$toadd; } } break; case "glpi_profiles.interface": return Profile::getInterfaceName($data[$NAME . $num]); break; case "glpi_profiles.name": if ($itemtype == 'User') { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $split2 = explode("\$\$\$\$", $data[$NAME . $num . "_2"]); $split3 = explode("\$\$\$\$", $data[$NAME . $num . "_3"]); $count_display = 0; $added = array(); for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { $text = $split[$k] . " - " . $split2[$k]; if ($split3[$k]) { $text .= " (R)"; } if (!in_array($text, $added)) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= $text; $added[] = $text; } } } return $out; } break; case "glpi_entities.completename": if ($itemtype == 'User') { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $split2 = explode("\$\$\$\$", $data[$NAME . $num . "_2"]); $split3 = explode("\$\$\$\$", $data[$NAME . $num . "_3"]); $added = array(); $count_display = 0; for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { $text = $split[$k] . " - " . $split2[$k]; if ($split3[$k]) { $text .= " (R)"; } if (!in_array($text, $added)) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= $text; $added[] = $text; } } } return $out; } else { if ($data[$NAME . $num . "_2"] == 0) { // Set name for Root entity $data[$NAME . $num] = $LANG['entity'][2]; } } break; case "glpi_documenttypes.icon": if (!empty($data[$NAME . $num])) { return "<img class='middle' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $data[$NAME . $num] . "'>"; } return " "; case "glpi_documents.filename": $doc = new Document(); if ($doc->getFromDB($data['id'])) { return $doc->getDownloadLink(); } return NOT_AVAILABLE; case "glpi_deviceharddrives.specificity": case "glpi_devicememories.specificity": case "glpi_deviceprocessors.specificity": return $data[$NAME . $num]; case "glpi_networkports.mac": $out = ""; if ($itemtype == 'Computer') { $displayed = array(); if (!empty($data[$NAME . $num . "_2"])) { $split = explode("\$\$\$\$", $data[$NAME . $num . "_2"]); $count_display = 0; for ($k = 0; $k < count($split); $k++) { $lowstr = utf8_strtolower($split[$k]); if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= $split[$k]; $displayed[] = $lowstr; } } if (!empty($data[$NAME . $num])) { $out .= "<br>"; } } if (!empty($data[$NAME . $num])) { $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; for ($k = 0; $k < count($split); $k++) { $lowstr = utf8_strtolower($split[$k]); if (strlen(trim($split[$k])) > 0 && !in_array($lowstr, $displayed)) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= $split[$k]; $displayed[] = $lowstr; } } } return $out; } break; case "glpi_contracts.duration": case "glpi_contracts.notice": case "glpi_contracts.periodicity": case "glpi_contracts.billing": if (!empty($data[$NAME . $num])) { $split = explode('$$$$', $data[$NAME . $num]); $output = ""; foreach ($split as $duration) { $output .= (empty($output) ? '' : '<br>') . $duration . " " . $LANG['financial'][57]; } return $output; } return " "; case "glpi_contracts.renewal": return Contract::getContractRenewalName($data[$NAME . $num]); case "glpi_infocoms.sink_time": if (!empty($data[$NAME . $num])) { $split = explode("\$\$\$\$", $data[$NAME . $num]); $out = ''; foreach ($split as $val) { $out .= empty($out) ? '' : '<br>'; if ($val > 0) { $out .= $val . " " . $LANG['financial'][9]; } } return $out; } return " "; case "glpi_infocoms.warranty_duration": if (!empty($data[$NAME . $num])) { $split = explode("\$\$\$\$", $data[$NAME . $num]); $out = ''; foreach ($split as $val) { $out .= empty($out) ? '' : '<br>'; if ($val > 0) { $out .= $val . " " . $LANG['financial'][57]; } if ($val < 0) { $out .= $LANG['financial'][2]; } } return $out; } return " "; case "glpi_infocoms.sink_type": $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(); return $tmp->getDescription($data['id']); case 'glpi_crontasks.state': return CronTask::getStateName($data[$NAME . $num]); case 'glpi_crontasks.mode': return CronTask::getModeName($data[$NAME . $num]); case 'glpi_crontasks.itemtype': if ($plug = isPluginItemType($data[$NAME . $num])) { return $plug['plugin']; } return ''; case 'glpi_tickets.status': $status = Ticket::getStatus($data[$NAME . $num]); // status Stevenes Donato if ($data[$NAME . $num] == "1") { $data[$NAME . $num] = "new"; } if ($data[$NAME . $num] == "2") { $data[$NAME . $num] = "assign"; } if ($data[$NAME . $num] == "3") { $data[$NAME . $num] = "plan"; } if ($data[$NAME . $num] == "4") { $data[$NAME . $num] = "waiting"; } if ($data[$NAME . $num] == "5") { $data[$NAME . $num] = "solved"; } if ($data[$NAME . $num] == "6") { $data[$NAME . $num] = "closed"; } // return "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . $data[$NAME . $num] . ".png\"\n alt='{$status}' title='{$status}'> {$status}"; case 'glpi_tickets.priority': return Ticket::getPriorityName($data[$NAME . $num]); case 'glpi_tickets.urgency': return Ticket::getUrgencyName($data[$NAME . $num]); case 'glpi_tickets.impact': return Ticket::getImpactName($data[$NAME . $num]); case 'glpi_tickets.items_id': if (!empty($data[$NAME . $num . "_2"]) && class_exists($data[$NAME . $num . "_2"])) { $item = new $data[$NAME . $num . "_2"](); if ($item->getFromDB($data[$NAME . $num])) { return $item->getLink(true); } } return ' '; case 'glpi_tickets.id': $link = getItemTypeFormURLMobile('Ticket'); $out = "<a id='ticket" . $data[$NAME . $num . "_2"] . "' href=\"" . $link; $out .= strstr($link, '?') ? '&' : '?'; $out .= 'id=' . $data[$NAME . $num]; //$out .= 'id='.$data[$NAME.$num."_2"]; $out .= "\" data-back='false'>" . $data[$NAME . $num]; if ($_SESSION["glpiis_ids_visible"] || empty($data[$NAME . $num])) { //$out .= " (".$data[$NAME.$num."_2"].")"; $out .= $data[$NAME . $num . "_2"]; } $out .= "</a>"; return $out; case 'glpi_ticketvalidations.status': case "glpi_tickets.global_validation": $split = explode("\$\$\$\$", $data[$NAME . $num]); $out = ''; foreach ($split as $val) { $status = TicketValidation::getStatus($val); $bgcolor = TicketValidation::getStatusColor($val); $out .= (empty($out) ? '' : '<br>') . "<div style=\"background-color:" . $bgcolor . ";\">" . $status . '</div>'; } return $out; case 'glpi_notimportedemails.reason': return NotImportedEmail::getReason($data[$NAME . $num]); case 'glpi_notimportedemails.messageid': $clean = array('<' => '', '>' => ''); return strtr($data[$NAME . $num], $clean); } //// Default case // Link with plugin tables : need to know left join structure if (preg_match("/^glpi_plugin_([a-z0-9]+)/", $table . '.' . $field, $matches)) { if (count($matches) == 2) { $plug = $matches[1]; $function = 'plugin_' . $plug . '_giveItem'; if (function_exists($function)) { $out = $function($itemtype, $ID, $data, $num); if (!empty($out)) { return $out; } } } } $unit = ''; if (isset($searchopt[$ID]['unit'])) { $unit = $searchopt[$ID]['unit']; } // Preformat items if (isset($searchopt[$ID]["datatype"])) { switch ($searchopt[$ID]["datatype"]) { case "itemlink": if (!empty($data[$NAME . $num . "_2"])) { if (isset($searchopt[$ID]["itemlink_type"])) { $link = getItemTypeFormURLMobile($searchopt[$ID]["itemlink_type"]); } else { $link = getItemTypeFormURLMobile($itemtype); } $out = "<a id='" . $itemtype . "_" . $data[$NAME . $num . "_2"] . "' href=\"" . $link; $out .= strstr($link, '?') ? '&' : '?'; $out .= 'id=' . $data[$NAME . $num . "_2"] . "\" data-back='false'>"; $out .= $data[$NAME . $num] . $unit; if ($_SESSION["glpiis_ids_visible"] || empty($data[$NAME . $num])) { $out .= " (" . $data[$NAME . $num . "_2"] . ")"; } $out .= "</a>"; return $out; } else { if (isset($searchopt[$ID]["itemlink_type"])) { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; $separate = '<br>'; if (isset($searchopt[$ID]['splititems']) && $searchopt[$ID]['splititems']) { $separate = '<hr>'; } for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { $split2 = explode("\$\$", $split[$k]); if (isset($split2[1]) && $split2[1] > 0) { if ($count_display) { $out .= $separate; } $count_display++; $page = getItemTypeFormURLMobile($searchopt[$ID]["itemlink_type"]); $page .= strpos($page, '?') ? '&id' : '?id'; $out .= "<a id='" . $searchopt[$ID]["itemlink_type"] . "_" . $split2[1] . "'\n href='{$page}=" . $split2[1] . "' data-back='false'>"; $out .= $split2[0] . $unit; if ($_SESSION["glpiis_ids_visible"] || empty($split2[0])) { $out .= " (" . $split2[1] . ")"; } $out .= "</a>"; } } } return $out; } } break; case "text": $separate = '<br>'; if (isset($searchopt[$ID]['splititems']) && $searchopt[$ID]['splititems']) { $separate = '<hr>'; } return str_replace('$$$$', $separate, nl2br($data[$NAME . $num])); case "date": $split = explode("\$\$\$\$", $data[$NAME . $num]); $out = ''; foreach ($split as $val) { $out .= (empty($out) ? '' : '<br>') . convDate($val); } return $out; case "datetime": $split = explode("\$\$\$\$", $data[$NAME . $num]); $out = ''; foreach ($split as $val) { $out .= (empty($out) ? '' : '<br>') . Html::convDateTime($val); } return $out; case "timestamp": return timestampToString($data[$NAME . $num]); case "realtime": return Ticket::getRealtime($data[$NAME . $num]); case "date_delay": $split = explode('$$$$', $data[$NAME . $num]); $out = ''; foreach ($split as $val) { if (strpos($val, ',')) { list($dat, $dur) = explode(',', $val); if (!empty($dat)) { $out .= (empty($out) ? '' : '<br>') . getWarrantyExpir($dat, $dur); } } } return empty($out) ? " " : $out; case "email": // Stevenes // $email=trim($data[$NAME.$num]); $email = explode('$$', $data[$NAME . $num]); if (!empty($email['0'])) { return $email['0']; //return "<a href='mailto:$email'>$email</a>"; } return " "; case "weblink": $orig_link = trim($data[$NAME . $num]); if (!empty($orig_link)) { // strip begin of link $link = preg_replace('/https?:\\/\\/(www[^\\.]*\\.)?/', '', $orig_link); $link = preg_replace('/\\/$/', '', $link); if (utf8_strlen($link) > 30) { $link = Toolbox::substr($link, 0, 30) . "..."; } //return "<a href=\"".formatOutputWebLink($orig_link)."\" target='_blank'>$link</a>"; return $orig_link; } return " "; case "number": if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= str_replace(' ', ' ', Html::formatNumber($split[$k], false, 0)) . $unit; } } return $out; } return str_replace(' ', ' ', Html::formatNumber($data[$NAME . $num], false, 0)) . $unit; case "decimal": if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { if ($count_display) { $out .= "<br>"; } $count_display++; $out .= str_replace(' ', ' ', Html::formatNumber($split[$k])) . $unit; } } return $out; } return str_replace(' ', ' ', Html::formatNumber($data[$NAME . $num])) . $unit; case "bool": return Dropdown::getYesNo($data[$NAME . $num]) . $unit; case "right": return Profile::getRightValue($data[$NAME . $num]); case "itemtypename": if (class_exists($data[$NAME . $num])) { $obj = new $data[$NAME . $num](); return $obj->getTypeName(); } else { return ""; } case "language": if (isset($CFG_GLPI['languages'][$data[$NAME . $num]])) { return $CFG_GLPI['languages'][$data[$NAME . $num]][0]; } else { return $LANG['setup'][46]; } break; } } // Manage items with need group by / group_concat if (isset($searchopt[$ID]['forcegroupby']) && $searchopt[$ID]['forcegroupby']) { $out = ""; $split = explode("\$\$\$\$", $data[$NAME . $num]); $count_display = 0; $separate = '<br>'; if (isset($searchopt[$ID]['splititems']) && $searchopt[$ID]['splititems']) { $separate = '<hr>'; } for ($k = 0; $k < count($split); $k++) { if (strlen(trim($split[$k])) > 0) { if ($count_display) { $out .= $separate; } $count_display++; $out .= $split[$k] . $unit; } } return $out; } return $data[$NAME . $num] . $unit; }
-------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- // Entry menu case //define('GLPI_ROOT', '../../..'); include "../../../inc/includes.php"; $itemtype = $_REQUEST['itemtype']; $menu_obj = new PluginMobileMenu(); $menu = $menu_obj->getMenu(); if (isset($_REQUEST['menu']) && isset($_REQUEST['ssmenu'])) { $welcome = $menu[$_REQUEST['menu']]['content'][$_REQUEST['ssmenu']]['title']; $_SESSION['plugin_mobile']['menu'] = $_REQUEST['menu']; $_SESSION['plugin_mobile']['ssmenu'] = $_REQUEST['ssmenu']; if (isset($_REQUEST['start'])) { $_SESSION['plugin_mobile']['start'] = $_REQUEST['start']; } else { $_SESSION['plugin_mobile']['start'] = 0; } } else { $welcome = " "; } $common = new PluginMobileCommon(); $common->displayHeader($welcome, "ss_menu.php?menu=" . $_REQUEST['menu'], true); PluginMobileSearch::manageGetValues($itemtype); //Search::manageParams($itemtype); $numrows = PluginMobileSearch::show(ucfirst($itemtype)); PluginMobileSearch::displayFooterNavBar("search.php?itemtype=" . $itemtype . "&menu=" . $_REQUEST['menu'] . "&ssmenu=" . $_REQUEST['ssmenu'], $numrows); $common->displayFooter();