Пример #1
0
 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' , '');
     }
 }
Пример #2
0
 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'));
     }
 }
Пример #3
0
 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'));
     }
 }
 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'));
     }
 }
Пример #5
0
 public function wikieditarticle($parameters = array())
 {
     $view = new ui($this);
     if (!$parameters['history']) {
         $this->response->addWaypoint('myarticle', 'wikieditarticle', 'wiki_' . $parameters['section'], $parameters);
     }
     $articlemodel = new myarticleModel();
     $versionmodel = new myarticleversionModel();
     $article = $articlemodel->getfromId($parameters['id']);
     $closerequest = new ajaxrequest('myarticle', 'followwikibreadcrumb', array('id' => $parameters['id'], 'section' => $parameters['section']));
     $view->assign('closerequest', $closerequest);
     $section = new myarticlesectionObject();
     $section->setId($parameters['section']);
     if (count($article) == 1) {
         $article = $article[0];
         $view->assign('article', $article);
         $aliasform = new form($parameters);
         $aliasform->addField(new textField('alias', 'Werktitel', $article->getAlias(), array('required')));
         $aliasform->addField(new hiddenField('id', $parameters['id']));
         $aliasform->addField(new hiddenField('section', $parameters['section']));
         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.'));
             }
             $flash->createflash(array('name' => 'error', 'type' => 'success', 'content' => 'De aanpassing werd goed doorgevoerd.'));
             $this->followwikibreadcrumb(array('id' => $parameters['id'], 'section' => $parameters['section']));
             return true;
         } elseif (!$aliasform->isSent()) {
             $view->assign('aliasform', $aliasform);
         }
         $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', 'wikieditversion', array('id' => '{id}', 'articleid' => $parameters['id'], 'title' => 'Versie aanpassen', 'myacl' => array('target' => $section, 'right' => 'manage_articlelinks', 'default' => false)));
         $view->assign('grid', $grid);
         $this->response->assign('wiki_' . $parameters['section'], 'innerHTML', $view->fetch('myarticle_wiki_editarticle.tpl'));
     }
 }
Пример #6
0
            <div class="col-md-3 col-sm-6 hero-feature">
                <div class="thumbnail">
                   
                    <div class="caption">
                        <h3>Account Dashboard</h3>
                        <p>
                            <a href="#" class="btn btn-primary">Dashboard</a> 
                        </p>

             </div>
