Pimcore\Model\Element\Editlock::isLocked PHP Метод

isLocked() публичный статический Метод

public static isLocked ( $cid, $ctype ) : boolean
$cid
$ctype
Результат boolean
    public static function isLocked($cid, $ctype)
    {
        if ($lock = self::getByElement($cid, $ctype)) {
            if (time() - $lock->getDate() > 3600 || $lock->getSessionId() == session_id()) {
                // lock is out of date unlock it
                self::unlock($cid, $ctype);
                return false;
            }
            return true;
        }
        return false;
    }

Usage Example

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")));
     }
     Element\Editlock::lock($this->getParam("id"), "document");
     $page = Document\Page::getById($this->getParam("id"));
     $page = $this->getLatestVersion($page);
     $page->setVersions(array_splice($page->getVersions(), 0, 1));
     $page->getScheduledTasks();
     $page->idPath = Element\Service::getIdPath($page);
     $page->userPermissions = $page->getUserPermissions();
     $page->setLocked($page->isLocked());
     $page->setParent(null);
     if ($page->getContentMasterDocument()) {
         $page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
     }
     // get depending redirects
     $redirectList = new Redirect\Listing();
     $redirectList->setCondition("target = ?", $page->getId());
     $page->redirects = $redirectList->load();
     // unset useless data
     $page->setElements(null);
     $page->childs = null;
     // cleanup properties
     $this->minimizeProperties($page);
     if ($page->isAllowed("view")) {
         $this->_helper->json($page);
     }
     $this->_helper->json(false);
 }
All Usage Examples Of Pimcore\Model\Element\Editlock::isLocked