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


PHP CommonGLPI::can方法代码示例

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


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

示例1: displayTabContentForItem

 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     global $CFG_GLPI;
     if ($item->getType() == 'PluginResourcesResource') {
         $ID = $item->getField('id');
         self::showReports($ID, $withtemplate);
         if ($item->can($ID, 'w') && !self::checkIfReportsExist($ID)) {
             $self = new self();
             $self->showForm("", array('plugin_resources_resources_id' => $ID, 'target' => $CFG_GLPI['root_doc'] . "/plugins/resources/front/reportconfig.form.php"));
         }
         if ($item->can($ID, 'w') && self::checkIfReportsExist($ID) && !$withtemplate) {
             PluginResourcesResource::showReportForm(array('id' => $ID, 'target' => $CFG_GLPI['root_doc'] . "/plugins/resources/front/resource.form.php"));
         }
     }
     return true;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:16,代码来源:reportconfig.class.php

示例2: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case __CLASS__:
                 if ($item->isRecursive() && $item->can($item->fields['id'], 'w')) {
                     return __('Merging');
                 }
                 break;
         }
     }
     return '';
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:13,代码来源:software.class.php

示例3: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getID() && $item->can($item->getField('id'), 'r')) {
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 case 'NetworkName':
                     $numberElements = countElementsInTable($this->getTable(), "networknames_id='" . $item->getID() . "'");
                     break;
                 case 'FQDN':
                     $numberElements = countElementsInTable($this->getTable(), "fqdns_id='" . $item->getID() . "'");
             }
             return self::createTabEntry(self::getTypeName(2), $numberElements);
         }
         return self::getTypeName(2);
     }
     return '';
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:17,代码来源:networkalias.class.php

示例4: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getID() && $item->can($item->getField('id'), READ)) {
         $nb = 0;
         if ($_SESSION['glpishow_count_on_tabs']) {
             $nb = self::countForItem($item);
         }
         return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $nb);
     }
     return '';
 }
开发者ID:kipman,项目名称:glpi,代码行数:11,代码来源:networkname.class.php

