当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonGLPI::canUpdate方法代码示例

本文整理汇总了PHP中CommonGLPI::canUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonGLPI::canUpdate方法的具体用法?PHP CommonGLPI::canUpdate怎么用?PHP CommonGLPI::canUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonGLPI的用法示例。


在下文中一共展示了CommonGLPI::canUpdate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (static::canView()) {
         switch ($item->getType()) {
             case __CLASS__:
                 $ong = array(1 => __('Analysis'), 3 => __('Plans'), 2 => __('Solution'));
                 if ($item->canUpdate()) {
                     $ong[4] = __('Statistics');
                 }
                 return $ong;
         }
     }
     return '';
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:14,代码来源:change.class.php

示例2: getTabNameForItem

 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (Session::haveRight("reminder_public", "r")) {
         switch ($item->getType()) {
             case 'Reminder':
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return array(1 => self::createTabEntry(__('Targets'), $item->countVisibilities()));
                     }
                     return array(1 => __('Targets'));
                 }
         }
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:18,代码来源:reminder.class.php

示例3: 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 '';
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:74,代码来源:ticket.class.php

示例4: getTabNameForItem

   /**
    * Display tab
    *
    * @param CommonGLPI $item
    * @param integer $withtemplate
    *
    * @return varchar name of the tab(s) to display
    */
   function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {

      $ong = array();

      if ($item->getType() == 'PluginMonitoringSlider') {
         if ($item->getID() > 0) {
            $ong[1] = 'items';

            if ($item->canUpdate()) {
               $ong[2] = __('Targets');
            }
         }
      } else if ($item->getType() == 'Central') {
         $a_sliders = $this->getSliders(1);
         foreach ($a_sliders as $sliders_id=>$name) {
            $this->getFromDB($sliders_id);
            if (Session::haveRight("plugin_monitoring_slider", PluginMonitoringSlider::HOMEPAGE)
                    && $this->haveVisibilityAccess()) {
               $ong[] = "[".__('Carrousel / slider', 'monitoring')."] ".$this->fields['name'];
            }
         }
      }
      return $ong;
   }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:32,代码来源:slider.class.php

示例5: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case __CLASS__:
                 $ong[1] = $this->getTypeName(1);
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $ong[2] = self::createTabEntry(__('Targets'), $item->countVisibilities());
                     } else {
                         $ong[2] = __('Targets');
                     }
                 }
                 return $ong;
         }
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:18,代码来源:knowbaseitem.class.php

示例6: getTabNameForItem

 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (self::canView()) {
         switch ($item->getType()) {
             case 'Reminder':
                 if ($item->canUpdate()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $nb = $item->countVisibilities();
                         return array(1 => self::createTabEntry(_n('Target', 'Targets', $nb), $nb));
                     }
                     return array(1 => _n('Target', 'Targets', Session::getPluralNumber()));
                 }
         }
     }
     return '';
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:19,代码来源:reminder.class.php

示例7: displayTabContentForItem

 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if (array_key_exists($item->getType(), self::$clone_types) && $item->canUpdate()) {
         self::showCloneForm($item);
     }
     return true;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:7,代码来源:common.class.php

示例8: 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 '';
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:64,代码来源:ticket.class.php

示例9: getTabNameForItem

 /**
  * Display tab
  *
  * @param CommonGLPI $item
  * @param integer $withtemplate
  *
  * @return varchar name of the tab(s) to display
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $ong = array();
     if ($item->getType() == 'PluginMonitoringDisplayview') {
         if ($item->getID() > 0) {
             $ong[1] = 'items';
             if ($item->canUpdate()) {
                 $ong[2] = __('Targets');
             }
             $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
             $ong = $pmDisplayview_rule->addRulesTabs($item->getID(), $ong);
         }
     } else {
         if ($item->getType() == 'Central') {
             $a_views = $this->getViews(1);
             foreach ($a_views as $views_id => $name) {
                 $this->getFromDB($views_id);
                 if (Session::haveRight("plugin_monitoring_displayview", PluginMonitoringDisplayview::HOMEPAGE) && $this->haveVisibilityAccess()) {
                     $ong[] = "[" . _n('View', 'Views', 1, 'monitoring') . "] " . $this->fields['name'];
                 }
             }
         }
     }
     return $ong;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:33,代码来源:displayview.class.php

示例10: getTabNameForItem

 /**
  * Display tab
  *
  * @param CommonGLPI $item
  * @param integer $withtemplate
  *
  * @return varchar name of the tab(s) to display
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $ong = array();
     if ($item->getType() == 'PluginMonitoringDisplayview') {
         if ($item->getID() > 0) {
             $ong[1] = 'items';
             if ($item->canUpdate() && isset($item->fields['is_frontview']) && $item->fields['is_frontview'] == 1) {
                 $ong[2] = __('Targets');
             }
             $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
             $ong = $pmDisplayview_rule->addRulesTabs($item->getID(), $ong);
         }
     }
     return $ong;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:23,代码来源:displayview.class.php


注:本文中的CommonGLPI::canUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。