本文整理汇总了PHP中Session::initNavigateListItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::initNavigateListItems方法的具体用法?PHP Session::initNavigateListItems怎么用?PHP Session::initNavigateListItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::initNavigateListItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDatas
//.........这里部分代码省略.........
$linkto = $data['search']['target'] . (strpos($data['search']['target'], '?') ? '&' : '?') . "itemtype=" . $data['itemtype'] . "&sort=" . $val['id'] . "&order=" . ($data['search']['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $data['search']['start'] . "&" . $globallinkto;
}
$name = $val["name"];
// prefix by group name (corresponding to optgroup in dropdown) if exists
if (isset($val['groupname'])) {
$name = $val['groupname'] . " - " . $name;
}
// Not main itemtype add itemtype to display
if ($data['itemtype'] != $val['itemtype']) {
if (!isset($metanames[$val['itemtype']])) {
if ($metaitem = getItemForItemtype($val['itemtype'])) {
$metanames[$val['itemtype']] = $metaitem->getTypeName();
}
}
$name = sprintf(__('%1$s - %2$s'), $metanames[$val['itemtype']], $val["name"]);
}
$headers_line .= self::showHeaderItem($data['display_type'], $name, $header_num, $linkto, !$val['meta'] && $data['search']['sort'] == $val['id'], $data['search']['order']);
}
// Add specific column Header
if (isset($CFG_GLPI["union_search_type"][$data['itemtype']])) {
$headers_line .= self::showHeaderItem($data['display_type'], __('Item type'), $header_num);
}
// End Line for column headers
$headers_line .= self::showEndLine($data['display_type']);
$headers_line_top .= $headers_line;
if ($data['display_type'] == self::HTML_OUTPUT) {
$headers_line_bottom .= $headers_line;
}
$headers_line_top .= self::showEndHeader($data['display_type']);
// $headers_line_bottom .= self::showEndHeader($data['display_type']);
echo $headers_line_top;
// Init list of items displayed
if ($data['display_type'] == self::HTML_OUTPUT) {
Session::initNavigateListItems($data['itemtype']);
}
// Num of the row (1=header_line)
$row_num = 1;
$massiveaction_field = 'id';
if ($data['itemtype'] != 'AllAssets' && isset($CFG_GLPI["union_search_type"][$data['itemtype']])) {
$massiveaction_field = 'refID';
}
$typenames = array();
// Display Loop
foreach ($data['data']['rows'] as $rowkey => $row) {
// Column num
$item_num = 1;
$row_num++;
// New line
echo self::showNewLine($data['display_type'], $row_num % 2, $data['search']['is_deleted']);
$current_type = isset($row['TYPE']) ? $row['TYPE'] : $data['itemtype'];
$massiveaction_type = $current_type;
if ($data['itemtype'] != 'AllAssets' && isset($CFG_GLPI["union_search_type"][$data['itemtype']])) {
$massiveaction_type = $data['itemtype'];
}
// Add item in item list
Session::addToNavigateListItems($current_type, $row["id"]);
if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
// HTML display - massive modif
$tmpcheck = "";
if ($data['itemtype'] == 'Entity' && !in_array($row["id"], $_SESSION["glpiactiveentities"])) {
$tmpcheck = " ";
} else {
if ($data['item'] instanceof CommonDBTM && $data['item']->maybeRecursive() && !in_array($row["entities_id"], $_SESSION["glpiactiveentities"])) {
$tmpcheck = " ";
} else {
$tmpcheck = Html::getMassiveActionCheckBox($massiveaction_type, $row[$massiveaction_field]);
示例2: __construct
function __construct($name, $title, $itemtype, $options = array())
{
parent::__construct($name, $title, $options);
$this->obj = getItemForItemtype($itemtype);
if (isset($options['with_comment'])) {
$this->with_comment = $options['with_comment'];
}
if (isset($options['with_navigate'])) {
$this->with_navigate = $options['with_navigate'];
Session::initNavigateListItems($this->obj->getType(), _n('Report', 'Reports', 2));
}
}
示例3: showListForItem
//.........这里部分代码省略.........
$options['criteria'][0]['field'] = 71;
$options['criteria'][0]['searchtype'] = $tree ? 'under' : 'equals';
$options['criteria'][0]['value'] = $item->getID();
$options['criteria'][0]['link'] = 'AND';
break;
default:
$restrict = "(`glpi_items_tickets`.`items_id` = '" . $item->getID() . "' " . " AND `glpi_items_tickets`.`itemtype` = '" . $item->getType() . "')";
// you can only see your tickets
if (!Session::haveRight(self::$rightname, self::READALL)) {
$restrict .= " AND (`glpi_tickets`.`users_id_recipient` = '" . Session::getLoginUserID() . "'\n OR (`glpi_tickets_users`.`tickets_id` = '" . $item->getID() . "'\n AND `glpi_tickets_users`.`users_id`\n = '" . Session::getLoginUserID() . "'))";
}
$order = '`glpi_tickets`.`date_mod` DESC';
$options['criteria'][0]['field'] = 12;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = 'all';
$options['criteria'][0]['link'] = 'AND';
$options['metacriteria'][0]['itemtype'] = $item->getType();
$options['metacriteria'][0]['field'] = Search::getOptionNumber($item->getType(), 'id');
$options['metacriteria'][0]['searchtype'] = 'equals';
$options['metacriteria'][0]['value'] = $item->getID();
$options['metacriteria'][0]['link'] = 'AND';
break;
}
$query = "SELECT " . self::getCommonSelect() . "\n FROM `glpi_tickets` " . self::getCommonLeftJoin() . "\n WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n ORDER BY {$order}\n LIMIT " . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
$number = $DB->numrows($result);
$colspan = 11;
if (count($_SESSION["glpiactiveentities"]) > 1) {
$colspan++;
}
// Ticket for the item
echo "<div class='firstbloc'>";
// Link to open a new ticket
if ($item->getID() && Ticket::isPossibleToAssignType($item->getType()) && self::canCreate()) {
Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/ticket.form.php", '_add_fromitem', __('New ticket for this item...'), array('itemtype' => $item->getType(), 'items_id' => $item->getID()));
}
echo "</div><div>";
if ($number > 0) {
echo "<table class='tab_cadre_fixehov'>";
if (Session::haveRight(self::$rightname, self::READALL)) {
Session::initNavigateListItems('Ticket', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
echo "<tr class='noHover'><th colspan='{$colspan}'>";
$title = sprintf(_n('Last %d ticket', 'Last %d tickets', $number), $number);
$link = "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&') . "'>" . __('Show all') . "</a>";
$title = printf(__('%1$s (%2$s)'), $title, $link);
echo "</th></tr>";
} else {
echo "<tr><th colspan='{$colspan}'>" . __("You don't have right to see all tickets") . "</th></tr>";
}
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No ticket found.') . "</th></tr>";
}
if ($item->getID() && $item->getType() == 'User' && self::canCreate()) {
echo "<tr><td class='tab_bg_2 center b' colspan='{$colspan}'>";
Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/ticket.form.php", '_add_fromitem', __('New ticket for this item...'), array('_users_id_requester' => $item->getID()));
echo "</td></tr>";
}
// Ticket list
if ($number > 0) {
self::commonListHeader(Search::HTML_OUTPUT);
while ($data = $DB->fetch_assoc($result)) {
Session::addToNavigateListItems('Ticket', $data["id"]);
self::showShort($data["id"]);
}
self::commonListHeader(Search::HTML_OUTPUT);
}
echo "</table></div>";
// Tickets for linked items
$linkeditems = $item->getLinkedItems();
$restrict = array();
if (count($linkeditems)) {
foreach ($linkeditems as $ltype => $tab) {
foreach ($tab as $lID) {
$restrict[] = "(`glpi_items_tickets`.`itemtype` = '{$ltype}' AND `glpi_items_tickets`.`items_id` = '{$lID}')";
}
}
}
if (count($restrict) && Session::haveRight(self::$rightname, self::READALL)) {
$query = "SELECT " . self::getCommonSelect() . "\n FROM `glpi_tickets` " . self::getCommonLeftJoin() . "\n WHERE " . implode(' OR ', $restrict) . getEntitiesRestrictRequest(' AND ', 'glpi_tickets') . "\n ORDER BY `glpi_tickets`.`date_mod` DESC\n LIMIT " . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<div class='spaced'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='12'>";
echo _n('Ticket on linked items', 'Tickets on linked items', $number);
echo "</th></tr>";
if ($number > 0) {
self::commonListHeader(Search::HTML_OUTPUT);
while ($data = $DB->fetch_assoc($result)) {
// Session::addToNavigateListItems(TRACKING_TYPE,$data["id"]);
self::showShort($data["id"]);
}
self::commonListHeader(Search::HTML_OUTPUT);
} else {
echo "<tr><th>" . __('No ticket found.') . "</th></tr>";
}
echo "</table></div>";
}
// Subquery for linked item
}
示例4: showList
/**
* Print out list kb item
*
* @param $options $_GET
* @param $type string search type : browse / search (default search)
**/
static function showList($options, $type = 'search')
{
global $DB, $CFG_GLPI;
// Default values of parameters
$params['faq'] = !Session::haveRight("knowbase", "r");
$params["start"] = "0";
$params["knowbaseitemcategories_id"] = "0";
$params["contains"] = "";
$params["target"] = $_SERVER['PHP_SELF'];
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$ki = new self();
switch ($type) {
case 'myunpublished':
if (!Session::haveRight('knowbase', 'w') && !Session::haveRight('faq', 'w')) {
return false;
}
break;
case 'allunpublished':
if (!Session::haveRight('knowbase_admin', 1)) {
return false;
}
break;
default:
break;
}
if (!$params["start"]) {
$params["start"] = 0;
}
$query = self::getListRequest($params, $type);
// Get it from database
if ($result = $DB->query($query)) {
$KbCategory = new KnowbaseItemCategory();
$title = "";
if ($KbCategory->getFromDB($params["knowbaseitemcategories_id"])) {
$title = empty($KbCategory->fields['name']) ? "(" . $params['knowbaseitemcategories_id'] . ")" : $KbCategory->fields['name'];
$title = sprintf(__('%1$s: %2$s'), __('Category'), $title);
}
Session::initNavigateListItems('KnowbaseItem', $title);
$numrows = $DB->numrows($result);
$list_limit = $_SESSION['glpilist_limit'];
$showwriter = in_array($type, array('myunpublished', 'allunpublished', 'allmy'));
// Limit the result, if no limit applies, use prior result
if ($numrows > $list_limit && !isset($_GET['export_all'])) {
$query_limit = $query . " LIMIT " . intval($params["start"]) . ", " . intval($list_limit) . " ";
$result_limit = $DB->query($query_limit);
$numrows_limit = $DB->numrows($result_limit);
} else {
$numrows_limit = $numrows;
$result_limit = $result;
}
if ($numrows_limit > 0) {
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq=" . $params['faq'];
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$parameters .= "&item_items_id=" . $options['item_items_id'] . "&item_itemtype=" . $options['item_itemtype'];
}
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Subject'), $header_num);
if ($output_type != Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, __('Content'), $header_num);
}
if ($showwriter) {
echo Search::showHeaderItem($output_type, __('Writer'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Category'), $header_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_assoc($result_limit);
Session::addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
if ($output_type == Search::HTML_OUTPUT) {
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
//.........这里部分代码省略.........
示例5: showAesKey
public function showAesKey($ID)
{
global $DB;
$this->h->getFromDB($ID);
Session::initNavigateListItems("PluginAccountsAesKey", __('Hash', 'accounts') . " = " . $this->h->fields["name"]);
$candelete = $this->h->can($ID, 'w');
$query = "SELECT *\n FROM `glpi_plugin_accounts_aeskeys`\n WHERE `plugin_accounts_hashes_id` = '{$ID}' ";
$result = $DB->query($query);
$rand = mt_rand();
echo "<div class='center'>";
echo "<form method='post' name='show_aeskey{$rand}' id='show_aeskey{$rand}' action=\"./aeskey.form.php\">";
echo "<input type='hidden' name='plugin_accounts_hashes_id' value='" . $ID . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='5'>" . __('Encryption key', 'accounts') . "</th></tr>";
echo "<tr><th> </th>";
echo "<th class='left'>" . __('Name') . "</th>";
echo "</tr>";
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_array($result)) {
Session::addToNavigateListItems("PluginAccountsAesKey", $data['id']);
echo "<input type='hidden' name='item[" . $data["id"] . "]' value='" . $ID . "'>";
echo "<tr class='tab_bg_1 center'>";
echo "<td width='10'>";
if ($candelete) {
echo "<input type='checkbox' name='check[" . $data["id"] . "]'";
if (isset($_POST['check']) && $_POST['check'] == 'all') {
echo " checked ";
}
echo ">";
}
echo "</td>";
$link = Toolbox::getItemTypeFormURL("PluginAccountsAesKey");
echo "<td class='left'><a href='" . $link . "?id=" . $data["id"] . "&plugin_accounts_hashes_id=" . $ID . "'>";
echo __('Encryption key', 'accounts') . "</a></td>";
echo "</tr>";
}
echo "</table>";
if ($candelete) {
Html::openArrowMassives("show_aeskey{$rand}", true);
Html::closeArrowMassives(array('delete' => __('Delete permanently')));
}
} else {
echo "</table>";
}
Html::closeForm();
echo "</div>";
}
示例6: showForFQDN
/**
* Show the aliases contained by the alias
*
* @param $item the FQDN owning the aliases
* @param $withtemplate integer withtemplate param
**/
static function showForFQDN(CommonGLPI $item, $withtemplate)
{
global $DB;
$alias = new self();
$address = new NetworkName();
$item->check($item->getID(), 'r');
$canedit = $item->can($item->getID(), 'w');
if (isset($_POST["start"])) {
$start = $_POST["start"];
} else {
$start = 0;
}
if (!empty($_POST["order"])) {
$order = $_POST["order"];
} else {
$order = "alias";
}
$number = countElementsInTable($alias->getTable(), "`fqdns_id`='" . $item->getID() . "'");
echo "<br><div class='center'>";
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . self::getTypeName(1) . "</th><th>" . __('No item found') . "</th></tr>";
echo "</table>\n";
} else {
Html::printAjaxPager(self::getTypeName($number), $start, $number);
echo "<table class='tab_cadre_fixe'><tr>";
echo "<th><a href='javascript:reloadTab(\"order=alias\");'>" . self::getTypeName(1) . "</a></th>";
// Alias
echo "<th><a href='javascript:reloadTab(\"order=realname\");'>" . __("Computer's name") . "</a></th>";
echo "<th>" . __('Comments') . "</th>";
echo "</tr>\n";
Session::initNavigateListItems($item->getType(), sprintf(__('%1$s = %2$s'), self::getTypeName(1), $item->fields['name']));
$query = "SELECT `glpi_networkaliases`.`id` AS alias_id,\n `glpi_networkaliases`.`name` AS alias,\n `glpi_networknames`.`id` AS address_id,\n `glpi_networkaliases`.`comment` AS comment\n FROM `glpi_networkaliases`, `glpi_networknames`\n WHERE `glpi_networkaliases`.`fqdns_id` = '" . $item->getID() . "'\n AND `glpi_networknames`.`id` = `glpi_networkaliases`.`networknames_id`\n ORDER BY `{$order}`\n LIMIT " . $_SESSION['glpilist_limit'] . "\n OFFSET {$start}";
foreach ($DB->request($query) as $data) {
Session::addToNavigateListItems($alias->getType(), $data["alias_id"]);
if ($address->getFromDB($data["address_id"])) {
echo "<tr class='tab_bg_1'>";
echo "<td><a href='" . $alias->getFormURL() . '?id=' . $data['alias_id'] . "'>" . $data['alias'] . "</a></td>";
echo "<td><a href='" . $address->getLinkURL() . "'>" . $address->getInternetName() . "</a></td>";
echo "<td>" . $data['comment'] . "</td>";
echo "</tr>\n";
}
}
echo "</table>\n";
Html::printAjaxPager(self::getTypeName($number), $start, $number);
}
echo "</div>\n";
}
示例7: showListForItem
/**
* Display changes for an item
*
* Will also display changes of linked items
*
* @param $item CommonDBTM object
*
* @return nothing (display a table)
**/
static function showListForItem(CommonDBTM $item)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight(self::$rightname, self::READALL)) {
return false;
}
if ($item->isNewID($item->getID())) {
return false;
}
$restrict = '';
$order = '';
$options['reset'] = 'reset';
switch ($item->getType()) {
case 'User':
$restrict = "(`glpi_changes_users`.`users_id` = '" . $item->getID() . "')";
$order = '`glpi_changes`.`date_mod` DESC';
$options['criteria'][0]['field'] = 4;
// status
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = $item->getID();
$options['criteria'][0]['link'] = 'OR';
$options['criteria'][1]['field'] = 66;
// status
$options['criteria'][1]['searchtype'] = 'equals';
$options['criteria'][1]['value'] = $item->getID();
$options['criteria'][1]['link'] = 'OR';
$options['criteria'][5]['field'] = 5;
// status
$options['criteria'][5]['searchtype'] = 'equals';
$options['criteria'][5]['value'] = $item->getID();
$options['criteria'][5]['link'] = 'OR';
break;
case 'Supplier':
$restrict = "(`glpi_changes_suppliers`.`suppliers_id` = '" . $item->getID() . "')";
$order = '`glpi_changes`.`date_mod` DESC';
$options['criteria'][0]['field'] = 6;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = $item->getID();
$options['criteria'][0]['link'] = 'AND';
break;
case 'Group':
// Mini search engine
if ($item->haveChildren()) {
$tree = Session::getSavedOption(__CLASS__, 'tree', 0);
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th>" . __('Last changes') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
_e('Child groups');
Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
} else {
$tree = 0;
}
echo "</td></tr></table>";
if ($tree) {
$restrict = "IN (" . implode(',', getSonsOf('glpi_groups', $item->getID())) . ")";
} else {
$restrict = "='" . $item->getID() . "'";
}
$restrict = "(`glpi_changes_groups`.`groups_id` {$restrict}\n AND `glpi_changes_groups`.`type` = " . CommonITILActor::REQUESTER . ")";
$order = '`glpi_changes`.`date_mod` DESC';
$options['criteria'][0]['field'] = 71;
$options['criteria'][0]['searchtype'] = $tree ? 'under' : 'equals';
$options['criteria'][0]['value'] = $item->getID();
$options['criteria'][0]['link'] = 'AND';
break;
default:
$restrict = "(`items_id` = '" . $item->getID() . "'\n AND `itemtype` = '" . $item->getType() . "')";
$order = '`glpi_changes`.`date_mod` DESC';
break;
}
$query = "SELECT " . self::getCommonSelect() . "\n FROM `glpi_changes`\n LEFT JOIN `glpi_changes_items`\n ON (`glpi_changes`.`id` = `glpi_changes_items`.`changes_id`) " . self::getCommonLeftJoin() . "\n WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_changes") . "\n ORDER BY {$order}\n LIMIT " . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
$number = $DB->numrows($result);
// Ticket for the item
echo "<div class='firstbloc'><table class='tab_cadre_fixe'>";
$colspan = 11;
if (count($_SESSION["glpiactiveentities"]) > 1) {
$colspan++;
}
if ($number > 0) {
Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
echo "<tr><th colspan='{$colspan}'>";
//TRANS : %d is the number of problems
echo sprintf(_n('Last %d change', 'Last %d changes', $number), $number);
// echo "<span class='small_space'><a href='".$CFG_GLPI["root_doc"]."/front/ticket.php?".
// Toolbox::append_params($options,'&')."'>".__('Show all')."</a></span>";
echo "</th></tr>";
} else {
echo "<tr><th>" . __('No change found.') . "</th></tr>";
}
// Ticket list
//.........这里部分代码省略.........
示例8: showForTicket
/**
* Show changes for a ticket
*
* @param $ticket Ticket object
**/
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
$ID = $ticket->getField('id');
if (!$ticket->can($ID, READ)) {
return false;
}
$canedit = $ticket->canEdit($ID);
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_changes_tickets`.`id` AS linkID,\n `glpi_changes`.*\n FROM `glpi_changes_tickets`\n LEFT JOIN `glpi_changes`\n ON (`glpi_changes_tickets`.`changes_id` = `glpi_changes`.`id`)\n WHERE `glpi_changes_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_changes`.`name`";
$result = $DB->query($query);
$changes = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$changes[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='changeticket_form{$rand}' id='changeticket_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a change') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
Change::dropdown(array('used' => $used, 'entity' => $ticket->getEntityID()));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td><td>";
if (Session::haveRight('change', CREATE)) {
echo "<a href='" . Toolbox::getItemTypeFormURL('Change') . "?tickets_id={$ID}'>";
_e('Create a change from this ticket');
echo "</a>";
}
echo "</td></tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'><th colspan='12'>" . Change::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Change::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->fields["name"]));
$i = 0;
foreach ($changes as $data) {
Session::addToNavigateListItems('Change', $data["id"]);
Change::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
Change::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例9: 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>";
//.........这里部分代码省略.........
示例10: showMinimalList
//.........这里部分代码省略.........
$end_display = $numrows;
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
Html::openMassiveActionsForm('massform' . $itemtype);
$massiveactionparams = array('num_displayed' => $end_display - $begin_display, 'fixed' => false, 'is_deleted' => $p['is_deleted']);
Html::showMassiveActions("PluginResourcesDirectory", $massiveactionparams);
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
$header_num = 1;
// Display column Headers for toview items
$headers_line = '';
$headers_line_top = '';
$headers_line_bottom = '';
echo Search::showNewLine($output_type);
if ($output_type == Search::HTML_OUTPUT && $item->canCreate() && $canedit) {
// HTML display - massive modif
$headers_line_top .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
$headers_line_bottom .= Search::showHeaderItem($output_type, Html::getCheckAllAsCheckbox('massform' . $itemtype), $header_num, "", 0, $p['order']);
}
// Display column Headers for toview items
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt["PluginResourcesDirectory"][$val]['nosort']) || !$searchopt["PluginResourcesDirectory"][$val]['nosort']) {
$linkto = "javascript:reloadTab('sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto . "')";
}
$headers_line .= Search::showHeaderItem($output_type, $searchopt["PluginResourcesDirectory"][$val]["name"], $header_num, $linkto, $p['sort'] == $val, $p['order']);
}
// End Line for column headers
$headers_line .= Search::showEndLine($output_type);
$headers_line_top .= $headers_line;
$headers_line_bottom .= $headers_line;
echo $headers_line_top;
$DB->data_seek($result, $p['start']);
// Define begin and end var for loop
// Search case
$i = $begin_display;
// Init list of items displayed
if ($output_type == Search::HTML_OUTPUT) {
Session::initNavigateListItems($itemtype);
}
// Num of the row (1=header_line)
$row_num = 1;
// Display Loop
while ($i < $numrows && $i < $end_display) {
$item_num = 1;
$data = $DB->fetch_array($result);
$i++;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
Session::addToNavigateListItems($itemtype, $data['id']);
$tmpcheck = "";
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$sel = "";
$tmpcheck = "<input type='checkbox' name='item[" . $data["id"] . "]' value='1' {$sel}>";
echo Search::showItem($output_type, $tmpcheck, $item_num, $row_num, "width='10'");
}
foreach ($toview as $key => $val) {
echo Search::showItem($output_type, Search::giveItem("PluginResourcesDirectory", $val, $data, $key), $item_num, $row_num, Search::displayConfigItem("PluginResourcesDirectory", $val, $data, $key));
}
echo Search::showEndLine($output_type);
}
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= self::getTypeName(1);
}
// Display footer
echo Search::showFooter($output_type, $title);
//massive action
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
$massiveactionparams['ontop'] = false;
$massiveactionparams['fixed'] = false;
Html::showMassiveActions("PluginResourcesDirectory", $massiveactionparams);
Html::closeForm();
} else {
echo "</table></div>";
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
echo "<br>";
Html::printPager($p['start'], $numrows, $target, $parameters, "PluginResourcesDirectory", 0, $search_config);
}
} else {
echo Search::showError($output_type);
}
}
}
示例11: showSummary
/**
* Print the validation list into ticket
*
* @param $ticket class
**/
function showSummary($ticket)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
return false;
}
$tID = $ticket->fields['id'];
$tmp = array('tickets_id' => $tID);
$canadd = $this->can(-1, 'w', $tmp);
$rand = mt_rand();
echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
if ($canadd) {
echo "<script type='text/javascript' >\n";
echo "function viewAddValidation" . $tID . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $tID, 'id' => -1);
Ajax::updateItemJsCode("viewfollowup" . $tID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
if ($ticket->fields["status"] != CommonITILObject::SOLVED && $ticket->fields["status"] != CommonITILObject::CLOSED) {
echo "<div class='center'>";
echo "<a class='vsubmit' href='javascript:viewAddValidation" . $tID . "{$rand}();'>";
echo __('Send an approval request') . "</a></div><br>\n";
}
}
$query = "SELECT *\n FROM `" . $this->getTable() . "`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'";
if (!$canadd) {
$query .= " AND `users_id_validate` = '" . Session::getLoginUserID() . "' ";
}
$query .= " ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$colonnes = array(__('State'), sprintf(__('%1$s: %2$s'), __('Request'), __('Date')), __('Approval requester'), sprintf(__('%1$s: %2$s'), __('Request'), __('Comments')), __('Approval date'), __('Approver'), sprintf(__('%1$s: %2$s'), __('Approval'), __('Comments')));
$nb_colonnes = count($colonnes);
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='" . $nb_colonnes . "'>" . __('Approvals for the ticket') . "</th></tr>";
echo "<tr>";
foreach ($colonnes as $colonne) {
echo "<th>" . $colonne . "</th>";
}
echo "</tr>";
Session::initNavigateListItems('TicketValidation', sprintf(__('%1$s = %2$s'), $ticket->getTypeName(1), $ticket->fields["name"]));
while ($row = $DB->fetch_assoc($result)) {
$canedit = $this->can($row["id"], 'w');
Session::addToNavigateListItems('TicketValidation', $row["id"]);
$bgcolor = $this->getStatusColor($row['status']);
$status = $this->getStatus($row['status']);
echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}();\"" : '') . " id='viewfollowup" . $this->fields['tickets_id'] . $row["id"] . "{$rand}'>";
echo "<td>";
if ($canedit) {
echo "\n<script type='text/javascript' >\n";
echo "function viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $this->fields["tickets_id"], 'id' => $row["id"]);
Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
}
echo "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div></td>";
echo "<td>" . Html::convDateTime($row["submission_date"]) . "</td>";
echo "<td>" . getUserName($row["users_id"]) . "</td>";
echo "<td>" . $row["comment_submission"] . "</td>";
echo "<td>" . Html::convDateTime($row["validation_date"]) . "</td>";
echo "<td>" . getUserName($row["users_id_validate"]) . "</td>";
echo "<td>" . $row["comment_validation"] . "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<div class='center b'>" . __('No item found') . "</div>";
}
}
示例12: showList
/**
* Print out list kb item
*
* @param $options $_GET
* @param $type string search type : browse / search (default search)
**/
static function showList($options, $type = 'search')
{
global $DB, $CFG_GLPI;
// Default values of parameters
$params['faq'] = !Session::haveRight(self::$rightname, READ);
$params["start"] = "0";
$params["knowbaseitemcategories_id"] = "0";
$params["contains"] = "";
$params["target"] = $_SERVER['PHP_SELF'];
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$ki = new self();
switch ($type) {
case 'myunpublished':
if (!Session::haveRightsOr(self::$rightname, array(UPDATE, self::PUBLISHFAQ))) {
return false;
}
break;
case 'allunpublished':
if (!Session::haveRight(self::$rightname, self::KNOWBASEADMIN)) {
return false;
}
break;
default:
break;
}
if (!$params["start"]) {
$params["start"] = 0;
}
$query = self::getListRequest($params, $type);
// Get it from database
if ($result = $DB->query($query)) {
$KbCategory = new KnowbaseItemCategory();
$title = "";
if ($KbCategory->getFromDB($params["knowbaseitemcategories_id"])) {
$title = empty($KbCategory->fields['name']) ? "(" . $params['knowbaseitemcategories_id'] . ")" : $KbCategory->fields['name'];
$title = sprintf(__('%1$s: %2$s'), __('Category'), $title);
}
Session::initNavigateListItems('KnowbaseItem', $title);
$numrows = $DB->numrows($result);
$list_limit = $_SESSION['glpilist_limit'];
$showwriter = in_array($type, array('myunpublished', 'allunpublished', 'allmy'));
// Limit the result, if no limit applies, use prior result
if ($numrows > $list_limit && !isset($_GET['export_all'])) {
$query_limit = $query . " LIMIT " . intval($params["start"]) . ", " . intval($list_limit) . " ";
$result_limit = $DB->query($query_limit);
$numrows_limit = $DB->numrows($result_limit);
} else {
$numrows_limit = $numrows;
$result_limit = $result;
}
if ($numrows_limit > 0) {
// Set display type for export if define
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
// Pager
$parameters = "start=" . $params["start"] . "&knowbaseitemcategories_id=" . $params['knowbaseitemcategories_id'] . "&contains=" . $params["contains"] . "&is_faq=" . $params['faq'];
if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
$parameters .= "&item_items_id=" . $options['item_items_id'] . "&item_itemtype=" . $options['item_itemtype'];
}
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($params['start'], $numrows, Toolbox::getItemTypeSearchURL('KnowbaseItem'), $parameters, 'KnowbaseItem');
}
$nbcols = 1;
// Display List Header
echo Search::showHeader($output_type, $numrows_limit + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, __('Subject'), $header_num);
if ($output_type != Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, __('Content'), $header_num);
}
if ($showwriter) {
echo Search::showHeaderItem($output_type, __('Writer'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Category'), $header_num);
if (isset($options['item_itemtype']) && isset($options['item_items_id']) && $output_type == Search::HTML_OUTPUT) {
echo Search::showHeaderItem($output_type, ' ', $header_num);
}
// Num of the row (1=header_line)
$row_num = 1;
for ($i = 0; $i < $numrows_limit; $i++) {
$data = $DB->fetch_assoc($result_limit);
Session::addToNavigateListItems('KnowbaseItem', $data["id"]);
// Column num
$item_num = 1;
$row_num++;
echo Search::showNewLine($output_type, $i % 2);
$item = new self();
//.........这里部分代码省略.........
示例13: showForCalendar
/**
* Show holidays for a calendar
*
* @param $calendar Calendar object
**/
static function showForCalendar(Calendar $calendar)
{
global $DB, $CFG_GLPI;
$ID = $calendar->getField('id');
if (!$calendar->can($ID, 'r')) {
return false;
}
$canedit = $calendar->can($ID, 'w');
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_calendars_holidays`.`id` AS linkID,\n `glpi_holidays`.*\n FROM `glpi_calendars_holidays`\n LEFT JOIN `glpi_holidays`\n ON (`glpi_calendars_holidays`.`holidays_id` = `glpi_holidays`.`id`)\n WHERE `glpi_calendars_holidays`.`calendars_id` = '{$ID}'\n ORDER BY `glpi_holidays`.`name`";
$result = $DB->query($query);
$holidays = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$holidays[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n action='";
echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='7'>" . __('Add a close time') . "</tr>";
echo "<tr class='tab_bg_2'><td class='right' colspan='4'>";
echo "<input type='hidden' name='calendars_id' value='{$ID}'>";
Holiday::dropdown(array('used' => $used, 'entity' => $calendar->fields["entities_id"]));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$paramsma = array('num_displayed' => $numrows);
Html::showMassiveActions(__CLASS__, $paramsma);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
if ($canedit && $numrows) {
echo "<th width='10'>";
Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
echo "</th>";
}
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Start') . "</th>";
echo "<th>" . __('End') . "</th>";
echo "<th>" . __('Recurrent') . "</th>";
echo "</tr>";
$used = array();
if ($numrows) {
Session::initNavigateListItems('Holiday', sprintf(__('%1$s = %2$s'), Calendar::getTypeName(1), $calendar->fields["name"]));
foreach ($holidays as $data) {
Session::addToNavigateListItems('Holiday', $data["id"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
echo "</td>";
}
echo "<td><a href='" . Toolbox::getItemTypeFormURL('Holiday') . "?id=" . $data['id'] . "'>" . $data["name"] . "</a></td>";
echo "<td>" . Html::convDate($data["begin_date"]) . "</td>";
echo "<td>" . Html::convDate($data["end_date"]) . "</td>";
echo "<td>" . Dropdown::getYesNo($data["is_perpetual"]) . "</td>";
echo "</tr>";
}
}
echo "</table>";
if ($canedit && $numrows) {
$paramsma['ontop'] = false;
Html::showMassiveActions(__CLASS__, $paramsma);
Html::closeForm();
}
echo "</div>";
}
示例14: showOrderReception
public function showOrderReception($orders_id)
{
global $DB, $CFG_GLPI;
$order_order = new PluginOrderOrder();
$order_item = new PluginOrderOrder_Item();
$reference = new PluginOrderReference();
$order_order->getFromDB($orders_id);
Session::initNavigateListItems($this->getType(), __("Order", "order") . " = " . $order_order->fields["name"]);
$canedit = self::canCreate() && !$order_order->canUpdateOrder() && !$order_order->isCanceled();
$result_ref = $order_item->queryDetail($orders_id);
$numref = $DB->numrows($result_ref);
while ($data_ref = $DB->fetch_array($result_ref)) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
if (!$numref) {
echo "<tr><th>" . __("No item to take delivery of", "order") . "</th></tr></table></div>";
} else {
$references_id = $data_ref["id"];
$typeRef = $data_ref["itemtype"];
$price_taxfree = $data_ref["price_taxfree"];
$discount = $data_ref["discount"];
$item = new $typeRef();
$rand = mt_rand();
echo "<tr><th><ul><li>";
echo "<a href=\"javascript:showHideDiv('reception{$rand}','reception_img{$rand}', '" . $CFG_GLPI['root_doc'] . "/pics/plus.png','" . $CFG_GLPI['root_doc'] . "/pics/moins.png');\">";
echo "<img alt='' name='reception_img{$rand}' src=\"" . $CFG_GLPI['root_doc'] . "/pics/plus.png\">";
echo "</a>";
echo "</li></ul></th>";
echo "<th>" . __("Type") . "</th>";
echo "<th>" . __("Manufacturer") . "</th>";
echo "<th>" . __("Product reference", "order") . "</th>";
echo "<th>" . __("Delivered items", "order") . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1 center'>";
echo "<td></td>";
echo "<td align='center'>" . $item->getTypeName() . "</td>";
echo "<td align='center'>" . Dropdown::getDropdownName("glpi_manufacturers", $data_ref["manufacturers_id"]) . "</td>";
echo "<td>" . $reference->getReceptionReferenceLink($data_ref) . "</td>";
$total = $order_item->getTotalQuantityByRefAndDiscount($orders_id, $references_id, $data_ref["price_taxfree"], $data_ref["discount"]);
echo "<td>" . $order_item->getDeliveredQuantity($orders_id, $references_id, $data_ref["price_taxfree"], $data_ref["discount"]) . " / " . $total . "</td>";
echo "</tr></table>";
echo "<div class='center' id='reception{$rand}' style='display:none'>";
echo "<form method='post' name='order_reception_form{$rand}' id='order_reception_form{$rand}'" . " action=\"" . Toolbox::getItemTypeFormURL("PluginOrderReception") . "\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th width='15'></th>";
if ($typeRef != 'SoftwareLicense') {
echo "<th>" . __("ID") . "</th>";
}
echo "<th>" . __("Reference") . "</th>";
echo "<th>" . __("Status") . "</th>";
echo "<th>" . __("Delivery date") . "</th>";
echo "<th>" . __("Delivery form") . "</th>";
echo "<th>" . __("Delivery status", "order") . "</th>";
echo "</tr>";
$query = "SELECT `glpi_plugin_order_orders_items`.`id` AS IDD,\n `glpi_plugin_order_references`.`id` AS id,\n `glpi_plugin_order_references`.`templates_id`,\n `glpi_plugin_order_orders_items`.`states_id`,\n `glpi_plugin_order_orders_items`.`comment`,\n `glpi_plugin_order_orders_items`.`plugin_order_deliverystates_id`,\n `glpi_plugin_order_orders_items`.`delivery_date`,\n `glpi_plugin_order_orders_items`.`delivery_number`,\n `glpi_plugin_order_references`.`name`,\n `glpi_plugin_order_references`.`itemtype`,\n `glpi_plugin_order_orders_items`.`items_id`\n FROM `glpi_plugin_order_orders_items`, `glpi_plugin_order_references`\n WHERE `plugin_order_orders_id` = '{$orders_id}'\n AND `glpi_plugin_order_orders_items`.`plugin_order_references_id` = '" . $references_id . "'\n AND `glpi_plugin_order_orders_items`.`plugin_order_references_id` = `glpi_plugin_order_references`.`id`\n AND `glpi_plugin_order_orders_items`.`discount` LIKE '" . $discount . "'\n AND `glpi_plugin_order_orders_items`.`price_taxfree` LIKE '" . $price_taxfree . "' ";
if ($typeRef == 'SoftwareLicense') {
$query .= " GROUP BY `glpi_plugin_order_references`.`name` ";
}
$query .= " ORDER BY `glpi_plugin_order_references`.`name` ";
$result = $DB->query($query);
$num = $DB->numrows($result);
while ($data = $DB->fetch_array($result)) {
$random = mt_rand();
$detailID = $data["IDD"];
Session::addToNavigateListItems($this->getType(), $detailID);
echo "<tr class='tab_bg_2'>";
$status = 1;
if ($typeRef != 'SoftwareLicense') {
$status = $this->checkThisItemStatus($detailID, PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED);
}
if ($order_order->canDeliver() && $status) {
echo "<td width='15' align='left'>";
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
echo "<input type='checkbox' name='item[" . $detailID . "]' value='1' {$sel}>";
echo "</td>";
} else {
echo "<td width='15' align='left'></td>";
}
if ($typeRef != 'SoftwareLicense') {
echo "<td align='center'>" . $data["IDD"] . " ";
Html::showTooltip($data['comment']);
echo "</td>";
}
echo "<td align='center'>" . $reference->getReceptionReferenceLink($data) . "</td>";
echo "<td align='center'>";
$link = Toolbox::getItemTypeFormURL($this->getType());
if ($canedit && $data["states_id"] == PluginOrderOrder::ORDER_DEVICE_DELIVRED) {
echo "<a href=\"" . $link . "?id=" . $data["IDD"] . "\">";
}
echo $this->getReceptionStatus($detailID);
if ($canedit && $data["states_id"] == PluginOrderOrder::ORDER_DEVICE_DELIVRED) {
echo "</a>";
}
echo "</td>";
echo "<td align='center'>" . Html::convDate($data["delivery_date"]) . "</td>";
echo "<td align='center'>" . $data["delivery_number"] . "</td>";
echo "<td align='center'>" . Dropdown::getDropdownName("glpi_plugin_order_deliverystates", $data["plugin_order_deliverystates_id"]) . "</td>";
//.........这里部分代码省略.........
示例15: showForGroup
/**
* Show users of a group
*
* @since version 0.83
*
* @param $group Group object: the group
**/
static function showForGroup(Group $group)
{
global $DB, $CFG_GLPI;
$ID = $group->getID();
if (!User::canView() || !$group->can($ID, READ)) {
return false;
}
// Have right to manage members
$canedit = self::canUpdate();
$rand = mt_rand();
$user = new User();
$crit = Session::getSavedOption(__CLASS__, 'criterion', '');
$tree = Session::getSavedOption(__CLASS__, 'tree', 0);
$used = array();
$ids = array();
// Retrieve member list
$entityrestrict = self::getDataForGroup($group, $used, $ids, $crit, $tree);
if ($canedit) {
self::showAddUserForm($group, $ids, $entityrestrict, $crit);
}
// Mini Search engine
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='2'>" . User::getTypeName(Session::getPluralNumber()) . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
echo _n('Criterion', 'Criteria', 1) . " ";
$crits = array('' => Dropdown::EMPTY_VALUE, 'is_manager' => __('Manager'), 'is_userdelegate' => __('Delegatee'));
Dropdown::showFromArray('crit', $crits, array('value' => $crit, 'on_change' => 'reloadTab("start=0&criterion="+this.value)'));
if ($group->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;
}
echo "</td></tr></table>";
$number = count($used);
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
if ($start >= $number) {
$start = 0;
}
// Display results
if ($number) {
echo "<div class='spaced'>";
Html::printAjaxPager(sprintf(__('%1$s (%2$s)'), User::getTypeName(Session::getPluralNumber()), __('D=Dynamic')), $start, $number);
Session::initNavigateListItems('User', sprintf(__('%1$s = %2$s'), Group::getTypeName(1), $group->getName()));
if ($canedit) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => min($number - $start, $_SESSION['glpilist_limit']), 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
$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>" . User::getTypeName(1) . "</th>";
if ($tree) {
$header_end .= "<th>" . Group::getTypeName(1) . "</th>";
}
$header_end .= "<th>" . __('Dynamic') . "</th>";
$header_end .= "<th>" . __('Manager') . "</th>";
$header_end .= "<th>" . __('Delegatee') . "</th></tr>";
echo $header_begin . $header_top . $header_end;
$tmpgrp = new Group();
for ($i = $start, $j = 0; $i < $number && $j < $_SESSION['glpilist_limit']; $i++, $j++) {
$data = $used[$i];
$user->getFromDB($data["id"]);
Session::addToNavigateListItems('User', $data["id"]);
echo "\n<tr class='tab_bg_" . ($user->isDeleted() ? '1_2' : '1') . "'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
echo "</td>";
}
echo "<td>" . $user->getLink();
if ($tree) {
echo "</td><td>";
if ($tmpgrp->getFromDB($data['groups_id'])) {
echo $tmpgrp->getLink(array('comments' => true));
}
}
echo "</td><td class='center'>";
if ($data['is_dynamic']) {
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' width='14' height='14' alt=\"" . __('Dynamic') . "\">";
}
echo "</td><td class='center'>";
if ($data['is_manager']) {
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' width='14' height='14' alt=\"" . __('Manager') . "\">";
//.........这里部分代码省略.........