/** * @requiresRight id WRITE */ public function index() { $resource = new \core_kernel_classes_Resource($this->getRequestParameter('id')); $revisions = RepositoryProxy::getRevisions($resource->getUri()); $returnRevision = array(); foreach ($revisions as $revision) { $returnRevision[] = array('id' => $revision->getVersion(), 'modified' => \tao_helpers_Date::displayeDate($revision->getDateCreated()), 'author' => UserHelper::renderHtmlUser($revision->getAuthorId()), 'message' => _dh($revision->getMessage())); } $this->setData('resourceLabel', _dh($resource->getLabel())); $this->setData('id', $resource->getUri()); $this->setData('revisions', $returnRevision); $this->setView('History/index.tpl'); }
/** * Helper to determin suitable next version nr * * @param string $resourceId * @return number */ protected static function getNextVersion($resourceId) { $candidate = 0; foreach (RepositoryProxy::getRevisions($resourceId) as $revision) { $version = $revision->getVersion(); if (is_numeric($version) && $version > $candidate) { $candidate = $version; } } return $candidate + 1; }