本文整理汇总了PHP中Search::showFooter方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::showFooter方法的具体用法?PHP Search::showFooter怎么用?PHP Search::showFooter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::showFooter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMinimalList
//.........这里部分代码省略.........
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $this->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype);
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
$end_display = $p['start'] + $LIST_LIMIT;
// Export All case
if ($p['export_all']) {
$begin_display = 0;
$end_display = $numrows;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
$header_num = 1;
// Display column Headers for toview items
echo Search::showNewLine($output_type);
// Display column Headers for toview items
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt[$itemtype][$val]['nosort']) || !$searchopt[$itemtype][$val]['nosort']) {
$linkto = "{$target}?itemtype={$itemtype}&sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto;
}
echo Search::showHeaderItem($output_type, $searchopt[$itemtype][$val]["name"], $header_num, $linkto, $p['sort'] == $val, $p['order']);
}
// End Line for column headers
echo Search::showEndLine($output_type);
$DB->data_seek($result, $p['start']);
// Define begin and end var for loop
// Search case
$i = $begin_display;
// Init list of items displayed
if ($output_type == Search::HTML_OUTPUT) {
Session::initNavigateListItems($itemtype);
}
// Num of the row (1=header_line)
$row_num = 1;
// Display Loop
while ($i < $numrows && $i < $end_display) {
$item_num = 1;
$data = $DB->fetch_array($result);
$i++;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
Session::addToNavigateListItems($itemtype, $data['id']);
foreach ($toview as $key => $val) {
echo Search::showItem($output_type, Search::giveItem($itemtype, $val, $data, $key), $item_num, $row_num, Search::displayConfigItem($itemtype, $val, $data, $key));
}
echo Search::showEndLine($output_type);
}
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= __('List of non contract periods', 'resources');
}
// Display footer
echo Search::showFooter($output_type, $title);
// Pager
if ($output_type == Search::HTML_OUTPUT) {
echo "<br>";
Html::printPager($p['start'], $numrows, $target, $parameters);
}
} else {
echo Search::showError($output_type);
}
}
}
示例2: showItems
/**
* @param $target
* @param $date1
* @param $date2
* @param $start
**/
static function showItems($target, $date1, $date2, $start)
{
global $DB, $CFG_GLPI;
$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 `glpi_items_tickets`.`itemtype`,\n `glpi_items_tickets`.`items_id`,\n COUNT(*) AS NB\n FROM `glpi_tickets`\n LEFT JOIN `glpi_items_tickets`\n ON (`glpi_tickets`.`id` = `glpi_items_tickets`.`tickets_id`)\n WHERE `date` <= '{$date2}'\n AND `glpi_tickets`.`date` >= '{$date1}' " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n AND `glpi_items_tickets`.`itemtype` <> ''\n AND `glpi_items_tickets`.`items_id` > 0\n GROUP BY `glpi_items_tickets`.`itemtype`, `glpi_items_tickets`.`items_id`\n ORDER BY NB DESC";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
if ($numrows > 0) {
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($start, $numrows, $target, "date1=" . $date1 . "&date2=" . $date2 . "&type=hardwares&start={$start}", 'Stat');
echo "<div class='center'>";
}
$end_display = $start + $_SESSION['glpilist_limit'];
if (isset($_GET['export_all'])) {
$end_display = $numrows;
}
echo Search::showHeader($output_type, $end_display - $start + 1, 2, 1);
$header_num = 1;
echo Search::showNewLine($output_type);
echo Search::showHeaderItem($output_type, _n('Associated element', 'Associated elements', 2), $header_num);
if ($view_entities) {
echo Search::showHeaderItem($output_type, __('Entity'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Number of tickets'), $header_num);
echo Search::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 (!($item = getItemForItemtype($data["itemtype"]))) {
continue;
}
if ($item->getFromDB($data["items_id"])) {
echo Search::showNewLine($output_type, $i % 2);
echo Search::showItem($output_type, sprintf(__('%1$s - %2$s'), $item->getTypeName(), $item->getLink()), $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
if ($view_entities) {
$ent = $item->getEntityID();
$ent = $entities[$ent]['completename'];
echo Search::showItem($output_type, $ent, $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
}
echo Search::showItem($output_type, $data["NB"], $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
}
}
echo Search::showFooter($output_type);
if ($output_type == Search::HTML_OUTPUT) {
echo "</div>";
}
}
}
示例3: showMinimalList
//.........这里部分代码省略.........
$begin_display = 0;
$end_display = $numrows;
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
Html::openMassiveActionsForm('massform' . $itemtype);
$massiveactionparams = array('num_displayed' => $end_display - $begin_display, 'fixed' => true, 'is_deleted' => $p['is_deleted']);
Html::showMassiveActions($itemtype, $massiveactionparams);
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols, 1);
$header_num = 1;
// Display column Headers for toview items
$headers_line = '';
$headers_line_top = '';
$headers_line_bottom = '';
echo Search::showNewLine($output_type);
if ($output_type == Search::HTML_OUTPUT && $item->canCreate() && $canedit) {
// HTML display - massive modif
$headers_line_top .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
$headers_line_bottom .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
}
// Display column Headers for toview items
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt[$itemtype][$val]['nosort']) || !$searchopt[$itemtype][$val]['nosort']) {
$linkto = "javascript:reloadTab('sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto . "')";
}
$headers_line .= Search::showHeaderItem($output_type, $searchopt[$itemtype][$val]["name"], $header_num, $linkto, $p['sort'] == $val, $p['order']);
}
// End Line for column headers
$headers_line .= Search::showEndLine($output_type);
$headers_line_top .= $headers_line;
$headers_line_bottom .= $headers_line;
echo $headers_line_top;
$DB->data_seek($result, $p['start']);
// Define begin and end var for loop
// Search case
$i = $begin_display;
// Init list of items displayed
if ($output_type == Search::HTML_OUTPUT) {
Session::initNavigateListItems($itemtype, PluginResourcesResource::getTypeName(2) . " = " . (empty($PluginResourcesResource->fields['name']) ? "(" . $p['id'] . ")" : $PluginResourcesResource->fields['name']));
}
// Num of the row (1=header_line)
$row_num = 1;
// Display Loop
while ($i < $numrows && $i < $end_display) {
$item_num = 1;
$data = $DB->fetch_array($result);
$i++;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
Session::addToNavigateListItems($itemtype, $data['id']);
$tmpcheck = "";
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$sel = "";
$tmpcheck = "<input type='checkbox' name='item[" . $data["id"] . "]' value='1' {$sel}>";
}
echo Search::showItem($output_type, $tmpcheck, $item_num, $row_num, "width='10'");
foreach ($toview as $key => $val) {
echo Search::showItem($output_type, Search::giveItem($itemtype, $val, $data, $key), $item_num, $row_num, Search::displayConfigItem($itemtype, $val, $data, $key));
}
echo Search::showEndLine($output_type);
}
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= __('Tasks list', 'resources');
}
// Display footer
echo Search::showFooter($output_type, $title);
//massive action
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($itemtype, $massiveactionparams);
Html::closeForm();
} else {
echo "</table></div>";
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
echo "<br>";
Html::printAjaxPager(self::getTypeName(2), $p['start'], $numrows);
}
} else {
echo Search::showError($output_type);
}
}
}
示例4: showTitle
$name .= $data["name"];
}
$name .= "</a>";
echo Search::showItem($output_type, $name, $num, $key);
echo Search::showItem($output_type, $data['firstname'], $num, $key);
echo Search::showItem($output_type, $data['registration_number'], $num, $key);
$link1 = Toolbox::getItemTypeFormURL("PluginResourcesProfession");
$profName = "<a href='" . $link1 . "?id=" . $data["profID"] . "' target='_blank'>" . $data["profession"] . "</a>";
echo Search::showItem($output_type, $profName, $num, $key);
echo Search::showItem($output_type, Html::convDate($data['date_begin']), $num, $key);
echo Search::showItem($output_type, Html::convDate($data['date_end']), $num, $key);
echo Search::showItem($output_type, Html::convDate($data['begin_date']), $num, $key);
echo Search::showItem($output_type, Html::convDate($data['end_date']), $num, $key);
echo Search::showEndLine($output_type);
}
echo Search::showFooter($output_type, $title);
}
if ($output_type == Search::HTML_OUTPUT) {
Html::footer();
}
/**
* Display the column title and allow the sort
*
* @param $output_type
* @param $num
* @param $title
* @param $columnname
* @param bool $sort
* @return mixed
*/
function showTitle($output_type, &$num, $title, $columnname, $sort = false)
示例5: showMinimalList
//.........这里部分代码省略.........
$end_display = $numrows;
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
Html::openMassiveActionsForm('massform' . $itemtype);
$massiveactionparams = array('num_displayed' => $end_display - $begin_display, 'fixed' => false, 'is_deleted' => $p['is_deleted']);
Html::showMassiveActions("PluginResourcesDirectory", $massiveactionparams);
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
$header_num = 1;
// Display column Headers for toview items
$headers_line = '';
$headers_line_top = '';
$headers_line_bottom = '';
echo Search::showNewLine($output_type);
if ($output_type == Search::HTML_OUTPUT && $item->canCreate() && $canedit) {
// HTML display - massive modif
$headers_line_top .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
$headers_line_bottom .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
}
// Display column Headers for toview items
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt["PluginResourcesDirectory"][$val]['nosort']) || !$searchopt["PluginResourcesDirectory"][$val]['nosort']) {
$linkto = "javascript:reloadTab('sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto . "')";
}
$headers_line .= Search::showHeaderItem($output_type, $searchopt["PluginResourcesDirectory"][$val]["name"], $header_num, $linkto, $p['sort'] == $val, $p['order']);
}
// End Line for column headers
$headers_line .= Search::showEndLine($output_type);
$headers_line_top .= $headers_line;
$headers_line_bottom .= $headers_line;
echo $headers_line_top;
$DB->data_seek($result, $p['start']);
// Define begin and end var for loop
// Search case
$i = $begin_display;
// Init list of items displayed
if ($output_type == Search::HTML_OUTPUT) {
Session::initNavigateListItems($itemtype);
}
// Num of the row (1=header_line)
$row_num = 1;
// Display Loop
while ($i < $numrows && $i < $end_display) {
$item_num = 1;
$data = $DB->fetch_array($result);
$i++;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
Session::addToNavigateListItems($itemtype, $data['id']);
$tmpcheck = "";
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$sel = "";
$tmpcheck = "<input type='checkbox' name='item[" . $data["id"] . "]' value='1' {$sel}>";
echo Search::showItem($output_type, $tmpcheck, $item_num, $row_num, "width='10'");
}
foreach ($toview as $key => $val) {
echo Search::showItem($output_type, Search::giveItem("PluginResourcesDirectory", $val, $data, $key), $item_num, $row_num, Search::displayConfigItem("PluginResourcesDirectory", $val, $data, $key));
}
echo Search::showEndLine($output_type);
}
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= self::getTypeName(1);
}
// Display footer
echo Search::showFooter($output_type, $title);
//massive action
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$massiveactionparams['ontop'] = false;
$massiveactionparams['fixed'] = false;
Html::showMassiveActions("PluginResourcesDirectory", $massiveactionparams);
Html::closeForm();
} else {
echo "</table></div>";
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
echo "<br>";
Html::printPager($p['start'], $numrows, $target, $parameters, "PluginResourcesDirectory", 0, $search_config);
}
} else {
echo Search::showError($output_type);
}
}
}
示例6: showList
//.........这里部分代码省略.........
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq=" . $params['faq'];
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$parameters .= "&item_items_id=" . $options['item_items_id'] . "&item_itemtype=" . $options['item_itemtype'];
}
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Subject'), $header_num);
if ($output_type != Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, __('Content'), $header_num);
}
if ($showwriter) {
echo Search::showHeaderItem($output_type, __('Writer'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Category'), $header_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_assoc($result_limit);
Session::addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
$item = new self();
$item->getFromDB($data["id"]);
$name = $data["name"];
$answer = $data["answer"];
// Manage translations
if (isset($data['transname']) && !empty($data['transname'])) {
$name = $data["transname"];
}
if (isset($data['transanswer']) && !empty($data['transanswer'])) {
$answer = $data["transanswer"];
}
if ($output_type == Search::HTML_OUTPUT) {
$toadd = '';
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$href = " href='#' onClick=\"" . Html::jsGetElementbyID('kbshow' . $data["id"]) . ".dialog('open');\"";
$toadd = Ajax::createIframeModalWindow('kbshow' . $data["id"], $CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $data["id"], array('display' => false));
} else {
$href = " href=\"" . $CFG_GLPI['root_doc'] . "/front/knowbaseitem.form.php?id=" . $data["id"] . "\" ";
}
echo Search::showItem($output_type, "<div class='kb'>{$toadd}<a " . ($data['is_faq'] ? " class='pubfaq' title='" . __("This item is part of the FAQ") . "' " : " class='knowbase' ") . " {$href}>" . Html::resume_text($name, 80) . "</a></div>\n <div class='kb_resume'>" . Html::resume_text(Html::clean(Toolbox::unclean_cross_side_scripting_deep($answer)), 600) . "</div>", $item_num, $row_num);
} else {
echo Search::showItem($output_type, $name, $item_num, $row_num);
echo Search::showItem($output_type, Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($answer, ENT_QUOTES, "UTF-8"))), $item_num, $row_num);
}
$showuserlink = 0;
if (Session::haveRight('user', READ)) {
$showuserlink = 1;
}
if ($showwriter) {
echo Search::showItem($output_type, getUserName($data["users_id"], $showuserlink), $item_num, $row_num);
}
$categ = $data["category"];
if ($output_type == Search::HTML_OUTPUT) {
$cathref = $ki->getSearchURL() . "?knowbaseitemcategories_id=" . $data["knowbaseitemcategories_id"] . '&forcetab=Knowbase$2';
$categ = "<a href='{$cathref}'>" . $categ . '</a>';
}
echo Search::showItem($output_type, $categ, $item_num, $row_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
$forcetab = $options['item_itemtype'];
if (!$_SESSION['glpiticket_timeline'] || $_SESSION['glpiticket_timeline_keep_replaced_tabs']) {
$forcetab .= '$2';
//Solution tab
} else {
$forcetab .= '$1';
//Timeline tab
}
$content = "<a href='" . Toolbox::getItemTypeFormURL($options['item_itemtype']) . "?load_kb_sol=" . $data['id'] . "&id=" . $options['item_items_id'] . "&forcetab=" . $forcetab . "'>" . __('Use as a solution') . "</a>";
echo Search::showItem($output_type, $content, $item_num, $row_num);
}
// End Line
echo Search::showEndLine($output_type);
}
// Display footer
if ($output_type == Search::PDF_OUTPUT_LANDSCAPE || $output_type == Search::PDF_OUTPUT_PORTRAIT) {
echo Search::showFooter($output_type, Dropdown::getDropdownName("glpi_knowbaseitemcategories", $params['knowbaseitemcategories_id']));
} else {
echo Search::showFooter($output_type);
}
echo "<br>";
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
} else {
echo "<div class='center b'>" . __('No item found') . "</div>";
}
}
}
示例7: showList
//.........这里部分代码省略.........
if ($result = $DB->query($query)) {
$KbCategory = new KnowbaseItemCategory();
$title = "";
if ($KbCategory->getFromDB($params["knowbaseitemcategories_id"])) {
$title = empty($KbCategory->fields['name']) ? "(" . $params['knowbaseitemcategories_id'] . ")" : $KbCategory->fields['name'];
$title = sprintf(__('%1$s: %2$s'), __('Category'), $title);
}
Session::initNavigateListItems('KnowbaseItem', $title);
$numrows = $DB->numrows($result);
$list_limit = $_SESSION['glpilist_limit'];
$showwriter = in_array($type, array('myunpublished', 'allunpublished', 'allmy'));
// Limit the result, if no limit applies, use prior result
if ($numrows > $list_limit && !isset($_GET['export_all'])) {
$query_limit = $query . " LIMIT " . intval($params["start"]) . ", " . intval($list_limit) . " ";
$result_limit = $DB->query($query_limit);
$numrows_limit = $DB->numrows($result_limit);
} else {
$numrows_limit = $numrows;
$result_limit = $result;
}
if ($numrows_limit > 0) {
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq=" . $params['faq'];
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$parameters .= "&item_items_id=" . $options['item_items_id'] . "&item_itemtype=" . $options['item_itemtype'];
}
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Subject'), $header_num);
if ($output_type != Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, __('Content'), $header_num);
}
if ($showwriter) {
echo Search::showHeaderItem($output_type, __('Writer'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Category'), $header_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_assoc($result_limit);
Session::addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
if ($output_type == Search::HTML_OUTPUT) {
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$href = " href='#' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=show_kb&id=" . $data['id'] . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' );" . "w.focus();\"";
} else {
$href = " href=\"" . $CFG_GLPI['root_doc'] . "/front/knowbaseitem.form.php?id=" . $data["id"] . "\" ";
}
echo Search::showItem($output_type, "<div class='kb'><a " . ($data['is_faq'] ? " class='pubfaq' " : " class='knowbase' ") . " {$href}>" . Html::resume_text($data["name"], 80) . "</a></div>\n <div class='kb_resume'>" . Html::resume_text(Html::clean(Toolbox::unclean_cross_side_scripting_deep($data["answer"])), 600) . "</div>", $item_num, $row_num);
} else {
echo Search::showItem($output_type, $data["name"], $item_num, $row_num);
echo Search::showItem($output_type, Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($data["answer"], ENT_QUOTES, "UTF-8"))), $item_num, $row_num);
}
if ($showwriter) {
echo Search::showItem($output_type, getUserName($data["users_id"], 1), $item_num, $row_num);
}
$categ = $data["category"];
if ($output_type == Search::HTML_OUTPUT) {
$cathref = $ki->getSearchURL() . "?knowbaseitemcategories_id=" . $data["knowbaseitemcategories_id"] . '&forcetab=Knowbase$2';
$categ = "<a href='{$cathref}'>" . $categ . '</a>';
}
echo Search::showItem($output_type, $categ, $item_num, $row_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
$content = "<a href='" . Toolbox::getItemTypeFormURL($options['item_itemtype']) . "?load_kb_sol=" . $data['id'] . "&id=" . $options['item_items_id'] . "&forcetab=" . $options['item_itemtype'] . "\$2'>" . __('Use as a solution') . "</a>";
echo Search::showItem($output_type, $content, $item_num, $row_num);
}
// End Line
echo Search::showEndLine($output_type);
}
// Display footer
if ($output_type == Search::PDF_OUTPUT_LANDSCAPE || $output_type == Search::PDF_OUTPUT_PORTRAIT) {
echo Search::showFooter($output_type, Dropdown::getDropdownName("glpi_knowbaseitemcategories", $params['knowbaseitemcategories_id']));
} else {
echo Search::showFooter($output_type);
}
echo "<br>";
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
} else {
echo "<div class='center b'>" . __('No item found') . "</div>";
}
}
}
示例8: showAccountsList
public static function showAccountsList($values, $list)
{
global $CFG_GLPI;
$ID = $values["id"];
$aeskey = $values["aeskey"];
$PluginAccountsHash = new PluginAccountsHash();
$PluginAccountsHash->getFromDB($ID);
$hash = $PluginAccountsHash->fields["hash"];
$default_values["start"] = $start = 0;
$default_values["id"] = $id = 0;
$default_values["export"] = $export = false;
foreach ($default_values as $key => $val) {
if (isset($values[$key])) {
${$key} = $values[$key];
}
}
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($values["display_type"])) {
$output_type = $values["display_type"];
}
$header_num = 1;
$nbcols = 4;
$row_num = 1;
$numrows = 1;
$parameters = "id=" . $ID . "&aeskey=" . $aeskey;
if ($output_type == Search::HTML_OUTPUT && !empty($list)) {
self::printPager($start, $numrows, $_SERVER['PHP_SELF'], $parameters, "PluginAccountsReport");
}
echo Search::showHeader($output_type, 1, $nbcols, 1);
echo Search::showNewLine($output_type);
echo Search::showHeaderItem($output_type, __('Name'), $header_num);
if (Session::isMultiEntitiesMode()) {
echo Search::showHeaderItem($output_type, __('Entity'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Type'), $header_num);
echo Search::showHeaderItem($output_type, __('Login'), $header_num);
echo Search::showHeaderItem($output_type, __('Uncrypted password', 'accounts'), $header_num);
echo Search::showEndLine($output_type);
if (!empty($list)) {
foreach ($list as $user => $field) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type);
$IDc = $field["id"];
if ($output_type == Search::HTML_OUTPUT) {
echo "<input type='hidden' name='hash_id' value='" . $ID . "'>";
echo "<input type='hidden' name='id[{$IDc}]' value='" . $IDc . "'>";
}
$name = "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/accounts/front/account.form.php?id=" . $IDc . "'>" . $field["name"];
if ($_SESSION["glpiis_ids_visible"]) {
$name .= " (" . $IDc . ")";
}
$name .= "</a>";
echo Search::showItem($output_type, $name, $item_num, $row_num);
if ($output_type == Search::HTML_OUTPUT) {
echo "<input type='hidden' name='name[{$IDc}]' value='" . $field["name"] . "'>";
}
if (Session::isMultiEntitiesMode()) {
echo Search::showItem($output_type, $field['entities_id'], $item_num, $row_num);
if ($output_type == Search::HTML_OUTPUT) {
echo "<input type='hidden' name='entities_id[{$IDc}]' value='" . $field["entities_id"] . "'>";
}
}
echo Search::showItem($output_type, $field["type"], $item_num, $row_num);
if ($output_type == Search::HTML_OUTPUT) {
echo "<input type='hidden' name='type[{$IDc}]' value='" . $field["type"] . "'>";
}
echo Search::showItem($output_type, $field["login"], $item_num, $row_num);
if ($output_type == Search::HTML_OUTPUT) {
echo "<input type='hidden' name='login[{$IDc}]' value='" . $field["login"] . "'>";
}
if ($output_type == Search::HTML_OUTPUT) {
$encrypted = $field["password"];
echo "<input type='hidden' name='password[{$IDc}]'>";
$pass = "<p name='show_password' id='show_password\${$IDc}'></p>";
$pass .= "<script language='javascript'>\n var good_hash=\"{$hash}\";\n var hash=SHA256(SHA256(\"{$aeskey}\"));\n if (hash != good_hash) {\n pass = \"" . __('Wrong encryption key', 'accounts') . "\";\n } else {\n pass = AESDecryptCtr(\"{$encrypted}\",SHA256(\"{$aeskey}\"), 256);\n };\n\n document.getElementsByName(\"password[{$IDc}]\").item(0).value = pass;\n\n document.getElementById(\"show_password\${$IDc}\").innerHTML = pass;\n </script>";
echo Search::showItem($output_type, $pass, $item_num, $row_num);
} else {
echo Search::showItem($output_type, $field["password"], $item_num, $row_num);
}
echo Search::showEndLine($output_type);
}
}
if ($output_type == Search::HTML_OUTPUT) {
Html::closeForm();
}
// Display footer
echo Search::showFooter($output_type, __('Linked accounts list', 'accounts'));
}
示例9: displayReport
//.........这里部分代码省略.........
foreach ($lines as $line) {
$row_num++;
$item_num = 1;
$name = $line["dname"];
$namep = $line["pname"];
// IP
echo $this->displaySearchNewLine($output_type, count($lines) > 1 ? "double" : $row_num % 2);
echo Search::showItem($output_type, $ip, $item_num, $row_num);
// Device
$item = new $line["itemtype"]();
$link = Toolbox::getItemTypeFormURL($line["itemtype"]);
if ($line["itemtype"] != 'NetworkEquipment') {
if ($item->canView()) {
$output_iddev = "<a href='" . $link . "?id=" . $line["on_device"] . "'>" . $name . (empty($name) || $_SESSION["glpiis_ids_visible"] ? " (" . $line["on_device"] . ")" : "") . "</a>";
} else {
$output_iddev = $name . (empty($name) || $_SESSION["glpiis_ids_visible"] ? " (" . $line["on_device"] . ")" : "");
}
} else {
if ($item->canView()) {
if (empty($namep)) {
$linkp = '';
} else {
$linkp = $namep . " - ";
}
$output_iddev = "<a href='" . $link . "?id=" . $line["on_device"] . "'>" . $linkp . $name . (empty($name) || $_SESSION["glpiis_ids_visible"] ? " (" . $line["on_device"] . ")" : "") . "</a>";
} else {
$output_iddev = $namep . " - " . $name . (empty($name) || $_SESSION["glpiis_ids_visible"] ? " (" . $line["on_device"] . ")" : "");
}
}
echo Search::showItem($output_type, $output_iddev, $item_num, $row_num);
// User
if ($line["users_id"] && $user->getFromDB($line["users_id"])) {
$username = formatUserName($user->fields["id"], $user->fields["name"], $user->fields["realname"], $user->fields["firstname"]);
if ($user->canView()) {
$output_iduser = "<a href='" . $CFG_GLPI["root_doc"] . "/front/user.form.php?id=" . $line["users_id"] . "'>" . $username . "</a>";
} else {
$output_iduser = $username;
}
echo Search::showItem($output_type, $output_iduser, $item_num, $row_num);
} else {
echo Search::showItem($output_type, " ", $item_num, $row_num);
}
// Mac
if ($line["id"]) {
if ($item->canView()) {
$output_mac = "<a href='" . $CFG_GLPI["root_doc"] . "/front/networkport.form.php?id=" . $line["id"] . "'>" . $line["mac"] . "</a>";
} else {
$output_mac = $line["mac"];
}
echo Search::showItem($output_type, $output_mac, $item_num, $row_num);
} else {
echo Search::showItem($output_type, " ", $item_num, $row_num);
}
// Type
echo Search::showItem($output_type, $item::getTypeName(), $item_num, $row_num);
// Reserved
if ($PluginAddressingAddressing->fields["reserved_ip"] && strstr($line["pname"], "reserv")) {
echo Search::showItem($output_type, __('Reserved Address', 'addressing'), $item_num, $row_num);
} else {
echo Search::showItem($output_type, " ", $item_num, $row_num);
}
// End
echo Search::showEndLine($output_type);
}
}
} else {
if ($PluginAddressingAddressing->fields["free_ip"]) {
$row_num++;
$item_num = 1;
if (!$ping) {
echo $this->displaySearchNewLine($output_type, "free");
echo Search::showItem($output_type, $ip, $item_num, $row_num);
echo Search::showItem($output_type, " ", $item_num, $row_num);
} else {
if ($output_type == Search::HTML_OUTPUT) {
Html::glpi_flush();
}
if ($this->ping($system, $ip)) {
$ping_response++;
echo $this->displaySearchNewLine($output_type, "ping_off");
echo Search::showItem($output_type, $ip, $item_num, $row_num);
echo Search::showItem($output_type, __('Ping: got a response - used Ip', 'addressing'), $item_num, $row_num);
} else {
echo $this->displaySearchNewLine($output_type, "ping_on");
echo Search::showItem($output_type, $ip, $item_num, $row_num);
echo Search::showItem($output_type, __('Ping: no response - free Ip', 'addressing'), $item_num, $row_num);
}
}
echo Search::showItem($output_type, " ", $item_num, $row_num);
echo Search::showItem($output_type, " ", $item_num, $row_num);
echo Search::showItem($output_type, " ", $item_num, $row_num);
echo Search::showItem($output_type, " ", $item_num, $row_num);
echo Search::showEndLine($output_type);
}
}
}
// Display footer
echo Search::showFooter($output_type, $PluginAddressingAddressing->getTitle());
return $ping_response;
}
示例10: round
$buy = $result[$itemtype]['buy'];
if ($ref == 'buy' || $buy == 0 || $val == 0) {
$tmp = '';
} else {
$tmp = round($val * 100 / $buy, 0) . "%";
}
echo Search::showItem($display_type, $tmp, $numcol, $row_num, "class='right'");
}
echo Search::showEndLine($display_type);
$row_num++;
}
if ($display_type == Search::HTML_OUTPUT) {
$row = array_pop($result);
// Last line : total or single type
unset($row['buy']);
Stat::showGraph(array($title => $row), array('type' => 'pie'));
}
} else {
$nbrows = 1;
$nbcols = 1;
echo Search::showHeader($display_type, $nbrows, $nbcols, true);
echo Search::showNewLine($display_type);
$num = 1;
echo Search::showHeaderItem($display_type, __('No item found'), $num);
echo Search::showEndLine($display_type);
}
echo Search::showFooter($display_type, $title);
}
if ($display_type == Search::HTML_OUTPUT) {
Html::footer();
}
示例11: afficheTableau
//.........这里部分代码省略.........
$status = "true";
}
echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/financialreports/front/financialreport.php?" . $display . "=" . $status . "&date=" . $date . "&locations_id=" . $locations_id . "'>";
if ($_SESSION[$display]) {
echo __('Hide', 'financialreports');
} else {
echo __('Display', 'financialreports');
}
echo "</a>";
if ($itemtable != 'disposal') {
echo "</th><th colspan='4'><th>";
} else {
echo "</th><th colspan='3'><th>";
}
} else {
echo Search::showHeaderItem($output_type, $titre, $header_num);
//th
echo Search::showHeaderItem($output_type, __('Total'), $header_num);
if ($total != -1) {
echo Search::showHeaderItem($output_type, Html::formatNumber($total) . " " . _n('Euro', 'Euros', 2, 'financialreports'), $header_num);
}
}
echo Search::showEndLine($output_type);
//tr
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Name'), $header_num);
echo Search::showHeaderItem($output_type, __('Inventory number'), $header_num);
echo Search::showHeaderItem($output_type, __('Date of purchase'), $header_num);
if ($itemtable != 'disposal') {
echo Search::showHeaderItem($output_type, __('User / Group', 'financialreports'), $header_num);
echo Search::showHeaderItem($output_type, __('Location'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Model'), $header_num);
echo Search::showHeaderItem($output_type, __('Supplier'), $header_num);
if ($itemtable == 'disposal') {
echo Search::showHeaderItem($output_type, __('Disposal date', 'financialreports'), $header_num);
echo Search::showHeaderItem($output_type, __('Comments'), $header_num);
} else {
echo Search::showHeaderItem($output_type, __('Purchase Price HT in', 'financialreports') . " " . _n('Euro', 'Euros', 2, 'financialreports'), $header_num);
}
// End Line for column headers
echo Search::showEndLine($output_type);
$row_num = 1;
if ($_SESSION[$display]) {
foreach ($items as $data) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
//name
$link = Toolbox::getItemTypeFormURL($data["TYPE"]);
$output_iddev = "<a href='" . $link . "?id=" . $data["id"] . "'>" . $data["ITEM_0"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["id"] . ")" : "") . "</a>";
echo Search::showItem($output_type, $output_iddev, $item_num, $row_num);
//otherserial
echo Search::showItem($output_type, $data["ITEM_2"], $item_num, $row_num);
//buy_date
echo Search::showItem($output_type, Html::convdate($data["ITEM_3"]), $item_num, $row_num);
if ($itemtable != 'disposal') {
//user
$username_computer = formatUserName($data["ITEM_4_3"], $data["ITEM_4"], $data["ITEM_4_2"], $data["ITEM_4_4"]);
$output_iduser = "<a href='" . $CFG_GLPI["root_doc"] . "/front/user.form.php?id=" . $data["ITEM_4_3"] . "'>" . $username_computer . "</a>";
if ($data["ITEM_4_3"] && $data["ITEM_5"]) {
$output_iduser .= " / <a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["ITEM_5_1"] . "'>" . $data["ITEM_5"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["ITEM_5_1"] . ")" : "") . "</a>";
} else {
if (!isset($data["ITEM_4_3"]) && $data["ITEM_5"]) {
$output_iduser = "<a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["ITEM_5_1"] . "'>" . $data["ITEM_5"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["ITEM_5_1"] . ")" : "") . "</a>";
} else {
if (!isset($data["ITEM_4_3"]) && !isset($data["ITEM_5"])) {
$output_iduser = __('In stock / available', 'financialreports');
}
}
}
echo Search::showItem($output_type, $output_iduser, $item_num, $row_num);
//location
echo Search::showItem($output_type, $data["ITEM_9"], $item_num, $row_num);
}
//model
echo Search::showItem($output_type, $data["ITEM_6"], $item_num, $row_num);
//manufacturer
echo Search::showItem($output_type, $data["ITEM_7"], $item_num, $row_num);
if ($itemtable == 'disposal') {
//comments
echo Search::showItem($output_type, Html::convdate($data["ITEM_10"]), $item_num, $row_num);
echo Search::showItem($output_type, nl2br($data["ITEM_9"]), $item_num, $row_num);
} else {
//value
if ($output_type == Search::HTML_OUTPUT) {
$ouput_value = "<font color='red'>" . Html::formatNumber($data["ITEM_8"]) . "</font>";
} else {
$ouput_value = Html::formatNumber($data["ITEM_8"]);
}
echo Search::showItem($output_type, $ouput_value, $item_num, $row_num);
}
echo Search::showEndLine($output_type);
}
}
echo Search::showFooter($output_type);
}
return $master_total;
}
示例12: seePreImport
//.........这里部分代码省略.........
}
//////////////////////HEADER///////////////
if ($output_type == Search::HTML_OUTPUT) {
echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action=\"../ajax/massiveaction.php\">";
}
//echo Search::displaySearchHeader($output_type,0); //table + div
if ($canedit) {
$nbcols = 11 + $colsup;
} else {
$nbcols = 10 + $colsup;
}
$LIST_LIMIT = $_SESSION['glpilist_limit'];
$begin_display = $p['start'];
$end_display = $p['start'] + $LIST_LIMIT;
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) || !$searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) {
$linkto = "{$target}?itemtype=" . $p['itemtype'] . "&manufacturers_id=" . $p['manufacturers_id'] . "&imported=" . $p['imported'] . "&sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto;
}
}
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, "", $header_num);
echo Search::showHeaderItem($output_type, __('Name'), $header_num, $linkto, $p['sort'] == $val, $p['order']);
if (Session::isMultiEntitiesMode()) {
echo Search::showHeaderItem($output_type, __('Entity'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Serial number'), $header_num);
echo $supplier->showItemTitle($output_type, $header_num);
echo Search::showHeaderItem($output_type, __('Financial and administrative information'), $header_num);
echo Search::showHeaderItem($output_type, __('Supplier attached', 'manufacturersimports'), $header_num);
echo Search::showHeaderItem($output_type, __('New warranty attached', 'manufacturersimports'), $header_num);
echo Search::showHeaderItem($output_type, _n('Link', 'Links', 1), $header_num);
echo Search::showHeaderItem($output_type, _n('Status', 'Statuses', 1), $header_num);
echo $supplier->showDocTitle($output_type, $header_num);
// End Line for column headers
echo Search::showEndLine($output_type);
$i = $p['start'];
if (isset($_GET['export_all'])) {
$i = 0;
}
if ($i > 0) {
$DB->data_seek($result, $i);
}
$row_num = 1;
while ($i < $numrows && $i < $end_display) {
$i++;
$item_num = 1;
$line = $DB->fetch_array($result);
$compSerial = $line['serial'];
$compId = $line['id'];
$model = $line["model_name"];
if (!$line["itemtype"]) {
$line["itemtype"] = $p['itemtype'];
}
self::showImport($row_num, $item_num, $line, $output_type, $p['manufacturers_id'], $line["import_status"], $p['imported']);
//1.show already imported items && import_status not failed
if ($p['imported'] == 1) {
$total += 1;
}
}
echo "<tr class='tab_bg_1'><td colspan='" . ($canedit ? 11 + $colsup : 10 + $colsup) . "'>";
echo sprintf(__('Total number of devices to import %s', 'manufacturersimports'), $total);
echo "</td></tr>";
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= PluginManufacturersimportsPreImport::getTypeName(2) . " " . $suppliername;
}
echo Search::showFooter($output_type, $title);
//massive action
if ($canedit && $output_type == Search::HTML_OUTPUT) {
if ($_SESSION['glpilist_limit'] < Toolbox::get_max_input_vars()) {
Html::openArrowMassives("massiveaction_form", false);
self::dropdownMassiveAction($compId, $p['itemtype'], $p['manufacturers_id'], $p['start'], $p['imported']);
Html::closeArrowMassives(array());
} else {
echo "<table class='tab_cadre' width='80%'><tr class='tab_bg_1'>" . "<td><span class='b'>";
echo __('Selection too large, massive action disabled.') . "</span>";
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
echo "<br>" . __('To increase the limit: change max_input_vars or suhosin.post.max_vars in php configuration.');
}
echo "</td></tr></table>";
}
Html::closeForm();
} else {
echo "</table>";
echo "</div>";
}
echo "<br>";
if ($output_type == Search::HTML_OUTPUT) {
self::printPager($p['start'], $numrows, $target, $parameters, $p['itemtype']);
}
} else {
echo "<div align='center'><b>" . __('No device finded', 'manufacturersimports') . "</b></div>";
}
}
}
示例13: execute
//.........这里部分代码省略.........
$param .= "{$key}=" . urlencode($val);
}
}
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td></tr>";
echo "</table></div>";
Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
}
}
}
if (!isset($_POST["display_type"]) || $_POST["display_type"] == Search::HTML_OUTPUT) {
if (isset($options['withmassiveaction']) && class_exists($options['withmassiveaction'])) {
echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action=\"" . $CFG_GLPI["root_doc"] . "/front/massiveaction.php\">";
}
}
plugin_reports_checkRight($this->plug, $this->name, "r");
if ($res && $nbtot > 0) {
$nbcols = $DB->num_fields($res);
$nbrows = $DB->numrows($res);
echo Search::showHeader($output_type, $nbrows, $nbcols, true);
echo Search::showNewLine($output_type);
$num = 1;
// fill $sqlcols with default sql query fields so we can validate $columns
$sqlcols = array();
for ($i = 0; $i < $nbcols; $i++) {
$colname = $DB->field_name($res, $i);
$sqlcols[] = $colname;
}
$colsname = array();
// if $columns is not empty, display $columns
if (count($this->columns) > 0) {
foreach ($this->columns as $colname => $column) {
// display only $columns that are valid
if (in_array($colname, $sqlcols)) {
$column->showTitle($output_type, $num);
$colsname[$colname] = $column;
}
}
} else {
// else display default columns from SQL query
foreach ($sqlcols as $colname) {
$column = new PluginReportsColumn($colname, $colname);
$column->showTitle($output_type, $num);
$colsname[$colname] = $column;
}
}
echo Search::showEndLine($output_type);
$prev = "";
for ($row_num = 2; $row = $DB->fetch_assoc($res); $row_num++) {
$crt = "";
foreach ($this->group_by as $colname) {
if (isset($row[$colname])) {
$crt .= $row[$colname] . "####";
}
}
echo Search::showNewLine($output_type);
$num = 1;
foreach ($colsname as $colname => $column) {
//If value needs to be modified on the fly
if (isset($this->columns_mapping[$colname]) && isset($this->columns_mapping[$colname][$row[$colname]])) {
$new_value = $this->columns_mapping[$colname][$row[$colname]];
$row[$colname] = $new_value;
}
if (!in_array($colname, $this->group_by)) {
$column->showValue($output_type, $row, $num, $row_num);
} else {
if ($crt == $prev) {
$column->showValue($output_type, $output_type == Search::CSV_OUTPUT ? $row : array(), $num, $row_num);
} else {
$column->showValue($output_type, $row, $num, $row_num, true);
}
}
}
// Each column
echo Search::showEndLine($output_type);
$prev = $crt;
}
// Each row
if (isset($options['withtotal']) && $options['withtotal']) {
echo Search::showNewLine($output_type);
$num = 1;
foreach ($colsname as $colname => $column) {
$column->showTotal($output_type, $num, $row_num);
}
echo Search::showEndLine($output_type);
}
}
echo Search::showFooter($output_type, $title);
if (!isset($_POST["display_type"]) || $_POST["display_type"] == Search::HTML_OUTPUT) {
if (isset($options['withmassiveaction']) && class_exists($options['withmassiveaction'])) {
Html::openArrowMassives("massiveaction_form", true);
Dropdown::showForMassiveAction($options['withmassiveaction']);
$options = array();
Html::closeArrowMassives($options);
Html::closeForm();
}
Html::footer();
}
}
示例14: showList
//.........这里部分代码省略.........
}
} else {
// no search -> browse by category
$where .= " (`glpi_knowbaseitems`.`knowbaseitemcategories_id`\n = '" . $params["knowbaseitemcategories_id"] . "')";
$order = " ORDER BY `glpi_knowbaseitems`.`question` ASC";
}
if (!$params["start"]) {
$params["start"] = 0;
}
$query = "SELECT `glpi_knowbaseitems`.*,\n `glpi_knowbaseitemcategories`.`completename` AS category\n {$score}\n FROM `glpi_knowbaseitems`\n LEFT JOIN `glpi_knowbaseitemcategories`\n ON (`glpi_knowbaseitemcategories`.`id`\n = `glpi_knowbaseitems`.`knowbaseitemcategories_id`)\n WHERE {$where}\n {$order}";
// Get it from database
if ($result = $DB->query($query)) {
$KbCategory = new KnowbaseItemCategory();
$title = "";
if ($KbCategory->getFromDB($params["knowbaseitemcategories_id"])) {
$title = $LANG['common'][36] . " = " . (empty($KbCategory->fields['name']) ? "(" . $params['knowbaseitemcategories_id'] . ")" : $KbCategory->fields['name']);
}
initNavigateListItems('KnowbaseItem', $title);
$numrows = $DB->numrows($result);
$list_limit = $_SESSION['glpilist_limit'];
// Limit the result, if no limit applies, use prior result
if ($numrows > $list_limit && !isset($_GET['export_all'])) {
$query_limit = $query . " LIMIT " . intval($params["start"]) . ", " . intval($list_limit) . " ";
$result_limit = $DB->query($query_limit);
$numrows_limit = $DB->numrows($result_limit);
} else {
$numrows_limit = $numrows;
$result_limit = $result;
}
if ($numrows_limit > 0) {
// Set display type for export if define
$output_type = HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq={$faq}";
if (isset($options['tickets_id'])) {
$parameters .= "&tickets_id=" . $options['tickets_id'];
}
if ($output_type == HTML_OUTPUT) {
printPager($params['start'], $numrows, getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
$header_num = 1;
echo Search::showHeaderItem($output_type, $LANG['knowbase'][14], $header_num);
if ($output_type != HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, $LANG['knowbase'][15], $header_num);
}
echo Search::showHeaderItem($output_type, $LANG['common'][36], $header_num);
if (isset($options['tickets_id']) && $output_type == HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_array($result_limit);
addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
if ($output_type == HTML_OUTPUT) {
if (isset($options['tickets_id'])) {
$href = " href='#' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=show_kb&id=" . $data['id'] . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' );w.focus();\"";
} else {
$href = " href=\"" . $params['target'] . "?id=" . $data["id"] . "\" ";
}
echo Search::showItem($output_type, "<div class='kb'><a " . ($data['is_faq'] ? " class='pubfaq' " : " class='knowbase' ") . " {$href}>" . resume_text($data["question"], 80) . "</a></div>\n <div class='kb_resume'>" . resume_text(html_clean(unclean_cross_side_scripting_deep($data["answer"])), 600) . "</div>", $item_num, $row_num);
} else {
echo Search::showItem($output_type, $data["question"], $item_num, $row_num);
echo Search::showItem($output_type, html_clean(unclean_cross_side_scripting_deep(html_entity_decode($data["answer"], ENT_QUOTES, "UTF-8"))), $item_num, $row_num);
}
echo Search::showItem($output_type, $data["category"], $item_num, $row_num);
if (isset($options['tickets_id']) && $output_type == HTML_OUTPUT) {
$content = "<a href='" . $CFG_GLPI['root_doc'] . "/front/ticket.form.php?load_kb_sol=" . $data['id'] . "&id=" . $options['tickets_id'] . "&forcetab=4'>" . $LANG['job'][24] . "</a>";
echo Search::showItem($output_type, $content, $item_num, $row_num);
}
// End Line
echo Search::showEndLine($output_type);
}
// Display footer
if ($output_type == PDF_OUTPUT_LANDSCAPE || $output_type == PDF_OUTPUT_PORTRAIT) {
echo Search::showFooter($output_type, Dropdown::getDropdownName("glpi_knowbaseitemcategories", $params['knowbaseitemcategories_id']));
} else {
echo Search::showFooter($output_type);
}
echo "<br>";
if ($output_type == HTML_OUTPUT) {
printPager($params['start'], $numrows, getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
} else {
if ($params["knowbaseitemcategories_id"] != 0) {
echo "<div class='center b'>" . $LANG['search'][15] . "</div>";
}
}
}
}
示例15: showResult
//.........这里部分代码省略.........
echo Search::showItem($output_type, ' ', $num, $cptRow);
}
} else {
echo Search::showItem($output_type, " ", $num, $cptRow);
}
if (isset($row['itemtype']) && $row['itemtype'] != "") {
// U
if (isset($row['position']) && $row['position'] != "") {
echo Search::showItem($output_type, $row['position'], $num, $cptRow);
} else {
echo Search::showItem($output_type, " ", $num, $cptRow);
}
// avant / arrière
if ($row['faces_id'] == 1) {
echo Search::showItem($output_type, __("Front", "racks"), $num, $cptRow);
} else {
echo Search::showItem($output_type, __("Back", "racks"), $num, $cptRow);
}
// Nom de l'objet
if (array_key_exists("object_name", $listFields)) {
$link = Toolbox::getItemTypeFormURL(substr($itemtype, 0, -5));
if ($itemtype != 'PluginRacksOtherModel') {
if ($output_type == Search::HTML_OUTPUT) {
echo Search::showItem($output_type, "<a href=\"" . $link . "?id=" . $row["items_id"] . "\">" . $device["name"] . "</a>", $num, $cptRow);
} else {
echo Search::showItem($output_type, $device["name"], $num, $cptRow);
}
} else {
echo Search::showItem($output_type, $device["name"], $num, $cptRow);
}
}
// Lieu de l'objet
if (array_key_exists("object_location", $listFields)) {
if ($itemtype != 'PluginRacksOtherModel') {
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_locations", $device["locations_id"]), $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
// Groupe
if (array_key_exists("group", $listFields)) {
// Groupe
if ($itemtype != 'PluginRacksOtherModel') {
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_groups", $device["groups_id_tech"]), $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
// type
if (array_key_exists("type", $listFields)) {
echo Search::showItem($output_type, $item->getTypeName(), $num, $cptRow);
}
// fabricant
if (array_key_exists("manufacturer", $listFields)) {
if ($itemtype != 'PluginRacksOtherModel') {
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_manufacturers", $device["manufacturers_id"]), $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
// modèle //TODO = model du rack => model des objets
if (array_key_exists("model", $listFields)) {
if ($itemtype != 'PluginRacksOtherModel') {
$model_table = getTableForItemType($itemtype);
$modelfield = getForeignKeyFieldForTable(getTableForItemType($itemtype));
echo Search::showItem($output_type, Dropdown::getDropdownName($model_table, $device[$modelfield]), $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
// numéro de série
if (array_key_exists("serial_number", $listFields)) {
if ($itemtype != 'PluginRacksOtherModel') {
echo Search::showItem($output_type, $device['serial'], $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
// numéro d'inventaire
if (array_key_exists("other_serial", $listFields)) {
if ($itemtype != 'PluginRacksOtherModel') {
echo Search::showItem($output_type, $device['otherserial'], $num, $cptRow);
} else {
echo Search::showItem($output_type, Dropdown::EMPTY_VALUE, $num, $cptRow);
}
}
$currentRack = $row['id'];
} else {
for ($k = 0; $k < $cptField - 3; $k++) {
echo Search::showItem($output_type, " ", $num, $cptRow, "");
}
}
echo Search::showEndLine($output_type);
}
if ($output_type == Search::HTML_OUTPUT) {
Html::closeForm();
}
echo Search::showFooter($output_type, $title);
}
}