private function tinyMCE() { Stuffpress_TinyMCE::append($this->view); }
public function editAction() { // We'll need to access the pages database $pages = new Pages(); // Get the source from the request $id = (int) $this->_getParam('id'); $type = (string) $this->_getParam('type'); // Validate the parameters if (!($id >= 0 && in_array($type, Pages::getAvailablePages()))) { throw new Stuffpress_Exception("Parameters failed validation"); } // Does the page exist ? if (!($page = $pages->getPage($id))) { throw new Stuffpress_Exception("Unknown page with id {$id}"); } // Are we the owner ? if ($page['user_id'] != $this->_application->user->id) { throw new Stuffpress_AccessDeniedException("Not the owner of page {$id}"); } // Get the page model $model = Pages::getModel($type); // Prepare the form $form = $model->getForm(); $values = $model->getPageValues($id); $values['id'] = $id; $values['title'] = $page['title']; $form->populate($values); // Prepare the view $this->common(); $this->view->headScript()->appendFile('js/storytlr/effects.js'); $this->view->headScript()->appendFile('js/controllers/pages.js'); $this->view->name = $model->getName(); $this->view->edit = 'true'; $this->view->description = $model->getDescription(); $this->view->form = $form; // Add TinyMCE code Stuffpress_TinyMCE::append($this->view); }