getRevision() public static method

Get all data for a given revision
public static getRevision ( integer $id, integer $revisionId ) : array
$id integer The id of the item.
$revisionId integer The revision to get.
return array
Exemplo n.º 1
0
 /**
  * Get the data
  * If a revision-id was specified in the URL we load the revision and not the actual data.
  */
 private function getData()
 {
     $this->record = (array) BackendBlogModel::get($this->id);
     $this->imageIsAllowed = $this->get('fork.settings')->get($this->URL->getModule(), 'show_image_form', true);
     // is there a revision specified?
     $revisionToLoad = $this->getParameter('revision', 'int');
     // if this is a valid revision
     if ($revisionToLoad !== null) {
         // overwrite the current record
         $this->record = (array) BackendBlogModel::getRevision($this->id, $revisionToLoad);
         // show warning
         $this->tpl->assign('usingRevision', true);
     }
     // is there a revision specified?
     $draftToLoad = $this->getParameter('draft', 'int');
     // if this is a valid revision
     if ($draftToLoad !== null) {
         // overwrite the current record
         $this->record = (array) BackendBlogModel::getRevision($this->id, $draftToLoad);
         // show warning
         $this->tpl->assign('usingDraft', true);
         // assign draft
         $this->tpl->assign('draftId', $draftToLoad);
     }
     // no item found, throw an exceptions, because somebody is f*****g with our URL
     if (empty($this->record)) {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }