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


PHP modResource::addLock方法代碼示例

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


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

示例1: addLock

 /**
  * Add a lock to the Resource while unpublishing it
  * @return boolean
  */
 public function addLock()
 {
     $locked = $this->resource->addLock();
     if ($locked !== true) {
         $user = $this->modx->getObject('modUser', $locked);
         if ($user) {
             $locked = false;
         }
     }
     return $locked;
 }
開發者ID:ChrstnMgcn,項目名稱:revolution,代碼行數:15,代碼來源:unpublish.class.php

示例2: addLock

 /**
  * Add a lock to the resource we are saving
  * @return boolean
  */
 public function addLock()
 {
     $locked = $this->object->addLock();
     if ($locked !== true) {
         $stealLock = $this->getProperty('steal_lock', false);
         if (!empty($stealLock)) {
             if (!$this->modx->hasPermission('steal_locks') || !$this->object->checkPolicy('steal_lock')) {
                 return false;
             }
             if ($locked > 0 && $locked != $this->modx->user->get('id')) {
                 $this->object->removeLock($locked);
                 $locked = $this->object->addLock($this->modx->user->get('id'));
             }
         }
         if ($locked !== true) {
             $lockedBy = intval($locked);
             $this->lockedUser = $this->modx->getObject('modUser', $lockedBy);
             if ($this->lockedUser) {
                 $locked = false;
             } else {
                 $this->object->removeLock($lockedBy);
                 $locked = true;
             }
         }
     }
     return $locked;
 }
開發者ID:semencov-com,項目名稱:affiliate,代碼行數:31,代碼來源:update.class.php

示例3: afterSave

 /**
  * {@inheritDoc}
  * @return mixed
  */
 public function afterSave()
 {
     $this->object->addLock();
     $this->setParentToContainer();
     $this->saveResourceGroups();
     $this->checkIfSiteStart();
     return parent::afterSave();
 }
開發者ID:e-gob,項目名稱:apps.gob.cl,代碼行數:12,代碼來源:create.class.php

示例4: checkForLocks

 /**
  * Check for locks on the Resource
  *
  * @return bool
  */
 public function checkForLocks()
 {
     $lockedBy = $this->resource->addLock($this->modx->user->get('id'));
     $this->canSave = $this->modx->hasPermission('save_document') ? 1 : 0;
     $this->locked = false;
     $this->lockedText = '';
     if (!empty($lockedBy) && $lockedBy !== true) {
         $this->canSave = false;
         $this->locked = true;
         $locker = $this->modx->getObject('modUser', $lockedBy);
         if ($locker) {
             $lockedBy = $locker->get('username');
         }
         $this->lockedText = $this->modx->lexicon('resource_locked_by', array('user' => $lockedBy, 'id' => $this->resource->get('id')));
     }
     return $this->locked;
 }
開發者ID:e-gob,項目名稱:apps.gob.cl,代碼行數:22,代碼來源:update.class.php


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