/** * Get most recently created documents (with type "page") * @param int $limit Maximum number of documents to return. Default is 25. * @return object Document_List */ protected function getPages($path, $limit = null, $offset = null) { $list = new \Pimcore\Model\Document\Listing(); if ($path != null) { $list->setCondition("type = 'page' AND path LIKE '" . $path . "%'"); } else { $list->setCondition("type = 'page'"); } if ($limit != null) { $list->setLimit($limit); } if ($offset != null) { $list->setOffset($offset); } return $list->load(); }
private function getSubDocumentIds(\Pimcore\Model\Document $document) { $childsList = new Pimcore\Model\Document\Listing(); $condition = "path LIKE ?"; if (!$this->getUser()->isAdmin()) { $userIds = $this->getUser()->getRoles(); $userIds[] = $this->getUser()->getId(); $condition .= " AND (\n (SELECT `view` FROM users_workspaces_document WHERE userId IN (\" . implode(',', {$userIds}) . \") and LOCATE(CONCAT(path,`key`),cpath)=1 ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n OR\n (SELECT `view` FROM users_workspaces_document WHERE userId IN (\" . implode(',', {$userIds}) . \") and LOCATE(cpath,CONCAT(path,`key`))=1 ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n )"; } $childsList->setCondition($condition, $document->getRealFullPath() . '/%'); return $childsList->loadIdList(); }