本文整理汇总了PHP中Search::showNewLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::showNewLine方法的具体用法?PHP Search::showNewLine怎么用?PHP Search::showNewLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::showNewLine方法的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: showHardware
/**
* show hardware to be identified, or identified and imported, or just the hardware with agents installed on them
* @param type $hardware array
* @param type $lim integer
* @param int|type $start integer
* @param type $ipAdress string
* @param type $status string
* @param $subnet
* @param $action
* @global type $CFG_GLPI
*/
static function showHardware($hardware, $lim, $start = 0, $ipAdress, $status, $subnet, $action)
{
global $CFG_GLPI, $DB;
$output_type = Search::HTML_OUTPUT;
//0
$link = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php";
$return = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.php";
$returnargs = "subnetsChoice={$subnet}&action={$action}";
$reload = "ip={$ipAdress}&status={$status}&action={$action}";
$backValues = "?b[]={$ipAdress}&b[]={$status}";
if ($status == "inventoried") {
$status_name = __('Inventoried', 'ocsinventoryng');
} elseif ($status == "imported") {
$status_name = __('Imported / Linked', 'ocsinventoryng');
} elseif ($status == "noninventoried") {
$status_name = __('Non Inventoried', 'ocsinventoryng');
} else {
$status_name = __('Identified', 'ocsinventoryng');
}
$subnet_name = self::getSubnetNamebyIP($ipAdress);
echo "<div class='center'>";
echo "<h2>" . __('Subnet', 'ocsinventoryng') . " " . $subnet_name . " (" . $ipAdress . ") - " . $status_name;
echo " ";
$refresh = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php?" . $reload;
Html::showSimpleForm($refresh, 'refresh', _sx('button', 'Refresh'), array(), $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/synchro.png");
echo "</h2>";
echo "</div>";
if ($subnet >= 0) {
$back = __('Back');
echo "<div class='center'><a href='{$return}?{$returnargs}'>{$back}</div>";
}
echo Html::printPager($start, count($hardware), $link, $reload);
echo Search::showNewLine($output_type, true);
if (empty($hardware)) {
echo "<div class='center b'><br>" . __('No new IPDiscover device to import', 'ocsinventoryng') . "</div>";
Html::displayBackLink();
} else {
$header_num = 1;
switch ($status) {
case "inventoried":
echo "<table width='100%'class='tab_cadrehov'>\n";
echo Search::showHeaderItem($output_type, __('User'), $header_num);
echo Search::showHeaderItem($output_type, __('Name'), $header_num);
echo Search::showHeaderItem($output_type, __('System'), $header_num);
echo Search::showHeaderItem($output_type, __('Version of the operating system'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Last OCSNG inventory date', 'ocsinventoryng'), $header_num);
echo Search::showEndLine($output_type);
$row_num = 1;
for ($i = $start; $i < $lim + $start; $i++) {
if (isset($hardware[$i])) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
echo Search::showItem($output_type, $hardware[$i]["userid"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["name"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["osname"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["osversion"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["ipaddr"], $item_num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($hardware[$i]["lastdate"]), $item_num, $row_num);
echo Search::showEndLine($output_type);
}
}
echo "</table>\n";
break;
case "imported":
$target = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php" . $backValues;
self::checkBox($target);
echo "<form method='post' id='ipdiscover_form' name='ipdiscover_form' action='{$target}'>";
echo "<div class='center' style=\"width=100%\">";
echo "<input type='submit' class='submit' name='deletelink' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\"></div>";
echo "<table width='100%'class='tab_cadrehov'>\n";
echo Search::showHeaderItem($output_type, __('Item'), $header_num);
echo Search::showHeaderItem($output_type, __('Item type'), $header_num);
echo Search::showHeaderItem($output_type, __('MAC address'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Location'), $header_num);
echo Search::showHeaderItem($output_type, __('Import date in GLPI', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Subnet'), $header_num);
echo Search::showHeaderItem($output_type, __(' '), $header_num);
echo Search::showEndLine($output_type);
$row_num = 1;
for ($i = $start; $i < $lim + $start; $i++) {
if (isset($hardware[$i])) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
$class = getItemForItemtype($hardware[$i]["itemtype"]);
$class->getFromDB($hardware[$i]["items_id"]);
//.........这里部分代码省略.........
示例3: displayList
static function displayList(PluginFusioninventoryDeployOrder $order, $datas, $rand)
{
global $CFG_GLPI;
$pfDeployPackage = new PluginFusioninventoryDeployPackage();
$pfDeployPackage->getFromDB($order->fields['plugin_fusioninventory_deploypackages_id']);
echo "<table class='tab_cadrehov package_item_list' id='table_action_{$rand}'>";
$i = 0;
foreach ($datas['jobs']['actions'] as $action) {
echo Search::showNewLine(Search::HTML_OUTPUT, $i % 2);
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<td class='control'>";
Html::showCheckbox(array('name' => 'action_entries[]'));
echo "</td>";
}
$keys = array_keys($action);
$action_type = array_shift($keys);
echo "<td>";
echo "<a class='edit' " . "onclick=\"edit_subtype('action', {$order->fields['id']}, {$rand}, this)\">";
echo PluginFusioninventoryDeployAction::getType($action_type);
echo "</a><br />";
foreach ($action[$action_type] as $key => $value) {
if (is_array($value)) {
if ($key === "list") {
foreach ($value as $list) {
echo $list;
echo " ";
}
}
} else {
echo "<b>";
if ($key == 'exec') {
echo __('Command to execute', 'fusioninventory');
} else {
echo $key;
}
echo "</b>";
if ($key === "exec") {
echo "<pre style='border-left:solid lightgrey 3px;margin-left: 5px;" . "padding-left:2px'>{$value}</pre>";
} else {
echo " {$value} ";
}
}
}
if (isset($action[$action_type]['retChecks'])) {
echo "<br><b>" . __("return codes saved for this command", 'fusioninventory') . "</b> : <ul class='retChecks'>";
foreach ($action[$action_type]['retChecks'] as $retCheck) {
echo "<li>";
$retchecks_entries = self::retchecks_entries();
echo $retchecks_entries[$retCheck['type']] . " " . array_shift($retCheck['values']);
echo "</li>";
}
echo "</ul>";
}
echo "</td>";
echo "</td>";
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<td class='rowhandler control' title='" . __('drag', 'fusioninventory') . "'><div class='drag row'></div></td>";
}
echo "</tr>";
$i++;
}
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<tr><th>";
Html::checkAllAsCheckbox("actionsList{$rand}", mt_rand());
echo "</th><th colspan='3' class='mark'></th></tr>";
}
echo "</table>";
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo " <img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png' alt=''>";
echo "<input type='submit' name='delete' value=\"" . __('Delete', 'fusioninventory') . "\" class='submit'>";
}
}
示例4: 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();
}
示例5: show
function show($itemtype, $type, $date1, $date2, $start, array $value, $value2 = "")
{
global $LANG, $CFG_GLPI;
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
//printCleanArray($value);
if (is_array($value)) {
$end_display = $start + $_SESSION['plugin_mobile']['rows_limit'];
$numrows = count($value);
if (isset($_GET['export_all'])) {
$start = 0;
$end_display = $numrows;
}
$nbcols = 8;
if ($output_type != Search::HTML_OUTPUT) {
// not HTML display
$nbcols--;
}
echo PluginMobileSearch::showHeader($output_type, $end_display - $start + 1, $nbcols);
Search::showNewLine($output_type);
$header_num = 1;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$search_config = "";
echo PluginMobileSearch::showHeaderItem($output_type, $search_config, $header_num, "", 0, array());
}
echo "<div data-type='horizontal' data-role='controlgroup' class='mobile_list_header'>";
$header_num = 1;
echo PluginMobileSearch::showHeaderItem($output_type, " ", $header_num, '#', 0, '', 3);
/*if ($output_type==Search::HTML_OUTPUT) { // HTML display
echo PluginMobileSearch::showHeaderItem($output_type," ",$header_num, '#', 0, '', 7);
}*/
//stevenes
echo PluginMobileSearch::showHeaderItem($output_type, $LANG['stats'][13], $header_num, '#', 0, '', 3);
echo PluginMobileSearch::showHeaderItem($output_type, $LANG['stats'][11], $header_num, '#', 0, '', 3);
// echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][11],$header_num, '#', 0, '', 7);
/* echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][15],$header_num, '#', 0, '', 7);
echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][25],$header_num, '#', 0, '', 7);
echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][27],$header_num, '#', 0, '', 7);
echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][30],$header_num, '#', 0, '', 7);
*/
echo "</div>";
// End Line for column headers
echo PluginMobileSearch::showEndLine($output_type);
$itemtype = "Ticket";
//echo $start;
//echo $value[0]['id'];
//echo $value[0]['link'];
$row_num = 1;
for ($i = $start; $i < $numrows && $i < $end_display; $i++) {
$value[$i]['link'] = preg_replace('#<a.*>(.*)</a>#isU', '$1', $value[$i]['link']);
$value[$i]['link'] = "<a href='stat.graph.php?id=" . $value[$i + 1]['id'] . "&date1={$date1}&date2=" . "{$date2}&type={$type}" . (!empty($value2) ? "&champ={$value2}" : "") . "'>" . $value[$i]['link'] . "</a>";
$row_num++;
$item_num = 1;
echo PluginMobileSearch::showNewLine($output_type, $i % 2);
echo PluginMobileSearch::showItem($output_type, $value[$i]['link'], $item_num, $row_num, '', 3);
//echo PluginMobileSearch::showItem($output_type,$link,$item_num,$row_num, '', 7);
/*if ($output_type==Search::HTML_OUTPUT) { // HTML display
$link="";
if ($value[$i]['id']>0) {
$link="<a href='stat.graph.php?id=".$value[$i]['id']."&date1=$date1&date2=".
"$date2&type=$type".(!empty($value2)?"&champ=$value2":"")."'>".
"<img src=\"".$CFG_GLPI["root_doc"]."/pics/stats_item.png\" alt='' title=''>".
"</a>";
}
echo PluginMobileSearch::showItem($output_type,$link,$item_num,$row_num, '', 7);
}*/
//le nombre d'intervention - the number of intervention
$opened = Stat::constructEntryValues($itemtype, "inter_total", $date1, $date2, $type, $value[$i]["id"], $value2);
$nb_opened = array_sum($opened);
echo PluginMobileSearch::showItem($output_type, $nb_opened, $item_num, $row_num, '', 3);
$export_data['opened'][$value[$i]['link']] = $nb_opened;
//le nombre d'intervention resolues - the number of resolved intervention
$solved = Stat::constructEntryValues($itemtype, "inter_solved", $date1, $date2, $type, $value[$i]["id"], $value2);
$nb_solved = array_sum($solved);
echo PluginMobileSearch::showItem($output_type, $nb_solved, $item_num, $row_num, '', 3);
$export_data['solved'][$value[$i]['link']] = $nb_solved;
//dados chamados
//Le temps moyen de resolution - The average time to resolv
/*
$data=Stat::constructEntryValues($itemtype,"inter_avgsolvedtime",$date1,$date2,$type,$value[$i]["id"],$value2);
foreach ($data as $key2 => $val2) {
$data[$key2]*=$solved[$key2];
}
if ($nb_solved>0) {
$nb=array_sum($data)/$nb_solved;
} else {
$nb=0;
}
$timedisplay = $nb*HOUR_TIMESTAMP;
if ($output_type==Search::HTML_OUTPUT
|| $output_type==Search::PDF_OUTPUT_LANDSCAPE
|| $output_type==Search::PDF_OUTPUT_PORTRAIT) {
$timedisplay=mobileTimestampToString($timedisplay,0);
}
echo PluginMobileSearch::showItem($output_type,$timedisplay,$item_num,$row_num, '', 7);
//.........这里部分代码省略.........
示例6: showSnmpDeviceToAdd
//.........这里部分代码省略.........
//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%');
echo Search::showItem($output_type, $tab["type"], $item_num, $row_num);
示例7: 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
//.........这里部分代码省略.........
示例8: displayList
static function displayList(PluginFusioninventoryDeployOrder $order, $datas, $rand)
{
global $CFG_GLPI;
$pfDeployPackage = new PluginFusioninventoryDeployPackage();
$pfDeployPackage->getFromDB($order->fields['plugin_fusioninventory_deploypackages_id']);
$checks_types = self::getTypes();
echo "<table class='tab_cadrehov package_item_list' id='table_check_{$rand}'>";
$i = 0;
foreach ($datas['jobs']['checks'] as $check) {
//specific case for filesystem size
if (is_numeric($check['value'])) {
if ($check['type'] == "freespaceGreater") {
$check['value'] = $check['value'] * 1024 * 1024;
}
$check['value'] = PluginFusioninventoryDeployFile::processFilesize($check['value']);
}
echo Search::showNewLine(Search::HTML_OUTPUT, $i % 2);
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<td class='control'>";
echo "<input type='checkbox' name='check_entries[]' value='{$i}' />";
echo "</td>";
}
echo "<td>";
echo "<a class='edit'" . "onclick=\"edit_subtype('check', {$order->fields['id']}, {$rand} ,this)\">" . $checks_types[$check['type']] . "</a><br />";
echo $check['path'];
if (!empty($check['value'])) {
echo " <b>";
if (strpos($check['type'], "Greater") !== FALSE) {
echo ">";
} else {
if (strpos($check['type'], "Lower") !== FALSE) {
echo "<";
} else {
echo "=";
}
}
echo "</b> ";
echo $check['value'];
}
echo "</td>";
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<td class='rowhandler control' title='" . __('drag', 'fusioninventory') . "'><div class='drag row'></div></td>";
}
echo "</tr>";
$i++;
}
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo "<tr><th>";
Html::checkAllAsCheckbox("checksList{$rand}", mt_rand());
echo "</th><th colspan='3' class='mark'></th></tr>";
}
echo "</table>";
if ($pfDeployPackage->can($pfDeployPackage->getID(), UPDATE)) {
echo " <img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png' alt='' />";
echo "<input type='submit' name='delete' value=\"" . __('Delete', 'fusioninventory') . "\" class='submit' />";
}
}
示例9: 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);
//.........这里部分代码省略.........
示例10: displayList
function displayList($tasks_id)
{
global $CFG_GLPI;
$rand = mt_rand();
echo "<script type=\"text/javascript\">\nfunction edit_subtype(id,el) {\n\n //remove all border to previous selected item (remove classes)\n// Ext.select('#table_taskjob_'+ _rand +' tr').removeClass('selected');\n\n\n var row = null;\n if (el) {\n // get parent row of the selected element\n row = jQuery(el).parents('tr:first')\n }\n\n if (row) {\n //add border to selected index (add class)\n row.addClass('selected');\n// params['index'] = row.index();\n // change mode to edit\n// params['mode'] = 'edit';\n arg = 'taskjobs_id=' + id;\n } else {\n arg = 'tasks_id=' + id;\n }\n\n //scroll to edit form\n// document.getElementById('th_title_taskjob_' + _rand).scrollIntoView();\n\n //show and load form\n// \$('taskjobs_block' + _rand).setDisplayed('block');\n \$('#taskjobs_block').load('../ajax/taskjob_form.php?' + arg);\n}\n\n/*\n * Create a new subtype element.\n * This method just override *edit_subtype* with a null element.\n */\nfunction new_subtype(id) {\n edit_subtype(id, null);\n}\n</script>";
echo "<table class='tab_cadre_fixe' id='package_order_" . $tasks_id . "'>";
echo "<tr>";
echo "<th id='th_title_taskjob_{$rand}'>";
//echo "<img src='".$CFG_GLPI["root_doc"]."/plugins/fusioninventory/pics/$subtype.png' />";
echo " " . $this->getTypeName();
echo " ";
echo "<img id='plus_taskjobs_block{$rand}'";
echo " onclick=\"new_subtype({$tasks_id})\" ";
echo " title='" . __('Add') . "' alt='" . __('Add') . "' ";
echo " class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' /> ";
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<td style='vertical-align:top'>";
/**
* Display subtype form
**/
echo "<form name='additiontaskjob' method='post' " . " action='taskjob.form.php'>";
echo "<input type='hidden' name='orders_id' value='{$tasks_id}' />";
echo "<input type='hidden' name='itemtype' value='PluginFusioninventoryDeploy" . ucfirst('taskjob') . "' />";
echo "<div id='taskjobs_block'></div>";
Html::closeForm();
$a_taskjobs = getAllDatasFromTable($this->getTable(), "`plugin_fusioninventory_tasks_id`='" . $tasks_id . "'", FALSE, '`ranking`');
echo "<div id='drag_taskjob_taskjobs'>";
echo "<table class='tab_cadrehov package_item_list' id='table_taskjob_{$rand}' style='width: 950px'>";
$i = 0;
foreach ($a_taskjobs as $data) {
echo Search::showNewLine(Search::HTML_OUTPUT, $i % 2);
echo "<td class='control'>";
Html::showCheckbox(array('name' => 'taskjob_entries[]', 'value' => $i));
echo "</td>";
echo "<td>";
echo "<a class='edit' " . "onclick=\"edit_subtype({$data['id']}, this)\">";
echo $data['name'];
echo "</a><br />";
echo "<b>";
echo __('Definition', 'fusioninventory');
echo "</b>";
echo "<ul class='retChecks'>";
$a_definitions = importArrayFromDB($data['definition']);
foreach ($a_definitions as $a_definition) {
foreach ($a_definition as $itemtype => $items_id) {
echo "<li>";
$item = new $itemtype();
$item->getFromDB($items_id);
echo $item->getTypeName() . " > ";
echo $item->getLink();
echo "</li>";
}
}
echo "</ul>";
echo "<b>";
echo __('Action', 'fusioninventory');
echo "</b>";
echo "<ul class='retChecks'>";
$a_actions = importArrayFromDB($data['action']);
foreach ($a_actions as $a_action) {
foreach ($a_action as $itemtype => $items_id) {
echo "<li>";
$item = new $itemtype();
$item->getFromDB($items_id);
echo $item->getTypeName() . " > ";
echo $item->getLink();
echo "</li>";
}
}
echo "</ul>";
echo "</td>";
echo "</td>";
echo "<td class='rowhandler control' title='" . __('drag', 'fusioninventory') . "'><div class='drag row'></div></td>";
echo "</tr>";
$i++;
}
echo "<tr><th>";
Html::checkAllAsCheckbox("taskjobsList{$rand}", mt_rand());
echo "</th><th colspan='3' class='mark'></th></tr>";
echo "</table>";
echo "</div>";
echo " <img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left.png' alt=''>";
echo "<input type='submit' name='delete' value=\"" . __('Delete', 'fusioninventory') . "\" class='submit'>";
/**
* Initialize drag and drop on subtype lists
**/
echo "<script type=\"text/javascript\">\n redipsInit('taskjob', 'taskjob', {$tasks_id});\n</script>";
echo "</table>";
}
示例11: seePreImport
//.........这里部分代码省略.........
// 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"];
if (!$line["itemtype"]) {
示例12: 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
//.........这里部分代码省略.........
示例13: commonListHeader
static function commonListHeader($output_type = HTML_OUTPUT, $canedit)
{
// New Line for Header Items Line
echo Search::showNewLine($output_type);
// $show_sort if
$header_num = 1;
$items = array();
$items[__('Name')] = "glpi_plugin_projet_projets.name";
if (Session::isMultiEntitiesMode()) {
$items[__('Entity')] = "glpi_entities.completename";
}
$items[__('Description')] = "glpi_plugin_projet_projets.description";
$items[__('Progress')] = "glpi_plugin_projet_projets.advance";
$items[__('Start date')] = "glpi_plugin_projet_projets.date_begin";
$items[__('End date')] = "glpi_plugin_projet_projets.date_end";
foreach ($items as $key => $val) {
$issort = 0;
$link = "";
echo Search::showHeaderItem($output_type, $key, $header_num, $link);
}
if ($canedit) {
echo "<th> </th>";
}
// End Line for column headers
echo Search::showEndLine($output_type);
}
示例14: showShort
/**
* Display a line for an object
*
* @since version 0.85 (befor in each object with differents parameters)
*
* @param $id Integer ID of the object
* @param $options array of options
* output_type : Default output type (see Search class / default Search::HTML_OUTPUT)
* row_num : row num used for display
* type_for_massiveaction : itemtype for massive action
* id_for_massaction : default 0 means no massive action
* followups : only for Tickets : show followup columns
*/
static function showShort($id, $options = array())
{
global $CFG_GLPI, $DB;
$p['output_type'] = Search::HTML_OUTPUT;
$p['row_num'] = 0;
$p['type_for_massiveaction'] = 0;
$p['id_for_massiveaction'] = 0;
if (count($options)) {
foreach ($options as $key => $val) {
$p[$key] = $val;
}
}
$rand = mt_rand();
// Prints a job in short form
// Should be called in a <table>-segment
// Print links or not in case of user view
// Make new job object and fill it from database, if success, print it
$item = new static();
$candelete = static::canDelete();
$canupdate = Session::haveRight(static::$rightname, UPDATE);
$align = "class='center";
$align_desc = "class='left";
$align .= "'";
$align_desc .= "'";
if ($item->getFromDB($id)) {
$item_num = 1;
$bgcolor = $_SESSION["glpipriority_" . $item->fields["priority"]];
echo Search::showNewLine($p['output_type'], $p['row_num'] % 2);
$check_col = '';
if (($candelete || $canupdate) && $p['output_type'] == Search::HTML_OUTPUT && $p['id_for_massiveaction']) {
$check_col = Html::getMassiveActionCheckBox($p['type_for_massiveaction'], $p['id_for_massiveaction']);
}
echo Search::showItem($p['output_type'], $check_col, $item_num, $p['row_num'], $align);
$id_col = $item->fields["id"];
echo Search::showItem($p['output_type'], $id_col, $item_num, $p['row_num'], $align);
// First column
$first_col = '';
$color = '';
if ($item->fields["projectstates_id"]) {
$query = "SELECT `color`\n FROM `glpi_projectstates`\n WHERE `id` = '" . $item->fields["projectstates_id"] . "'";
foreach ($DB->request($query) as $color) {
$color = $color['color'];
}
$first_col = Dropdown::getDropdownName('glpi_projectstates', $item->fields["projectstates_id"]);
}
echo Search::showItem($p['output_type'], $first_col, $item_num, $p['row_num'], "{$align} bgcolor='{$color}'");
// Second column
$second_col = sprintf(__('Opened on %s'), ($p['output_type'] == Search::HTML_OUTPUT ? '<br>' : '') . Html::convDateTime($item->fields['date']));
echo Search::showItem($p['output_type'], $second_col, $item_num, $p['row_num'], $align . " width=130");
// Second BIS column
$second_col = Html::convDateTime($item->fields["date_mod"]);
echo Search::showItem($p['output_type'], $second_col, $item_num, $p['row_num'], $align . " width=90");
// Second TER column
if (count($_SESSION["glpiactiveentities"]) > 1) {
$second_col = Dropdown::getDropdownName('glpi_entities', $item->fields['entities_id']);
echo Search::showItem($p['output_type'], $second_col, $item_num, $p['row_num'], $align . " width=100");
}
// Third Column
echo Search::showItem($p['output_type'], "<span class='b'>" . CommonITILObject::getPriorityName($item->fields["priority"]) . "</span>", $item_num, $p['row_num'], "{$align} bgcolor='{$bgcolor}'");
// Fourth Column
$fourth_col = "";
if ($item->fields["users_id"]) {
$userdata = getUserName($item->fields["users_id"], 2);
$fourth_col .= sprintf(__('%1$s %2$s'), "<span class='b'>" . $userdata['name'] . "</span>", Html::showToolTip($userdata["comment"], array('link' => $userdata["link"], 'display' => false)));
}
echo Search::showItem($p['output_type'], $fourth_col, $item_num, $p['row_num'], $align);
// Fifth column
$fifth_col = "";
if ($item->fields["groups_id"]) {
$fifth_col .= Dropdown::getDropdownName("glpi_groups", $item->fields["groups_id"]);
$fifth_col .= "<br>";
}
echo Search::showItem($p['output_type'], $fifth_col, $item_num, $p['row_num'], $align);
// Eigth column
$eigth_column = "<span class='b'>" . $item->fields["name"] . "</span> ";
// Add link
if ($item->canViewItem()) {
$eigth_column = "<a id='" . $item->getType() . $item->fields["id"] . "{$rand}' href=\"" . $item->getLinkURL() . "&forcetab=Project\$\">{$eigth_column}</a>";
}
if ($p['output_type'] == Search::HTML_OUTPUT) {
$eigth_column = sprintf(__('%1$s %2$s'), $eigth_column, Html::showToolTip($item->fields['content'], array('display' => false, 'applyto' => $item->getType() . $item->fields["id"] . $rand)));
}
echo Search::showItem($p['output_type'], $eigth_column, $item_num, $p['row_num'], $align_desc . "width='200'");
// Finish Line
echo Search::showEndLine($p['output_type']);
} else {
echo "<tr class='tab_bg_2'>";
//.........这里部分代码省略.........
示例15: 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>";
}
}
}