_end;
} else {
    echo "<h1>Login</h1>\n";
    echo "<div ><p>Use your Email and password along with your institutional code to login. </p><ul style=\"color:#c02929\" class=\"alert alert-error nav \" id=\"message\"></ul></div>\n";
    $login_form = new form("index.php", "Login");
    $login_form->addField("uEmail", "Email", "email");
    $login_form->addField("inId", "Instituition ID", "text");
    $login_form->addField("uPwd", "Password", "Password");
    $login_form->displayForm();
}
$connection->close();
echo "</header>";
?>
			
        <hr>

        <!-- Title -->
        <div class="row">
            <div class="col-lg-12">
              <h3>Features</h3>
            </div>
 public function lijst($parameters)
 {
     $starget = new securitytarget();
     $starget->setId('voorinschrijving_lijst');
     if (!myacl::isAllowed(myauth::getCurrentuser(), $starget, 'view')) {
         return;
     }
     $template = new ui($this);
     $uurModel = new uurModel();
     $ingeschrevenModel = new ingeschrevenModel();
     $trajectModel = new trajectModel();
     $userModel = new userModel();
     $form = new form($parameters);
     $select = new selectField('wat', '', '');
     $select->addOption(new selectoptionField('Alles', '9990'));
     $daggroup = new selectoptgroupField('Dagen');
     $daggroup->addOption(new selectoptionField('Zaterdag', '6661'));
     $daggroup->addOption(new selectoptionField('Zondag', '4442'));
     $select->addOptgroup($daggroup);
     $trajecten = $trajectModel->get();
     $trajectgroup = new selectoptgroupField('Trajecten');
     foreach ($trajecten as $tr) {
         $trajectgroup->addOption(new selectoptionField($tr->getName(), 888 . $tr->getId()));
     }
     $select->addOptgroup($trajectgroup);
     $typegroup = new selectoptgroupField('Type');
     $typegroup->addOption(new selectoptionField('Personeel', '1114'));
     $typegroup->addOption(new selectoptionField('VIP', '1115'));
     $select->addOptgroup($typegroup);
     $uren = $uurModel->get();
     $uurgroup = new selectoptgroupField('Uren - Zaterdag');
     $uurgroup2 = new selectoptgroupField('Uren - Zondag');
     foreach ($uren as $uur) {
         if ($uur->getDag() == 1) {
             $uurgroup->addOption(new selectoptionField($uur->getUur(), 777 . $uur->getId()));
         } else {
             $uurgroup2->addOption(new selectoptionField($uur->getUur(), 555 . $uur->getId()));
         }
     }
     $select->addOptgroup($uurgroup);
     $select->addOptgroup($uurgroup2);
     $form->addField($select);
     $template->assign('form', $form);
     $terug = new pagerequest(1);
     $template->assign('terug', $terug);
     if (!$form->isSent()) {
         $wat = 9990;
     } else {
         $wat = $form->getFieldvalue('wat');
     }
     $mode = substr($wat, 0, 3);
     $modevalue = substr($wat, 3);
     if ($mode == 999 || $mode == 888) {
         $dag = 0;
     } elseif ($mode == 777 || $mode == 666) {
         $dag = 1;
     } elseif ($mode == 555 || $mode == 444) {
         $dag = 2;
     }
     if ($dag == 0) {
         $lijst[0]['dag'] = 'Zaterdag';
         $lijst[1]['dag'] = 'Zondag';
     } elseif ($dag == 1) {
         $lijst[0]['dag'] = 'Zaterdag';
     } elseif ($dag == 2) {
         $lijst[1]['dag'] = 'Zondag';
     }
     foreach ($lijst as $dag => $lijstelement) {
         $dag++;
         if ($mode == 888) {
             $uurCond = array('AND' => array('dag' => array('mode' => '=', 'value' => $dag), 'trajectid' => array('mode' => '=', 'value' => $modevalue)));
         } elseif ($mode == 777 || $mode == 555) {
             $uurCond = array('AND' => array('id' => array('mode' => '=', 'value' => $modevalue)));
         } else {
             $uurCond = array('AND' => array('dag' => array('mode' => '=', 'value' => $dag)));
         }
         $uren = $uurModel->get($uurCond);
         foreach ($uren as $uur) {
             $tempuur = array();
             $tempuur['uur'] = $uur;
             $gasten = $ingeschrevenModel->getfromUurid($uur->getId());
             $tempuur['aantal'] = 0;
             foreach ($gasten as $gast) {
                 $tempgast = array();
                 $tempgast['gast'] = $gast;
                 if ($mode == 111) {
                     if ($gast->getUserid() != $modevalue) {
                         continue;
                     }
                 }
                 if ($gast->getRegistrationtime() > time() - 60 * 60 * 24) {
                     $tempgast['new'] = 'true';
                 } else {
                     $tempgast['new'] = 'false';
                 }
                 $sameip = $ingeschrevenModel->getfromIpaddress($gast->getIpaddress());
                 if (count($sameip) > 1) {
                     $tempgast['sameip']['aantal'] = count($sameip);
                     $tempgast['sameip']['wie'] = $sameip;
                     $showrequest = new ajaxrequest('myvoorinschrijving', 'showsameip', array('id' => $gast->getId()));
                     $hiderequest = new ajaxrequest('myvoorinschrijving', 'hidesameip', array('id' => $gast->getId()));
                     $tempgast['sameip']['showrequest'] = $showrequest;
                     $tempgast['sameip']['hiderequest'] = $hiderequest;
                 } else {
                     $tempgast['sameip'] = 0;
                 }
                 $showmorerequest = new ajaxrequest('myvoorinschrijving', 'showmore', array('id' => $gast->getId()));
                 $hidemorerequest = new ajaxrequest('myvoorinschrijving', 'hidemore', array('id' => $gast->getId()));
                 $tempgast['showmorerequest'] = $showmorerequest;
                 $tempgast['hidemorerequest'] = $hidemorerequest;
                 $deleterequest = new ajaxrequest('myvoorinschrijving', 'deletegast', array('gastid' => $gast->getId()));
                 $tempgast['deleterequest'] = $deleterequest;
                 $user = $userModel->getfromId($gast->getUserid());
                 $tempgast['user'] = $user[0];
                 $tempuur['aantal'] += $gast->getAantal();
                 $tempuur['gasten'][] = $tempgast;
             }
             if (count($tempuur['gasten']) > 0) {
                 if (!isset($lijst[$dag - 1]['trajecten'][$uur->getTrajectid()]['traject'])) {
                     $traject = $trajectModel->getfromId($uur->getTrajectid());
                     $lijst[$dag - 1]['trajecten'][$uur->getTrajectid()]['traject'] = $traject[0];
                 }
                 $lijst[$dag - 1]['trajecten'][$uur->getTrajectid()]['uren'][] = $tempuur;
             }
         }
     }
     foreach ($lijst as $id => $dag) {
         if (count($dag['trajecten']) == 0) {
             unset($lijst[$id]);
         }
     }
     $template->assign('lijst', $lijst);
     $this->response->assign($this->self, 'innerHTML', $template->fetch('myvoorinschrijving_lijst.tpl'));
 }
