protected function loadParams()
    {
        $patientNr           = $this->_getParam(\MUtil_Model::REQUEST_ID1);
        $this->appointmentId = $this->_getParam(\Gems_Model::APPOINTMENT_ID);

        if ($this->appointmentId) {
            $select = $this->db->select();
            $select->from('gems__appointments', array('gap_id_user', 'gap_id_organization'))
                    ->joinInner(
                            'gems__respondent2org',
                            'gap_id_user = gr2o_id_user AND gap_id_organization = gr2o_id_organization',
                            array('gr2o_patient_nr')
                            )
                    ->where('gap_id_appointment = ?', $this->appointmentId);
            $data = $this->db->fetchRow($select);

            if ($data) {
                $this->organizationId = $data['gap_id_organization'];
                $this->respondentId   = $data['gap_id_user'];
                $patientNr            = $data['gr2o_patient_nr'];
            }
        } else {
            $this->organizationId = $this->_getParam(\MUtil_Model::REQUEST_ID2);

            if ($patientNr && $this->organizationId) {
                $this->respondentId   = $this->util->getDbLookup()->getRespondentId(
                        $patientNr,
                        $this->organizationId
                        );
            }
        }

        if (! $this->respondentId) {
            throw new \Gems_Exception($this->_('Requested agenda data not available!'));
        } else {
            $orgs = $this->currentUser->getAllowedOrganizations();

            if (! isset($orgs[$this->organizationId])) {
                $org = $this->loader->getOrganization($this->organizationId);

                if ($org->exists()) {
                    throw new \Gems_Exception(
                            sprintf($this->_('You have no access to %s appointments!'), $org->getName())
                            );
                } else {
                    throw new \Gems_Exception($this->_('Organization does not exist.'));
                }
            }
        }

        $source = $this->menu->getParameterSource();
        if ($this->appointmentId) {
            $source->setAppointmentId($this->appointmentId);
        }
        if ($patientNr && $this->organizationId) {
            $source->setPatient($patientNr, $this->organizationId);
        }
    }
protected function loadParams()
    {
        $patientNr           = $this->_getParam(\MUtil_Model::REQUEST_ID1);
        $this->appointmentId = $this->_getParam(\Gems_Model::APPOINTMENT_ID);

        if ($this->appointmentId) {
            $select = $this->db->select();
            $select->from('gems__appointments', array('gap_id_user', 'gap_id_organization'))
                    ->joinInner(
                            'gems__respondent2org',
                            'gap_id_user = gr2o_id_user AND gap_id_organization = gr2o_id_organization',
                            array('gr2o_patient_nr')
                            )
                    ->where('gap_id_appointment = ?', $this->appointmentId);
            $data = $this->db->fetchRow($select);

            if ($data) {
                $this->organizationId = $data['gap_id_organization'];
                $this->respondentId   = $data['gap_id_user'];
                $patientNr            = $data['gr2o_patient_nr'];
            }
        } else {
            $this->organizationId = $this->_getParam(\MUtil_Model::REQUEST_ID2);

            if ($patientNr && $this->organizationId) {
                $this->respondentId   = $this->util->getDbLookup()->getRespondentId(
                        $patientNr,
                        $this->organizationId
                        );
            }
        }

        if (! $this->respondentId) {
            throw new \Gems_Exception($this->_('Requested agenda data not available!'));
        } else {
            $orgs = $this->currentUser->getAllowedOrganizations();

            if (! isset($orgs[$this->organizationId])) {
                $org = $this->loader->getOrganization($this->organizationId);

                if ($org->exists()) {
                    throw new \Gems_Exception(
                            sprintf($this->_('You have no access to %s appointments!'), $org->getName())
                            );
                } else {
                    throw new \Gems_Exception($this->_('Organization does not exist.'));
                }
            }
        }

        $source = $this->menu->getParameterSource();
        if ($this->appointmentId) {
            $source->setAppointmentId($this->appointmentId);
        }
        if ($patientNr && $this->organizationId) {
            $source->setPatient($patientNr, $this->organizationId);
        }
    }
protected function loadParams ( ) { $ patientNr = $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID1 ) ; $ this -> appointmentId = $ this -> _getParam ( \ Gems_Model :: APPOINTMENT_ID ) ; if ( $ this -> appointmentId ) { $ select = $ this -> db -> select ( ) ; $ select -> from ( 'gems__appointments' , array ( 'gap_id_user' , 'gap_id_organization' ) ) -> joinInner ( 'gems__respondent2org' , 'gap_id_user = gr2o_id_user AND gap_id_organization = gr2o_id_organization' , array ( 'gr2o_patient_nr' ) ) -> where ( 'gap_id_appointment = ?' , $ this -> appointmentId ) ; $ data = $ this -> db -> fetchRow ( $ select ) ; if ( $ data ) { $ this -> organizationId = $ data [ 'gap_id_organization' ] ; $ this -> respondentId = $ data [ 'gap_id_user' ] ; $ patientNr = $ data [ 'gr2o_patient_nr' ] ; } } else { $ this -> organizationId = $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID2 ) ; if ( $ patientNr && $ this -> organizationId ) { $ this -> respondentId = $ this -> util -> getDbLookup ( ) -> getRespondentId ( $ patientNr , $ this -> organizationId ) ; } } if ( ! $ this -> respondentId ) { throw new \ Gems_Exception ( $ this -> _ ( 'Requested agenda data not available!' ) ) ; } else { $ orgs = $ this -> currentUser -> getAllowedOrganizations ( ) ; if ( ! isset ( $ orgs [ $ this -> organizationId ] ) ) { $ org = $ this -> loader -> getOrganization ( $ this -> organizationId ) ; if ( $ org -> exists ( ) ) { throw new \ Gems_Exception ( sprintf ( $ this -> _ ( 'You have no access to %s appointments!' ) , $ org -> getName ( ) ) ) ; } else { throw new \ Gems_Exception ( $ this -> _ ( 'Organization does not exist.' ) ) ; } } } $ source = $ this -> menu -> getParameterSource ( ) ; if ( $ this -> appointmentId ) { $ source -> setAppointmentId ( $ this -> appointmentId ) ; } if ( $ patientNr && $ this -> organizationId ) { $ source -> setPatient ( $ patientNr , $ this -> organizationId ) ; } }
Loads and checks the request parameters

@throws \Gems_Exception
Loads and checks the request parameters