public function doCollection() { // Document need to contain the minimum require data for each collection // Author, title, updated, id, link $crit = new ezpContentCriteria(); $crit->accept[] = ezpContentCriteria::location()->subtree( ezpContentLocation::fetchByNodeId( $this->nodeId ) ); $retData = array(); $baseUri = substr( $this->request->protocol, 0, strpos( $this->request->protocol, "-" ) ) . "://{$this->request->host}"; foreach ( ezpContentRepository::query( $crit ) as $node ) { $retData[] = array( "objectName" => $node->name, "author" => $node->owner->Name, "modified" => $node->dateModified, "published" => $node->datePublished, "classIdentifier" => $node->classIdentifier, "nodeUrl" => $baseUri . $this->getRouter()->generateUrl( 1, array( "nodeId" => $node->locations->node_id ) ) ); } $result = new ezcMvcResult(); $result->variables["collection"] = $retData; return $result; }
public function doCollection() { // Document need to contain the minimum require data for each collection // Author, title, updated, id, link $crit = new ezpContentCriteria(); $crit->accept[] = ezpContentCriteria::location()->subtree( ezpContentLocation::fetchByNodeId( $this->nodeId ) ); $childNodes = ezpContentRepository::query( $crit ); $result = new ezcMvcResult(); $retData = array(); $protIndex = strpos( $this->request->protocol, '-' ); $baseUri = substr( $this->request->protocol, 0, $protIndex ) . "://{$this->request->host}"; foreach( $childNodes as $node ) { $childEntry = array( 'objectName' => $node->name, 'author' => $node->owner->Name, 'modified' => $node->dateModified, 'published' => $node->datePublished, 'classIdentifier' => $node->classIdentifier, 'nodeUrl' => $baseUri . $this->getRouter()->generateUrl( 1, array( 'nodeId' => $node->locations->node_id ) ) ); $retData[] = $childEntry; } $result->variables['collection'] = $retData; return $result; }
public static function getChildrenList(ezpContentCriteria $c, ezpRestRequest $currentRequest, array $responseGroups = array(), ezcMvcRouter $router = null) { $aRetData = array(); /** @var ezpContent[] $aChildren */ $aChildren = ezpContentRepository::query($c); $fieldBlacklist = self::getFieldBlacklist(); foreach ($aChildren as $childNode) { $childEntry = self::getMetadataByContent($childNode); $childEntry = array_merge($childEntry, self::getMetadataByLocation($childNode->locations)); // Add fields with their values if requested if (in_array(ezpRestContentController::VIEWLIST_RESPONSEGROUP_FIELDS, $responseGroups)) { $childEntry['fields'] = array(); foreach ($childNode->fields as $fieldName => $field) { if (!isset($fieldBlacklist[$fieldName]) && !isset($fieldBlacklist[$childNode->classIdentifier . '/' . $fieldName])) { $childEntry['fields'][self::getOverrideFieldIdentifier($fieldName, $childNode->classIdentifier)] = self::attributeOutputData($field, $currentRequest, $router); } } } $aRetData[] = $childEntry; } return $aRetData; }
public function doList() { $crit = new ezpContentCriteria(); // Hmm, the following sequence is too long... $crit->accept[] = ezpContentCriteria::location()->subtree(ezpContentLocation::fetchByNodeId($this->nodeId)); $childNodes = ezpContentRepository::query($crit); // Need paging here $result = new ezcMvcResult(); $retData = array(); // To be moved to URI convenience methods $protIndex = strpos($this->request->protocol, '-'); $baseUri = substr($this->request->protocol, 0, $protIndex) . "://{$this->request->host}"; foreach ($childNodes as $node) { $childEntry = array('objectName' => $node->name, 'classIdentifier' => $node->classIdentifier, 'nodeUrl' => $baseUri . $this->getRouter()->generateUrl(1, array('nodeId' => $node->locations->node_id))); $retData[] = $childEntry; } $result->variables['childNodes'] = $retData; return $result; }
/** * Returns the children count, based on the provided criteria object * @param ezpContentCriteria $c * @return int */ public static function getChildrenCount(ezpContentCriteria $c) { $count = ezpContentRepository::queryCount($c); return $count; }