示例#1
0
 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     Element\Editlock::lock($this->getParam("id"), "document");
     $email = Document\Newsletter::getById($this->getParam("id"));
     $email = clone $email;
     $email = $this->getLatestVersion($email);
     $versions = Element\Service::getSafeVersionInfo($email->getVersions());
     $email->setVersions(array_splice($versions, 0, 1));
     $email->idPath = Element\Service::getIdPath($email);
     $email->userPermissions = $email->getUserPermissions();
     $email->setLocked($email->isLocked());
     $email->setParent(null);
     // unset useless data
     $email->setElements(null);
     $email->childs = null;
     $this->addTranslationsData($email);
     $this->minimizeProperties($email);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($email));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $email, "returnValueContainer" => $returnValueContainer]);
     if ($email->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
示例#2
0
 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     Element\Editlock::lock($this->getParam("id"), "document");
     $link = Document\Hardlink::getById($this->getParam("id"));
     $link = clone $link;
     $link->idPath = Element\Service::getIdPath($link);
     $link->userPermissions = $link->getUserPermissions();
     $link->setLocked($link->isLocked());
     $link->setParent(null);
     if ($link->getSourceDocument()) {
         $link->sourcePath = $link->getSourceDocument()->getRealFullPath();
     }
     $this->addTranslationsData($link);
     $this->minimizeProperties($link);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($link));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $link, "returnValueContainer" => $returnValueContainer]);
     if ($link->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
示例#3
0
 public function getDataByIdAction()
 {
     // check for lock
     if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     \Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
     $page = Document\Printpage::getById($this->getParam("id"));
     $page = $this->getLatestVersion($page);
     $page->getVersions();
     $page->getScheduledTasks();
     $page->idPath = Service::getIdPath($page);
     $page->userPermissions = $page->getUserPermissions();
     $page->setLocked($page->isLocked());
     if ($page->getContentMasterDocument()) {
         $page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
     }
     $this->addTranslationsData($page);
     // unset useless data
     $page->setElements(null);
     $page->childs = null;
     // cleanup properties
     $this->minimizeProperties($page);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($page));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $page, "returnValueContainer" => $returnValueContainer]);
     if ($page->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
示例#4
0
 public function getDataByIdAction()
 {
     $document = Document::getById($this->getParam("id"));
     $document = clone $document;
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($document));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $document, "returnValueContainer" => $returnValueContainer]);
     if ($document->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(["success" => false, "message" => "missing_permission"]);
 }