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");
$snippet = Document\Snippet::getById($this->getParam("id"));
$modificationDate = $snippet->getModificationDate();
$snippet = $this->getLatestVersion($snippet);
$snippet->setVersions(array_splice($snippet->getVersions(), 0, 1));
$snippet->getScheduledTasks();
$snippet->idPath = Element\Service::getIdPath($snippet);
$snippet->userPermissions = $snippet->getUserPermissions();
$snippet->setLocked($snippet->isLocked());
$snippet->setParent(null);
if ($snippet->getContentMasterDocument()) {
$snippet->contentMasterDocumentPath = $snippet->getContentMasterDocument()->getRealFullPath();
}
$this->minimizeProperties($snippet);
// unset useless data
$snippet->setElements(null);
if ($snippet->isAllowed("view")) {
$this->_helper->json($snippet);
}
$this->_helper->json(false);
}