original_string: public function refresh()
      {
          $default = true;
          $filter  = array();
  
          if ($this->patientId) {
              $filter['gr2o_patient_nr'] = $this->patientId;
              $default = false;
          } elseif ($this->respondentId) {
              $filter['gr2o_id_user'] = $this->respondentId;
              $default = false;
          }
          if (! $filter) {
              // Otherwise we load the first patient in the current organization
              $filter[] = '1=0';
          }
          if ($this->organizationId) {
              $filter['gr2o_id_organization'] = $this->organizationId;
          }
  
          $this->_gemsData = $this->model->loadFirst($filter);
  
          if ($this->_gemsData) {
              $this->exists = true;
  
              $this->patientId      = $this->_gemsData['gr2o_patient_nr'];
              $this->organizationId = $this->_gemsData['gr2o_id_organization'];
              $this->respondentId   = $this->_gemsData['gr2o_id_user'];
          } else {
              $this->_gemsData = $this->model->loadNew();
              $this->exists = false;
          }
  
          if ($this->currentUser instanceof \Gems_User_User) {
              $this->_gemsData = $this->currentUser->applyGroupMask($this->_gemsData);
          }
  	}
code: public function refresh()
      {
          $default = true;
          $filter  = array();
  
          if ($this->patientId) {
              $filter['gr2o_patient_nr'] = $this->patientId;
              $default = false;
          } elseif ($this->respondentId) {
              $filter['gr2o_id_user'] = $this->respondentId;
              $default = false;
          }
          if (! $filter) {
              // Otherwise we load the first patient in the current organization
              $filter[] = '1=0';
          }
          if ($this->organizationId) {
              $filter['gr2o_id_organization'] = $this->organizationId;
          }
  
          $this->_gemsData = $this->model->loadFirst($filter);
  
          if ($this->_gemsData) {
              $this->exists = true;
  
              $this->patientId      = $this->_gemsData['gr2o_patient_nr'];
              $this->organizationId = $this->_gemsData['gr2o_id_organization'];
              $this->respondentId   = $this->_gemsData['gr2o_id_user'];
          } else {
              $this->_gemsData = $this->model->loadNew();
              $this->exists = false;
          }
  
          if ($this->currentUser instanceof \Gems_User_User) {
              $this->_gemsData = $this->currentUser->applyGroupMask($this->_gemsData);
          }
  	}
code_tokens: public function refresh ( ) { $ default = true ; $ filter = array ( ) ; if ( $ this -> patientId ) { $ filter [ 'gr2o_patient_nr' ] = $ this -> patientId ; $ default = false ; } elseif ( $ this -> respondentId ) { $ filter [ 'gr2o_id_user' ] = $ this -> respondentId ; $ default = false ; } if ( ! $ filter ) { // Otherwise we load the first patient in the current organization $ filter [ ] = '1=0' ; } if ( $ this -> organizationId ) { $ filter [ 'gr2o_id_organization' ] = $ this -> organizationId ; } $ this -> _gemsData = $ this -> model -> loadFirst ( $ filter ) ; if ( $ this -> _gemsData ) { $ this -> exists = true ; $ this -> patientId = $ this -> _gemsData [ 'gr2o_patient_nr' ] ; $ this -> organizationId = $ this -> _gemsData [ 'gr2o_id_organization' ] ; $ this -> respondentId = $ this -> _gemsData [ 'gr2o_id_user' ] ; } else { $ this -> _gemsData = $ this -> model -> loadNew ( ) ; $ this -> exists = false ; } if ( $ this -> currentUser instanceof \ Gems_User_User ) { $ this -> _gemsData = $ this -> currentUser -> applyGroupMask ( $ this -> _gemsData ) ; } }
docstring: Refresh the data
docstring_tokens: Refresh the data