Пример #8
0
 public function managepages($parameters = array())
 {
     $view = new ui($this);
     if (!isset($parameters['parentid'])) {
         $parentid = 0;
     } else {
         $parentid = $parameters['parentid'];
     }
     $pagemodel = new pageModel();
     if ($parentid != 0) {
         $currentpage = $pagemodel->getfromId($parentid);
         if (count($currentpage) == 1) {
             $currentpage = $currentpage[0];
             if (!$parameters['history']) {
                 $this->response->addWaypoint('mypageadmin', 'managepages', 'pageadmin', $parameters);
             }
         }
     }
     $grid = new mygrid('pagelist_' . $parentid);
     $grid->setModel($pagemodel);
     $grid->setDefaultconditions(array('parentid' => array('mode' => '=', 'value' => $parentid)));
     $grid->setDefaultorder(array('fields' => array('order'), 'type' => 'ASC'));
     $grid->setOrderfield('order');
     $grid->registerRequest('title', 'mypageadmin', 'managepages', array('parentid' => '{id}'));
     if ($currentpage instanceof pageObject) {
         $add = myacl::isAllowed(myauth::getCurrentuser(), $currentpage, 'addpage');
     } else {
         $add = myacl::isAllowed(myauth::getCurrentuser(), new securitytarget('pagemanagement'), 'addrootpage');
     }
     if ($add) {
         $grid->registerAddrequest('mypageadmin', 'addpage', array('title' => 'Pagina toevoegen', 'parentid' => $parentid));
     }
     $view->assign('grid', $grid);
     $pageid = $currentpage instanceof pageObject ? $currentpage->getId() : -1;
     $areamodel = new areaModel();
     $areas = $areamodel->get();
     $modules = array();
     $idcond = array('pageid' => array('mode' => '=', 'value' => $pageid));
     foreach ($areas as $area) {
         $areacond = array('areaid' => array('mode' => '=', 'value' => $area->getId()));
         $grid = new mygrid('modules_page_' . $pageid . '_area_' . $area->getId());
         $grid->setModel(new processedmodulepageModel());
         $grid->setDefaultconditions(array('AND' => array($idcond, $areacond)));
         $grid->setDefaultorder(array('fields' => array('order'), 'type' => 'ASC'));
         $grid->setOrderfield('order');
         $grid->registerAddrequest('mypageadmin', 'addmodulepagelink', array('title' => 'Module aan pagina toevoegen', 'areaid' => $area->getId(), 'pageid' => $pageid));
         $modules[$area->getName()] = $grid;
     }
     $view->assign('modules', $modules);
     if ($currentpage instanceof pageObject) {
         $aclcontroller = new myaclController();
         $acl = $aclcontroller->listacl(array('targetoutput' => '_return_', 'objecttype' => 'pageObject', 'objectid' => $currentpage->getId()));
         $view->assign('acl', $acl);
         $titleform = new form($parameters);
         $titleform->addField(new textField('title', 'Titel', $currentpage->getTitle(), array('required')));
         $titleform->addField(new hiddenField('parentid', $currentpage->getId()));
         if ($titleform->validate()) {
             $flash = new popupController();
             if ($titleform->getFieldvalue('title') != $currentpage->getTitle()) {
                 $currentpage->setTitle($titleform->getFieldvalue('title'));
                 try {
                     $pagemodel->save($currentpage);
                 } catch (Exception $e) {
                     $flash->createflash(array('name' => 'err', 'type' => 'error', 'content' => 'De gegevens zijn niet goed bewaard! Raadpleeg de informaticadienst.'));
                     return false;
                 }
                 $flash->createflash(array('name' => 'success', 'type' => 'success', 'content' => 'De gegevens zijn goed bewaard.'));
             } else {
                 $flash->createflash(array('name' => 'warning', 'type' => 'warning', 'content' => 'De nieuwe titel is gelijk aan de vorige titel.'));
             }
             $view->assign('titleform', $titleform);
         } elseif (!$titleform->isSent()) {
             $view->assign('titleform', $titleform);
         } else {
             return false;
         }
     }
     $theparentid = $parentid;
     $path = array();
     while ($theparentid != 0) {
         $parent = $pagemodel->getfromId($theparentid);
         if (count($parent) == 1) {
             $parent = $parent[0];
             $tmp = array();
             $tmp['page'] = $parent;
             $tmp['request'] = new ajaxrequest('mypageadmin', 'managepages', array('parentid' => $theparentid));
             $path[] = $tmp;
             $theparentid = $parent->getParentid();
         } else {
             $theparentid = 0;
         }
     }
     $rootpage = new pageObject();
     $rootpage->setTitle('Root');
     $root['page'] = $rootpage;
     $root['request'] = new ajaxrequest('mypageadmin', 'managepages', array('parentid' => 0));
     $path[] = $root;
     $view->assign('path', array_reverse($path));
     $view->assign('currentpage', $currentpage);
     $this->response->assign($this->self, 'innerHTML', $view->fetch('mypageadmin_managepages.tpl'));
 }
