Example #1
0
 /**
  * Edit Group Page
  *
  * @return 	void
  */
 public function editTask()
 {
     //get request vars
     $pageid = Request::getInt('pageid', 0, 'get');
     // load page object
     $this->view->page = new Page($pageid);
     $this->view->version = $this->view->page->version();
     //are we adding or editing
     $new = $this->view->page->get('id') === null && $pageid == null ? true : false;
     // make sure page exists
     if (!$this->view->page->exists() && !$new) {
         App::abort(404, Lang::txt('COM_GROUPS_PAGES_PAGE_NOT_FOUND'));
     }
     // make sure page belongs to group - if editing
     if (!$this->view->page->belongsToGroup($this->group) && !$new) {
         App::abort(403, Lang::txt('COM_GROUPS_PAGES_PAGE_NOT_AUTH'));
     }
     // are we passing in a page from someplace else
     if ($this->page) {
         $this->view->page = $this->page;
     }
     if ($this->version) {
         $this->view->version = $this->version;
     }
     // checkout page
     Helpers\Pages::checkout($this->view->page->get('id'));
     // get a list of all pages for page ordering
     $pageArchive = Page\Archive::getInstance();
     $this->view->pages = $pageArchive->pages('list', array('gidNumber' => $this->group->get('gidNumber'), 'state' => array(0, 1), 'orderby' => 'lft'));
     // get page categories
     $categoryArchive = new Page\Category\Archive();
     $this->view->categories = $categoryArchive->categories('list', array('gidNumber' => $this->group->get('gidNumber'), 'orderby' => 'title'));
     // get stylesheets for editor
     // [!] (zooley) 07/2015
     //     This causes extreme performance issues under certain situations
     //     Bypassing until a better solution can be found.
     $this->view->stylesheets = array();
     //Helpers\View::getPageCss($this->group);
     // get page templates
     $this->view->pageTemplates = Helpers\View::getPageTemplates($this->group);
     // build the title
     $this->_buildTitle();
     // build pathway
     $this->_buildPathway();
     // get view notifications
     $this->view->notifications = $this->getNotifications();
     $this->view->notifications = $this->view->notifications ? $this->view->notifications : array();
     $this->view->group = $this->group;
     $this->view->config = $this->config;
     //display layout
     $this->view->setLayout('edit')->display();
 }
Example #2
0
 /**
  * Edit a group page
  *
  * @return void
  */
 public function editTask()
 {
     // get request vars
     $ids = Request::getVar('id', array());
     $id = isset($ids[0]) ? $ids[0] : null;
     // get the page & version objects
     $this->view->page = new Page($id);
     $this->view->version = $this->view->page->version();
     $this->view->firstversion = $this->view->page->version(1);
     // get a list of all pages for creating module menu
     $pageArchive = Page\Archive::getInstance();
     $this->view->pages = $pageArchive->pages('list', array('gidNumber' => $this->group->get('gidNumber'), 'state' => array(0, 1), 'orderby' => 'lft ASC'));
     // get page categories
     $categoryArchive = new Page\Category\Archive();
     $this->view->categories = $categoryArchive->categories('list', array('gidNumber' => $this->group->get('gidNumber'), 'orderby' => 'title'));
     // pass vars to view
     $this->view->group = $this->group;
     // get page templates
     $this->view->pageTemplates = Helpers\View::getPageTemplates($this->group);
     // Set any errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }