Exemplo n.º 1
0
 public function nieuw()
 {
     ecpimport("components.omb.listel.ombform");
     $formmodel = new ECP_Comp_OmbForm();
     if ($_SERVER['REQUEST_METHOD'] != "POST") {
         /*
          * Model
          */
         $contactwijze = $this->model->getContactwijze();
         $relatie = $this->model->getHoofdrelatie();
         //$probleemfactor = $this->model->getProbleemfactor();
         //$test = $this->model->testFunction();
         /*
          * Form
          */
         $formmodel->updateContactwijzeList($contactwijze);
         $formmodel->updateHoofdrelatieList($relatie);
         /*
          * View
          */
         $this->view->viewMeldingForm($formmodel->getForm("melding"));
     } else {
         echo '{"succes":"negative","message":"Oei het loopt even mis!<br/>De server ontving geen waarden van het formulier..."}';
         ecpexit();
     }
 }
Exemplo n.º 2
0
 /**
  * Dispatch from URI (load the components)
  * @return boolean true on succes
  */
 public function dispatch()
 {
     //do dispatching
     if ($this->state === "parsed") {
         $component = $this->uri->getComponent();
         $command = $this->uri->getCommand();
         if (!ecplocate("components." . $component . "." . $component)) {
             $component = "error";
             $command = "unknown_component";
         }
         ecpimport("components.componentcontroller");
         //load the component interface!
         ecpimport("components." . $component . "." . $component);
         $componentname = "ECP_Comp_" . ucwords($component) . "_Controller";
         if (class_exists($componentname)) {
             $this->controller = new $componentname();
             $this->controller->command($command);
             $varr = $this->uri->getVars();
             array_pop($varr);
             $this->controller->params($varr);
             $this->controller->execute();
         } else {
             parent::addError("ECP_ROUTER::dispatch() - Couldn't open component because classname didn't exist. Component classnames wrong?");
             return false;
         }
         return true;
     } else {
         parent::addError("ECP_ROUTER::dispatch() - Can't dispatch because uri isn't parsed yet!");
         return false;
     }
 }
Exemplo n.º 3
0
 public function login()
 {
     /*
             $db = ECPFactory::getDbo();
              * */
     ecpimport("helpers.cryptology");
     $db = ECPFactory::getPDO("Logins");
     $pasw = 'c17a1a963e2b9ebb228030c0615fdb4bd91bd982';
     //$pasw = ECPFactory::getForm("login")->pasw->value;
     $login = '******';
     $loginpin = ECP_Cryptology::generateInteger(30);
     $pinhash = ECP_Cryptology::generateHash($loginpin);
     $log = new Logins();
     $log->setLogin($login)->setPaswoord($pasw);
     $results = Logins::findByExample($db, $log);
     if (empty($results)) {
         //email en ww komt niet overeen
         return false;
     } else {
         foreach ($results as $result) {
             $id = $result->getId();
             $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash);
             $count = $result->updateToDatabase($db);
             if ($count != l) {
                 return 2;
             } else {
                 return array("uid" => $id, "pin" => $loginpin);
             }
         }
     }
 }
Exemplo n.º 4
0
 public function testFunction()
 {
     ecpimport("database.overleggen.Overleggen");
     self::$db = ECPFactory::getPDO("Overleggen");
     $lok = new OverlegLok();
     $result = $lok->findByOverleg(self::$db);
     return self::resultToArray($result, OverlegLok::getFieldNamesLok());
 }
Exemplo n.º 5
0
 public function __CONSTRUCT($options, $conf = array())
 {
     ecpimport("database.query");
     $this->_conf = $conf;
     self::$_prefix = array_key_exists("prefix", $options) ? $options["prefix"] : "e_";
     $this->_conf['prefix'] = self::$_prefix;
     self::$_host = array_key_exists("host", $options) ? $options["host"] : "localhost";
     if (!array_key_exists("user", $options) || !array_key_exists("password", $options) || !array_key_exists("database", $options)) {
         $this->addError("ECP_DATABASE CONSTRUCTOR");
     } else {
         self::$_user = $options["user"];
         self::$_pasw = $options['password'];
         self::$_db = $options['database'];
     }
     $this->con = mysql_connect(self::$_host, self::$_user, self::$_pasw);
     mysql_select_db(self::$_db, $this->con);
 }