Пример #9
0
 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'));
     }
 }
Пример #10
0
 public function getSearchform()
 {
     $form = new form(array(), 'mygrid', 'search');
     if ($this->getLastsearch() != '') {
         $def = $this->getLastsearch();
     } else {
         $def = 'Zoek ...';
     }
     $form->addField(new inlinetextField('search', $def, '', array('required')));
     $form->addField(new hiddenField('gridid', $this->id));
     $form->setSubmittext('Zoek');
     return $form;
 }
Пример #11
0
 public function showbedbezgraph($parameters = array())
 {
     $view = new ui($this);
     $starttime = isset($parameters['starttime']) ? $parameters['starttime'] : strtotime('-1 months');
     $endtime = isset($parameters['endtime']) ? $parameters['endtime'] : time();
     $dienst = $parameters['dienst'];
     $form = new form($parameters);
     $form->addField(new hiddenField('dienst', $parameters['dienst']));
     $dienstmodel = new keukendienstModel();
     $diensten = $dienstmodel->get();
     $adiensten = array();
     $select = new selectField('dienst', 'Dienst', array('required'));
     $select->addOption(new selectoptionField('Alles', '_all_', $dienst == '_all_' ? true : false));
     foreach ($diensten as $dienstobj) {
         //if(myacl::isAllowed(myauth::getCurrentuser(),$dienst,'countstats')){
         $select->addOption(new selectoptionField($dienstobj->getName(), $dienstobj->getDienstnr(), $dienst == $dienstobj->getDienstnr() ? true : false));
         //}
     }
     $form->addField($select);
     $form->addField(new datepickerField('starttime', 'Startdatum', false, $starttime, array('required')));
     $form->addField(new datepickerField('endtime', 'Einddatum', false, $endtime, array('required')));
     if ($form->validate()) {
         $view->assign('dienst', $parameters['dienst']);
         $view->assign('starttime', $starttime);
         $view->assign('endtime', $endtime);
         $view->assign('closerequest', new ajaxrequest('mystats', 'closebedbezgraph'));
         $view->assign('form', $form);
         $this->response->assign('bedbezgraph', 'innerHTML', $view->fetch('mystats_showbedbezgraph.tpl'));
     } elseif (!$form->isSent()) {
         $view->assign('dienst', $parameters['dienst']);
         $view->assign('starttime', $starttime);
         $view->assign('endtime', $endtime);
         $view->assign('closerequest', new ajaxrequest('mystats', 'closebedbezgraph'));
         $view->assign('form', $form);
         $this->response->assign('bedbezgraph', 'innerHTML', $view->fetch('mystats_showbedbezgraph.tpl'));
     } else {
     }
 }