示例5: showForItem

 static function showForItem(CommonGLPI $item, $withtemplate = 0)
 {
     global $CFG_GLPI;
     $is_device = $item instanceof CommonDevice;
     $ID = $item->getField('id');
     if (!$item->can($ID, READ)) {
         return false;
     }
     $canedit = $withtemplate != 2 && $item->canEdit($ID) && Session::haveRightsOr('device', array(UPDATE, PURGE));
     echo "<div class='spaced'>";
     $rand = mt_rand();
     if ($canedit) {
         echo "\n<form id='form_device_add{$rand}' name='form_device_add{$rand}'\n                  action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>\n";
         echo "\t<input type='hidden' name='items_id' value='{$ID}'>\n";
         echo "\t<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
     }
     $table = new HTMLTableMain();
     $table->setTitle(_n('Component', 'Components', Session::getPluralNumber()));
     if ($canedit) {
         $delete_all_column = $table->addHeader('delete all', Html::getCheckAllAsCheckbox("form_device_action{$rand}", '__RAND__'));
         $delete_all_column->setHTMLClass('center');
     } else {
         $delete_all_column = NULL;
     }
     $column_label = $is_device ? _n('Item', 'Items', Session::getPluralNumber()) : __('Type of component');
     $common_column = $table->addHeader('common', $column_label);
     $specific_column = $table->addHeader('specificities', __('Specificities'));
     $specific_column->setHTMLClass('center');
     $dynamic_column = '';
     if ($item->isDynamic()) {
         $dynamic_column = $table->addHeader('is_dynamic', __('Automatic inventory'));
         $dynamic_column->setHTMLClass('center');
     }
     if ($canedit) {
         $massiveactionparams = array('container' => "form_device_action{$rand}", 'fixed' => false, 'display_arrow' => false);
         $content = array(array('function' => 'Html::showMassiveActions', 'parameters' => array($massiveactionparams)));
         $delete_column = $table->addHeader('delete one', $content);
         $delete_column->setHTMLClass('center');
     } else {
         $delete_column = NULL;
     }
     $table_options = array('canedit' => $canedit, 'rand' => $rand);
     if ($is_device) {
         Session::initNavigateListItems(static::getType(), sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         foreach (array_merge(array(''), self::getConcernedItems()) as $itemtype) {
             $table_options['itemtype'] = $itemtype;
             $link = getItemForItemtype(static::getType());
             $link->getTableGroup($item, $table, $table_options, $delete_all_column, $common_column, $specific_column, $delete_column, $dynamic_column);
         }
     } else {
         $devtypes = array();
         foreach (self::getItemAffinities($item->getType()) as $link_type) {
             $devtypes[] = $link_type::getDeviceType();
             $link = getItemForItemtype($link_type);
             Session::initNavigateListItems($link_type, sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
             $link->getTableGroup($item, $table, $table_options, $delete_all_column, $common_column, $specific_column, $delete_column, $dynamic_column);
         }
     }
     if ($canedit) {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><td>";
         echo __('Add a new component') . "</td><td class=left width='70%'>";
         if ($is_device) {
             Dropdown::showNumber('number_devices_to_add', array('value' => 0, 'min' => 0, 'max' => 10));
         } else {
             Dropdown::showSelectItemFromItemtypes(array('itemtype_name' => 'devicetype', 'items_id_name' => 'devices_id', 'itemtypes' => $devtypes, 'entity_restrict' => $item->getEntityID(), 'showItemSpecificity' => $CFG_GLPI['root_doc'] . '/ajax/selectUnaffectedOrNewItem_Device.php'));
         }
         echo "</td><td>";
         echo "<input type='submit' class='submit' name='add' value='" . _sx('button', 'Add') . "'>";
         echo "</td></tr></table>";
         Html::closeForm();
     }
     if ($canedit) {
         echo "\n<form id='form_device_action{$rand}' name='form_device_action{$rand}'\n                  action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>\n";
         echo "\t<input type='hidden' name='items_id' value='{$ID}'>\n";
         echo "\t<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
     }
     $table->display(array('display_super_for_each_group' => false, 'display_title_for_each_group' => false));
     if ($canedit) {
         //          echo "<input type='submit' class='submit' name='updateall' value='" .
         //               _sx('button', 'Save')."'>";
         Html::closeForm();
     }
     echo "</div>";
     // Force disable selected items
     $_SESSION['glpimassiveactionselected'] = array();
 }
开发者ID:pvasener,项目名称:glpi,代码行数:86,代码来源:item_devices.class.php

示例6: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getID() && $item->can($item->getField('id'), 'r')) {
         if ($_SESSION['glpishow_count_on_tabs']) {
             return self::createTabEntry(self::getTypeName(2), self::countForItem($item));
         }
         return self::getTypeName(2);
     }
     return '';
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:10,代码来源:networkname.class.php

示例7: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate && $item->can($item->getField('id'), READ)) {
         $ong = array();
         $ong[1] = _sx('button', 'Test');
         // test connexion
         $ong[2] = _n('User', 'Users', Session::getPluralNumber());
         $ong[3] = _n('Group', 'Groups', Session::getPluralNumber());
         /// TODO clean fields entity_XXX if not used
         //          $ong[4]  = __('Entity');                  // params for entity config
         $ong[5] = __('Advanced information');
         // params for entity advanced config
         $ong[6] = _n('Replicate', 'Replicates', Session::getPluralNumber());
         return $ong;
     }
     return '';
 }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:17,代码来源:authldap.class.php

