public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $html = $this->getHtmlSequence();
     $html->h1($this->_('Respondent report'));
     $table = $html->table(array('class' => 'browser'));
     $table->th($this->_('Report information'), array('colspan' => 2));
     $table->tr()->th($this->_('Generated by'))->td($this->currentUser->getFullName());
     $table->tr()->th($this->_('Generated on'))->td(new \Zend_Date());
     $table->tr()->th($this->_('Organization'))->td($this->currentOrganization->getName());
     $html->br();
     return $html;
 }
 /**
  * Add organization id and gul_user_class when needed
  *
  * @param mixed $row array or \Traversable row
  * @param scalar $key
  * @return mixed Row array or false when errors occurred
  */
 public function translateRowValues($row, $key)
 {
     $row = parent::translateRowValues($row, $key);
     if (!$row) {
         return false;
     }
     if (!isset($row['gsf_id_organization'])) {
         $row['gsf_id_organization'] = $this->_organization->getId();
         if (!isset($row['gul_user_class'])) {
             $row['gul_user_class'] = $this->_organization->get('gor_user_class');
         }
     } elseif (!isset($row['gul_user_class'])) {
         $row['gul_user_class'] = $this->loader->getUserLoader()->getOrganization($row['gsf_id_organization'])->get('gor_user_class');
     }
     return $row;
 }
 /**
  * Function to allow the creation of search defaults in code
  *
  * @see getSearchFilter()
  *
  * @return array
  */
 public function getSearchDefaults()
 {
     if (!$this->defaultSearchData) {
         $orgId = $this->currentOrganization->getId();
         $this->defaultSearchData[-1] = "gtr_organizations LIKE '%|{$orgId}|%'";
     }
     return parent::getSearchDefaults();
 }
 /**
  * Overrule default index for the case that the current
  * organization cannot have users.
  */
 public function indexAction()
 {
     if ($this->currentUser->hasPrivilege('pr.respondent.multiorg') || $this->currentOrganization->canHaveRespondents()) {
         parent::indexAction();
     } else {
         $this->addSnippet('Organization\\ChooseOrganizationSnippet');
     }
 }
 /**
  * Function to allow the creation of search defaults in code
  *
  * @see getSearchFilter()
  *
  * @return array
  */
 public function getSearchDefaults()
 {
     if (!$this->defaultSearchData) {
         $orgId = $this->currentOrganization->getId();
         $this->defaultSearchData[-1] = "((gsu_insertable = 1 AND gsu_insert_organizations LIKE '%|{$orgId}|%') OR\r\n                EXISTS\r\n                (SELECT gro_id_track FROM gems__tracks INNER JOIN gems__rounds ON gtr_id_track = gro_id_track\r\n                    WHERE gro_id_survey = gsu_id_survey AND gtr_organizations LIKE '%|{$orgId}|%'\r\n                    ))";
     }
     return parent::getSearchDefaults();
 }
 /**
  * Get the organization name/code used by the long term filename
  *
  * @return string
  */
 public function getOrganizationCode()
 {
     if (!$this->_orgCode) {
         $this->_orgCode = $this->currentOrganization->getCode();
         if (!$this->_orgCode) {
             $this->_orgCode = \MUtil_File::cleanupName($this->currentOrganization->getName());
         }
     }
     return $this->_orgCode;
 }
 /**
  * Set the current Organization as from
  */
 public function setOrganizationFrom()
 {
     $this->from = $this->organization->getEmail();
 }
 /**
  *
  * @param string $patientId
  * @param int|\Gems_User_Organization $organization
  * @param int $respondentId
  * @return boolean True when something changed
  */
 public function handleRespondentChanged($patientId, $organization, $respondentId = null)
 {
     if ($organization instanceof \Gems_User_Organization) {
         $org = $organization;
         $orgId = $organization->getId();
     } else {
         $org = $this->loader->getOrganization($organization);
         $orgId = $organization;
     }
     $changeEventClass = $org->getRespondentChangeEventClass();
     if ($changeEventClass) {
         $event = $this->loader->getEvents()->loadRespondentChangedEvent($changeEventClass);
         if ($event) {
             $respondent = $this->loader->getRespondent($patientId, $orgId, $respondentId);
             if ($event->processChangedRespondent($respondent)) {
                 // If no change was registered yet, do so now
                 if (!$this->getChanged()) {
                     $this->addChanged();
                 }
                 return true;
             }
         }
     }
     return false;
 }