Пример #1
0
 function testSaveReturnsTrueOnValidData()
 {
     $data = array('navn' => 'tests');
     $kursus = new VIH_Model_LangtKursus();
     $this->assertTrue($kursus->save($data) > 0);
     $this->assertEquals('tests', $kursus->get('navn'));
 }
Пример #2
0
 function renderHtml()
 {
     $kursus = new VIH_Model_LangtKursus($this->context->name());
     if ($this->query("addrate")) {
         if (!$kursus->addRate($this->query("addrate"))) {
             throw new Exception('Kunne ikke tilføje rate.', E_USER_ERROR);
         }
     }
     $this->document->setTitle('Opdater rater');
     $pris = array('kursus' => $kursus);
     if ($kursus->antalRater() == 0) {
         $form = new HTML_QuickForm('rater', 'POST', $this->url());
         $form->addElement('text', 'antal', 'Antal rater');
         $form->addElement('text', 'foerste_rate_dato', 'Første rate dato', 'dd-mm-YYYY');
         $form->addElement('submit', 'opret_rater', 'Opret rater');
         $form_html = $form->toHTML();
     } else {
         $data = array('kursus' => $kursus);
         $tpl = $this->template->create('langekurser/rater_form');
         $form_html = $tpl->render($this, $data);
     }
     $this->document->setTitle('Rater for betaling ' . $kursus->get('kursusnavn'));
     $this->document->addOption('Til kurset', $this->context->url());
     $tpl = $this->template->create('langekurser/pris');
     return '<p><strong>Periode</strong>: ' . $kursus->getDateStart()->format('%d-%m-%Y') . ' &mdash; ' . $kursus->getDateEnd()->format('%d-%m-%Y') . '</p>
     ' . $tpl->render($this, $pris) . $form_html;
 }
Пример #3
0
 function renderHtml()
 {
     $kursus = new VIH_Model_LangtKursus($this->context->name());
     $tilmeldinger = $kursus->getTilmeldinger();
     $this->document->setTitle('Tilmeldinger til ' . $kursus->get('kursusnavn'));
     $this->document->addOption('Alle kurser', $this->url('../../'));
     $data = array('tilmeldinger' => $tilmeldinger, 'caption' => 'Tilmeldinger');
     $tpl = $this->template->create('langekurser/tilmeldinger');
     return $tpl->render($this, $data);
 }
Пример #4
0
 function renderHtml()
 {
     $kursus = new VIH_Model_LangtKursus($this->name());
     $ansat = new VIH_Model_Ansat($kursus->get('ansat_id'));
     if ($ansat->get('id')) {
         $sprg_link = '<a href="' . $this->url('/underviser/' . $kursus->get('ansat_id')) . '">' . $ansat->get('navn') . ' svarer på spørgsmål</a>';
     } else {
         $sprg_link = '<a href="' . $this->url('/kontakt/') . '">Kontoret</a> svarer gerne på spørgsmål om kurset';
     }
     $pictures = $kursus->getPictures();
     $pic_html = '';
     if (count($pictures) > 0) {
         $pic_html .= '<div style="clear: both;">';
         foreach ($pictures as $pic) {
             $file = new VIH_FileHandler($pic['file_id']);
             if ($file->get('id')) {
                 $file->loadInstance('small');
             } else {
                 continue;
             }
             $pic_uri = $file->getImageHtml();
             $file->loadInstance('medium');
             $pic_html .= '<a href="' . htmlspecialchars($file->get('file_uri')) . '" rel="lightbox">' . $pic_uri . '</a>';
         }
         $pic_html .= '</div>';
     }
     if ($kursus->get('title')) {
         $title = $kursus->get('title') . ' ' . $kursus->get('aar');
     } else {
         $title = $kursus->get('kursusnavn');
     }
     $meta['description'] = $kursus->get('description');
     $meta['keywords'] = $kursus->get('keywords');
     $this->document->setTitle($kursus->getKursusNavn());
     $this->document->meta = $meta;
     $data = array('kursus' => $kursus, 'f*g' => $this->getSubjectsTable());
     $tpl = $this->template->create('LangtKursus/kursus');
     $content = array('content' => $tpl->render($this, $data) . $this->getInformationAboutCourse($kursus), 'content_sub' => $this->getSubContent($sprg_link));
     $tpl = $this->template->create('sidebar-wrapper');
     return $tpl->render($this, $content);
 }
Пример #5
0
 function renderHtml()
 {
     if (is_numeric($this->context->name()) and $this->name() == 'edit') {
         $kursus = new VIH_Model_LangtKursus($this->context->name());
         $defaults = array('id' => $kursus->get('id'), 'navn' => $kursus->get('navn'), 'shorturl' => $kursus->get('shorturl'), 'belong_to_id' => $kursus->get('belong_to_id'), 'tekst_diplom' => $kursus->get('tekst_diplom'), 'ugeantal' => $kursus->get('ugeantal'), 'dato_start' => $kursus->get('dato_start'), 'dato_slut' => $kursus->get('dato_slut'), 'ansat_id' => $kursus->get('ansat_id'), 'title' => $kursus->get('title'), 'keywords' => $kursus->get('keywords'), 'description' => $kursus->get('description'), 'manchet' => $kursus->get('manchet'), 'beskrivelse' => $kursus->get('beskrivelse'), 'pris_uge' => $kursus->get('pris_uge'), 'pris_materiale' => $kursus->get('pris_materiale'), 'pris_rejsedepositum' => $kursus->get('pris_rejsedepositum'), 'pris_tilmeldingsgebyr' => $kursus->get('pris_tilmeldingsgebyr'), 'published' => $kursus->get('published'));
         $this->getForm()->setDefaults($defaults);
     } else {
         $kursus_id = 0;
         $this->getForm()->setDefaults(array('pris_tilmeldingsgebyr' => LANGEKURSER_STANDARDPRISER_TILMELDINGSGEBYR));
     }
     $this->document->setTitle('Rediger kursus');
     $this->document->addOption('Luk uden at gemme', $this->url('../'));
     return $this->getForm()->toHTML();
 }
Пример #6
0
 function getForm()
 {
     if ($this->form) {
         return $this->form;
     }
     $kursus = new VIH_Model_LangtKursus((int) $this->name());
     $form = new HTML_QuickForm('show', 'POST', $this->url());
     $form->addElement('hidden', 'id', $kursus->get('id'));
     $form->addElement('file', 'userfile', 'Fil');
     $form->addElement('submit', null, 'Upload');
     return $this->form = $form;
 }