當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Lock::getUnlockMassiveActions方法代碼示例

本文整理匯總了PHP中Lock::getUnlockMassiveActions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lock::getUnlockMassiveActions方法的具體用法?PHP Lock::getUnlockMassiveActions怎麽用?PHP Lock::getUnlockMassiveActions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Lock的用法示例。


在下文中一共展示了Lock::getUnlockMassiveActions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAllMassiveActions

 /**
  * Get the standard massive actions
  *
  * @since version 0.84
  *
  * This must not be overloaded in Class
  * @param $is_deleted massive action for deleted items ?   (default 0)
  * @param $checkitem link item to check right              (default NULL)
  *
  * @return an array of massive actions
  **/
 function getAllMassiveActions($is_deleted = 0, $checkitem = NULL)
 {
     global $CFG_GLPI, $PLUGIN_HOOKS;
     if (!is_null($checkitem)) {
         $isadmin = $checkitem->canUpdate();
     } else {
         $isadmin = static::canUpdate();
     }
     $itemtype = $this->getType();
     $actions = array();
     if ($is_deleted) {
         if ($isadmin) {
             $actions['purge'] = _x('button', 'Delete permanently');
             $actions['restore'] = _x('button', 'Restore');
         }
     } else {
         if ($isadmin || in_array($itemtype, $CFG_GLPI["infocom_types"]) && Infocom::canUpdate()) {
             //TRANS: select action 'update' (before doing it)
             $actions['update'] = _x('button', 'Update');
         }
         if (in_array($itemtype, $CFG_GLPI["infocom_types"]) && Infocom::canCreate()) {
             $actions['activate_infocoms'] = __('Enable the financial and administrative information');
         }
         // No delete for entities and tracking of not have right
         if ($isadmin) {
             // do not take into account is_deleted if items may be dynamic
             if ($this->maybeDeleted() && !$this->useDeletedToLockIfDynamic()) {
                 $actions['delete'] = _x('button', 'Put in dustbin');
             } else {
                 $actions['purge'] = _x('button', 'Delete permanently');
             }
         }
         if (in_array($itemtype, $CFG_GLPI["document_types"])) {
             if (Document::canView()) {
                 $actions['add_document'] = _x('button', 'Add a document');
                 $actions['remove_document'] = _x('button', 'Remove a document');
             }
         }
         if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
             if (Contract::canUpdate()) {
                 $actions['add_contract_item'] = _x('button', 'Add a contract');
                 $actions['remove_contract_item'] = _x('button', 'Remove a contract');
             }
         }
         // Specific actions
         $actions += $this->getSpecificMassiveActions($checkitem);
         // Plugin Specific actions
         if (isset($PLUGIN_HOOKS['use_massive_action'])) {
             foreach ($PLUGIN_HOOKS['use_massive_action'] as $plugin => $val) {
                 $plug_actions = Plugin::doOneHook($plugin, 'MassiveActions', $itemtype);
                 if (count($plug_actions)) {
                     $actions += $plug_actions;
                 }
             }
         }
     }
     //Add unlock if needed
     $actions += Lock::getUnlockMassiveActions($itemtype);
     // Manage forbidden actions
     $forbidden_actions = $this->getForbiddenStandardMassiveAction();
     if (is_array($forbidden_actions) && count($forbidden_actions)) {
         foreach ($forbidden_actions as $actiontodel) {
             if (isset($actions[$actiontodel])) {
                 unset($actions[$actiontodel]);
             }
         }
     }
     return $actions;
 }
開發者ID:gaforeror,項目名稱:glpi,代碼行數:80,代碼來源:commondbtm.class.php


注:本文中的Lock::getUnlockMassiveActions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。