protected function loadExport()
 {
     $this->export = $this->loader->getRespondentExport();
     if ($this->token instanceof \Gems_Tracker_Token) {
         $this->addRespondent($this->token->getPatientNumber(), $this->token->getOrganizationId());
         $this->export->addRespondentTrackFilter($this->token->getRespondentTrackId());
         $this->export->addTokenFilter($this->token->getTokenId());
     } elseif ($this->respondentTrack instanceof \Gems_Tracker_RespondentTrack) {
         $this->addRespondent($this->respondentTrack->getPatientNumber(), $this->respondentTrack->getOrganizationId());
         $this->export->addRespondentTrackFilter($this->respondentTrack->getRespondentTrackId());
     } elseif ($this->respondent instanceof \Gems_Tracker_Respondent) {
         $this->addRespondent($this->respondent->getPatientNumber(), $this->respondent->getOrganizationId());
     }
 }
 /**
  * The place to check if the data set in the snippet is valid
  * to generate the snippet.
  *
  * When invalid data should result in an error, you can throw it
  * here but you can also perform the check in the
  * checkRegistryRequestsAnswers() function from the
  * {@see \MUtil_Registry_TargetInterface}.
  *
  * @return boolean
  */
 public function hasHtmlOutput()
 {
     // Try to set $this->respondentTrackId, it can be ok when not set
     if (!$this->respondentTrackId) {
         if ($this->respondentTrack) {
             $this->respondentTrackId = $this->respondentTrack->getRespondentTrackId();
         } else {
             $this->respondentTrackId = $this->request->getParam(\Gems_Model::RESPONDENT_TRACK);
         }
     }
     // First attempt at trackId
     if (!$this->trackId && $this->trackEngine) {
         $this->trackId = $this->trackEngine->getTrackId();
     }
     // Check if a sufficient set of data is there
     if (!($this->trackId || $this->patientId || $this->organizationId)) {
         // Now we really need $this->respondentTrack
         if (!$this->respondentTrack) {
             if ($this->respondentTrackId) {
                 $this->respondentTrack = $this->loader->getTracker()->getRespondentTrack($this->respondentTrackId);
             } else {
                 // Parameters not valid
                 return false;
             }
         }
     }
     if (!$this->trackId) {
         $this->trackId = $this->respondentTrack->getTrackId();
     }
     if (!$this->patientId) {
         $this->patientId = $this->respondentTrack->getPatientNumber();
     }
     if (!$this->organizationId) {
         $this->organizationId = $this->respondentTrack->getOrganizationId();
     }
     // \MUtil_Echo::track($this->trackId, $this->patientId, $this->organizationId, $this->respondentTrackId);
     return $this->getModel()->loadFirst() && parent::hasHtmlOutput();
 }