Пример #12
0
 public function setObjectorder($parameters = array())
 {
     $id = $parameters['id'];
     $gridid = $parameters['gridid'];
     $popup = new popupController();
     $grid = new mygrid($gridid);
     $model = $grid->getModel();
     $linkmodel = $grid->getModel();
     $object = $model->getfromId($id);
     if (count($object) == 1) {
         $object = $object[0];
         $view = new ui($this);
         $form = new form($parameters);
         $form->addField(new hiddenField('gridid', $gridid));
         $form->addField(new hiddenField('id', $id));
         $form->addField(new textField('order', 'Order', $object->_get($grid->getOrderfield()), array('required', 'numeric', 'range:1<->' . $model->getMax($grid->getOrderfield(), $grid->getConditions()))));
         if ($form->validate()) {
             $curlink = $object;
             if ($object->_get($grid->getOrderfield()) > $form->getFieldvalue('order')) {
                 $cond = array($grid->getOrderfield() => array('mode' => 'BETWEEN', 'value' => $form->getFieldvalue('order'), 'topvalue' => $object->_get($grid->getOrderfield())));
                 $links = $linkmodel->get(array('AND' => array($cond, $grid->getConditions())));
                 try {
                     foreach ($links as $link) {
                         $link->setOrder($link->getOrder() + 1);
                         $linkmodel->save($link);
                     }
                     $curlink->setOrder($form->getFieldvalue('order'));
                     $linkmodel->save($curlink);
                 } catch (Exception $e) {
                     $popup->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De wijziging is niet doorgevoerd! Raadpleeg de informaticadienst.'));
                     return false;
                 }
             } elseif ($object->_get($grid->getOrderfield()) < $form->getFieldvalue('order')) {
                 $cond = array($grid->getOrderfield() => array('mode' => 'BETWEEN', 'value' => $object->_get($grid->getOrderfield()), 'topvalue' => $form->getFieldvalue('order')));
                 $links = $linkmodel->get(array('AND' => array($cond, $grid->getConditions())));
                 try {
                     foreach ($links as $link) {
                         $link->setOrder($link->getOrder() - 1);
                         $linkmodel->save($link);
                     }
                     $curlink->setOrder($form->getFieldvalue('order'));
                     $linkmodel->save($curlink);
                 } catch (Exception $e) {
                     $popup->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De wijziging is niet doorgevoerd! Raadpleeg de informaticadienst.'));
                     return false;
                 }
             } else {
                 $popup->createflash(array('name' => 'warning', 'type' => 'warning', 'content' => 'De nieuwe plaats was dezelfde als de oude plaats. Er is dus niets gewijzigd.'));
                 $this->response->assign('gridextra_' . $gridid, 'innerHTML', '');
                 return false;
             }
             $popup->createflash(array('name' => 'success', 'type' => 'success', 'content' => 'De wijziging is goed doorgevoerd.'));
             $gridcontr = new mygridController();
             $gridcontr->reloadgrid($gridid);
             $this->response->assign('gridextra_' . $gridid, 'innerHTML', '');
         } elseif (!$form->isSent()) {
             $view->assign('form', $form);
             $view->assign('closeextra', new ajaxrequest('mygrid', 'closeextra', array('id' => 'gridextra_' . $gridid)));
             $this->response->assign('gridextra_' . $gridid, 'innerHTML', $view->fetch($parameters['viewprefix'] . 'mygrid_setobjectorder.tpl'));
         }
     }
 }
