Beispiel #1
0
 function renderHtml()
 {
     $kursus = new VIH_Model_LangtKursus((int) $this->name());
     if (is_numeric($this->query('sletbillede'))) {
         $kursus->deletePicture($this->query('sletbillede'));
     }
     $pictures = $kursus->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'] . '&amp;id=' . $kursus->get('id') . '">Slet</a></div>';
     }
     $this->document->setTitle($kursus->getKursusNavn());
     $this->document->addOption('Kurser', $this->url('../'));
     $this->document->addOption('Ret', $this->url('edit'));
     $this->document->addOption('Lav en kopi', $this->url('copy'));
     $this->document->addOption('Slet', $this->url('delete'));
     $this->document->addOption('Rater', $this->url('rater'));
     $this->document->addOption('Perioder', $this->url('periode'));
     $this->document->addOption('Ministerium', $this->url('ministeriumliste'));
     $this->document->addOption('Elevuger', $this->url('elevuger'));
     $this->document->addOption('Tilmeldinger', $this->url('tilmeldinger'));
     $this->document->addOption('Holdlister', $this->url('../holdliste'));
     $data = array('kursus' => $kursus, 'subjects' => $this->getSubjects());
     $tpl = $this->template->create('langekurser/show');
     return $tpl->render($this, $data) . $this->getForm()->toHTML() . $pic_html;
 }
Beispiel #2
0
 function renderHtml()
 {
     $title = 'Elevchat';
     $meta['description'] = 'Her kan du stille spørgsmål til elever.';
     $meta['keywords'] = 'elevchat, feedback, debat, dialog';
     $elevchattere = VIH_Model_Ansat::getList('elevchatter');
     if (count($elevchattere) == 0) {
         return '<h1>Elevchat</h1><p>Vi har i øjeblikket ikke nogen elevchattere. Du kan skrive til en af <a href="' . $this->url('/underviser') . '">lærerne</a> eller til <a href="' . $this->url('/kontakt') . '">kontoret</a>.</p>';
     }
     $file = new VIH_FileHandler($elevchattere[0]->get('pic_id'));
     $file->loadInstance('small');
     $pic_uri = $file->getImageHtml();
     $file->loadInstance(IMAGE_POPUP_SIZE);
     // Oplysninger om Elevchatter
     $this->elevchatter['navn'] = $elevchattere[0]->get('navn');
     $this->elevchatter['email'] = $elevchattere[0]->get('email');
     $this->elevchatter['billede'] = $pic_uri;
     $this->elevchatter['text'] = $elevchattere[0]->get('beskrivelse');
     $msg = '';
     $extra_text = '';
     $this->document->setTitle($title);
     $this->document->headline = $title;
     $this->document->meta = $meta;
     return '<h1>Elevchat</h1>' . $msg . autoop($this->elevchatter['text']) . ($extra_text = '<h2>Send en besked</h2>' . $this->getForm()->toHTML());
     //$main->set('content_sub', '<a rel="lightbox" title="'.$elevchatter['navn'].'" href="'.$file->get('file_uri').'">' . $elevchatter['billede'] . '</a>');
 }
