protected function loadTrackSettings()
    {
        $respTracks = $this->tracker->getRespondentTracks(
                $this->formData['gto_id_respondent'],
                $this->formData['gto_id_organization']
                );
        $tracks = array();
        foreach ($respTracks as $respTrack) {
            if ($respTrack instanceof \Gems_Tracker_RespondentTrack) {
                if ($respTrack->hasSuccesCode()) {
                    $tracks[$respTrack->getRespondentTrackId()] = substr(sprintf(
                            $this->_('%s - %s'),
                            $respTrack->getTrackEngine()->getTrackName(),
                            $respTrack->getFieldsInfo()
                            ), 0, 100);
                }
            }
        }
        if ($tracks) {
            if (! isset($this->formData['gto_id_track'])) {
                reset($tracks);
                $this->formData['gto_id_track'] = key($tracks);
            }
        } else {
            $this->addMessageInvalid($this->_('Survey insertion impossible: respondent has no track!'));
            $tracks = $this->util->getTranslated()->getEmptyDropdownArray();
        }
        asort($tracks);
        $model = $this->getModel();
        $model->set('gto_id_track', 'multiOptions', $tracks);
        if (count($tracks) === 1) {
            $model->set('gto_id_track', 'elementClass', 'Exhibitor');
        }

        if (isset($this->formData['gto_id_track'])) {
            $this->respondentTrack = $respTracks[$this->formData['gto_id_track']];

            // Add relation field when survey is not for staff
            if ($this->survey && $this->survey->isTakenByStaff() === false) {
                $engine = $this->respondentTrack->getTrackEngine();
                if (method_exists($engine, 'getRespondentRelationFields')) {
                    $empty = array('-1' => $this->_('Patient'));
                    $relations = $empty + $engine->getRespondentRelationFields();
                    $model->set('gto_id_relationfield', 'label', $this->_('Fill out by'),
                        'multiOptions', $relations, 'elementClass', 'Select',
                    'required', true);
                }
            }
        }
    }
protected function loadTrackSettings()
    {
        $respTracks = $this->tracker->getRespondentTracks(
                $this->formData['gto_id_respondent'],
                $this->formData['gto_id_organization']
                );
        $tracks = array();
        foreach ($respTracks as $respTrack) {
            if ($respTrack instanceof \Gems_Tracker_RespondentTrack) {
                if ($respTrack->hasSuccesCode()) {
                    $tracks[$respTrack->getRespondentTrackId()] = substr(sprintf(
                            $this->_('%s - %s'),
                            $respTrack->getTrackEngine()->getTrackName(),
                            $respTrack->getFieldsInfo()
                            ), 0, 100);
                }
            }
        }
        if ($tracks) {
            if (! isset($this->formData['gto_id_track'])) {
                reset($tracks);
                $this->formData['gto_id_track'] = key($tracks);
            }
        } else {
            $this->addMessageInvalid($this->_('Survey insertion impossible: respondent has no track!'));
            $tracks = $this->util->getTranslated()->getEmptyDropdownArray();
        }
        asort($tracks);
        $model = $this->getModel();
        $model->set('gto_id_track', 'multiOptions', $tracks);
        if (count($tracks) === 1) {
            $model->set('gto_id_track', 'elementClass', 'Exhibitor');
        }

        if (isset($this->formData['gto_id_track'])) {
            $this->respondentTrack = $respTracks[$this->formData['gto_id_track']];

            // Add relation field when survey is not for staff
            if ($this->survey && $this->survey->isTakenByStaff() === false) {
                $engine = $this->respondentTrack->getTrackEngine();
                if (method_exists($engine, 'getRespondentRelationFields')) {
                    $empty = array('-1' => $this->_('Patient'));
                    $relations = $empty + $engine->getRespondentRelationFields();
                    $model->set('gto_id_relationfield', 'label', $this->_('Fill out by'),
                        'multiOptions', $relations, 'elementClass', 'Select',
                    'required', true);
                }
            }
        }
    }
protected function loadTrackSettings ( ) { $ respTracks = $ this -> tracker -> getRespondentTracks ( $ this -> formData [ 'gto_id_respondent' ] , $ this -> formData [ 'gto_id_organization' ] ) ; $ tracks = array ( ) ; foreach ( $ respTracks as $ respTrack ) { if ( $ respTrack instanceof \ Gems_Tracker_RespondentTrack ) { if ( $ respTrack -> hasSuccesCode ( ) ) { $ tracks [ $ respTrack -> getRespondentTrackId ( ) ] = substr ( sprintf ( $ this -> _ ( '%s - %s' ) , $ respTrack -> getTrackEngine ( ) -> getTrackName ( ) , $ respTrack -> getFieldsInfo ( ) ) , 0 , 100 ) ; } } } if ( $ tracks ) { if ( ! isset ( $ this -> formData [ 'gto_id_track' ] ) ) { reset ( $ tracks ) ; $ this -> formData [ 'gto_id_track' ] = key ( $ tracks ) ; } } else { $ this -> addMessageInvalid ( $ this -> _ ( 'Survey insertion impossible: respondent has no track!' ) ) ; $ tracks = $ this -> util -> getTranslated ( ) -> getEmptyDropdownArray ( ) ; } asort ( $ tracks ) ; $ model = $ this -> getModel ( ) ; $ model -> set ( 'gto_id_track' , 'multiOptions' , $ tracks ) ; if ( count ( $ tracks ) === 1 ) { $ model -> set ( 'gto_id_track' , 'elementClass' , 'Exhibitor' ) ; } if ( isset ( $ this -> formData [ 'gto_id_track' ] ) ) { $ this -> respondentTrack = $ respTracks [ $ this -> formData [ 'gto_id_track' ] ] ; // Add relation field when survey is not for staff if ( $ this -> survey && $ this -> survey -> isTakenByStaff ( ) === false ) { $ engine = $ this -> respondentTrack -> getTrackEngine ( ) ; if ( method_exists ( $ engine , 'getRespondentRelationFields' ) ) { $ empty = array ( '-1' => $ this -> _ ( 'Patient' ) ) ; $ relations = $ empty + $ engine -> getRespondentRelationFields ( ) ; $ model -> set ( 'gto_id_relationfield' , 'label' , $ this -> _ ( 'Fill out by' ) , 'multiOptions' , $ relations , 'elementClass' , 'Select' , 'required' , true ) ; } } } }
Load the settings for the survey
Load the settings for the survey