public function &render() { $this->setAttribute('content', $this->getEngine()->fetch($this->getDirectory() . '/' . $this->contentTemplate)); $user = $this->getContext()->getUser(); if ($user->isAuthenticated()) { $roles = array(); $user_roles = $user->getAttribute('Login')->getRoles(); foreach ($user_roles as $role) { if (array_key_exists($role->name, $roles)) { $roles[$role->name] = array(); } $roles[$role->name][] = $role; } $commontasks = ''; if ($this->renderTasks) { foreach (array_keys($roles) as $roleName) { $name = str_replace(array(' ', '.', '/', '\\', '&', '?', ';'), '', $roleName); $this->setAttribute('roles', $roles[$roleName]); // TODO: check for template existence $commontasks = $this->getEngine()->fetch($this->getDirectory() . '/commontasks/' . $name . '.tpl') . $commontasks; } $commontasks = $this->getEngine()->fetch($this->getDirectory() . '/commontasks/_everyone.tpl') . $commontasks; } $this->setAttribute("commontasks", $commontasks); } return parent::render(); }
public function &render() { $request = $this->getContext()->getRequest(); $this->setAttribute('nocList', $request->getAttribute("nocList")); return parent::render(); }
/** * Sets some in this case, we leave it all up to the child classes to reimplement * this and by default call View::render() * * @returns always true */ function render() { if (!$this->isCached()) { // and then add our stuff to the view... $this->setValue('archives', $this->_getArchives()); $this->setValue('recentposts', $this->_getRecentPosts()); $this->setValue('mylinkscategories', $this->_getLinkCategories()); $this->setValue('monthposts', $this->_getMonthPosts()); $this->setValue('articlecategories', $this->_getArticleCategories()); $this->generateCalendar($this->getValue('Year'), $this->getValue('Month')); // also, let's not forget about the plugins... // put the plugins in the context $plugins = $this->_pm->getPlugins(); foreach ($plugins as $name => $plugin) { $this->setValue($name, $plugin); } } // // these things can go in since they do not mean much overhead when generating the view... // $this->setValue('locale', $this->_blogInfo->getLocale()); $this->setValue('version', Version::getVersion()); $this->setValue('now', new Timestamp()); $this->setValue('blog', $this->_blogInfo); $this->setValue('url', $this->_blogInfo->getBlogRequestGenerator()); $this->setValue('utils', $this->_blogInfo->getBlogRequestGenerator()); $this->setValue('blogsettings', $this->_blogInfo->getSettings()); $this->setValue('rss', new RssParser()); // ask the parent to do something, if needed parent::render(); }