Beispiel #3
0
 function renderHtml()
 {
     $type_key = $this->context->getTypeKeys();
     if (is_numeric($this->query('sletbillede'))) {
         $fields = array('date_updated', 'pic_id');
         $values = array('NOW()', 0);
         $sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $this->query('id'));
         $res = $this->db->execute($sth, $values);
         if (PEAR::isError($res)) {
             throw new Exception($res->getMessage());
         }
     }
     $form = new HTML_QuickForm();
     $form->addElement('hidden', 'id', $this->name());
     $form->addElement('file', 'userfile', 'Fil');
     $form->addElement('submit', null, 'Upload');
     if ($form->validate()) {
         $file = new VIH_FileHandler();
         if ($file->upload('userfile')) {
             $fields = array('date_updated', 'pic_id');
             $values = array('NOW()', $file->get('id'));
             $sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $form->exportValue('id'));
             $res = $this->db->execute($sth, $values);
             if (PEAR::isError($res)) {
                 throw new Exception($res->getMessage());
             }
             return new k_SeeOther($this->url('./'));
         }
     }
     $tilmelding = new VIH_Model_LangtKursus_Tilmelding($this->name());
     if ($tilmelding->get('id') == 0) {
         throw new k_http_Response(404);
     }
     $file = new VIH_FileHandler($tilmelding->get('pic_id'));
     $file->loadInstance('small');
     $extra_html = $file->getImageHtml($tilmelding->get('name'), 'width="100""');
     $file->loadInstance('medium');
     $stor = $file->get('file_uri');
     if (empty($extra_html)) {
         $extra_html = $form->toHTML();
     } else {
         $extra_html .= ' <br /><a href="' . $stor . '">stor</a> <a href="' . url('./') . '?sletbillede=' . $this->name() . '" onclick="return confirm(\'Er du sikker\');">slet billede</a>';
     }
     $res = $this->db->query('SELECT *, DATE_FORMAT(date_start, "%d-%m %H:%i") AS date_start_dk, DATE_FORMAT(date_end, "%d-%m %H:%i") AS date_end_dk FROM langtkursus_tilmelding_protokol_item WHERE tilmelding_id = ' . (int) $this->name() . ' ORDER BY date_start DESC, date_end DESC');
     if (PEAR::isError($res)) {
         throw new Exception($res->getMessage());
     }
     $data = array('items' => $res, 'type_key' => $type_key, 'vis_navn' => false);
     $this->document->setTitle($tilmelding->get('navn'));
     $this->document->addOption('Ret', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
     $this->document->addOption('Indtast', $this->url('indtast'));
     $this->document->addOption('Tilmelding', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
     $this->document->addOption('F*g', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/f*g'));
     $this->document->addOption('Holdliste', $this->context->url());
     $this->document->addOption('Diplom', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/diplom'));
     $tpl = $this->template->create('protokol/liste');
     return '<div style="border: 1px solid #ccc; padding: 0.5em; float: right;">' . $extra_html . '</div>
         ' . $tpl->render($this, $data);
 }
Beispiel #4
0
 function postMultipart()
 {
     $nyhed = new VIH_News($this->name());
     if ($this->getForm()->validate()) {
         $file = new VIH_FileHandler();
         if ($file->upload('userfile')) {
             $nyhed->addPicture($file->get('id'));
         }
     }
     return $this->render();
 }
Beispiel #5
0
 function postForm()
 {
     $facilitet = new VIH_Model_Facilitet($this->name());
     if ($this->getForm()->validate()) {
         $file = new VIH_FileHandler();
         if ($file->upload('userfile')) {
             $facilitet->addPicture($file->get('id'));
             return new k_SeeOther($this->url());
         }
     }
     return $this->render();
 }
Beispiel #6
0
 function postMultipart()
 {
     if ($this->getForm()->validate()) {
         $file = new VIH_FileHandler();
         $id = $file->upload('userfile');
         if ($id) {
             $this->ansat->addPicture($file->get('id'));
         }
         return new k_SeeOther($this->url());
     }
     return $this->render();
 }
Beispiel #7
0
 function postForm()
 {
     $db = $this->db;
     if ($this->getForm()->validate()) {
         $file = new VIH_FileHandler();
         if ($file->upload('userfile')) {
             $fields = array('date_updated', 'pic_id');
             $values = array('NOW()', $file->get('id'));
             $sth = $db->autoPrepare('langtkursus_fag', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $this->name());
             $res = $db->execute($sth, $values);
             if (PEAR::isError($res)) {
                 throw new Exception($res->getMessage());
             }
             return new k_SeeOther($this->url());
         }
     }
     return $this->render();
 }
Beispiel #8
0
 function GET()
 {
     $id = strip_tags($this->name());
     $facilitet = new VIH_Model_Facilitet($id);
     $file = new VIH_FileHandler($facilitet->get('pic_id'));
     $file->loadInstance('medium');
     $html = $file->getImageHtml();
     $title = $facilitet->get('navn');
     $meta['description'] = $facilitet->get('description');
     $meta['keywords'] = '';
     $this->document->setTitle($title);
     $this->document->meta = $meta;
     $this->document->theme = 'faciliteter';
     $data = array('content' => '
         <h1>' . $facilitet->get('navn') . '</h1>
         ' . $html . '
         <div>' . autoop($facilitet->get('beskrivelse')) . '</div>', 'content_sub' => $this->getFaciliteterList());
     $tpl = $this->template->create('sidebar-wrapper');
     return $tpl->render($this, $data);
 }
Beispiel #9
0
 function renderHtml()
 {
     $kursus = $this->context->getGateway()->findById($this->name());
     $kursus->getPladser();
     $kursus->getBegyndere();
     $underviser = new VIH_Model_Ansat($kursus->get('ansat_id'));
     $file = new VIH_FileHandler($kursus->get('pic_id'));
     $pic_html = '';
     if ($file->get('id') > 0) {
         $file->loadInstance('small');
         $image_tag = $file->getImageHtml();
         $file->loadInstance(IMAGE_POPUP_SIZE);
         $pic_html = '<a href="' . htmlspecialchars($file->get('file_uri')) . '" rel="lightbox">' . $image_tag . '</a>';
     }
     $this->document->theme = $kursus->getGruppe();
     $this->document->setTitle($kursus->get('title'));
     $this->document->meta = array('keywords' => $kursus->get('keywords'), 'description' => $kursus->get('description'));
     $this->document->body_class = 'widepicture';
     $this->document->widepicture = $this->context->getWidePictureUrl($this->document->theme);
     $data = array('kursus' => $kursus, 'kursusleder' => new VIH_Model_Ansat($kursus->get('ansat_id')));
     $tpl = $this->template->create('KortKursus/kursus');
     $content = array('content' => $tpl->render($this, $data));
     $tpl = $this->template->create('wrapper');
     return $tpl->render($this, $content);
 }
Beispiel #10
0
 function getSubContent()
 {
     $nyhed = new VIH_News($this->name());
     $pictures = $nyhed->getPictures();
     $pic_html = '';
     foreach ($pictures as $pic) {
         $file = new VIH_FileHandler($pic['file_id']);
         if ($file->get('id')) {
             $file->loadInstance('filgallerithumb');
         } else {
             continue;
         }
         $pic_uri = $file->getImageHtml();
         $file->loadInstance('medium');
         $pic_html .= '<p><a href="' . htmlspecialchars($file->get('file_uri')) . '" rel="lightbox">' . $pic_uri . '</a></p>';
     }
     return $pic_html;
 }
Beispiel #11
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);
 }
Beispiel #12
0
 function getSidePicture($pic_id)
 {
     $file = new VIH_FileHandler($pic_id);
     $file->loadInstance('sidepicture');
     return $file->get('file_uri');
 }