Пример #13
0
 public function addTicket($parameters = array())
 {
     require FRAMEWORK . DS . 'conf' . DS . 'myticket.php';
     require FRAMEWORK . DS . 'conf' . DS . 'mycafetaria.php';
     $view = new ui($this);
     $form = new form($parameters);
     $currentuser = myauth::getCurrentuser();
     $currentname = '';
     $groups = $currentuser->getGroupid();
     if (!isset($groups[$algemenegebruikers])) {
         $currentname = $currentuser->getName();
     }
     if (!isset($groups[$externgroup])) {
         $pricefield = 'price';
     } else {
         $pricefield = 'price2';
     }
     $form->addField(new suggesttextField('myticket', 'listusers', 'contact', 'Uw naam', $currentname, array('required')));
     $dienstveld = new selectField('dienst', 'Dienst', array('required'));
     $groupmodel = new groupModel();
     $diensten = array();
     foreach ($groups as $groupid) {
         $group = $groupmodel->getfromId($groupid);
         if (count($group) == 1) {
             $group = $group[0];
             $groupmemberof = $group->getMemberof();
             $flipped = array_flip($groupmemberof);
             if (isset($flipped[$meldinggroep])) {
                 $diensten[$group->getId()] = $group->getDescription();
             }
         }
     }
     if (count($diensten) > 1) {
         $dienstveld->addOption(new selectoptionField('', '', true));
         asort($diensten);
         foreach ($diensten as $id => $desc) {
             $dienstveld->addOption(new selectoptionField($desc, $id, false));
         }
     } else {
         foreach ($diensten as $id => $desc) {
             $dienstveld->addOption(new selectoptionField($desc, $id, true));
         }
     }
     $form->addField($dienstveld);
     $to = new selectField('to', 'Melding aan', array('required'));
     $to->addOption(new selectoptionField('', ''));
     $meldingdienstenmodel = new meldingdienstenModel();
     $meldingdiensten = $meldingdienstenmodel->get();
     foreach ($meldingdiensten as $meldingdienst) {
         $to->addOption(new selectoptionField($meldingdienst->getName(), $meldingdienst->getId()));
     }
     $form->addField($to);
     $form->addField(new textField('titel', 'Titel', '', array('required')));
     $form->addField(new textareaField('message', 'Melding', '', array('required')));
     if ($form->validate()) {
         $ticket = new myticketObject();
         $ticket->setDienstid($form->getFieldvalue('dienst'));
         $ticket->setTo($form->getFieldvalue('to'));
         $ticket->setContact($form->getFieldvalue('contact'));
         $ticket->setTitel($form->getFieldvalue('titel'));
         $ticket->setMessage($form->getFieldvalue('message'));
         $ticket->setPlacedby($currentuser->getId());
         $ticket->setTime(time());
         $ticket->setStatus('Created');
         $ticket->setUser($currentuser->getName());
         $dienst = $groupmodel->getfromId($form->getFieldvalue('dienst'));
         $ticket->setDienst($dienst[0]->getDescription());
         $to = $meldingdienstenmodel->getfromId($form->getFieldvalue('to'));
         $ticket->setToname($to[0]->getName());
         $ticketmodel = new myticketModel();
         $saved = true;
         try {
             $ticketmodel->save($ticket);
         } catch (Exception $e) {
             $saved = false;
         }
         $mailed = $this->mail($ticket);
         if ($mailed) {
             $ticket->setStatus('Mailed');
             $ticketmodel->save($ticket);
         }
         $this->listmytickets();
         $message = new ui($this);
         $message->assign('saved', $saved);
         $message->assign('mailed', $mailed);
         if ($saved && $mailed) {
             $type = 'success';
         } elseif ($saved) {
             $type = 'error';
         } elseif ($mailed) {
             $type = 'warning';
         } else {
             $type = 'error';
         }
         $popupcontroller = new popupController();
         $popupcontroller->createflash(array('name' => 'flash_melding', 'type' => $type, 'content' => $message->fetch('myticket_saveflash.tpl')));
     } elseif (!$form->isSent()) {
         $view->assign('form', $form);
         $this->response->assign($this->self, 'innerHTML', $view->fetch('myticket_addTicket.tpl'));
     }
 }
 public function adddoktervanwacht($parameters = array())
 {
     $view = new ui($this);
     if ($parameters['history'] != 'history') {
         $this->response->addWaypoint('mydoktervanwacht', 'adddoktervanwacht', 'adddoktervanwacht', array('specid' => $parameters['specid'], 'startofmonth' => $parameters['startofmonth'], 'endofmonth' => $parameters['endofmonth']));
     }
     $form = new form($parameters);
     $form->addField(new hiddenField('specid', $parameters['specid']));
     $select = new selectField('dokter', 'Dokter');
     $wdokterModel = new wdokterModel();
     $specmodel = new wdokterspecialismeModel();
     $maindocs = $wdokterModel->getfromSpecialisme($parameters['specid']);
     $mainspec = $specmodel->getfromId($parameters['specid']);
     $mainoptgroup = new selectoptgroupField($mainspec[0]->getName());
     foreach ($maindocs as $maindok) {
         $mainoptgroup->addOption(new selectoptionField('Dr. ' . $maindok->getNaam() . ' ' . $maindok->getVoornaam(), $maindok->getId()));
     }
     $select->addOptgroup($mainoptgroup);
     $specs = $specmodel->get(array(), array('fields' => array('name'), 'type' => 'ASC'));
     foreach ($specs as $spec) {
         if ($spec->getId() != $parameters['specid']) {
             $tmp = new selectoptgroupField($spec->getName());
             $tmpdocs = $wdokterModel->getfromSpecialisme($spec->getId());
             foreach ($tmpdocs as $tmpdok) {
                 $tmp->addOption(new selectoptionField('Dr. ' . $tmpdok->getNaam() . ' ' . $tmpdok->getVoornaam(), $tmpdok->getId()));
             }
             $select->addOptgroup($tmp);
         }
     }
     $form->addField($select);
     $form->addField(new datepickerField('start', 'Start', true, mktime(0, 0, 0, date('m', $parameters['start']), date('d', $parameters['start']), date('Y', $parameters['start'])), array('required')));
     $form->addField(new datepickerField('stop', 'Stop', true, mktime(23, 59, 0, date('m', $parameters['start']), date('d', $parameters['start']), date('Y', $parameters['start'])), array('required')));
     $startofmonth = isset($parameters['startofmonth']) ? $parameters['startofmonth'] : mktime(00, 00, 00, date('m'), 01, date('Y'));
     $endofmonth = isset($parameters['endofmonth']) ? $parameters['endofmonth'] : mktime(00, 00, 00, date('m') + 1, 01, date('Y')) - 1;
     for ($i = $startofmonth; $i < $endofmonth; $i += 86400) {
         $boxes[$i]['name'] = date('d/m/Y', $i);
         $boxes[$i]['selected'] = false;
     }
     $form->addField(new checkboxgroupField('day', 'Dag', $boxes));
     $form->addField(new hiddenField('startofmonth', $startofmonth));
     $form->addField(new hiddenField('endofmonth', $endofmonth));
     if ($form->validate()) {
         if ($form->getFieldvalue('start') < $form->getFieldvalue('stop')) {
             $wachtdokterModel = new wachtdokterModel();
             $start = $form->getFieldvalue('start');
             $stop = $form->getFieldvalue('stop');
             // Overlap
             //contained
             $contained = array('AND' => array(array('start' => array('mode' => '<', 'value' => $start)), array('stop' => array('mode' => '>', 'value' => $stop))));
             //stop after start
             $stopstart = array('AND' => array(array('start' => array('mode' => '<', 'value' => $start)), array('stop' => array('mode' => '>', 'value' => $start))));
             //start before stop
             $startstop = array('AND' => array(array('start' => array('mode' => '<', 'value' => $stop)), array('stop' => array('mode' => '>', 'value' => $stop))));
             $big = array('AND' => array(array('start' => array('mode' => '>', 'value' => $start)), array('stop' => array('mode' => '<', 'value' => $stop))));
             $timecond = array('OR' => array($contained, $startstop, $stopstart, $big));
             $speccond = array('specialisme' => array('mode' => '=', 'value' => $parameters['specid']));
             $cond = array('AND' => array($speccond, $timecond));
             $test = $wachtdokterModel->get($cond);
             if (count($test) > 0) {
                 $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Er mogen geen overlappingen zijn.', true);
                 $overlap = true;
             } else {
                 $wachtdokter = new wachtdokterObject();
                 $wachtdokter->setDokter($form->getFieldvalue('dokter'));
                 $wachtdokter->setStart($form->getFieldvalue('start'));
                 $wachtdokter->setStop($form->getFieldvalue('stop'));
                 $wachtdokter->setSpecialisme($form->getFieldvalue('specid'));
                 try {
                     $wachtdokterModel->save($wachtdokter);
                 } 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_edit_' . $parameters['-gridid-'], 'type' => 'success', 'content' => 'De gegevens zijn goed aangepast.'));
                 $this->showspecdetails($parameters);
             }
         } else {
             $this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Einduur moet na het beginuur liggen.', true);
         }
     } elseif (!$form->isSent()) {
         $view->assign('form', $form);
         $output = array();
         $closerequest = new ajaxrequest('mydoktervanwacht', 'showspecdetails', array('specid' => $parameters['specid'], 'startofmonth' => $parameters['startofmonth'], 'endofmonth' => $parameters['endofmonth']));
         $view->assign('closerequest', $closerequest);
         $wachtdokterModel = new wachtdokterviewModel();
         $speccond = array('specialisme' => array('mode' => '=', 'value' => $parameters['specid']));
         for ($i = $startofmonth; $i < $endofmonth; $i += 86400) {
             $start = array('start' => array('mode' => 'BETWEEN', 'value' => $i + 1, 'topvalue' => $i + 86400 - 1));
             $stop = array('stop' => array('mode' => 'BETWEEN', 'value' => $i, 'topvalue' => $i + 86400 - 1));
             $cond = array('OR' => array($start, $stop));
             $dokters = $wachtdokterModel->get(array('AND' => array($speccond, $cond)));
             $tmp = array();
             $tmp['dokters'] = $dokters;
             $tmp['start'] = $i;
             $output[] = $tmp;
         }
         $view->assign('list', $output);
         $view->assign('specialisme', $mainspec[0]);
         $this->response->assign($this->self, 'innerHTML', $view->fetch('mydoktervanwacht_edit.tpl'));
     } else {
         return false;
     }
 }
