public function managemodules($parameters = array()) { $view = new ui($this); $grid = new mygrid('modules'); $grid->setModel(new processedmoduleModel()); $grid->setNosortfield(array('arguments')); $grid->registerAddrequest('mymoduleadmin', 'addmodule', array('title' => 'Module toevoegen')); $grid->registerEditrequest('mymoduleadmin', 'editmodule', array('title' => 'Module aanpassen', 'moduleid' => '{id}')); $grid->registerDeleterequest('mymoduleadmin', 'deletemodule', array('title' => 'Module verwijderen', 'moduleid' => '{id}')); $view->assign('grid', $grid); $this->response->assign($this->self, 'innerHTML', $view->fetch('mymoduleadmin_managemodules.tpl')); }
public function editArticle($parameters = array()) { $view = new ui($this); $articlemodel = new myarticleModel(); $versionmodel = new myarticleversionModel(); $article = $articlemodel->getfromId($parameters['id']); if (count($article) == 1) { $article = $article[0]; $view->assign('article', $article); $aliasform = new mygridform($parameters, $parameters['-gridid-'], 'edit'); $aliasform->addField(new textField('alias', 'Werktitel', $article->getAlias(), array('required'))); $aliasform->addField(new hiddenField('id', $parameters['id'])); $aliasform->addField(new hiddenField('title', $parameters['title'])); if ($aliasform->validate()) { $article->setAlias($aliasform->getFieldvalue('alias')); $flash = new popupController(); try { $articlemodel->save($article); } 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.')); $gridcontroller = new mygridController(); unset($parameters['hidden_form_id']); $parameters['alias'] = ''; $gridcontroller->editrequest($parameters); return true; } elseif (!$aliasform->isSent()) { $view->assign('aliasform', $aliasform); } else { return false; } $versionsids = $article->getVersion(); $grid = new mygrid('articleversions-' . $article->getId()); $grid->setModel(new myarticleversionModel()); $idcond = array('articleid' => array('mode' => '=', 'value' => $parameters['id'])); $grid->setDefaultconditions($idcond); $grid->setDefaultorder(array('fields' => array('state', 'creationdate'), 'type' => 'DESC')); $grid->registerEditrequest('myarticle', 'editversion', array('id' => '{id}', 'articleid' => $parameters['id'], 'title' => 'Versie aanpassen', 'myacl' => array('target' => $article, 'right' => 'create_newversion', 'default' => false))); $view->assign('grid', $grid); if (myacl::isAllowed(myauth::getCurrentuser(), $article, 'manage_sectionlinks')) { $sectiongrid = new mygrid('sections_' . $article->getId()); $sectiongrid->setModel(new processedmyarticlesectionlinkModel()); $sectiongrid->setDefaultconditions($idcond); $sectiongrid->registerAddrequest('myarticle', 'addsectionlink', array('articleid' => $article->getId(), 'title' => 'Nieuwe sectie linken')); $sectiongrid->registerDeleterequest('myarticle', 'deletesectionlink', array('id' => '{id}', 'title' => 'Link met sectie verwijderen')); $view->assign('sectiongrid', $sectiongrid); } $aclcontroller = new myaclController(); $view->assign('acllist', $aclcontroller->listacl(array('targetoutput' => '_return_', 'objecttype' => 'myarticleObject', 'objectid' => $parameters['id']))); return $view->fetch('myarticle_editarticle.tpl'); } else { return false; } }
public function showstatus($parameters = array()) { $view = new ui($this); $dienstmodel = new keukendienstModel(); $kamermodel = new keukenkamerModel(); $diensten = $dienstmodel->get(); $adiensten = array(); $kamercond = array(); foreach ($diensten as $dienst) { if (myacl::isAllowed(myauth::getCurrentuser(), $dienst, 'view')) { $adiensten[$dienst->getId()] = $dienst; } } if (count($adiensten > 1)) { $form = new form($parameters); $select = new selectField('dienst', 'Dienst', array('required'), true); $select->addOption(new selectoptionField('Alles', '_all_', true)); foreach ($adiensten as $id => $dienst) { $select->addOption(new selectoptionField($dienst->getName(), $id)); } $form->addField($select); $continue = true; if ($form->validate()) { $all = false; foreach ($form->getFieldvalue('dienst') as $id) { $chosendienst[$id] = $adiensten[$id]; if ($id == '_all_') { $all = true; break; } } if (!$all) { $adiensten = $chosendienst; } $view->assign('form', $form); } elseif (!$form->isSent()) { $view->assign('form', $form); } else { $continue = false; } } if ($continue) { foreach ($adiensten as $id => $dienst) { $kamers = $kamermodel->getfromDienstid($id); foreach ($kamers as $kamer) { $kamercond[] = array('kamer' => array('mode' => '=', 'value' => $kamer->getKamernr())); } } if (count($kamercond) > 0) { $kamercond = array('OR' => $kamercond); } else { //Geen kamers, lege lijst voorzien $kamercond = array('kamer' => array('mode' => '=', 'value' => '-1')); } $model = new keukenpatientModel(); $count = $model->getcount($kamercond); $view->assign('count', $count); $grid = new mygrid('keukenstatus'); $grid->setModel($model); $grid->setDefaultconditions($kamercond); $grid->setDefaultorder(array('fields' => array('kamer', 'bed'), 'type' => 'ASC')); $grid->registerEditrequest('keukenpakket', 'editPatient', array('title' => 'Maaltijdfiche aanpassen', 'id' => '{id}')); $grid->setPagesize(999); $view->assign('grid', $grid); $this->response->assign($this->self, 'innerHTML', $view->fetch('keukenpakket_showstatus.tpl')); } }
public function pathdetails($parameters = array()) { $view = new ui($this); $flash = new popupController(); $model = new dirstatusModel(); $current = $model->getfromId($parameters['id']); if (count($current) == 1) { $current = $current[0]; $view->assign('current', $current); $closerequest = new ajaxrequest('mygrid', 'closeextra', array('id' => 'gridextra_' . $parameters['-gridid-'])); $view->assign('closerequest', $closerequest); $history = new mygrid('directorywatcher_' . $current->getId()); $history->setModel(new dirstatusModel()); $history->setDefaultconditions(array('path' => array('mode' => '=', 'value' => $current->getPath()))); $history->setDefaultorder(array('fields' => array('reporttime'), 'type' => 'DESC')); $view->assign('history', $history); $testmodel = new directorywatchertresholdModel(); $treshold = new mygrid('treshold_' . $current->getId()); $treshold->setModel($testmodel); $currentresholds = $testmodel->getfromPath($current->getPath()); if (count($currentresholds) == 0) { $treshold->registerAddrequest('directorywatcher', 'addTreshold', array('title' => 'Treshold toevoegen', 'currentid' => $current->getId())); $parent = $current->getParent(); $parenttresholds = array(); if ($parent != '') { $parentobj = $model->getfromPath($parent); $parentobj = $parentobj[0]; $parenttresholds = $testmodel->getfromPath($parent); while (count($parenttresholds) == 0 && $parent != '') { $parent = $parentobj->getParent(); $parentobj = $model->getfromPath($parent); $parentobj = $parentobj[0]; $parenttresholds = $testmodel->getfromPath($parent); } } if (count($parenttresholds) == 0 && $parent == '') { $parent = '_default_'; $parenttresholds = $testmodel->getfromPath($parent); } $treshold->setDefaultconditions(array('path' => array('mode' => '=', 'value' => $parent))); $treshold->unregisterRequest('-edit-'); $treshold->unregisterRequest('-delete-'); } else { $treshold->setDefaultconditions(array('path' => array('mode' => '=', 'value' => $current->getPath()))); $treshold->unregisterRequest('-add-'); $treshold->registerEditrequest('directorywatcher', 'editTreshold', array('title' => 'Treshold aanpassen', 'id' => '{id}')); $treshold->registerDeleterequest('directorywatcher', 'deleteTreshold', array('title' => 'Treshold verwijderen', 'id' => '{id}', 'currentid' => $current->getId())); } $view->assign('tresholdgrid', $treshold); $this->response->assign('gridextra_' . $parameters['-gridid-'], 'innerHTML', $view->fetch('directorywatcher_pathdetails.tpl')); $this->response->script('var myFx = new Fx.Scroll(window).toElement(\'gridextra_' . $parameters['-gridid-'] . '\')'); } else { $flash->createflash(array('name' => 'err', 'type' => 'error', 'content' => 'Dit path werd niet gevonden.')); return false; } }
public function editpromotext($parameters = array()) { $view = new ui($this); $articlemodel = new myarticleModel(); $versionmodel = new myarticleversionModel(); $article = $articlemodel->getfromId($parameters['id']); if (count($article) == 1) { $article = $article[0]; $view->assign('article', $article); $aliasform = new mygridform($parameters, $parameters['-gridid-'], 'edit'); $aliasform->addField(new textField('alias', 'Werktitel', $article->getAlias(), array('required'))); $aliasform->addField(new hiddenField('id', $parameters['id'])); $aliasform->addField(new hiddenField('title', $parameters['title'])); if ($aliasform->validate()) { $article->setAlias($aliasform->getFieldvalue('alias')); $flash = new popupController(); try { $articlemodel->save($article); } 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.')); $gridcontroller = new mygridController(); unset($parameters['hidden_form_id']); $parameters['alias'] = ''; $gridcontroller->editrequest($parameters); return true; } elseif (!$aliasform->isSent()) { $view->assign('aliasform', $aliasform); } else { return false; } $versionsids = $article->getVersion(); $grid = new mygrid('articleversions-' . $article->getId()); $grid->setModel(new myarticleversionModel()); $idcond = array('articleid' => array('mode' => '=', 'value' => $parameters['id'])); $grid->setDefaultconditions($idcond); $grid->setDefaultorder(array('fields' => array('state', 'creationdate'), 'type' => 'DESC')); $grid->registerEditrequest('mycafetaria', 'editpromotextversion', array('id' => '{id}', 'articleid' => $parameters['id'], 'title' => 'Versie aanpassen')); $view->assign('grid', $grid); return $view->fetch('myarticle_editarticle.tpl'); } else { return false; } }