示例8: showForItem

 static function showForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $ID = $item->getField('id');
     if (!$item->can($ID, 'r')) {
         return false;
     }
     $canedit = $withtemplate != 2 && $item->can($ID, 'w');
     echo "<div class='spaced'>";
     $rand = mt_rand();
     if ($canedit) {
         echo "\n<form id='form_device_action{$rand}' name='form_device_action{$rand}'\n                  action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "' method='post'>\n";
         echo "\t<input type='hidden' name='items_id' value='{$ID}'>\n";
         echo "\t<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
     }
     $table = new HTMLTableMain();
     $table->setTitle(_n('Component', 'Components', 2));
     if ($canedit) {
         $delete_all_column = $table->addHeader('delete all', Html::getCheckAllAsCheckbox("form_device_action{$rand}", '__RAND__'));
         $delete_all_column->setHTMLClass('center');
     } else {
         $delete_all_column = NULL;
     }
     $common_column = $table->addHeader('common', __('Type of component'));
     $specific_column = $table->addHeader('specificities', __('Specificities'));
     $specific_column->setHTMLClass('center');
     $dynamic_column = '';
     if ($item->isDynamic()) {
         $dynamic_column = $table->addHeader('is_dynamic', __('Automatic inventory'));
         $dynamic_column->setHTMLClass('center');
     }
     if ($canedit) {
         $content = "<input type='submit' class='submit' name='delete' value='" . _sx('button', 'Delete permanently') . "'>";
         $delete_column = $table->addHeader('delete one', $content);
         $delete_column->setHTMLClass('center');
     } else {
         $delete_column = NULL;
     }
     $table_options = array('canedit' => $canedit);
     $devtypes = array();
     foreach (self::getDeviceTypes() as $link_type) {
         $devtypes[] = $link_type::getDeviceType();
         $link_type::getTableGroup($item, $table, $table_options, $delete_all_column, $common_column, $specific_column, $delete_column, $dynamic_column);
     }
     if ($canedit) {
         echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><td>";
         echo __('Add a new component') . "</td><td class=left width='70%'>";
         Dropdown::showAllItems('devices_id', '', 0, -1, $devtypes, false, false, 'devicetype');
         echo "</td><td>";
         echo "<input type='submit' class='submit' name='add' value='" . _sx('button', 'Add') . "'>";
         echo "</td></tr></table>";
     }
     $table->display(array('display_super_for_each_group' => false, 'display_title_for_each_group' => false));
     if ($canedit) {
         echo "<input type='submit' class='submit' name='updateall' value='" . _sx('button', 'Save') . "'>";
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:58,代码来源:item_devices.class.php

示例9: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate && $item->can($item->getField('id'), 'r')) {
         $ong = array();
         $ong[1] = __('Main');
         // test connexion
         $ong[2] = _n('User', 'Users', 2);
         $ong[3] = _n('Group', 'Groups', 2);
         $ong[4] = __('Entity');
         // params for entity config
         $ong[5] = __('Advanced information');
         // params for entity advanced config
         $ong[6] = _n('Replicate', 'Replicates', 2);
         return $ong;
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:17,代码来源:authldap.class.php

示例10: getTabNameForItem

 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     // can exists for Template
     if ($item->can($item->getField('id'), READ)) {
         $nb = 0;
         switch ($item->getType()) {
             case 'Phone':
             case 'Printer':
             case 'Peripheral':
             case 'Monitor':
                 if (Computer::canView()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $nb = self::countForItem($item);
                     }
                     return self::createTabEntry(_n('Connection', 'Connections', Session::getPluralNumber()), $nb);
                 }
                 break;
             case 'Computer':
                 if (Phone::canView() || Printer::canView() || Peripheral::canView() || Monitor::canView()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $nb = self::countForComputer($item);
                     }
                     return self::createTabEntry(_n('Connection', 'Connections', Session::getPluralNumber()), $nb);
                 }
                 break;
         }
     }
     return '';
 }
开发者ID:stweil,项目名称:glpi,代码行数:32,代码来源:computer_item.class.php

示例11: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate && $item->can($item->getField('id'), READ)) {
         $ong = array();
         $ong[1] = _sx('button', 'Test');
         // test connexion
         return $ong;
     }
     return '';
 }
开发者ID:btry,项目名称:glpi,代码行数:10,代码来源:authmail.class.php

示例12: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate && $item->can($item->getField('id'), 'r')) {
         $ong = array();
         $ong[1] = __('Main');
         // test connexion
         return $ong;
     }
     return '';
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:10,代码来源:authmail.class.php

示例13: displayTabContentForItem

 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     $reference_supplier = new self();
     if ($item->getType() == 'PluginOrderReference') {
         $reference_supplier->showReferenceManufacturers($item->getID());
         if ($item->can($item->getID(), UPDATE)) {
             $reference_supplier->showForm(0, array('plugin_order_references_id' => $item->getID()));
         }
     }
     return true;
 }
开发者ID:korial29,项目名称:order,代码行数:11,代码来源:reference_supplier.class.php

示例14: getTabNameForItem

 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     // can exists for Template
     if ($item->can($item->getField('id'), 'r')) {
         switch ($item->getType()) {
             case 'Phone':
             case 'Printer':
             case 'Peripheral':
             case 'Monitor':
                 if (Session::haveRight('computer', 'r')) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return self::createTabEntry(_n('Connection', 'Connections', 2), self::countForItem($item));
                     }
                     return _n('Connection', 'Connections', 2);
                 }
                 break;
             case 'Computer':
                 if (Session::haveRight('phone', 'r') || Session::haveRight('printer', 'r') || Session::haveRight('peripheral', 'r') || Session::haveRight('monitor', 'r')) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return self::createTabEntry(_n('Connection', 'Connections', 2), self::countForComputer($item));
                     }
                     return _n('Connection', 'Connections', 2);
                 }
                 break;
         }
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:computer_item.class.php

示例15: displayTabContentForItem

 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($item->getType() == 'PluginOrderOrder') {
         $survey = new self();
         self::showOrderSupplierSurvey($item->getID());
         if (!$survey->checkIfSupplierSurveyExists($item->getID()) && $item->can($item->getID(), UPDATE)) {
             $survey->showForm("", array('plugin_order_orders_id' => $item->getID()));
         }
     }
     return true;
 }
开发者ID:equinoxefr,项目名称:order,代码行数:11,代码来源:surveysupplier.class.php


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