Exemplo n.º 6
0
 /**
  * Returns an object of EQApp from the right $id
  * @param type $id Clientname
  */
 public static function getInstance($id)
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     if (empty($instances[$id])) {
         $prefix = "ECP_";
         $classname = $id;
         if (ecpimport("application." . strtolower($classname) . "_app")) {
             $classname = $prefix . $id . 'App';
             $instance = new $classname($id);
         } else {
             parent::addError("ECPApp::getInstance");
             $instance = "";
         }
         $instances[$id] =& $instance;
     }
     return $instances[$id];
 }
Exemplo n.º 7
0
 public function setUser($id)
 {
     $db = ECPFactory::getDbo();
     $user = $db->newQuery("select", "user")->table("logins")->where("id", $id, "=")->execute();
     if ($user->getRows()) {
         $u = $user->getSingleResult();
         $this->guest = false;
         $this->id = $id;
         $u['profiel'] = strtolower($u['profiel']);
         $this->user = $u;
         ecpimport("user.usertype");
         //usertype interface
         if (ecplocate("user.types.{$u['profiel']}")) {
             ecpimport("user.types.{$u['profiel']}");
             //usertype class
             $classname = "ECP_User_" . $u['profiel'];
             $this->typeobj = new $classname();
         } else {
             echo "fatal error.. usertype unknown<br/>Missing type is: {$u['profiel']}";
             ecpexit();
         }
         $this->locked = 1;
     } else {
         $this->guest = 1;
         $this->locked = 1;
         $this->user = array("naam" => "Gast", "type" => "Guest");
     }
 }
Exemplo n.º 8
0
 public function __CONSTRUCT()
 {
     ecpimport("components.error.error.error");
     $this->model = new ECP_Comp_Error_Model();
     $this->action = "std_command";
 }
Exemplo n.º 9
0
 public function getPatientToewijzing($id, $getobject = false)
 {
     $patient = self::startPatient();
     $patient->setId($id);
     $result = Patient::findByExample(self::$db, $patient);
     if (count($result) < 1) {
         return 0;
     } else {
         $pat = $result[0];
         if ($getobject) {
             return $pat;
         }
         //patient object returnen
         switch ($pat->getToegewezenGenre()) {
             case "gemeente":
                 return 1;
                 break;
             case "rdc":
             case "psy":
                 ecpimport("database.organisatie", "class");
                 $org = new Organisatie();
                 $org->setId($pat->getToegewezenId());
                 $coresult = Organisatie::findByExample(self::$db, $org);
                 if (count($coresult) < 1) {
                     return null;
                 } else {
                     return $coresult[0]->getNaam();
                 }
                 break;
             default:
                 ecpimport("database.hulpverleners", "class");
                 $hulp = new Hulpverleners();
                 $hulp->setId($pat->getToegewezenId());
                 $huresult = Hulpverleners::findByExample(self::$db, $hulp);
                 if (count($huresult) < 1) {
                     return null;
                 } else {
                     return $huresult[0]->getNaam();
                 }
                 break;
         }
     }
 }
Exemplo n.º 10
0
 public function sessionToken()
 {
     if ($this->_state !== "guest") {
         return false;
     }
     if ($this->_state !== "error") {
         return 0;
     }
     $this->_state = "postunvalidated";
     if (array_key_exists("pin", $_POST)) {
         ecpimport("helpers.cryptology");
         $pinhash = ECP_Cryptology::generateHash($_POST['pin']);
         if ($pinhash !== $this->session['loginpin']) {
             $this->user->setGuest();
             return false;
         } else {
             //pin update?
             $this->_state = "active";
             return true;
             //hier normaal nieuwe pin teruggeven..
         }
     } else {
         $this->_state = "error";
         return 0;
     }
 }
Exemplo n.º 11
0
 /**
  * Returns an object of EQApp from the right $id
  * @param type $id Clientname
  */
 public static function getInstance($templatefile)
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     if (empty($instances[$id])) {
         $prefix = "ECP_Template_";
         $classname = $templatefile;
         if (ecpimport("template." . strtolower($classname))) {
             $classname = $prefix . $templatefile;
             $instance = new $classname($templatefile);
         } else {
             $this->addError("<hr/>error@ECP_Template::getInstance");
             $instance = "";
         }
         $instances[$templatefile] =& $instance;
     }
     return $instances[$templatefile];
 }
