public function getsections() { $result = array(); $sectionmodel = new myarticlesectionModel(); $sections = $sectionmodel->get(); foreach ($sections as $section) { $result[$section->getId()] = $section->getName(); } return $result; }
public function deleteArticle($parameters = array()) { if ($parameters['sure'] == 'sure') { $model = new myarticleModel(); $flash = new popupController(); try { $model->deletebyId($parameters['id']); } catch (Exception $e) { $flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De aanpassing werd niet doorgevoerd! Contacteer de informaticadienst.')); return false; } $flash->createflash(array('name' => 'error', 'type' => 'success', 'content' => 'De aanpassing werd goed doorgevoerd.')); return true; } else { $model = new myarticleModel(); $article = $model->getfromId($parameters['id']); if (count($article) == 1) { $article = $article[0]; $view = new ui($this); $view->assign('article', $article); $sectionmodel = new myarticlesectionModel(); $linked = ''; if (count($article->getSection()) > 0) { $cond = array('id' => array('mode' => 'IN', 'value' => $article->getSection())); $linked = $sectionmodel->get($cond); } $view->assign('linked', $linked); return $view->fetch('myarticle_deletearticle.tpl'); } } }