本文整理汇总了PHP中Html::printAjaxPager方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::printAjaxPager方法的具体用法?PHP Html::printAjaxPager怎么用?PHP Html::printAjaxPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::printAjaxPager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForTicket
/**
* Print the wainting ticket form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return Nothing (display)
* */
static function showForTicket($item)
{
global $CFG_GLPI;
// validation des droits
if (!Session::haveRight('plugin_moreticket', READ)) {
return false;
}
if (isset($_REQUEST["start"])) {
$start = $_REQUEST["start"];
} else {
$start = 0;
}
// Total Number of events
$number = countElementsInTable("glpi_plugin_moreticket_waitingtickets", "`tickets_id`='" . $item->getField('id') . "'");
if ($number < 1) {
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No historical') . "</th></tr>";
echo "</table>";
echo "</div><br>";
return;
} else {
echo "<div class='center'>";
// Display the pager
Html::printAjaxPager(__('Ticket suspension history', 'moreticket'), $start, $number);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th>" . __('Suspension date', 'moreticket') . "</th>";
echo "<th>" . __('Reason', 'moreticket') . "</th>";
echo "<th>" . PluginMoreticketWaitingType::getTypeName(1) . "</th>";
echo "<th>" . __('Postponement date', 'moreticket') . "</th>";
echo "<th>" . __('Suspension end date', 'moreticket') . "</th>";
echo "</tr>";
foreach (self::getWaitingTicketFromDB($item->getField('id'), array('start' => $start, 'limit' => $_SESSION['glpilist_limit'])) as $waitingTicket) {
echo "<tr class='tab_bg_2'>";
echo "<td>";
echo Html::convDateTime($waitingTicket['date_suspension']);
echo "</td>";
echo "<td>";
echo $waitingTicket['reason'];
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName('glpi_plugin_moreticket_waitingtypes', $waitingTicket['plugin_moreticket_waitingtypes_id']);
echo "</td>";
echo "<td>";
if ($waitingTicket['date_report'] == "0000-00-00 00:00:00") {
echo _x('periodicity', 'None');
} else {
echo Html::convDateTime($waitingTicket['date_report']);
}
echo "</td>";
echo "<td>";
echo Html::convDateTime($waitingTicket['date_end_suspension']);
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
Html::printAjaxPager(__('Ticket suspension history', 'moreticket'), $start, $number);
}
}
示例2: showForLicense
/**
* Show computers linked to a License
*
* @param $license SoftwareLicense object
*
* @return nothing
**/
static function showForLicense(SoftwareLicense $license)
{
global $DB, $CFG_GLPI;
$searchID = $license->getField('id');
if (!Software::canView() || !$searchID) {
return false;
}
$canedit = Session::haveRightsOr("software", array(CREATE, UPDATE, DELETE, PURGE));
$canshowcomputer = Computer::canView();
if (isset($_GET["start"])) {
$start = $_GET["start"];
} else {
$start = 0;
}
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (isset($_GET["sort"]) && !empty($_GET["sort"])) {
// manage several param like location,compname : order first
$tmp = explode(",", $_GET["sort"]);
$sort = "`" . implode("` {$order},`", $tmp) . "`";
} else {
$sort = "`entity` {$order}, `compname`";
}
//SoftwareLicense ID
$query_number = "SELECT COUNT(*) AS cpt\n FROM `glpi_computers_softwarelicenses`\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwarelicenses`.`computers_id`\n = `glpi_computers`.`id`)\n WHERE `glpi_computers_softwarelicenses`.`softwarelicenses_id` = '{$searchID}'" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwarelicenses`.`is_deleted` = '0'";
$number = 0;
if ($result = $DB->query($query_number)) {
$number = $DB->result($result, 0, 0);
}
echo "<div class='center'>";
if ($canedit) {
echo "<form method='post' action='" . $CFG_GLPI["root_doc"] . "/front/computer_softwarelicense.form.php'>";
echo "<input type='hidden' name='softwarelicenses_id' value='{$searchID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'>";
echo "<td>";
Computer::dropdown(array('entity' => $license->fields['entities_id'], 'entity_sons' => $license->fields['is_recursive']));
echo "</td>";
echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
}
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table></div>\n";
return;
}
// Display the pager
Html::printAjaxPager(__('Affected computers'), $start, $number);
$query = "SELECT `glpi_computers_softwarelicenses`.*,\n `glpi_computers`.`name` AS compname,\n `glpi_computers`.`id` AS cID,\n `glpi_computers`.`serial`,\n `glpi_computers`.`otherserial`,\n `glpi_users`.`name` AS username,\n `glpi_users`.`id` AS userid,\n `glpi_users`.`realname` AS userrealname,\n `glpi_users`.`firstname` AS userfirstname,\n `glpi_softwarelicenses`.`name` AS license,\n `glpi_softwarelicenses`.`id` AS vID,\n `glpi_softwarelicenses`.`name` AS vername,\n `glpi_entities`.`completename` AS entity,\n `glpi_locations`.`completename` AS location,\n `glpi_states`.`name` AS state,\n `glpi_groups`.`name` AS groupe,\n `glpi_softwarelicenses`.`name` AS lname,\n `glpi_softwarelicenses`.`id` AS lID,\n `glpi_softwarelicenses`.`softwares_id` AS softid\n FROM `glpi_computers_softwarelicenses`\n INNER JOIN `glpi_softwarelicenses`\n ON (`glpi_computers_softwarelicenses`.`softwarelicenses_id`\n = `glpi_softwarelicenses`.`id`)\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwarelicenses`.`computers_id` = `glpi_computers`.`id`)\n LEFT JOIN `glpi_entities` ON (`glpi_computers`.`entities_id` = `glpi_entities`.`id`)\n LEFT JOIN `glpi_locations`\n ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)\n LEFT JOIN `glpi_states` ON (`glpi_computers`.`states_id` = `glpi_states`.`id`)\n LEFT JOIN `glpi_groups` ON (`glpi_computers`.`groups_id` = `glpi_groups`.`id`)\n LEFT JOIN `glpi_users` ON (`glpi_computers`.`users_id` = `glpi_users`.`id`)\n WHERE (`glpi_softwarelicenses`.`id` = '{$searchID}') " . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwarelicenses`.`is_deleted` = '0'\n ORDER BY {$sort} {$order}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$rand = mt_rand();
if ($result = $DB->query($query)) {
if ($data = $DB->fetch_assoc($result)) {
if ($canedit) {
$rand = mt_rand();
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $_SESSION['glpilist_limit'], 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
// show transfer only if multi licenses for this software
if (self::countLicenses($data['softid']) > 1) {
$massiveactionparams['specific_actions'][__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'move_license'] = _x('button', 'Move');
}
// Options to update license
$massiveactionparams['extraparams']['options']['move']['used'] = array($searchID);
$massiveactionparams['extraparams']['options']['move']['softwares_id'] = $license->fields['softwares_id'];
Html::showMassiveActions($massiveactionparams);
}
$soft = new Software();
$soft->getFromDB($license->fields['softwares_id']);
$showEntity = $license->isRecursive();
$linkUser = User::canView();
$text = sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $soft->fields["name"]);
$text = sprintf(__('%1$s - %2$s'), $text, $data["vername"]);
Session::initNavigateListItems('Computer', $text);
$sort_img = "<img src='" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "' alt='' title=''>";
echo "<table class='tab_cadre_fixehov'>";
$columns = array('compname' => __('Name'), 'entity' => __('Entity'), 'serial' => __('Serial number'), 'otherserial' => __('Inventory number'), 'location,compname' => __('Location'), 'state,compname' => __('Status'), 'groupe,compname' => __('Group'), 'username,compname' => __('User'));
if (!$showEntity) {
unset($columns['entity']);
}
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
//.........这里部分代码省略.........
示例3: showMinimalList
//.........这里部分代码省略.........
$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>" . $item->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) {
if ($output_type == Search::HTML_OUTPUT && !$p['withtemplate']) {
echo "<div align='center'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/resources/front/task.php?contains%5B0%5D=" . $p['id'] . "&field%5B0%5D=13&sort=1&is_deleted=0&start=0'>" . _x('button', 'Search') . "</a><br>";
echo "</div>";
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$search_config = "";
if ($item->canCreate() && $canedit) {
$tmp = " class='pointer' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=search_config&itemtype=" . $itemtype . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' ); w.focus();\"";
$search_config = "<img alt='" . __('Select default items to show') . "' title='" . __('Select default items to show') . "' src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config .= $tmp . ">";
}
//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 = '';
示例4: showForSoftware
/**
* Show Licenses of a software
*
* @param $software Software object
*
* @return nothing
**/
static function showForSoftware(Software $software)
{
global $DB, $CFG_GLPI;
$softwares_id = $software->getField('id');
$license = new self();
$computer = new Computer();
if (!$software->can($softwares_id, READ)) {
return false;
}
$columns = array('name' => __('Name'), 'entity' => __('Entity'), 'serial' => __('Serial number'), 'number' => _x('quantity', 'Number'), '_affected' => __('Affected computers'), 'typename' => __('Type'), 'buyname' => __('Purchase version'), 'usename' => __('Version in use'), 'expire' => __('Expiration'));
if (!$software->isRecursive()) {
unset($columns['entity']);
}
if (isset($_GET["start"])) {
$start = $_GET["start"];
} else {
$start = 0;
}
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) {
$sort = "`" . $_GET["sort"] . "`";
} else {
$sort = "`entity` {$order}, `name`";
}
// Righ type is enough. Can add a License on a software we have Read access
$canedit = Software::canUpdate();
$showmassiveactions = $canedit;
// Total Number of events
$number = countElementsInTable("glpi_softwarelicenses", "glpi_softwarelicenses.softwares_id = {$softwares_id} " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true));
echo "<div class='spaced'>";
Session::initNavigateListItems('SoftwareLicense', sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $software->getName()));
if ($canedit) {
echo "<div class='center firstbloc'>";
echo "<a class='vsubmit' href='softwarelicense.form.php?softwares_id={$softwares_id}'>" . _x('button', 'Add a license') . "</a>";
echo "</div>";
}
$rand = mt_rand();
$query = "SELECT `glpi_softwarelicenses`.*,\n `buyvers`.`name` AS buyname,\n `usevers`.`name` AS usename,\n `glpi_entities`.`completename` AS entity,\n `glpi_softwarelicensetypes`.`name` AS typename\n FROM `glpi_softwarelicenses`\n LEFT JOIN `glpi_softwareversions` AS buyvers\n ON (`buyvers`.`id` = `glpi_softwarelicenses`.`softwareversions_id_buy`)\n LEFT JOIN `glpi_softwareversions` AS usevers\n ON (`usevers`.`id` = `glpi_softwarelicenses`.`softwareversions_id_use`)\n LEFT JOIN `glpi_entities`\n ON (`glpi_entities`.`id` = `glpi_softwarelicenses`.`entities_id`)\n LEFT JOIN `glpi_softwarelicensetypes`\n ON (`glpi_softwarelicensetypes`.`id`\n = `glpi_softwarelicenses`.`softwarelicensetypes_id`)\n WHERE (`glpi_softwarelicenses`.`softwares_id` = '{$softwares_id}') " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true) . "\n ORDER BY {$sort} {$order}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
if ($result = $DB->query($query)) {
if ($num_displayed = $DB->numrows($result)) {
// Display the pager
Html::printAjaxPager(self::getTypeName(Session::getPluralNumber()), $start, $number);
if ($showmassiveactions) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $num_displayed, 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('options' => array('glpi_softwareversions.name' => array('condition' => "`glpi_softwareversions`.`softwares_id`\n = {$softwares_id}"), 'glpi_softwarelicenses.name' => array('itemlink_as_string' => true))));
Html::showMassiveActions($massiveactionparams);
}
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr><th>";
$header_top = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_end = '';
foreach ($columns as $key => $val) {
// Non order column
if ($key[0] == '_') {
$header_end .= "<th>{$val}</th>";
} else {
$header_end .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>{$val}</a></th>";
}
}
$header_end .= "</tr>\n";
echo $header_begin . $header_top . $header_end;
$tot_assoc = 0;
for ($tot = 0; $data = $DB->fetch_assoc($result);) {
Session::addToNavigateListItems('SoftwareLicense', $data['id']);
$expired = true;
if (is_null($data['expire']) || $data['expire'] > date('Y-m-d')) {
$expired = false;
}
echo "<tr class='tab_bg_2" . ($expired ? '_2' : '') . "'>";
if ($license->canEdit($data['id'])) {
echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
} else {
echo "<td> </td>";
}
echo "<td><a href='softwarelicense.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a></td>";
if (isset($columns['entity'])) {
echo "<td>";
echo $data['entity'];
echo "</td>";
}
echo "<td>" . $data['serial'] . "</td>";
echo "<td class='numeric'>" . ($data['number'] > 0 ? $data['number'] : __('Unlimited')) . "</td>";
$nb_assoc = Computer_SoftwareLicense::countForLicense($data['id']);
$tot_assoc += $nb_assoc;
$color = $data['is_valid'] ? 'green' : 'red';
echo "<td class='numeric {$color}'>" . $nb_assoc . "</td>";
//.........这里部分代码省略.........
示例5: showForBudget
public static function showForBudget($budgets_id)
{
global $DB, $CFG_GLPI;
$table = getTableForItemType(__CLASS__);
$query = "SELECT *\n FROM `{$table}`\n WHERE `budgets_id` = '{$budgets_id}'\n AND `is_template`='0'\n ORDER BY `entities_id`, `name` ";
$result = $DB->query($query);
$nb = $DB->numrows($result);
echo "<div class='center'>";
if ($nb) {
$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
$query_limit = $query . " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
Html::printAjaxPager(__("Linked orders", "order"), $start, $nb);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th style='width:15%;'>" . _n("Action", "Actions", 2) . "</th>";
echo "<th>" . __("Name") . "</th>";
echo "<th>" . __("Order status", "order") . "</th>";
echo "<th>" . __("Entity") . "</th>";
echo "<th>" . __("Price tax free", "order") . "</th>";
echo "<th>" . __("Price ATI", "order") . "</th>";
echo "</tr>";
$total = 0;
foreach ($DB->request($query_limit) as $data) {
$PluginOrderOrder_Item = new PluginOrderOrder_Item();
$prices = $PluginOrderOrder_Item->getAllPrices($data["id"]);
$postagewithTVA = $PluginOrderOrder_Item->getPricesATI($data["port_price"], Dropdown::getDropdownName("glpi_plugin_order_ordertaxes", $data["plugin_order_ordertaxes_id"]));
$total += $prices["priceTTC"] + $postagewithTVA;
$link = Toolbox::getItemTypeFormURL(__CLASS__);
echo "<tr class='tab_bg_1' align='center'>";
echo "<td>";
echo "<a href=\"" . $link . "?unlink_order=unlink_order&id=" . $data["id"] . "\">" . __("Unlink", "order") . "</a>";
echo "</td>";
echo "<td>";
if (self::canView()) {
echo "<a href=\"" . $link . "?id=" . $data["id"] . "\">" . $data["name"] . "</a>";
} else {
echo $data["name"];
}
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName(getTableForItemType('PluginOrderOrderState'), $data["plugin_order_orderstates_id"]);
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName("glpi_entities", $data["entities_id"]);
echo "</td>";
echo "<td>";
echo Html::formatNumber($prices["priceHT"]);
echo "</td>";
echo "<td>";
echo Html::formatNumber($prices["priceTTC"] + $postagewithTVA);
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
echo "<br><div class='center'>";
echo "<table class='tab_cadre' width='15%'>";
echo "<tr class='tab_bg_2'><td>" . __("Budget already used") . ": </td>";
echo "<td>";
echo Html::formatNumber($total) . "</td>";
echo "</tr>";
echo "</table></div>";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><td class='center'>" . __("No item to display") . "</td></tr>";
echo "</table>";
}
}
示例6: showItems
/**
* Show items for the group
*
* @param $tech boolean false search groups_id, true, search groups_id_tech
**/
function showItems($tech)
{
global $DB, $CFG_GLPI;
$rand = mt_rand();
$ID = $this->fields['id'];
if ($tech) {
$types = $CFG_GLPI['linkgroup_tech_types'];
$field = 'groups_id_tech';
$title = __('Managed items');
} else {
$types = $CFG_GLPI['linkgroup_types'];
$field = 'groups_id';
$title = __('Used items');
}
$tree = Session::getSavedOption(__CLASS__, 'tree', 0);
$user = Session::getSavedOption(__CLASS__, 'user', 0);
$type = Session::getSavedOption(__CLASS__, 'onlytype', '');
if (!in_array($type, $types)) {
$type = '';
}
echo "<div class='spaced'>";
// Mini Search engine
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='3'>{$title}</tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
echo __('Type') . " ";
Dropdown::showItemType($types, array('value' => $type, 'name' => 'onlytype', 'plural' => true, 'on_change' => 'reloadTab("start=0&onlytype="+this.value)', 'checkright' => true));
if ($this->haveChildren()) {
echo "</td><td class='center'>" . __('Child groups') . " ";
Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
} else {
$tree = 0;
}
if ($this->getField('is_usergroup')) {
echo "</td><td class='center'>" . User::getTypeName(Session::getPluralNumber()) . " ";
Dropdown::showYesNo('user', $user, -1, array('on_change' => 'reloadTab("start=0&user="+this.value)'));
} else {
$user = 0;
}
echo "</td></tr></table>";
$datas = array();
if ($type) {
$types = array($type);
}
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$nb = $this->getDataItems($types, $field, $tree, $user, $start, $datas);
$nbcan = 0;
if ($nb) {
Html::printAjaxPager('', $start, $nb);
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
echo Html::hidden('field', array('value' => $field, 'data-glpicore-ma-tags' => 'common'));
$massiveactionparams = array('num_displayed' => $nb, 'check_itemtype' => 'Group', 'check_items_id' => $ID, 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('is_tech' => $tech, 'massive_action_fields' => array('field')), 'specific_actions' => array(__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'changegroup' => __('Move')));
Html::showMassiveActions($massiveactionparams);
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr><th width='10'>";
$header_top = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom = Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_end = '</th>';
$header_end .= "<th>" . __('Type') . "</th><th>" . __('Name') . "</th><th>" . __('Entity') . "</th>";
if ($tree || $user) {
$header_end .= "<th>" . sprintf(__('%1$s / %2$s'), self::getTypeName(1), User::getTypeName(1)) . "</th>";
}
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
$tuser = new User();
$group = new Group();
foreach ($datas as $data) {
if (!($item = getItemForItemtype($data['itemtype']))) {
continue;
}
echo "<tr class='tab_bg_1'><td>";
if ($item->canEdit($data['items_id'])) {
Html::showMassiveActionCheckBox($data['itemtype'], $data['items_id']);
}
echo "</td><td>" . $item->getTypeName(1);
echo "</td><td>" . $item->getLink(array('comments' => true));
echo "</td><td>" . Dropdown::getDropdownName("glpi_entities", $item->getEntityID());
if ($tree || $user) {
echo "</td><td>";
if ($grp = $item->getField($field)) {
if ($group->getFromDB($grp)) {
echo $group->getLink(array('comments' => true));
}
} else {
if ($usr = $item->getField(str_replace('groups', 'users', $field))) {
if ($tuser->getFromDB($usr)) {
echo $tuser->getLink(array('comments' => true));
}
}
}
}
echo "</td></tr>";
}
echo $header_begin . $header_bottom . $header_end;
echo "</table>";
//.........这里部分代码省略.........
示例7: showReport
function showReport($params)
{
global $CFG_GLPI;
$PluginAddressingReport = new PluginAddressingReport();
// Default values of parameters
$default_values["start"] = $start = 0;
$default_values["id"] = $id = 0;
$default_values["export"] = $export = false;
foreach ($default_values as $key => $val) {
if (isset($params[$key])) {
${$key} = $params[$key];
}
}
if ($this->getFromDB($id)) {
$result = $this->compute($start);
$nbipf = 0;
// ip libres
$nbipr = 0;
// ip reservees
$nbipt = 0;
// ip trouvees
$nbipd = 0;
// doublons
foreach ($result as $ip => $lines) {
if (count($lines)) {
if (count($lines) > 1) {
$nbipd++;
}
if (isset($lines[0]['pname']) && strstr($lines[0]['pname'], "reserv")) {
$nbipr++;
}
$nbipt++;
} else {
$nbipf++;
}
}
////title
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2 left'>";
echo "<td>";
if ($this->fields['free_ip']) {
echo __('Number of free ip', 'addressing') . " " . $nbipf . "<br>";
}
if ($this->fields['reserved_ip']) {
echo __('Number of reserved ip', 'addressing') . " " . $nbipr . "<br>";
}
if ($this->fields['alloted_ip']) {
echo __('Number of assigned ip (no doubles)', 'addressing') . " " . $nbipt . "<br>";
}
if ($this->fields['double_ip']) {
echo __('Doubles', 'addressing') . " " . $nbipd . "<br>";
}
echo "</td>";
echo "<td>";
if ($this->fields['double_ip']) {
echo "<span class='plugin_addressing_ip_double'>" . __('Red row', 'addressing') . "</span> - " . __('Same Ip', 'addressing') . "<br>";
}
if (isset($this->fields['use_ping']) && $this->fields['use_ping']) {
echo __('Ping free Ip', 'addressing') . "<br>";
echo "<span class='plugin_addressing_ping_off'>" . __('Ping: got a response - used Ip', 'addressing') . "</span><br>";
echo "<span class='plugin_addressing_ping_on'>" . __('Ping: no response - free Ip', 'addressing') . "</span>";
} else {
echo "<span class='plugin_addressing_ip_free'>" . __('Blue row', 'addressing') . "</span> - " . __('Free Ip', 'addressing') . "<br>";
}
echo "</td></tr>";
echo "<tr><td colspan='2' align='center'>";
echo "<a href='./report.form.php?id=" . $this->getID() . "&export=true'>" . __('Export') . "</a>";
echo "</td></tr>";
echo "</table>";
echo "</div>";
$numrows = 1 + ip2long($this->fields['end_ip']) - ip2long($this->fields['begin_ip']);
if (strpos($_SERVER['PHP_SELF'], "report.form.php")) {
Html::printPager($start, $numrows, $_SERVER['PHP_SELF'], "start={$start}&id=" . $id, 'PluginAddressingReport');
} else {
Html::printAjaxPager("", $start, $numrows);
}
//////////////////////////liste ips////////////////////////////////////////////////////////////
$ping_response = $PluginAddressingReport->displayReport($result, $this);
if ($this->fields['use_ping']) {
$total_realfreeip = $nbipf - $ping_response;
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2 center'>";
echo "<td>";
echo __('Real free Ip (Ping=KO)', 'addressing') . " " . $total_realfreeip;
echo "</td></tr>";
echo "</table>";
}
echo "</div>";
} else {
echo "<div class='center'>" . "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt='warning'><br><br><b>" . __('Problem detected with the IP Range', 'addressing') . "</b></div>";
}
}
示例8: showErrorLog
function showErrorLog()
{
$fic = GLPI_LOG_DIR . "/ocsng_fullsync.log";
if (!is_file($fic)) {
return false;
}
$size = filesize($fic);
if ($size > 20000) {
$logfile = file_get_contents($fic, 0, NULL, $size - 20000, 20000);
$events = explode("\n", $logfile);
// Remove fist partial event
array_shift($events);
} else {
$logfile = file_get_contents($fic);
$events = explode("\n\n", $logfile);
}
// Remove last empty event
array_pop($events);
$number = count($events);
$SEARCH_OPTION = getSearchOptions();
if (isset($_REQUEST["start"])) {
$start = $_REQUEST["start"];
} else {
$start = 0;
}
if ($number < 1) {
return $this->lognothing();
}
if ($start > $number) {
$start = $number;
}
// Display the pager
Html::printAjaxPager("Logfile: ocsng_fullsync.log", $start, $number);
// Output events
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th>Message</th></tr>";
for ($i = $start; $i < $start + $_SESSION['glpilist_limit'] && $i < count($events); $i++) {
$lines = explode("\n", $events[$i]);
echo "<tr class='tab_bg_2 top'><td>" . $lines[0] . "</td>";
echo "</tr>";
}
echo "</table></div>";
}
示例9: showReferencesFromSupplier
public static function showReferencesFromSupplier($ID)
{
global $DB, $CFG_GLPI;
if (isset($_POST["start"])) {
$start = $_POST["start"];
} else {
$start = 0;
}
$query = "SELECT `gr`.`id`, `gr`.`manufacturers_id`, `gr`.`entities_id`, `gr`.`itemtype`, `gr`.`name`,\n `grm`.`price_taxfree`, `grm`.`reference_code`\n FROM `glpi_plugin_order_references_suppliers` AS grm, `glpi_plugin_order_references` AS gr\n WHERE `grm`.`suppliers_id` = '{$ID}'\n AND `grm`.`plugin_order_references_id` = `gr`.`id`" . getEntitiesRestrictRequest(" AND ", "gr", '', '', true);
$query_limit = $query . " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
$nb = $DB->numrows($result);
echo "<div class='center'>";
if ($nb) {
$result = $DB->query($query_limit);
Html::printAjaxPager(__("List references", "order"), $start, $nb);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th>" . __("Entity") . "</th>";
echo "<th>" . __("Manufacturer") . "</th>";
echo "<th>" . __("Product reference", "order") . "</th>";
echo "<th>" . __("Reference") . "</th>";
echo "<th>" . __("Product reference", "order") . "</th>";
echo "<th>" . __("Unit price tax free", "order") . "</th></tr>";
while ($data = $DB->fetch_array($result)) {
echo "<tr class='tab_bg_1' align='center'>";
echo "<td>";
echo Dropdown::getDropdownName("glpi_entities", $data["entities_id"]);
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName("glpi_manufacturers", $data["manufacturers_id"]);
echo "</td>";
echo "<td>";
$PluginOrderReference = new PluginOrderReference();
echo $PluginOrderReference->getReceptionReferenceLink($data);
echo "</td>";
echo "<td>";
$item = new $data["itemtype"]();
echo $item->getTypeName();
echo "</td>";
echo "<td>";
echo $data['reference_code'];
echo "</td>";
echo "<td>";
echo number_format($data["price_taxfree"], 2);
echo "</td>";
echo "</tr>";
}
}
echo "</table>";
echo "</div>";
}
示例10: showItems
/**
* Print the HTML array of items for a location
*
* @since version 0.85
*
* @return Nothing (display)
**/
function showItems()
{
global $DB, $CFG_GLPI;
$locations_id = $this->fields['id'];
$crit = Session::getSavedOption(__CLASS__, 'criterion', '');
if (!$this->can($locations_id, READ)) {
return false;
}
$first = 1;
$query = '';
if ($crit) {
$table = getTableForItemType($crit);
$query = "SELECT `{$table}`.`id`, '{$crit}' AS type\n FROM `{$table}`\n WHERE `{$table}`.`locations_id` = '{$locations_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id");
} else {
foreach ($CFG_GLPI['location_types'] as $type) {
$table = getTableForItemType($type);
$query .= ($first ? "SELECT " : " UNION SELECT ") . "`id`, '{$type}' AS type\n FROM `{$table}`\n WHERE `{$table}`.`locations_id` = '{$locations_id}' " . getEntitiesRestrictRequest(" AND", $table, "entities_id");
$first = 0;
}
}
$result = $DB->query($query);
$number = $DB->numrows($result);
$start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0;
if ($start >= $number) {
$start = 0;
}
// Mini Search engine
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Type') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
echo __('Type') . " ";
Dropdown::showItemType($CFG_GLPI['location_types'], array('value' => $crit, 'on_change' => 'reloadTab("start=0&criterion="+this.value)'));
echo "</td></tr></table>";
if ($number) {
echo "<div class='spaced'>";
Html::printAjaxPager('', $start, $number);
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Type') . "</th>";
echo "<th>" . __('Entity') . "</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Serial number') . "</th>";
echo "<th>" . __('Inventory number') . "</th>";
echo "</tr>";
$DB->data_seek($result, $start);
for ($row = 0; ($data = $DB->fetch_assoc($result)) && $row < $_SESSION['glpilist_limit']; $row++) {
$item = getItemForItemtype($data['type']);
$item->getFromDB($data['id']);
echo "<tr class='tab_bg_1'><td class='center top'>" . $item->getTypeName() . "</td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $item->getEntityID());
echo "</td><td class='center'>" . $item->getLink() . "</td>";
echo "<td class='center'>" . (isset($item->fields["serial"]) ? "" . $item->fields["serial"] . "" : "-");
echo "</td>";
echo "<td class='center'>" . (isset($item->fields["otherserial"]) ? "" . $item->fields["otherserial"] . "" : "-");
echo "</td></tr>";
}
} else {
echo "<p class='center b'>" . __('No item found') . "</p>";
}
echo "</table></div>";
}
示例11: showForLicense
/**
* Show users linked to a License
*
* @param $license SoftwareLicense object
*
* @return nothing
**/
static function showForLicense(SoftwareLicense $license)
{
global $DB, $CFG_GLPI;
$searchID = $license->getField('id');
if (!Software::canView() || !$searchID) {
return false;
}
$canedit = PluginFpsoftwareVersionhelper::checkRights("software", array(CREATE, UPDATE, DELETE, PURGE), "Or");
$canshowuser = User::canView();
if (isset($_GET["start"])) {
$start = $_GET["start"];
} else {
$start = 0;
}
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
//SoftwareLicense ID
$query_number = "SELECT COUNT(*) AS cpt\n FROM `glpi_users_softwarelicenses`\n INNER JOIN `glpi_users`\n ON (`glpi_users_softwarelicenses`.`users_id`\n = `glpi_users`.`id`)\n WHERE `glpi_users_softwarelicenses`.`softwarelicenses_id` = '{$searchID}'";
$number = 0;
if ($result = $DB->query($query_number)) {
$number = $DB->result($result, 0, 0);
}
echo "<div class='center'>";
if ($canedit) {
echo "<form method='post' action='" . $CFG_GLPI["root_doc"] . self::$front_url . "/front/user_softwarelicense.form.php'>";
echo "<input type='hidden' name='softwarelicenses_id' value='{$searchID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'>";
echo "<td>";
//FOR NOW ALL USERS ARE SHOWN, DON'T KNOW IF THERE SHOULD BE ANY RESTRICTION.
//ALSO IT CAUSES A POSSIBILITY TO ONE USER MANY TIMES.
User::dropdown(array('right' => 'all'));
echo "</td>";
echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
}
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table></div>\n";
return;
}
// Display the pager
Html::printAjaxPager(__('Affected users'), $start, $number);
$query = "SELECT `glpi_users_softwarelicenses`.*,\n `glpi_users`.`name` AS username,\n `glpi_users`.`id` AS userid,\n `glpi_users`.`realname` AS userrealname,\n `glpi_users`.`firstname` AS userfirstname,\n `glpi_softwarelicenses`.`name` AS license,\n `glpi_softwarelicenses`.`id` AS lID\n FROM `glpi_users_softwarelicenses`\n INNER JOIN `glpi_softwarelicenses`\n ON (`glpi_users_softwarelicenses`.`softwarelicenses_id`\n = `glpi_softwarelicenses`.`id`)\n INNER JOIN `glpi_users`\n ON (`glpi_users_softwarelicenses`.`users_id` = `glpi_users`.`id`)\n WHERE `glpi_softwarelicenses`.`id` = '{$searchID}'\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$rand = mt_rand();
if ($result = $DB->query($query)) {
if ($data = $DB->fetch_assoc($result)) {
if ($canedit) {
$rand = mt_rand();
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
list($higher_version, $massiveactionparams) = PluginFpsoftwareVersionhelper::massiveActionParams($rand, __CLASS__);
// Options to update license
$massiveactionparams['extraparams']['options']['move']['used'] = array($searchID);
$massiveactionparams['extraparams']['options']['move']['softwares_id'] = $license->fields['softwares_id'];
Html::showMassiveActions($higher_version ? $massiveactionparams : __CLASS__, $massiveactionparams);
}
$soft = new Software();
$soft->getFromDB($license->fields['softwares_id']);
$text = sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $soft->fields["name"]);
$text = sprintf(__('%1$s - ID %2$s'), $text, $license->fields['softwares_id']);
Session::initNavigateListItems('User', $text);
echo "<table class='tab_cadre_fixehov'>";
$columns = array('username' => __('Username'), 'userrealname' => __('Surname'), 'userfirstname' => __('First name'), 'added' => __('Added'));
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_end .= "</th>";
}
foreach ($columns as $key => $val) {
// Non order column
$header_end .= "<th>{$val}</th>";
}
$header_end .= "</tr>\n";
echo $header_begin . $header_top . $header_end;
do {
Session::addToNavigateListItems('User', $data["userid"]);
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
}
if ($canshowuser) {
echo "<td><a href='user.form.php?id=" . $data['userid'] . "'>" . $data['username'] . "</a></td>";
//.........这里部分代码省略.........
示例12: showUsersLicenses
/**
* Show table with linked licenses to user
* @param Software $software
* @return bool
*/
private static function showUsersLicenses(Software $software)
{
global $DB;
$softwareId = $software->getField("id");
$totalRecordsCount = self::countLicenses($software);
$currentPage = isset($_GET["start"]) ? $_GET["start"] : 0;
$sortingOrder = SortingOrder::getFromString($_GET["order"]);
$columnKeys = array_keys(self::getColumns());
$sortingColumn = array_key_exists($_GET["sort"], self::getColumns()) ? $_GET["sort"] : reset($columnKeys);
$queryResult = $DB->query(self::getDataQuery($softwareId, $currentPage, $sortingColumn, $sortingOrder));
$options = PluginFpsoftwareConfig::getConfigValues(array('group_by_users'));
Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount);
echo self::printTableBegin();
echo self::printGridColumnsHeaders($sortingOrder, $sortingColumn);
if ($totalRecordsCount > 0) {
while ($data = $DB->fetch_assoc($queryResult)) {
echo "<tr class='tab_bg_1'>";
echo "<td class='left'><a href='softwarelicense.form.php?id=" . $data['license_id'] . "'>" . $data["license_name"] . "</a> - " . $data["license_serial"] . " (" . $data["license_type"] . ") " . "</td>";
echo "<td class='left'><a href='user.form.php?id=" . $data['user_id'] . "'>" . $data["user_name"] . "</a></td>";
if ($options['group_by_users']) {
$computers = array();
if ($data['computer_ids']) {
$computer_ids = explode(';|;', $data['computer_ids']);
$computer_names = explode(';|;', $data['computer_names']);
foreach ($computer_ids as $index => $computer_id) {
$computers[] = " <a href='computer.form.php?id=" . $computer_id . "'>" . $computer_names[$index] . "</a>";
}
}
echo "<td class='left'>";
echo implode("<br /><br />", $computers) . "</td>";
} else {
echo "<td class='left'><a href='computer.form.php?id=" . $data['computer_id'] . "'>" . $data["computer_name"] . "</a></td>";
}
echo "<td class='left'><a href='location.form.php?id=" . $data['location_id'] . "'>" . $data["location_name"] . "</a></td>";
echo "</tr>";
}
} else {
echo "<tr class='tab_bg_1'><td class='center' colspan='3'>No results.</td></tr>";
}
Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount);
echo self::printTableEnd();
return true;
}
示例13: showInstallations
/**
* Show installations of a software
*
* @param $searchID value of the ID to search
* @param $crit to search : softwares_id (software) or id (version)
*
* @return nothing
**/
private static function showInstallations($searchID, $crit)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight("software", "r") || !$searchID) {
return false;
}
$canedit = Session::haveRight("software", "w");
$canshowcomputer = Session::haveRight("computer", "r");
if (isset($_POST["start"])) {
$start = $_POST["start"];
} else {
$start = 0;
}
if (isset($_POST["order"]) && $_POST["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (isset($_POST["sort"]) && !empty($_POST["sort"])) {
// manage several param like location,compname : order first
$tmp = explode(",", $_POST["sort"]);
$sort = "`" . implode("` {$order},`", $tmp) . "`";
} else {
if ($crit == "softwares_id") {
$sort = "`entity` {$order}, `version`, `compname`";
} else {
$sort = "`entity` {$order}, `compname`";
}
}
// Total Number of events
if ($crit == "softwares_id") {
// Software ID
$query_number = "SELECT COUNT(*) AS cpt\n FROM `glpi_computers_softwareversions`\n INNER JOIN `glpi_softwareversions`\n ON (`glpi_computers_softwareversions`.`softwareversions_id`\n = `glpi_softwareversions`.`id`)\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwareversions`.`computers_id`\n = `glpi_computers`.`id`)\n WHERE `glpi_softwareversions`.`softwares_id` = '{$searchID}'" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwareversions`.`is_deleted` = '0'";
} else {
//SoftwareVersion ID
$query_number = "SELECT COUNT(*) AS cpt\n FROM `glpi_computers_softwareversions`\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwareversions`.`computers_id`\n = `glpi_computers`.`id`)\n WHERE `glpi_computers_softwareversions`.`softwareversions_id`\n = '{$searchID}'" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwareversions`.`is_deleted` = '0'";
}
$number = 0;
if ($result = $DB->query($query_number)) {
$number = $DB->result($result, 0, 0);
}
echo "<div class='center'>";
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table></div>\n";
return;
}
// Display the pager
Html::printAjaxPager(self::getTypeName(2), $start, $number);
$query = "SELECT DISTINCT `glpi_computers_softwareversions`.*,\n `glpi_computers`.`name` AS compname,\n `glpi_computers`.`id` AS cID,\n `glpi_computers`.`serial`,\n `glpi_computers`.`otherserial`,\n `glpi_users`.`name` AS username,\n `glpi_users`.`id` AS userid,\n `glpi_users`.`realname` AS userrealname,\n `glpi_users`.`firstname` AS userfirstname,\n `glpi_softwareversions`.`name` AS version,\n `glpi_softwareversions`.`id` AS vID,\n `glpi_softwareversions`.`softwares_id` AS sID,\n `glpi_softwareversions`.`name` AS vername,\n `glpi_entities`.`completename` AS entity,\n `glpi_locations`.`completename` AS location,\n `glpi_states`.`name` AS state,\n `glpi_groups`.`name` AS groupe\n FROM `glpi_computers_softwareversions`\n INNER JOIN `glpi_softwareversions`\n ON (`glpi_computers_softwareversions`.`softwareversions_id`\n = `glpi_softwareversions`.`id`)\n INNER JOIN `glpi_computers`\n ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n LEFT JOIN `glpi_entities` ON (`glpi_computers`.`entities_id` = `glpi_entities`.`id`)\n LEFT JOIN `glpi_locations`\n ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)\n LEFT JOIN `glpi_states` ON (`glpi_computers`.`states_id` = `glpi_states`.`id`)\n LEFT JOIN `glpi_groups` ON (`glpi_computers`.`groups_id` = `glpi_groups`.`id`)\n LEFT JOIN `glpi_users` ON (`glpi_computers`.`users_id` = `glpi_users`.`id`)\n WHERE (`glpi_softwareversions`.`{$crit}` = '{$searchID}') " . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n AND `glpi_computers`.`is_deleted` = '0'\n AND `glpi_computers`.`is_template` = '0'\n AND `glpi_computers_softwareversions`.`is_deleted` = '0'\n ORDER BY {$sort} {$order}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$rand = mt_rand();
if ($result = $DB->query($query)) {
if ($data = $DB->fetch_assoc($result)) {
$softwares_id = $data['sID'];
$soft = new Software();
$showEntity = $soft->getFromDB($softwares_id) && $soft->isRecursive();
$linkUser = Session::haveRight('user', 'r');
$title = $soft->fields["name"];
if ($crit == "id") {
$title = sprintf(__('%1$s - %2$s'), $title, $data["vername"]);
}
Session::initNavigateListItems('Computer', sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $title));
$sort_img = "<img src='" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "' alt=''\n title=''>";
if ($canedit) {
$rand = mt_rand();
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$paramsma = array('num_displayed' => $_SESSION['glpilist_limit'], 'specific_actions' => array('move_version' => _x('button', 'Move'), 'purge' => _x('button', 'Delete permanently')));
// Options to update version
$paramsma['extraparams']['options']['move']['softwares_id'] = $softwares_id;
if ($crit == 'softwares_id') {
$paramsma['extraparams']['options']['move']['used'] = array();
} else {
$paramsma['extraparams']['options']['move']['used'] = array($searchID);
}
Html::showMassiveActions(__CLASS__, $paramsma);
}
echo "<table class='tab_cadre_fixehov'><tr>";
if ($canedit) {
echo "<th width='10'>";
Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
echo "</th>";
}
if ($crit == "softwares_id") {
echo "<th>" . ($sort == "`vername`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=vername&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>" . _n('Version', 'Versions', 2) . "</a></th>";
}
echo "<th>" . ($sort == "`compname`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=compname&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>" . __('Name') . "</a></th>";
if ($showEntity) {
echo "<th>" . (strstr($sort, "entity") ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=entity,compname&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>" . __('Entity') . "</a></th>";
}
echo "<th>" . ($sort == "`serial`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=serial&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>" . __('Serial number') . "</a></th>";
echo "<th>" . ($sort == "`otherserial`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort=otherserial&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>" . __('Inventory number') . "</a></th>";
//.........这里部分代码省略.........
示例14: showForItem
/**
* Show History of an item
*
* @param $item CommonDBTM object
* @param $withtemplate integer withtemplate param (default '')
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
global $DB;
$itemtype = $item->getType();
$items_id = $item->getField('id');
$SEARCHOPTION = Search::getOptions($itemtype);
if (isset($_POST["start"])) {
$start = $_POST["start"];
} else {
$start = 0;
}
// Total Number of events
$number = countElementsInTable("glpi_logs", "`items_id`='{$items_id}' AND `itemtype`='{$itemtype}'");
// No Events in database
if ($number < 1) {
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No historical') . "</th></tr>";
echo "</table>";
echo "</div><br>";
return;
}
// Display the pager
Html::printAjaxPager(self::getTypeName(1), $start, $number);
// Output events
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('ID') . "</th><th>" . __('Date') . "</th>";
echo "<th>" . __('User') . "</th><th>" . __('Field') . "</th>";
//TRANS: a noun, modification, change
echo "<th>" . _x('name', 'Update') . "</th></tr>";
foreach (self::getHistoryData($item, $start, $_SESSION['glpilist_limit']) as $data) {
if ($data['display_history']) {
// show line
echo "<tr class='tab_bg_2'>";
echo "<td>" . $data['id'] . "</td><td>" . $data['date_mod'] . "</td>" . "<td>" . $data['user_name'] . "</td><td>" . $data['field'] . "</td>";
echo "<td width='60%'>" . $data['change'] . "</td></tr>";
}
}
echo "</table></div>";
Html::printAjaxPager(self::getTypeName(1), $start, $number);
}
示例15: showForConsumableItem
/**
* Print out the consumables of a defined type
*
* @param $consitem ConsumableItem object
* @param $show_old boolean show old consumables or not. (default 0)
*
* @return Nothing (displays)
**/
static function showForConsumableItem(ConsumableItem $consitem, $show_old = 0)
{
global $DB, $CFG_GLPI;
$tID = $consitem->getField('id');
if (!$consitem->can($tID, READ)) {
return false;
}
if (isset($_GET["start"])) {
$start = $_GET["start"];
} else {
$start = 0;
}
$canedit = $consitem->can($tID, UPDATE);
$rand = mt_rand();
$where = "";
if (!$show_old) {
// NEW
$where = " AND `date_out` IS NULL\n ORDER BY `date_in`, `id`";
} else {
//OLD
$where = " AND `date_out` IS NOT NULL\n ORDER BY `date_out` DESC,\n `date_in`,\n `id`";
}
$number = countElementsInTable("glpi_consumables", "`consumableitems_id` = '{$tID}' {$where}");
$query = "SELECT `glpi_consumables`.*\n FROM `glpi_consumables`\n WHERE `consumableitems_id` = '{$tID}'\n {$where}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
echo "<div class='spaced'>";
// Display the pager
Html::printAjaxPager(Consumable::getTypeName(Session::getPluralNumber()), $start, $number);
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$actions = array('delete' => _x('button', 'Delete permanently'), 'Infocom' . MassiveAction::CLASS_ACTION_SEPARATOR . 'activate' => __('Enable the financial and administrative information'));
if ($show_old) {
$actions['Consumable' . MassiveAction::CLASS_ACTION_SEPARATOR . 'backtostock'] = __('Back to stock');
} else {
$actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'give'] = _x('button', 'Give');
}
$entparam = array('entities_id' => $consitem->getEntityID());
if ($consitem->isRecursive()) {
$entparam = array('entities_id' => getSonsOf('glpi_entities', $consitem->getEntityID()));
}
$massiveactionparams = array('num_displayed' => $number, 'specific_actions' => $actions, 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => $entparam);
Html::showMassiveActions($massiveactionparams);
echo "<input type='hidden' name='consumableitems_id' value='{$tID}'>\n";
}
echo "<table class='tab_cadre_fixehov'>";
if (!$show_old) {
echo "<tr><th colspan=" . ($canedit ? '5' : '4') . ">";
echo self::getCount($tID, -1);
echo "</th></tr>";
} else {
// Old
echo "<tr><th colspan='" . ($canedit ? '7' : '6') . "'>" . __('Used consumables') . "</th></tr>";
}
if ($number) {
$i = 0;
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th width='10'>";
$header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_end .= "</th>";
}
$header_end .= "<th>" . __('ID') . "</th>";
$header_end .= "<th>" . _x('item', 'State') . "</th>";
$header_end .= "<th>" . __('Add date') . "</th>";
if ($show_old) {
$header_end .= "<th>" . __('Use date') . "</th>";
$header_end .= "<th>" . __('Given to') . "</th>";
}
$header_end .= "<th width='200px'>" . __('Financial and administrative information') . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
while ($data = $DB->fetch_assoc($result)) {
$date_in = Html::convDate($data["date_in"]);
$date_out = Html::convDate($data["date_out"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
echo "</td>";
}
echo "<td class='center'>" . $data["id"] . "</td>";
echo "<td class='center'>" . self::getStatus($data["id"]) . "</td>";
echo "<td class='center'>" . $date_in . "</td>";
if ($show_old) {
echo "<td class='center'>" . $date_out . "</td>";
echo "<td class='center'>";
if ($item = getItemForItemtype($data['itemtype'])) {
if ($item->getFromDB($data['items_id'])) {
//.........这里部分代码省略.........