public function admin(Pagemill_Data $data, Pagemill_Stream $stream) { $data = $data->fork(); $this->settings = array_merge(array('limit' => ''), $this->settings); $data->setArray($this->settings); $categories = new Model_News_Category(); $caegories->order('categoryname'); foreach ($categories->getAll() as $category) { if (isset($this->settings['categoryid']) && in_array($row['categoryid'], $this->settings['categoryid'])) { $category->set('selected', true, true); } } $data->set('categories', $categories); parent::admin($data, $stream, $tag); }
public function admin(Pagemill_Data $data, Pagemill_Stream $stream) { $this->adminTemplate = '/admin/news/newsfeed.adminplug.html'; $data = $data->fork(); $this->attributes = array_merge(array('news_page_base' => '', 'limit' => ''), $this->attributes); $data->setArray($this->attributes); // get pages; add to template $pages = new Model_Page(); $pages->where('application = ?', 'News'); $data->set('pages', $pages); // get categories; add to template //$categories = new News_Category_Factory(); $categories = new Model_News_Category(); $categories->order('categoryname'); foreach ($categories->getAll() as $category) { if (isset($this->attributes['categoryid']) && in_array($row['categoryid'], $this->attributes['categoryid'])) { $category->set('selected', true, true); } } $data->set('categories', $categories); parent::output($data, $stream); }
$settings = Typeframe::CurrentPage()->settings(); // add articles, pagination to template $pm->setVariable('news', $articles); //$pm->setVariableArray(Pagination::Calculate($articles->getTotal(), // $perpage, $articles->getCurrentPage())); // get categories; limit to the given parent category //$categories = new News_Category_Factory(); $categories = new Model_News_Category(); //if ($categoryid) $categories->where('parentid IN ?', $categoryid); //$categories->setParentId($categoryid); // add parent category to template /*if ($category) { $pm->addLoop('crumbs', $category); $parentid = $category->get('parentid'); while ($parentid > 0) { $parent = Model_News_Category::Get($parentid); $pm->addLoop('crumbs', $parent); $parentid = $parent->get('parentid'); } }*/ // add categories to template with download counts foreach ($categories->getAll() as $category) { //$category->set('articlesCount', $category->countArticles()); $pm->addLoop('categories', $category); } // add page title and header to template //$title = News::GetTitle(); //$pm->setVariable('page_title', $title); //$pm->setVariable('page_header', $title);