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


PHP CommonDBTM::canUpdate方法代码示例

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


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

示例1: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'delete_email':
         case 'import_email':
             if (!$item->canUpdate()) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
             } else {
                 $input = $ma->getInput();
                 if (count($ids)) {
                     $mailcollector = new MailCollector();
                     if ($ma->getAction() == 'delete_email') {
                         $mailcollector->deleteOrImportSeveralEmails($ids, 0);
                     } else {
                         $mailcollector->deleteOrImportSeveralEmails($ids, 1, $input['entities_id']);
                     }
                 }
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:28,代码来源:notimportedemail.class.php

示例2: showChildsForItemForm

 /**
  * We can add several single CommonDBChild to a given Item. In such case, we display a "+"
  * button and the fields already entered.
  * This method display the fields
  *
  * @since version 0.84
  *
  * @todo study if we cannot use these methods for the user emails
  * @see showAddChildButtonForItemForm()
  *
  * @param $item         CommonDBTM object the item on which to add the current CommenDBChild
  * @param $field_name   the name of the HTML field inside Item's form
  * @param $canedit      (default NULL) NULL to use default behaviour
  *
  * @return nothing (display only)
  **/
 static function showChildsForItemForm(CommonDBTM $item, $field_name, $canedit = NULL)
 {
     global $DB, $CFG_GLPI;
     $items_id = $item->getID();
     if (is_null($canedit)) {
         if ($item->isNewItem()) {
             if (!$item->canCreate()) {
                 return false;
             }
             $canedit = $item->canUpdate();
         } else {
             if (!$item->can($items_id, 'r')) {
                 return false;
             }
             $canedit = $item->can($items_id, "w");
         }
     }
     $lower_name = strtolower(get_called_class());
     $div_id = "add_" . $lower_name . "_to_" . $item->getType() . "_" . $items_id;
     // To be sure not to load bad datas from this table
     if ($items_id == 0) {
         $items_id = -99;
     }
     $query = "SELECT *\n                FROM `" . static::getTable() . "`\n                WHERE `" . static::$items_id . "` = '" . $item->getID() . "'";
     if (preg_match('/^itemtype/', static::$itemtype)) {
         $query .= " AND `itemtype` = '" . $item->getType() . "'";
     }
     $current_item = new static();
     if ($current_item->maybeDeleted()) {
         $query .= " AND `is_deleted` = '0'";
     }
     $count = 0;
     foreach ($DB->request($query) as $data) {
         $current_item->fields = $data;
         if ($count) {
             echo '<br>';
         }
         $count++;
         $current_item->showChildForItemForm($canedit, $field_name . "[" . $current_item->getID() . "]");
     }
     if ($canedit) {
         echo "<div id='{$div_id}'>";
         // No Child display field
         if ($count == 0) {
             $current_item->getEmpty();
             $current_item->showChildForItemForm($canedit, $field_name . "[-100]");
         }
         echo "</div>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:66,代码来源:commondbchild.class.php


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