当前位置: 首页>>代码示例>>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;未经允许,请勿转载。