示例#1
0
文件: Show.php 项目: vih/vih.dk
 function renderHtml()
 {
     $nyhed = new VIH_News($this->name());
     if ($nyhed->get('date_expire') < date('Y-m-d H:i:s') and $nyhed->get('date_expire') != '0000-00-00 00:00:00' or $nyhed->get('published') == 0 or $nyhed->get('active') == 0) {
         throw new k_PageNotFound();
         exit;
     }
     $data = array('news' => $nyhed);
     $this->document->setTitle($nyhed->get('title'));
     $tpl = $this->template->create('News/nyhed');
     $data = array('content' => $tpl->render($this, $data), 'content_sub' => $this->getSubContent());
     $tpl = $this->template->create('sidebar-wrapper');
     return $tpl->render($this, $data);
 }
示例#2
0
 function renderHtml()
 {
     $nyhed = new VIH_News($this->name());
     if (is_numeric($this->query('sletbillede'))) {
         $nyhed->deletePicture($this->query('sletbillede'));
     }
     $pictures = $nyhed->getPictures();
     $pic_html = '';
     foreach ($pictures as $pic) {
         $file = new VIH_FileHandler($pic['file_id']);
         if ($file->get('id')) {
             $file->loadInstance('small');
         }
         $pic_html .= '<div>' . $file->getImageHtml() . '<br /><a href="' . $this->url('./') . '?sletbillede=' . $pic['file_id'] . '">Slet</a></div>';
     }
     $this->document->setTitle('Nyhed: ' . $nyhed->get('overskrift'));
     $this->document->addOption('Ret', $this->url('edit'));
     // $tpl->set('title', 'Nyhed');
     return '<div>' . autoop($nyhed->get('tekst')) . '</div> ' . $this->getForm()->toHTML() . $pic_html . $nyhed->get('date_updated');
 }
示例#3
0
 function renderHtml()
 {
     if (is_numeric($this->context->name())) {
         $nyhed = new VIH_News((int) $this->context->name());
     } else {
         $nyhed = new VIH_News();
     }
     if ($nyhed->get('id') > 0) {
         $defaults = array('overskrift' => $nyhed->get('overskrift'), 'type_id' => $nyhed->get('type_id'), 'tekst' => $nyhed->get('tekst'), 'date_publish' => $nyhed->get('date_publish'), 'title' => $nyhed->get('title'), 'keywords' => $nyhed->get('keywords'), 'description' => $nyhed->get('description'), 'published' => $nyhed->get('published'));
         if ($nyhed->get('date_expire') == '0000-00-00 00:00:00') {
             $defaults['date_expire'] = '';
         } else {
             $defaults['date_expire'] = $nyhed->get('date_expire');
         }
     } else {
         $defaults['date_publish'] = date('Y-m-d H:i');
     }
     $keyword = new Ilib_Keyword_Appender($nyhed);
     // starter keyword objektet
     $defaults['keyword'] = $keyword->getConnectedKeywordsAsString();
     $this->getForm()->setDefaults($defaults);
     $this->document->setTitle('Rediger nyhed');
     return $this->getForm()->toHTML();
 }