Exemplo n.º 12
0
 /**
  * Stelt de tabel in en returned thet object voor kettingvorming
  * @param string $table De tabelnaam
  * @return EQDatabaseQuery 
  */
 public function table($table)
 {
     ecpimport("database/tablehelper");
     if (self::$debug) {
         echo "* table given: {$table}<br/>";
     }
     if (ECP_DatabaseTableHelper::is_table($table)) {
         if (self::$debug) {
             echo "table exists,, checking permission..<br/>";
         }
         if (ECP_DatabaseTableHelper::getTablePermissionLevel($table) <= self::$permlvl) {
             if (self::$debug) {
                 echo "permission ok for table (deletepermission not checked yet): {$table}<br/>";
             }
             $this->table = strtolower($table);
         } else {
             if (self::$debug) {
                 echo "no permission for table: {$table}, permissionlevel::" . self::$permlvl . "<br/>";
             }
             $this->table = null;
         }
     } else {
         if (self::$debug) {
             echo "{$table} doesnt exist!<br/>";
         }
         $this->table = null;
     }
     return $this;
 }
Exemplo n.º 13
0
<?php

/**
 * Description of OverlegGDT
 *
 * @author Robin Moors, Joris Jacobs
 */
ecpimport("database.overleggen.OverlegExtended", "trait");
ecpimport("database.overleggen.OverlegOrg", "trait");
ecpimport("database.overleggen.OverlegLok", "trait");
ecpimport("database.overleggen.OverlegOmb", "trait");
ecpimport("database.overleggen.OverlegOrg", "trait");
ecpimport("database.overleggen.OverlegPsy", "trait");
ecpimport("database.overleggen.OverlegTp", "trait");
ecpimport("database.Overlegbasis", "class");
class OverlegGewoon extends Overlegbasis
{
}
class OverlegMenos extends Overlegbasis
{
    use OverlegOmbTrait;
}
/*
class OverlegLok extends Overlegbasis{
    use OverlegLokTrait, OverlegOrgTrait;
}

class OverlegGDT extends Overlegbasis{
    use OverlegExtendedTrait, OverlegOrgTrait{
        OverlegExtendedTrait:: setId insteadof OverlegOrgTrait;
        OverlegOrgTrait:: setId insteadof OverlegExtendedTrait;
Exemplo n.º 14
0
 public function eid()
 {
     include "openid.php";
     $openid = new LightOpenID('localhost');
     if ($openid->mode) {
         $session = ECPFactory::getSession();
         ecpimport("helpers.cryptology");
         $loginpin = ECP_Cryptology::generateInteger(30);
         $pinhash = ECP_Cryptology::generateHash($loginpin);
         $user = $openid->getAttributes();
         $achternaam = $user["namePerson/last"];
         $postcode = $user["contact/postalCode/home"];
         $adres = $user["contact/postalAddress/home"];
         $db = ECPFactory::getPDO("Logins");
         $log = new Logins();
         $log->setAdres($adres)->setOverlegGemeente($postcode)->setNaam($achternaam);
         $results = Logins::findByExample($db, $log);
         if (empty($results)) {
             //email en ww komt niet overeen
             ecpexit("exit");
         } else {
             foreach ($results as $result) {
                 $id = $result->getId();
                 $result->setIpadres($_SERVER['REMOTE_ADDR'])->setLoginpin($pinhash);
                 $count = $result->updateToDatabase($db);
                 if ($count != l) {
                     return 2;
                 } else {
                     ecpexit("uid=>{$id},pin=>{$loginpin}");
                 }
             }
         }
     } else {
         //Step 2: Authentication, with requirements
         $openid->identity = 'https://www.e-contract.be/eid-idp/endpoints/openid/auth-ident';
         $openid->required = array('namePerson/first', 'namePerson/last', 'namePerson', 'person/gender', 'contact/postalCode/home', 'contact/postalAddress/home', 'contact/city/home', 'eid/nationality', 'eid/pob', 'birthDate', 'eid/card-number', 'eid/card-validity/begin', 'eid/card-validity/end');
         //$openid->optional = array('');
         header('Location: ' . $openid->authUrl());
     }
 }
Exemplo n.º 15
0
 public function nieuw()
 {
     ecpimport("components.overleg.base.overlegform");
     $formmodel = new ECP_Comp_OverlegForm();
     if ($_SERVER['REQUEST_METHOD'] != "POST") {
         if (!is_null($this->vars[0])) {
             //patientnummer opgeven
             $pat_id = $this->vars[0];
             //patient met overleggen ophalen
             $patient = $this->model->getOverlegByPatientId($pat_id);
             if ($patient == null) {
                 //patient had geen overleggen... Dan maar alleen patient opgeven
                 $patient = $this->model->getPatientById($pat_id);
             }
             //de toegewezen OC ophalen en bij data patient steken...
             $patient['toegewezen'] = $this->model->getPatientToewijzing($pat_id);
             //regionaal dienstencentra ophalen (RDC)
             $formmodel->updateRDCList($this->model->getRDC());
             //zorgaanbieders ophalen (ZA)
             $formmodel->updateZAList($this->model->getZA());
             //zorgaanbieders profiel PSY ophalen
             $formmodel->updatePSYList($this->model->getPSY());
             $this->view->newOverleg($patient, $pat_id, $formmodel->getForm("new"));
         } else {
             $patienten = $this->model->getAllPatients();
             $formmodel->updatePatientList($patienten);
             $this->view->selectPatient($patienten, $formmodel->getForm("select"));
         }
     } else {
         //we zouden nu data hebben mee gekregen :)
         if (array_key_exists("values", $_POST) && array_key_exists("patid", $_POST)) {
             $session = ECPFactory::getSession();
             if ($session->isActive()) {
                 //hier normaal controle op loginpin
                 $patient = $this->model->getOverlegByPatientId($_POST['patid']);
                 if ($patient == null) {
                     //patient had geen overleggen... Dan maar alleen patient opgeven
                     $patient = $this->model->getPatientById($_POST['patid']);
                 }
                 if ($patient == null) {
                     ecpexit('{"succes":"negative","message":"Oei het loopt even mis!<br/>De server kon de patient niet vinden..."}');
                 }
                 //regionaal dienstencentra ophalen (RDC)
                 $formmodel->updateRDCList($this->model->getRDC());
                 //zorgaanbieders ophalen (ZA)
                 $formmodel->updateZAList($this->model->getZA());
                 //zorgaanbieders profiel PSY ophalen
                 $formmodel->updatePSYList($this->model->getPSY());
                 //data insteken
                 $values = json_decode($_POST['values'], true);
                 //json string naar assoc array parsen..
                 $report = $formmodel->validateValuesNewOverleg($values);
                 if ($report === 0) {
                     ecpexit('{"succes":"negative","message":"Oei het loopt even mis!<br/>De server kon niets opmaken uit de gestuurde waarden..."}');
                 }
                 //en dan nu valideren :)
                 //print_r($report);
                 $error = $formmodel->validateNewOverleg($report);
                 //print_r($error);
                 if ($this->model->setAanvraag($_POST['patid'], $values)) {
                     ecpexit('{"succes":"positive","message":"Het overleg werd aangevraagd!<br/>Het systeem keert terug naar de overleglijst..."}');
                 } else {
                     ecpexit('{"succes":"negative","message":"Oei het loopt even mis!<br/>Onze database kon de aanvraag niet verwerken.<br/>Probeer opnieuw of neem contact op met de beheerder."}');
                 }
             } else {
                 echo $session->getState();
             }
         } else {
             echo '{"succes":"negative","message":"Oei het loopt even mis!<br/>De server ontving geen waarden van het formulier..."}';
             ecpexit();
         }
     }
 }
Exemplo n.º 16
0
 public function __CONSTRUCT()
 {
     ecpimport("components.home.home.model");
     $this->model = new ECP_Comp_Home_Model();
 }
Exemplo n.º 17
0
 /**
  * Create a session object
  * @param   array  $options  An array containing session options
  * @return  ECP_Session object
  */
 protected static function createSession(array $options = array())
 {
     // Get the editor configuration setting
     $conf = self::getConfig();
     $options['expire'] = $conf->get('lifetime') ? $conf->get('lifetime') : 15;
     ecpimport('session.session');
     $session = ECP_Session::getInstance($options);
     if ($session->getState() == 'expired') {
         $session->restart();
     }
     return $session;
 }