本文整理汇总了PHP中CommonGLPI::getLinkedItems方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonGLPI::getLinkedItems方法的具体用法?PHP CommonGLPI::getLinkedItems怎么用?PHP CommonGLPI::getLinkedItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonGLPI
的用法示例。
在下文中一共展示了CommonGLPI::getLinkedItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
case 'Problem':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countElementsInTable('glpi_items_problems', "`problems_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
case 'User':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_problems_users', 'problems_id', "`users_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
case 'Group':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_groups_problems', 'problems_id', "`groups_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
case 'Supplier':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_problems_suppliers', 'problems_id', "`suppliers_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
default:
if (Session::haveRight("problem", Problem::READALL)) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'");
}
}
}
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
}
}
}
return '';
}
示例2: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
case 'Problem':
return _n('Item', 'Items', 2);
default:
if (Session::haveRight("show_all_problem", "1")) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'");
}
}
}
}
return self::createTabEntry(Problem::getTypeName(2), $nb);
}
}
}
return '';
}
示例3: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (static::canView()) {
$nb = 0;
$title = self::getTypeName(Session::getPluralNumber());
if ($_SESSION['glpishow_count_on_tabs']) {
switch ($item->getType()) {
case 'User':
$nb = countElementsInTable('glpi_tickets_users', "`users_id` = '" . $item->getID() . "'\n AND `type` = " . CommonITILActor::REQUESTER);
$title = __('Created tickets');
break;
case 'Supplier':
$nb = countElementsInTable('glpi_suppliers_tickets', "`suppliers_id` = '" . $item->getID() . "'");
break;
case 'SLA':
$nb = countElementsInTable('glpi_tickets', "`slas_id` = '" . $item->getID() . "'");
break;
case 'Group':
$nb = countElementsInTable('glpi_groups_tickets', "`groups_id` = '" . $item->getID() . "'\n AND `type` = " . CommonITILActor::REQUESTER);
$title = __('Created tickets');
break;
default:
// Direct one
$nb = countElementsInTable('glpi_items_tickets', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_tickets', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'");
}
}
}
break;
}
}
// glpishow_count_on_tabs
// Not for Ticket class
if ($item->getType() != __CLASS__) {
return self::createTabEntry($title, $nb);
}
}
// self::READALL right check
// Not check self::READALL for Ticket itself
switch ($item->getType()) {
case __CLASS__:
$ong = array();
$ong[2] = _n('Solution', 'Solutions', 1);
// enquete si statut clos
if ($item->fields['status'] == self::CLOSED) {
$satisfaction = new TicketSatisfaction();
if ($satisfaction->getFromDB($item->getID())) {
$ong[3] = __('Satisfaction');
}
}
if ($item->canUpdate()) {
$ong[4] = __('Statistics');
}
return $ong;
// default :
// return _n('Ticket','Tickets', Session::getPluralNumber());
}
return '';
}
示例4: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if ($item->isNewItem()) {
return;
}
if (static::canView()) {
$nb = 0;
$title = self::getTypeName(Session::getPluralNumber());
if ($_SESSION['glpishow_count_on_tabs']) {
switch ($item->getType()) {
case 'User':
$nb = countElementsInTable(array('glpi_tickets', 'glpi_tickets_users'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_tickets_users`.`tickets_id` = `glpi_tickets`.`id`\n AND `glpi_tickets_users`.`users_id` = '" . $item->getID() . "'\n AND `glpi_tickets_users`.`type` = " . CommonITILActor::REQUESTER);
$title = __('Created tickets');
break;
case 'Supplier':
$nb = countElementsInTable(array('glpi_tickets', 'glpi_suppliers_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_suppliers_tickets`.`tickets_id` = `glpi_tickets`.`id`\n AND `glpi_suppliers_tickets`.`suppliers_id` = '" . $item->getID() . "'");
break;
case 'SLT':
$nb = countElementsInTable('glpi_tickets', ['slts_tto_id' => $item->getID(), 'slts_ttr_id' => $item->getID()]);
break;
case 'Group':
$nb = countElementsInTable(array('glpi_tickets', 'glpi_groups_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_groups_tickets`.`tickets_id` = `glpi_tickets`.`id`\n AND `glpi_groups_tickets`.`groups_id` = '" . $item->getID() . "'\n AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER);
$title = __('Created tickets');
break;
default:
// Direct one
$nb = countElementsInTable('glpi_items_tickets', ['itemtype' => $item->getType(), 'items_id' => $item->getID()]);
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_tickets', ['itemtype' => $type, 'items_id' => $ID]);
}
}
}
break;
}
}
// glpishow_count_on_tabs
// Not for Ticket class
if ($item->getType() != __CLASS__) {
return self::createTabEntry($title, $nb);
}
}
// self::READALL right check
// Not check self::READALL for Ticket itself
switch ($item->getType()) {
case __CLASS__:
$ong = array();
if ($_SESSION['glpiticket_timeline']) {
$timeline = $item->getTimelineItems();
$nb_elements = count($timeline);
$ong[1] = __("Processing ticket") . " <sup class='tab_nb'>{$nb_elements}</sup>";
}
if (!$_SESSION['glpiticket_timeline'] || $_SESSION['glpiticket_timeline_keep_replaced_tabs']) {
$ong[2] = _n('Solution', 'Solutions', 1);
}
// enquete si statut clos
if ($item->fields['status'] == self::CLOSED && Session::haveRight('ticket', Ticket::SURVEY)) {
$satisfaction = new TicketSatisfaction();
if ($satisfaction->getFromDB($item->getID())) {
$ong[3] = __('Satisfaction');
}
}
if ($item->canUpdate()) {
$ong[4] = __('Statistics');
}
return $ong;
// default :
// return _n('Ticket','Tickets', Session::getPluralNumber());
}
return '';
}
示例5: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
$nb = 0;
switch ($item->getType()) {
case 'Project':
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countElementsInTable('glpi_items_projects', ['projects_id' => $item->getID()]);
}
return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
default:
// Not used now
if (Session::haveRight("project", Project::READALL)) {
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_projects', ['itemtype' => $item->getType(), 'items_id' => $item->getID()]);
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_projects', ['itemtype' => $type, 'items_id' => $ID]);
}
}
}
}
return self::createTabEntry(Project::getTypeName(Session::getPluralNumber()), $nb);
}
}
}
return '';
}