public function index($parameters) { $pageModel = new pageModel(); $view = new ui($this); $view->assign('pages', $allowedPages); $startlevel = isset($parameters['startlevel']) ? $parameters['startlevel'] : 1; $id = myauth::getCurrentpageid(); $page = $pageModel->getfromId($id); $page = $page[0]; $tree[] = $page; while ($page->getParentid() != 0) { $page = $pageModel->getfromId($page->getParentid()); $page = $page[0]; $tree[] = $page; $this->tree_id[$page->getId()] = $page->getId(); } $this->tree = array_reverse($tree); if ($startlevel != 1) { $startbelow = $this->tree[$startlevel - 2]->getId(); } else { $startbelow = 0; } $this->maxdepth = isset($parameters['maxdepth']) ? $parameters['maxdepth'] : -1; $depth = 1; $pages = $this->recursivegetpages($startbelow, $depth); $view->assign('menu', $pages); $this->response->assign($this->self, 'innerHTML', $view->fetch($parameters['viewprefix'] . 'menu_index.tpl')); }
public function updatesuggestselectfield($parameters = array()) { $result = array(); $view = new ui($this); if ($parameters['value'] != '') { $controller = $parameters['callbackcontroller'] . 'Controller'; $function = $parameters['callbackfunction']; $extra = $parameters['extraparams']; $extralist = explode(',', $extra); $extraparams = array(); foreach ($extralist as $extraparam) { list($key, $value) = explode('|', $extraparam); $extraparams[$key] = $value; } $theController = new $controller(); $result = $theController->{$function}(rawurldecode($parameters['value']), $extraparams); $form = new form($parameters); list($id, $name) = explode('_', $parameters['id'], 2); $form->setId($id); $select = new selectField(str_replace('_text', '', $name), '', '', true); $form->addField($select); foreach ($result as $row) { $select->addOption(new selectoptionField($row, $row, false)); } $view->assign('form', $form); $view->assign('field', $select); $this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl')); } else { $form = new form($parameters); $select = new selectField($parameters['id'], '', '', true); $view->assign('form', $form); $view->assign('field', $select); $this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl')); } }
function createErrorView($exception) { $ui = new ui(); $ui->assign('exceptionid', uniqid()); $ui->assign('exception', $exception); $template = VERBOSE_ERRORS ? 'detailederror.tpl' : 'shorterror.tpl'; return $ui->fetch($template); }
protected function confirm($controller, $title = '') { $view = new ui($controller); $view->assign('form', $this); $view->assign('title', $title); //$popup = new popupController(); //$popup->create(array('name' => 'confirm','title' => $title, 'content' => $view->fetch('confirmform.tpl'))); $response = responseLib::getInstance(); $response->assign($controller->getSelf(), 'innerHTML', $view->fetch('confirmform.tpl')); }
public function loginform($parameters = array()) { require FRAMEWORK . DS . 'conf' . DS . 'auth.php'; require FRAMEWORK . DS . 'conf' . DS . 'dispatcher.php'; $currentuser = myauth::getCurrentuser(); $groups = $currentuser->getGroupid(); $groupfound = false; foreach ($groups as $groupname => $groupid) { if (isset($defaultPageids[$groupname])) { $groupfound = true; $defaultPageid = $defaultPageids[$groupname]; } } if (!$groupfound) { $defaultPageid = $defaultPageids['default']; } if ($currentuser->getId() == $defaultUserid) { $form = new form($parameters); $username = new textField('username', 'Gebruiker', '', array('required')); $password = new passwordField('password', 'Wachtwoord', array('required')); $form->addField($username); $form->addField($password); $form->setSubmittext('Log in'); $form->setResettext('Herbegin'); $template = new ui($this); if ($form->validate()) { $usermodel = new userModel(); $authuser = $usermodel->auth($parameters['username'], $parameters['password']); if ($authuser instanceof userObject) { myauth::setCurrentuser($authuser); // Refresh the page $this->response->redirect('?pageid=' . $defaultPageid); } else { $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'De ingevulde gegevens zijn niet correct.', true); } } elseif (!$form->isSent()) { $template->assign('form', $form); $this->response->assign($this->self, 'innerHTML', $template->fetch($parameters['viewprefix'] . 'myauth_loginform.tpl')); } else { $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Alle velden moeten ingevuld worden.', true); } } else { $template = new ui($this); $defrequest = new pagerequest($defaultPageid); $template->assign('defrequest', $defrequest); $template->assign('logoutRequest', myauth::getLogoutrequest()); $template->assign('currentuser', $currentuser); $this->response->assign($this->self, 'innerHTML', $template->fetch($parameters['viewprefix'] . 'myauth_loginform_loggedin.tpl')); //$this->response->assign($this->self , 'innerHTML' , ''); } }
public function createflash($parameters) { $name = $parameters['name'] . uniqid(); $content = $parameters['content']; if (isset($parameters['duration'])) { $duration = $parameters['duration']; } elseif ($parameters['type'] == 'success') { $duration = 5000; } elseif ($parameters['type'] == 'warning') { $duration = 8000; } elseif ($parameters['type'] == 'error') { $duration = -1; } $destroyRequest = new ajaxrequest('popup', 'destroy', array('name' => $name)); $template = new ui($this); $template->assign('name', $name); $template->assign('content', $content); $template->assign('destroyRequest', $destroyRequest); $template->assign('type', $parameters['type']); $this->response->assign('flashcontainer', 'innerHTML', $template->fetch('flash.tpl')); if ($duration != -1) { $this->response->script("setTimeout(\"\$('{$name}').fade('out')\",{$duration});setTimeout(\"\$('{$name}').dispose()\"," . ($duration + 300) . ");"); } }
public function showallowed($parameter = array()) { $view = new ui($this); $grid = new mygrid('allowed'); $grid->setModel(new ftgdallowedModel()); $grid->setDefaultorder(array('fields' => array('time'), 'type' => 'DESC')); $grid->setPagesize(15); $grid->registerRequest('user', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{user}')); $grid->registerRequest('group', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{group}')); $grid->registerRequest('sourceip', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{sourceip}')); $grid->registerRequest('host', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{host}')); $grid->registerRequest('cat', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{cat}')); $grid->registerRequest('destip', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{destip}')); $view->assign('blocked', $grid); $this->response->assign($this->self, 'innerHTML', $view->fetch('ftgd_allowed.tpl')); }
public function adddokter($parameters = array()) { require FRAMEWORK . DS . 'conf' . DS . 'mydhcpcc.php'; $view = new ui($this); $form = new form($parameters); $form->addField(new textField('mac', 'Mac', '', array('required', 'mac'))); $form->addField(new textField('desc', 'Omschrijving', '', array('required'))); if ($form->validate()) { $output = array(); $lastline = exec('c:' . DS . 'plink.exe ' . $siecarehost . ' -l ' . $siecareuser . ' -i ' . $siecareppk . ' sudo /usr/sbin/adddokter ' . $form->getFieldvalue('mac') . ' ' . $form->getFieldvalue('desc') . ' && exit', $output); if ($lastline == 'Starting dhcpd: [ OK ]') { $form->clear(); } $output = implode('<br />', $output); $this->response->assign('formerror_' . $form->getId(), 'innerHTML', $output, true); } elseif (!$form->isSent()) { $view->assign('form', $form); $this->response->assign($this->self, 'innerHTML', $view->fetch('mydhcpcc_adddokter.tpl')); } }
function validate($value, $form = null) { $this->form = $form; $valid = true; foreach ($this->validator as $req) { list($function, $param) = explode(':', $req, 2); $function = 'validate_' . $function; if (!call_user_func(array($this, $function), $param, $value)) { $valid = false; } } $response = responseLib::getInstance(); if (!$valid) { $template = new ui($this); $template->assign('validateerror', $this->validateerror); //$response->assign($this->id . '_error' , 'innerHTML' , $template->fetch('validateerror.tpl'),true); $response->assign($this->id, 'title', $template->fetch('validateerror.tpl')); $response->script("highlightformfielderror('{$this->id}')"); } else { $response->assign($this->id, 'title', ''); $response->script("removehighlightformfielderror('{$this->id}')"); } return $valid; }
public function run() { require FRAMEWORK . DS . 'conf' . DS . 'dispatcher.php'; require FRAMEWORK . DS . 'conf' . DS . 'auth.php'; $pageid = isset($_GET['pageid']) ? $_GET['pageid'] : $defaultPageid; $page = $this->resolvePage($pageid); $pageid = $page->getId(); $module_pageModel = new modulepageModel(); // -1 equals all pages $req = array(); $req['pageid'] = array('mode' => 'IN', 'value' => array('-1', $pageid)); $order = array('fields' => array('areaid', 'order'), 'type' => 'ASC'); try { $modulesForPage = $module_pageModel->get($req, $order); } catch (Exception $e) { //error echo $e->getMessage(); } $pageview = new ui(); $xajaxJs = $this->xajax->getJavascript(); global $debugajax; if ($debugajax) { $debugJs = '<script type="text/javascript" src="xajax_js/xajax_debug.js" charset="UTF-8"></script>'; $pageview->assign('xajax_javascript', $xajaxJs . "\n" . $debugJs); } else { $pageview->assign('xajax_javascript', $xajaxJs); } $output = array(); $moduleModel = new moduleModel(); foreach ($modulesForPage as $moduleForPage) { try { $areaModel = new areaModel(); $area = $areaModel->getfromId($moduleForPage->getAreaid()); $meh = 1; if (count($area) == 1) { $area = $area[0]; } else { throw new Exception('Area could not be loaded'); } $module = $moduleModel->getfromId($moduleForPage->getModuleid()); if (count($module) == 1) { $module = $module[0]; } else { throw new Exception('Module could not be loaded'); } $controllerName = $module->getName() . 'Controller'; $actionName = $module->getAction(); $controller = new $controllerName($module->getPrefix() . '_' . $module->getName()); foreach ($controller->getAllowedget() as $allowedGetVar) { if (isset($_GET[$allowedGetVar])) { $module->addArguments(array($allowedGetVar => $_GET[$allowedGetVar])); } } $output[$area->getName()] .= '<div id="' . $module->getPrefix() . '_' . $module->getName() . '" class="module">' . $controller->{$actionName}($module->getArguments()) . '</div>'; } catch (Exception $e) { // Ok, that didn't work $result = createErrorView($e); if ($area instanceof areaObject) { $output[$area->getName()] .= '<div class="module">' . $result . '</div>'; } } } // Add the popup div $output['popup'] = '<div id="popupcontainer" style="visibility: hidden; position: absolute;"></div>'; foreach ($output as $area => $content) { $pageview->assign($area, $content); } // Add the RTE $myrte = new myrte(); $pageview->assign('rteheader', $myrte->getHeader()); $pageview->display($page->getTemplate()); // Init the responses $response = responseLib::getInstance(); $_SESSION['initpageresponse'] = $response; //echo '<script type="text/javascript" charset="UTF-8">xajax_initpage();</script>'; }
public function editMessage($parameters = array()) { $view = new ui($this); require FRAMEWORK . DS . 'conf' . DS . 'medibridgeparser.php'; $view->assign('basesourcemap', $basesourcemap); $view->assign('backupmap', $backupmap); $view->assign('errormap', $errormap); $view->assign('basedestinationmap', $basedestinationmap); $closerequest = new ajaxrequest('medibridgeparser', 'closeLog'); $view->assign('closerequest', $closerequest); $pmodel = new mbprocessedlogModel(); $model = new mblogModel(); $log = $model->getfromId($parameters['logid']); $plog = $pmodel->getfromId($parameters['logid']); if (count($log) == 1) { $log = $log[0]; } if (count($plog) == 1) { $plog = $plog[0]; } $view->assign('log', $log); $view->assign('plog', $plog); $location = ''; if ($log->getStatusdelivery() == 'DELIVERY_SUCCESS' && $log->getStatusbackup() == 'BACKUP_SUCCES') { $location = $backupmap . '\\' . $log->getRelativebackuppath(); } elseif ($log->getStatusdelivery() == 'MESSAGE_RESEND' && $log->getStatusbackup() == 'BACKUP_SUCCES') { $location = $backupmap . '\\' . $log->getRelativebackuppath(); } elseif ($log->getStatuserror() == 'ERROR_MOVE_SUCCESS') { $location = $errormap . '\\' . $log->getRelativeerrorpath(); } else { $location = 'GEEN BESTAND GEVONDEN!'; } $destination = $basesourcemap . '\\' . $log->getRelativesourcepath(); $view->assign('sourcelocation', $location); $view->assign('destination', $destination); $file = utf8_encode(file_get_contents($location)); $form = new form($parameters); $form->addField(new hiddenField('logid', $parameters['logid'])); $doktermodel = new mbdokterModel(); $dokters = $doktermodel->get(array(), array('fields' => array('achternaam'), 'mode' => 'ASC')); $select = new selectField('ontvanger', 'Verzet ontvanger naar'); $select->addOption(new selectoptionField('Niet verzetten', 'none')); foreach ($dokters as $dokter) { $select->addOption(new selectoptionField($dokter->getAchternaam() . ' ' . $dokter->getVoornaam() . ' - ' . $dokter->getRiziv(), $dokter->getRiziv())); } $form->addField($select); $form->addField(new textareaField('content', 'Bericht', $file, array('required'))); $view->assign('form', $form); $ignorerequest = new ajaxrequest('medibridgeparser', 'ignorelog', array('logid' => $parameters['logid'])); $view->assign('ignore', $ignorerequest); if ($form->validate()) { try { file_put_contents($location, $form->getFieldvalue('content')); $arrcontent = file($location, FILE_IGNORE_NEW_LINES); if ($form->getFieldvalue('ontvanger') != 'none') { if (stripos($location, 'hdm-lab') !== false) { $i = 0; foreach ($arrcontent as $fileline) { if (stripos($fileline, 'A4') === 0) { $parts = explode('\\', $fileline); $parts[2] = $form->getFieldvalue('ontvanger'); $fileline = implode('\\', $parts); $arrcontent[$i] = rtrim($fileline); break; } else { $arrcontent[$i] = rtrim($fileline); } $i++; } } else { $arrcontent[7] = $form->getFieldvalue('ontvanger'); } } $i = 0; foreach ($arrcontent as $fileline) { $arrcontent[$i] = rtrim($fileline); $i++; } file_put_contents($location, implode("\r\n", $arrcontent)); if (!rename($location, $destination)) { throw new Exception('Could not move file.'); } $log->setStatusdelivery('MESSAGE_RESEND'); $model->save($log); $this->response->redirect('?pageid=' . myauth::getCurrentpageid()); } catch (Exception $e) { $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Er was een probleem met het verwerken van de aanpassingen! (' . $e->getMessage() . ')', true); } } elseif (!$form->isSent()) { $this->response->assign('logcontainer', 'innerHTML', $view->fetch($parameters['viewprefix'] . 'medibridgeparser_editmessage.tpl')); } }
public function wikieditversion($parameters = array()) { $view = new ui($this); $articlemodel = new myarticleModel(); $versionmodel = new myarticleversionModel(); $version = $versionmodel->getfromId($parameters['id']); if (count($version) == 1) { $version = $version[0]; $form = new mygridform($parameters, $parameters['-gridid-'], 'edit'); $form->addField(new textField('title', 'Titel', $version->getTitle(), array('required'))); $form->addField(new hiddenField('start', time())); $form->addField(new hiddenField('alias', $parameters['alias'])); $form->addField(new hiddenField('limit', '')); $form->addField(new hiddenField('stop', -1)); $form->addField(new hiddenField('section', $parameters['section'])); $form->addField(new rteField('content', 'Inhoud', $version->getContent(), array('required'))); $draft = new selectField('state', 'Bewaar als', array('required')); $draft->addOption(new selectoptionField('Actieve versie', 'Actief', true)); $draft->addOption(new selectoptionField('Draft', 'Draft', false)); $form->addField($draft); $form->addField(new hiddenField('articleid', $parameters['articleid'])); $form->addField(new hiddenField('id', $parameters['id'])); if ($form->validate()) { $newversion = new myarticleversionObject(); $newversion->setArticleid($parameters['articleid']); $newversion->setAuthor(myauth::getCurrentuser()->getId()); $newversion->setAuthorname(myauth::getCurrentuser()->getName()); $newversion->setCreationdate(time()); $newversion->setTitle($form->getFieldvalue('title')); $newversion->setState($form->getFieldvalue('state')); $newversion->setStartpublishdate($form->getFieldvalue('start')); $newversion->setContent($form->getFieldvalue('content')); if ($form->getFieldvalue('limit') == 'limit') { $newversion->setStoppublishdate($form->getFieldvalue('stop')); } else { $newversion->setStoppublishdate(-1); } try { if ($form->getFieldvalue('state') == 'Actief') { $articleidcond = array('articleid' => array('mode' => '=', 'value' => $parameters['articleid'])); $statecond = array('state' => array('mode' => '=', 'value' => 'Actief')); $prevactive = $versionmodel->get(array('AND' => array($articleidcond, $statecond))); foreach ($prevactive as $prev) { // This could have been if equal to 1 and just do the one, but this method is "self-healing" if multiple versions get flagged active $prev->setState('Gearchiveerd'); $versionmodel->save($prev); } } $versionmodel->save($newversion); } catch (Exception $e) { $flash = new popupController(); $flash->createflash(array('name' => 'erroredit', 'type' => 'error', 'content' => 'De gegevens werden niet aangepast! Raadpleeg de informaticadienst.')); return false; } $flash = new popupController(); $flash->createflash(array('name' => 'flash_add_' . $parameters['-gridid-'], 'type' => 'success', 'content' => 'De gegevens zijn goed aangepast.')); $this->response->assign('gridextra_' . $parameters['-gridid-'], 'innerHTML', ''); return true; } elseif (!$form->isSent()) { $view->assign('form', $form); return $view->fetch('myarticle_editversion.tpl'); } else { return false; } } else { return false; } }
public function deletegast($parameters) { $gastid = $parameters['gastid']; $popupcontroller = new popupController(); $gastModel = new ingeschrevenModel(); $gast = $gastModel->getfromId($gastid); if (count($gast) == 1) { $gast = $gast[0]; } else { return; } $sure = $parameters['sure']; if ($sure != 'sure') { $template = new ui($this); $template->assign('gast', $gast); $ja = new ajaxrequest('myvoorinschrijving', 'deletegast', array('gastid' => $gastid, 'sure' => 'sure')); $template->assign('ja', $ja); $popupcontroller->create(array('name' => 'confirm', 'content' => $template->fetch('myvoorinschrijving_confirmdelete.tpl'))); } elseif (myacl::isAllowed(myauth::getCurrentuser(), $gast, 'delete')) { $popupcontroller->destroy(array('name' => 'confirm')); $gastModel->deletebyId($gastid); $this->response->remove($gastid . '_rij'); } }
public function updateeditform($parameters = array()) { $flash = new popupController(); $model = new moduleModel(); $modules = $model->getfromId($parameters['moduleid']); if (count($modules) == 1) { $module = $modules[0]; $parameters['themodule'] = $module; $form = $this->buildeditform($parameters); $view = new ui($this); $view->assign('form', $form); $this->response->assign('gridextra_' . $parameters['-gridid-'] . '_content', 'innerHTML', $view->fetch('mymoduleadmin_addmodule.tpl')); } else { $flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De module werd niet gevonden!')); return false; } }
public function deletemodulepagelink($parameters = array()) { if ($parameters['sure'] == 'sure') { $model = new myarticlesectionlinkModel(); $flash = new popupController(); $curlink = $model->getfromId($parameters['id']); if (count($curlink) == 1) { 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; } } else { $flash->createflash(array('name' => 'warning', 'type' => 'warning', 'content' => 'De aanpassing werd niet doorgevoerd omdat deze link reeds verwijderd was!')); return false; } $flash->createflash(array('name' => 'error', 'type' => 'success', 'content' => 'De aanpassing werd goed doorgevoerd.')); return true; } else { $model = new processedmodulepageModel(); $link = $model->getfromId($parameters['id']); if (count($link) == 1) { $view = new ui($this); $view->assign('link', $link[0]); return $view->fetch('mypageadmin_deletemodulepagelink.tpl'); } } }
public function editPatient($parameters = array()) { $patientmodel = new keukenpatientModel(); $flash = new popupController(); $view = new ui($this); $patients = $patientmodel->getfromId($parameters['id']); if (count($patients) == 1) { $patient = $patients[0]; $view->assign('patient', $patient); $form = $this->buildform($parameters); $form->setNofocus(false); if ($form->validate()) { if ($form->confirmed($this, 'Bent u zeker?')) { } else { } } elseif (!$form->isSent()) { $view->assign('form', $form); return $view->fetch('keukenpakket_editpatient.tpl'); } else { $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Gelieve alle benodigde velden correct in te vullen.', true); return false; } } else { $flash->createflash(array('name' => 'err', 'type' => 'error', 'content' => 'Deze patiƫnt werd niet teruggevonden!')); return false; } }
public function deletedoktervanwacht($parameters = array()) { $view = new ui($this); $wachtviewmodel = new wachtdokterviewModel(); $dok = $wachtviewmodel->getfromId($parameters['id']); if (count($dok) == 1) { if ($parameters['sure'] != 'sure') { $view->assign('dokter', $dok[0]); $yes = new ajaxrequest('mydoktervanwacht', 'deletedoktervanwacht', array('id' => $parameters['id'], 'sure' => 'sure', 'specid' => $parameters['specid'], 'startofmonth' => $parameters['startofmonth'], 'endofmonth' => $parameters['endofmonth'])); $no = new ajaxrequest('mydoktervanwacht', 'showspecdetails', array('specid' => $parameters['specid'], 'startofmonth' => $parameters['startofmonth'], 'endofmonth' => $parameters['endofmonth'])); $view->assign('yes', $yes); $view->assign('no', $no); $this->response->assign('specgrid_' . $parameters['specid'], 'innerHTML', $view->fetch('mydoktervanwacht_delete.tpl')); } else { $model = new wachtdokterModel(); try { $model->deletebyId($parameters['id']); } catch (Exception $e) { $flash = new popupController(); $flash->createflash(array('name' => 'erroredit', 'type' => 'error', 'content' => 'De gegevens werden niet aangepast! Raadpleeg de informaticadienst.')); } $flash = new popupController(); $flash->createflash(array('name' => 'flash_del_' . $parameters['-gridid-'], 'type' => 'success', 'content' => 'De gegevens zijn goed verwijderd.')); $this->showspecdetails(array('specid' => $parameters['specid'], 'startofmonth' => $parameters['startofmonth'], 'endofmonth' => $parameters['endofmonth'])); } } else { $flash = new popupController(); $flash->createflash(array('name' => 'flash_del_' . $parameters['-gridid-'], 'type' => 'warning', 'content' => 'De gegevens werden niet teruggevonden.')); } }
public function showvalidatiesnelheid($parameters = array()) { $view = new ui($this); $startthistime = strtotime('-1 months'); $startthis = date("m/j/Y", $startthistime); $view->assign('startthis', $startthistime); $condthis = array('creatiedatum' => array('mode' => '>', 'value' => $startthis)); $sql_validated = "\r\nSELECT \tvaliderendeArtsNummer, validerendeArtsNaam, COUNT(voorschriftID) AS total, AVG(validatieArtsSnelheid) AS avg, MIN(validatieArtsSnelheid)\r\n \tAS min, MAX(validatieArtsSnelheid) AS max\r\nFROM \tdbo.ValidatieSnelheid\r\nWHERE \t(creatieDatum > '{$startthis}') AND (validerendeArtsNummer IS NOT NULL)\r\nGROUP BY \tvaliderendeArtsNummer, validerendeArtsNaam\r\nORDER BY \tvaliderendeArtsNaam\r\n\t\t"; $sql_notvalidated = "\r\nSELECT \tverantwoordelijkeArtsNummer, verantwoordelijkeArtsNaam, COUNT(voorschriftID) AS total\r\nFROM \tValidatieSnelheid\r\nWHERE \t(creatieDatum > '{$startthis}') AND (validerendeArtsNummer IS NULL)\r\nGROUP BY \tverantwoordelijkeArtsNummer, verantwoordelijkeArtsNaam\r\nORDER BY \tverantwoordelijkeArtsNaam\r\n\t\t"; require FRAMEWORK . DS . 'conf' . DS . 'datastore.php'; $config = $datastore['mb']; $con = NewADOConnection($config['protocol']); if (!$con) { throw new connectException('Could not initialize the ADO class'); } if ($con->Connect($config['host'], $config['user'], $config['password'], $config['db'])) { $con->setFetchMode(ADODB_FETCH_ASSOC); } else { throw new connectException('Could not connect to the datastore: ' . $con->ErrorMsg()); } $rs_validated = $con->getAssoc($sql_validated); $rs_notvalidated = $con->getAssoc($sql_notvalidated); foreach ($rs_validated as $id => $row) { $avg = $row['avg']; $top = $avg + $avg * 0.45; $bottom = $avg - $avg * 0.45; $sql_normalized = "\r\nSELECT \tvaliderendeArtsNummer, validerendeArtsNaam, COUNT(voorschriftID) AS total, AVG(validatieArtsSnelheid) AS avg, MIN(validatieArtsSnelheid)\r\n \tAS min, MAX(validatieArtsSnelheid) AS max\r\nFROM \tdbo.ValidatieSnelheid\r\nWHERE \t(creatieDatum > '{$startthis}') AND (validerendeArtsNummer IS NOT NULL)\r\nAND\t\t\t(validerendeArtsNummer = '{$id}')\r\nAND\t\t\t(validatieArtsSnelheid BETWEEN {$bottom} AND {$top})\r\nGROUP BY \tvaliderendeArtsNummer, validerendeArtsNaam\r\nORDER BY \tvaliderendeArtsNaam\r\n\t\t\t"; $rs_normalized = $con->getAssoc($sql_normalized); $rs_validated[$id]['normavg'] = $rs_normalized[$id]['avg']; } $rs = $rs_validated; foreach ($rs_notvalidated as $id => $row) { $rs[$id]['notvalidated'] = $row['total']; if ($rs[$id]['validerendeArtsNaam'] == '') { $rs[$id]['validerendeArtsNaam'] = $row['verantwoordelijkeArtsNaam'] != '' ? $row['verantwoordelijkeArtsNaam'] : $id; } } uasort($rs, sort_validatie); $view->assign('avg', $rs); $this->response->assign($this->self, 'innerHTML', $view->fetch('mystats_showvalidatiesnelheid.tpl')); }
public function editpromotion($parameters = array()) { $view = new ui($this); $model = new cafetariapromotieModel(); $promo = $model->getfromId($parameters['id']); if (count($promo) == 1) { $promo = $promo[0]; $form = new mygridform($parameters, 'promotions', 'edit'); $form->addField(new datepickerField('start', 'Start', true, $promo->getStarttime(), array('required'))); $form->addField(new datepickerField('stop', 'Einde', true, $promo->getStoptime(), array('required'))); $form->addField(new hiddenField('id', $parameters['id'])); if ($form->validate()) { $promo->setStarttime($form->getFieldvalue('start')); $promo->setStoptime($form->getFieldvalue('stop')); try { $model->save($promo); } catch (Exception $e) { $flash = new popupController(); $flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De gegevens zijn niet aangepast! Raadpleeg de informaticadienst.')); return false; } $flash = new popupController(); $flash->createflash(array('name' => 'success', 'type' => 'success', 'content' => 'De gegevens zijn goed aangepast.')); $this->response->assign('gridextra_' . $parameters['-gridid-'], 'innerHTML', ''); return true; } elseif (!$form->isSent()) { $view->assign('form', $form); return $view->fetch('mycafetaria_editpromotion.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 setOrder($parameters = array()) { $col = $parameters['col']; if (isset($parameters['gridid'])) { $grid = new mygrid($parameters['gridid']); $current = $grid->getOrder(); // $model = $grid->getModel(); // $assoc = $model->getAssoc(); // if(isset($assoc[$col])){ // if($assoc[$col]['type'] = 'map'){ // $col = $assoc[$col]['relationkey']; // } // } if (is_array($current)) { $field = $current['fields'][0]; if ($field == $col) { if ($current['type'] == 'ASC') { $type = 'DESC'; } else { $type = 'ASC'; } } else { $type = 'ASC'; } } else { $type = 'ASC'; } $grid->setOrder(array('fields' => array($col), 'type' => $type)); $template = new ui($this); $template->assign('grid', $grid); $this->response->assign($parameters['gridid'], 'innerHTML', $template->fetch($parameters['viewprefix'] . 'mygridstructure.tpl')); } }
public function deleteacl($parameters) { $view = new ui($this); $model = new processedmyaclModel(); $acl = $model->getfromId($parameters['id']); $dependant = array(); if (count($acl) == 1) { $acl = $acl[0]; include FRAMEWORK . DS . 'conf' . DS . 'myacl.php'; $type = $acl->getObjecttype(); if ($type == 'securitytarget') { $type = $acl->getObjectid(); } $aclconf = $myacl[$type]; $dependant = array(); foreach ($aclconf['rights'] as $right => $rightconf) { if (in_array($acl->getRight(), $rightconf['requires'])) { $otypecond = array('objecttype' => array('mode' => '=', 'value' => $acl->getObjecttype())); $oidcond = array('objectid' => array('mode' => '=', 'value' => $acl->getObjectid())); $rtypecond = array('requestertype' => array('mode' => '=', 'value' => $acl->getRequestertype())); $ridcond = array('requesterid' => array('mode' => '=', 'value' => $acl->getRequesterid())); $righcond = array('right' => array('mode' => '=', 'value' => $right)); $cond = array('AND' => array($otypecond, $oidcond, $ridcond, $rtypecond, $righcond)); $dependant = array_merge($dependant, $model->get($cond)); } } } if ($parameters['sure'] == 'sure') { $flash = new popupController(); $ids[] = $parameters['id']; foreach ($dependant as $depacl) { $ids[] = $depacl->getId(); } $cond = array('id' => array('mode' => 'IN', 'value' => $ids)); try { $model->delete($cond); } catch (Exception $e) { $flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De gegevens zijn niet goed verwijderd! Raadpleeg de informaticadienst.')); return false; } $flash->createflash(array('name' => 'success', 'type' => 'success', 'content' => 'De gegevens zijn goed verwijderd.')); return true; } else { $view->assign('acl', $acl); $view->assign('dependant', $dependant); return $view->fetch('myacl_deleteacl.tpl'); } }
public function showTicket($parameters = array()) { $view = new ui($this); $ticketModel = new myticketModel(); $ticket = $ticketModel->getfromId($parameters['id']); if (count($ticket) == 1) { $view->assign('ticket', $ticket[0]); } $closerequest = new ajaxrequest('myticket', 'closeShowticket'); $view->assign('closerequest', $closerequest); $this->response->assign('ticketcontainer', 'innerHTML', $view->fetch('myticket_showticket.tpl')); }