Example #1
0
File: Show.php Project: vih/vih.dk
 function getSubContent($keyword)
 {
     $keywords = array($keyword);
     if (!is_array($keywords)) {
         throw new Exception('parameter should be an array with keywords');
     }
     $keyword_ids = array();
     foreach ($keywords as $keyword) {
         $keyword_object = new Ilib_Keyword(new VIH_News());
         // @todo: This is not really good, but the only way to identify keyword on name!
         $keyword_ids[] = $keyword_object->save(array('keyword' => $keyword));
     }
     $this->getDBQuery()->setKeyword((array) $keyword_ids);
     $this->getDBQuery()->setSorting('nyhed.date_publish DESC');
     $db = $this->getDBQuery()->getRecordset("nyhed.id", "", false);
     $news = array();
     $i = 0;
     while ($db->nextRecord()) {
         if ($i > 5) {
             break;
         }
         $news[] = new VIH_News($db->f('id'));
         $i++;
     }
     $data = array('nyheder' => $news);
     $tpl = $this->template->create('News/sidebar-featured');
     return $tpl->render($this, $data);
 }
Example #2
0
File: Root.php Project: vih/vih.dk
 function getHighlight()
 {
     $keywords = array('topbar');
     if (!is_array($keywords)) {
         throw new Exception('parameter should be an array with keywords');
     }
     $keyword_ids = array();
     foreach ($keywords as $keyword) {
         $keyword_object = new Ilib_Keyword(new VIH_News());
         // @todo: This is not really good, but the only way to identify keyword on name!
         $keyword_ids[] = $keyword_object->save(array('keyword' => $keyword));
     }
     $this->getDBQuery()->setKeyword((array) $keyword_ids);
     $db = $this->getDBQuery()->getRecordset("nyhed.id", "", false);
     $news = array();
     while ($db->nextRecord()) {
         $news[] = new VIH_News($db->f('id'));
     }
     if (empty($news)) {
         return '<p>Spørgsmål til højskoleophold eller rundvisning<span>Kontakt Peter Sebastian på 2929 6387 eller ps@vih.dk.</span></p>';
     } else {
         return '<p>' . $news[0]->get('title') . '<span>' . $news[0]->get('tekst') . '</span></p>';
     }
 }