/** * Load the record * * @return void */ private function loadData() { // get record $this->id = $this->getParameter('id', 'int'); // check if something went wrong if ($this->id === null || !BackendPagesModel::exists($this->id)) { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } // get the record $this->record = BackendPagesModel::get($this->id); // load blocks $this->blocksContent = BackendPagesModel::getBlocks($this->id); // is there a revision specified? $revisionToLoad = $this->getParameter('revision', 'int'); // if this is a valid revision if ($revisionToLoad !== null) { // save current template $templateId = $this->record['template_id']; // overwrite the current record $this->record = (array) BackendPagesModel::getRevision($this->id, $revisionToLoad); // template is not part of revision; only data $this->record['template_id'] = $templateId; // load blocks $this->blocksContent = BackendPagesModel::getBlocksRevision($this->id, $revisionToLoad); // show warning $this->tpl->assign('appendRevision', true); } // is there a revision specified? $draftToLoad = $this->getParameter('draft', 'int'); // if this is a valid revision if ($draftToLoad !== null) { // save current template $templateId = $this->record['template_id']; // overwrite the current record $this->record = (array) BackendPagesModel::getRevision($this->id, $draftToLoad); // template is not part of draft; only data $this->record['template_id'] = $templateId; // load blocks $this->blocksContent = BackendPagesModel::getBlocksRevision($this->id, $draftToLoad); // show warning $this->tpl->assign('appendRevision', true); } // reset some vars $this->record['full_url'] = BackendPagesModel::getFullURL($this->record['id']); $this->record['is_hidden'] = $this->record['hidden'] == 'Y'; }