Пример #15
0
	public function makeForm ()
	{
		$form = new form($_SERVER['REQUEST_URI'], 'post', 'scaffold', $this->invalid, $this->title, 
				($_POST['scaffoldSubmitted'] ? true : false));
		$form->addField('scaffoldSubmitted', 'hidden', 'true');
		foreach ($this->definitions as $k => $v)
		{
			if (! $v['internal'])
			{
				$form->addField($k, $v['type'], $this->values[$k], $v['title'], $this->definitions[$k]['linkfield'], 
						$this->definitions[$k]);
			}
		}
		return $form->create();
	}
Пример #16
0
 public function listmyorders($parameters = array())
 {
     $view = new ui($this);
     require FRAMEWORK . DS . 'conf' . DS . 'mycafetaria.php';
     $form = new form($parameters);
     if (isset($parameters['orderuser'])) {
         $currentname = $parameters['orderuser'];
     } else {
         $currentuser = myauth::getCurrentuser();
         $currentname = '';
         $groups = $currentuser->getGroupid();
         if (!isset($groups[$algemenegebruikers])) {
             $currentname = $currentuser->getName();
         }
     }
     $form->addField(new suggesttextField('mycafetaria', 'listusers', 'orderuser', 'Gebruiker', $currentname, array('required')));
     if ($currentname != '' || $form->getFieldvalue('orderuser') != '') {
         $form->setNofocus(true);
     }
     if ($form->validate() || !$form->isSent() && $currentname != '') {
         $name = $form->getFieldvalue('orderuser') == '' ? $currentname : $form->getFieldvalue('orderuser');
         $view->assign('name', $name);
         $grid = new mygrid('myorderlist_' . $name);
         $grid->setModel(new processedmealorderModel());
         $grid->setDefaultorder(array('fields' => array('uur'), 'type' => 'DESC'));
         $grid->setDefaultpagesize(15);
         $grid->setDefaultconditions(array('user' => array('mode' => '=', 'value' => $name)));
         $view->assign('myorderlist', $grid);
         $today = strtotime('today');
         $tomorrow = strtotime('tomorrow');
         $conditions = array('AND' => array(array('user' => array('mode' => '=', 'value' => $name)), array('uur' => array('mode' => 'BETWEEN', 'value' => $today, 'topvalue' => $tomorrow))));
         $model = new processedmealorderModel();
         /*
         			$grid2 = new mygrid('myorderlist_today_' . $name);
         			$grid2->setModel($model);
         			$grid2->setDefaultconditions($conditions);
         */
         $view->assign('myorderlisttoday', $grid2);
         $orders = $model->get($conditions);
         $view->assign('orders', $orders);
         $view->assign('form', $form);
     } elseif (!$form->isSent()) {
         $view->assign('form', $form);
     }
     $this->response->assign($this->self, 'innerHTML', $view->fetch($parameters['viewprefix'] . 'mycafetaria_listmyorders.tpl'));
 }