本文整理汇总了PHP中Search::showHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::showHeader方法的具体用法?PHP Search::showHeader怎么用?PHP Search::showHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::showHeader方法的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: showSnmpDeviceToAdd
//.........这里部分代码省略.........
Html::printPager($start, $numrows, $target, $parameters);
//Show preview form only in import even in multi-entity mode because computer import
//can be refused by a rule
/*if (!$tolinked) {
echo "<div class='firstbloc'>";
echo "<form method='post' name='ocsng_import_mode' id='ocsng_import_mode'
action='$target'>\n";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Manual import mode', 'ocsinventoryng') . "</th></tr>\n";
echo "<tr class='tab_bg_1'><td class='center'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}*/
if ($output_type == Search::HTML_OUTPUT) {
echo "<form method='post' name='ocsng_form' id='ocsng_form' action='{$target}'>";
}
if ($output_type == Search::HTML_OUTPUT && !$tolinked) {
echo "<div class='center'>";
PluginOcsinventoryngOcsServer::checkBox($target);
echo "</div>";
}
if ($output_type == Search::HTML_OUTPUT) {
echo "<table class='tab_cadrehov'>";
echo "<tr class='tab_bg_1'><td colspan='10' class='center'>";
if (!$tolinked) {
echo "<input class='submit' type='submit' name='import_ok' value=\"" . _sx('button', 'Import', 'ocsinventoryng') . "\">";
} else {
echo "<input class='submit' type='submit' name='import_ok' value=\"" . _sx('button', 'Link', 'ocsinventoryng') . "\">";
}
echo "</td></tr>\n";
}
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Name'), $header_num);
//, $linkto, $p['sort']==$val, $p['order']
echo Search::showHeaderItem($output_type, __('Description'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Date'), $header_num);
echo Search::showHeaderItem($output_type, __('Contact SNMP', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Location SNMP', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Type SNMP', 'ocsinventoryng'), $header_num);
if (!$tolinked) {
echo Search::showHeaderItem($output_type, __('Item type to create', 'ocsinventoryng'), $header_num, "", 0, "", 'width=15%');
echo Search::showHeaderItem($output_type, "", $header_num);
} else {
echo Search::showHeaderItem($output_type, __('Item to link', 'ocsinventoryng'), $header_num, "", 0, "", 'width=15%');
}
// End Line for column headers
echo Search::showEndLine($output_type);
$row_num = 1;
foreach ($hardware as $ID => $tab) {
$row_num++;
$item_num = 1;
if ($tab["type"] == "Network") {
$tab["type"] = "NetworkEquipment";
}
echo Search::showNewLine($output_type, $row_num % 2);
echo Search::showItem($output_type, $tab["name"], $item_num, $row_num);
echo Search::showItem($output_type, $tab["description"], $item_num, $row_num, 'width=15%');
echo Search::showItem($output_type, $tab["ipaddr"], $item_num, $row_num, 'width=5%');
echo Search::showItem($output_type, Html::convDateTime($tab["date"]), $item_num, $row_num, 'width=15%');
echo Search::showItem($output_type, $tab["contact"], $item_num, $row_num, 'width=5%');
echo Search::showItem($output_type, $tab["location"], $item_num, $row_num, 'width=15%');
示例3: displayReport
function displayReport(&$result, $PluginAddressingAddressing)
{
global $DB, $CFG_GLPI;
$network = $PluginAddressingAddressing->fields["networks_id"];
$ping = $PluginAddressingAddressing->fields["use_ping"];
$PluginAddressingConfig = new PluginAddressingConfig();
$PluginAddressingConfig->getFromDB('1');
$system = $PluginAddressingConfig->fields["used_system"];
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
$header_num = 1;
$nbcols = 6;
$ping_response = 0;
$parameters = "id=";
$row_num = 1;
echo Search::showHeader($output_type, 1, $nbcols, 1);
echo $this->displaySearchNewLine($output_type);
echo Search::showHeaderItem($output_type, __('IP'), $header_num);
echo Search::showHeaderItem($output_type, __('Connected to'), $header_num);
echo Search::showHeaderItem($output_type, _n('User', 'Users', 1), $header_num);
echo Search::showHeaderItem($output_type, __('MAC address'), $header_num);
echo Search::showHeaderItem($output_type, __('Item type'), $header_num);
echo Search::showHeaderItem($output_type, __('Free Ip', 'addressing'), $header_num);
// End Line for column headers
echo Search::showEndLine($output_type);
$user = new User();
foreach ($result as $num => $lines) {
$ip = long2ip(substr($num, 2));
if (count($lines)) {
if (count($lines) > 1) {
$disp = $PluginAddressingAddressing->fields["double_ip"];
} else {
$disp = $PluginAddressingAddressing->fields["alloted_ip"];
}
if ($disp) {
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
//.........这里部分代码省略.........
示例4: afficheTableau
function afficheTableau($date, $display, $output_type, $itemtable, $end_display, $start, $nbcols, $titre, $total, $items, $locations_id)
{
global $DB, $CFG_GLPI;
$first = true;
$deleted = 0;
$master_total = 0;
$master_total += $total;
if ($total != 0) {
if ($output_type == Search::HTML_OUTPUT) {
echo "<br>";
echo Search::showHeader($output_type, $end_display - $start + 1, $nbcols, 1);
} else {
echo Search::showNewLine($output_type);
echo Search::showEndLine($output_type);
}
echo Search::showNewLine($output_type);
//tr
if ($output_type == Search::HTML_OUTPUT) {
if ($total != -1) {
echo "<th>" . $titre . "</th><th><font color='red'>" . Html::formatNumber($total) . " " . _n('Euro', 'Euros', 2, 'financialreports') . "</font></th><th>";
} else {
echo "<th>" . $titre . "</th><th></th><th>";
}
if ($_SESSION[$display]) {
$status = "false";
} else {
$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
//.........这里部分代码省略.........
示例5: 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);
//.........这里部分代码省略.........
示例6: seePreImport
//.........这里部分代码省略.........
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
$end_display = $p['start'] + $_SESSION["glpilist_limit"];
// Export All case
if (isset($_GET['export_all'])) {
$begin_display = 0;
$end_display = $numrows;
}
if (Session::isMultiEntitiesMode()) {
$colsup = 1;
} else {
$colsup = 0;
}
//////////////////////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"];
示例7: array
$mylevels = array();
$restrict = getEntitiesRestrictRequest('', "glpi_plugin_timelineticket_grouplevels", '', '', true);
$restrict .= "ORDER BY rank";
$levels = getAllDatasFromTable("glpi_plugin_timelineticket_grouplevels", $restrict);
if (!empty($levels)) {
foreach ($levels as $level) {
$mylevels[$level["name"]] = json_decode($level["groups"], true);
}
}
$nbCols = $DB->num_fields($res);
$nbrows = $DB->numrows($res);
$num = 1;
$link = $_SERVER['PHP_SELF'];
$order = 'ASC';
$issort = false;
echo Search::showHeader($output_type, $nbrows, $nbCols, false);
echo Search::showNewLine($output_type);
showTitle($output_type, $num, __('id'), 'id', true);
showTitle($output_type, $num, __('Entity'), 'entities_id', true);
showTitle($output_type, $num, __('Status'), 'status', false);
showTitle($output_type, $num, __('Opening date'), 'date', true);
showTitle($output_type, $num, __('Last update'), 'date_mod', true);
showTitle($output_type, $num, __('Priority'), 'priority', true);
showTitle($output_type, $num, _n('Requester', 'Requesters', 2), '', false);
showTitle($output_type, $num, __('Type'), 'type', true);
showTitle($output_type, $num, __('Category'), 'itilcategories_id', true);
showTitle($output_type, $num, __('Title'), 'name', true);
showTitle($output_type, $num, __('Closing date'), 'closedate', true);
showTitle($output_type, $num, __('Request source'), 'requesttypes_id', true);
showTitle($output_type, $num, __('Take into account time'), 'takeintoaccount_delay_stat', true);
showTitle($output_type, $num, __('SLA'), 'slas_id', true);
示例8: execute
/**
* Execute the report
*
* @param $options array
**/
function execute($options = array())
{
global $DB, $CFG_GLPI, $HEADER_LOADED;
// Require (for pager) when not called by displayCriteriasForm
$this->manageCriteriasValues();
if (isset($_POST['list_limit'])) {
$_SESSION['glpilist_limit'] = $_POST['list_limit'];
unset($_POST['list_limit']);
}
$limit = $_SESSION['glpilist_limit'];
if (isset($_POST["display_type"])) {
$output_type = $_POST["display_type"];
if ($output_type < 0) {
$output_type = -$output_type;
$limit = 0;
}
} else {
$output_type = Search::HTML_OUTPUT;
}
$title = $this->title;
if ($this->subname) {
$title = sprintf(__('%1$s - %2$s'), $title, $this->subname);
}
$res = $DB->query($this->sql);
$nbtot = $res ? $DB->numrows($res) : 0;
if ($limit) {
$start = isset($_GET["start"]) ? $_GET["start"] : 0;
if ($start >= $nbtot) {
$start = 0;
}
if ($start > 0 || $start + $limit < $nbtot) {
$res = $DB->query($this->sql . " LIMIT {$start},{$limit}");
}
} else {
$start = 0;
}
if ($nbtot == 0) {
if (!$HEADER_LOADED) {
Html::header($title, $_SERVER['PHP_SELF'], "utils", "report");
Report::title();
}
echo "<div class='center'><font class='red b'>" . __('No item found') . "</font></div>";
Html::footer();
} else {
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
include GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
} else {
if ($output_type == Search::HTML_OUTPUT) {
if (!$HEADER_LOADED) {
Html::header($title, $_SERVER['PHP_SELF'], "utils", "report");
Report::title();
}
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th>" . $title . "</th></tr>\n";
echo "<tr class='tab_bg_2 center'><td class='center'>";
echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
$param = "";
foreach ($_POST as $key => $val) {
if (is_array($val)) {
foreach ($val as $k => $v) {
echo "<input type='hidden' name='" . $key . "[{$k}]' value='{$v}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= $key . "[" . $k . "]=" . urlencode($v);
}
} else {
echo "<input type='hidden' name='" . $key . "' value='{$val}' >";
if (!empty($param)) {
$param .= "&";
}
$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
//.........这里部分代码省略.........
示例9: 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();
}
示例10: 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>";
}
}
}
示例11: showList
/**
*Print out list kb item
*
* @param $options : $_GET
* @param $faq display on faq ?
**/
static function showList($options, $faq = 0)
{
global $DB, $LANG, $CFG_GLPI;
// Default values of parameters
$params["start"] = "0";
$params["knowbaseitemcategories_id"] = "0";
$params["contains"] = "";
$params["target"] = $_SERVER['PHP_SELF'];
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
// Lists kb Items
$where = "";
$order = "";
$score = "";
// Build query
if (getLoginUserID()) {
$where = getEntitiesRestrictRequest("", "glpi_knowbaseitems", "", "", true) . " AND ";
} else {
// Anonymous access
if (isMultiEntitiesMode()) {
$where = " (`glpi_knowbaseitems`.`entities_id` = '0'\n AND `glpi_knowbaseitems`.`is_recursive` = '1')\n AND ";
}
}
if ($faq) {
// helpdesk
$where .= " (`glpi_knowbaseitems`.`is_faq` = '1')\n AND ";
}
// a search with $contains
if (strlen($params["contains"]) > 0) {
$search = unclean_cross_side_scripting_deep($params["contains"]);
$score = " ,MATCH(glpi_knowbaseitems.question, glpi_knowbaseitems.answer)\n AGAINST('{$search}' IN BOOLEAN MODE) AS SCORE ";
$where_1 = $where . " MATCH(glpi_knowbaseitems.question, glpi_knowbaseitems.answer)\n AGAINST('{$search}' IN BOOLEAN MODE) ";
$order = "ORDER BY `SCORE` DESC";
// preliminar query to allow alternate search if no result with fulltext
$query_1 = "SELECT COUNT(`id`)\n FROM `glpi_knowbaseitems`\n WHERE {$where_1}";
$result_1 = $DB->query($query_1);
$numrows_1 = $DB->result($result_1, 0, 0);
if ($numrows_1 <= 0) {
// not result this fulltext try with alternate search
$search1 = array('/\\\\"/', "/\\+/", "/\\*/", "/~/", "/</", "/>/", "/\\(/", "/\\)/", "/\\-/");
$contains = preg_replace($search1, "", $params["contains"]);
$where .= " (`glpi_knowbaseitems`.`question` " . makeTextSearch($contains) . "\n OR `glpi_knowbaseitems`.`answer` " . makeTextSearch($contains) . ")";
} else {
$where = $where_1;
}
} 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;
//.........这里部分代码省略.........
示例12: showTitle
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td></tr>";
echo "</table></div>";
Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
}
}
}
if ($nbtot > 0) {
$nbcols = $DB->num_fields($result);
$nbrows = $DB->numrows($result);
$num = 1;
$link = $_SERVER['PHP_SELF'];
$order = 'ASC';
$issort = false;
echo Search::showHeader($output_type, $nbrows, $nbcols, true);
echo Search::showNewLine($output_type);
showTitle($output_type, $num, __('Entity'), 'entity', true);
showTitle($output_type, $num, __('Type'), 'type');
showTitle($output_type, $num, __('Name'), 'name', true);
showTitle($output_type, $num, __('First name'), 'firstname', true);
showTitle($output_type, $num, __('Administrative number'), 'registration_number', true);
showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1), 'profession', true);
showTitle($output_type, $num, __('Arrival date', 'resources'), 'date_begin', true);
showTitle($output_type, $num, __('Departure date', 'resources'), 'date_end', true);
showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('Begin date'), 'begin_date', true);
showTitle($output_type, $num, PluginResourcesProfession::getTypeName(1) . " - " . __('End date'), 'end_date', true);
echo Search::showEndLine($output_type);
if ($limit) {
$dataAll = array_slice($dataAll, $start, $limit);
}
示例13: showMinimalList
//.........这里部分代码省略.........
//echo Search::showHeaderItem($output_type,$search_config,$header_num,"",0,$p['order']);
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printAjaxPager(self::getTypeName(2), $p['start'], $numrows, $search_config);
echo "<br>";
}
// 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;
}
//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']));
}
示例14: showMinimalList
//.........这里部分代码省略.........
//echo Search::showHeaderItem($output_type,$search_config,$header_num,"",0,$p['order']);
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype, 0, $search_config);
echo "<br>";
}
// 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;
}
//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);
}
示例15: showList
/**
* Print out list kb item
*
* @param $options $_GET
* @param $type string search type : browse / search (default search)
**/
static function showList($options, $type = 'search')
{
global $DB, $CFG_GLPI;
// Default values of parameters
$params['faq'] = !Session::haveRight(self::$rightname, READ);
$params["start"] = "0";
$params["knowbaseitemcategories_id"] = "0";
$params["contains"] = "";
$params["target"] = $_SERVER['PHP_SELF'];
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$ki = new self();
switch ($type) {
case 'myunpublished':
if (!Session::haveRightsOr(self::$rightname, array(UPDATE, self::PUBLISHFAQ))) {
return false;
}
break;
case 'allunpublished':
if (!Session::haveRight(self::$rightname, self::KNOWBASEADMIN)) {
return false;
}
break;
default:
break;
}
if (!$params["start"]) {
$params["start"] = 0;
}
$query = self::getListRequest($params, $type);
// Get it from database
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);
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();
//.........这里部分代码省略.........