/** * Render Modules to group template or page * * @param string */ public function render() { // get the page id $pageid = $this->page ? $this->page->get('id') : 0; // get the list of modules $groupModuleArchive = Archive::getInstance(); $modules = $groupModuleArchive->modules('list', array('gidNumber' => $this->group->get('gidNumber'), 'state' => array(1), 'approved' => $this->allMods == 1 ? array(0, 1) : array(1), 'position' => $this->params->position, 'orderby' => 'ordering ASC')); // loop through each module to display $content = ''; foreach ($modules as $module) { // make sure module can be displayed if ($module->displayOnPage($pageid)) { $content .= $module->content('parsed'); } } //return final output return $content; }
/** * Render Module to group template or page * * @param string */ public function render() { // var to hold content $content = ''; // get the page id $pageid = $this->page ? $this->page->get('id') : null; // get the list of modules $groupModuleArchive = Archive::getInstance(); $modules = $groupModuleArchive->modules('list', array('gidNumber' => $this->group->get('gidNumber'), 'state' => array(1), 'approved' => $this->allMods == 1 ? array(0, 1) : array(1), 'title' => $this->params->title, 'orderby' => 'ordering DESC')); // make sure we have a module if ($modules->count() < 1) { return $content; } // get first module $module = $modules->first(); // make sure module can be displayed if ($module->displayOnPage($pageid)) { $content .= $module->content('parsed'); } //return final output return $content; }
/** * Edit Page Module * * @return void */ public function editTask() { Request::setVar('hidemainmenu', 1); // get request vars $id = Request::getVar('id', array(0)); if (is_array($id) && !empty($id)) { $id = $id[0]; } // get the category object $this->view->module = new Module($id); // 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, 2), 'orderby' => 'lft')); // get a list of all pages for creating module menu $moduleArchive = Module\Archive::getInstance(); $this->view->order = $moduleArchive->modules('list', array('gidNumber' => $this->group->get('gidNumber'), 'position' => $this->view->module->get('position'), 'state' => array(0, 1, 2), 'orderby' => 'ordering')); // are we passing a category object if ($this->module) { $this->view->module = $this->module; } // pass group to view $this->view->group = $this->group; // Set any errors foreach ($this->getErrors() as $error) { $this->view->setError($error); } // Output the HTML $this->view->setLayout('edit')->display(); }
/** * Edit Module * * @return void */ public function editTask() { //set to edit layout $this->view->setLayout('edit'); // get request vars $moduleid = Request::getInt('moduleid', 0); // get the category object $this->view->module = new Module($moduleid); // are we passing a module object if ($this->module) { $this->view->module = $this->module; } // 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 a list of all pages for creating module menu $moduleArchive = Module\Archive::getInstance(); $this->view->order = $moduleArchive->modules('list', array('gidNumber' => $this->group->get('gidNumber'), 'position' => $this->view->module->get('position'), 'state' => array(0, 1), 'orderby' => 'ordering')); // get stylesheets for editor $this->view->stylesheets = Helpers\View::getPageCss($this->group); // build the title $this->_buildTitle(); // build pathway $this->_buildPathway(); // get view notifications $this->view->notifications = $this->getNotifications() ? $this->getNotifications() : array(); $this->view->group = $this->group; //display layout $this->view->display(); }