当前位置: 首页>>代码示例>>PHP>>正文


PHP Gems_Loader::getOrganization方法代码示例

本文整理汇总了PHP中Gems_Loader::getOrganization方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Loader::getOrganization方法的具体用法?PHP Gems_Loader::getOrganization怎么用?PHP Gems_Loader::getOrganization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gems_Loader的用法示例。


在下文中一共展示了Gems_Loader::getOrganization方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadOrganization

 /**
  * Load the organization from the given organization id
  */
 protected function loadOrganization()
 {
     if (!$this->organizationId) {
         $this->loadOrganizationId();
     }
     $this->organization = $this->loader->getOrganization($this->organizationId);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:10,代码来源:MailerAbstract.php

示例2: applySettings

 /**
  *
  * @param boolean $detailed True when the current action is not in $summarizedActions.
  * @param string $action The current action.
  * @param int $defaultOrgId The default organization id or null if current organization
  * @return \Gems_Model_StaffModel
  */
 public function applySettings($detailed, $action, $defaultOrgId)
 {
     $this->resetOrder();
     $dbLookup = $this->util->getDbLookup();
     $editing = $action == 'edit' || $action == 'create';
     $translated = $this->util->getTranslated();
     $user = $this->loader->getCurrentUser();
     $yesNo = $translated->getYesNo();
     if ($editing) {
         $ucfirst = new \Zend_Filter_Callback('ucfirst');
         if ($this->project->isLoginShared()) {
             $this->set('gsf_login', 'validator', $this->createUniqueValidator('gsf_login', array('gsf_id_user')));
         } else {
             // per organization
             $this->set('gsf_login', 'validator', $this->createUniqueValidator(array('gsf_login', 'gsf_id_organization'), array('gsf_id_user')));
         }
     } else {
         $ucfirst = null;
     }
     $this->set('gsf_login', 'label', $this->_('Username'), 'minlength', 4, 'required', true, 'size', 15);
     if ($user->hasPrivilege('pr.staff.see.all') || !$editing) {
         // Select organization
         $options = $dbLookup->getOrganizations();
     } else {
         $options = $user->getAllowedOrganizations();
     }
     $this->set('gsf_id_organization', 'label', $this->_('Organization'), 'multiOptions', $options, 'required', true);
     if ($detailed) {
         $this->set('gsf_first_name', 'label', $this->_('First name'), 'filters[ucfirst]', $ucfirst);
         $this->set('gsf_surname_prefix', 'label', $this->_('Surname prefix'), 'description', $this->_('de, van der, \'t, etc...'));
         $this->set('gsf_last_name', 'label', $this->_('Last name'), 'required', true, 'filters[ucfirst]', $ucfirst);
     } else {
         $this->set('name', 'label', $this->_('Name'));
     }
     $this->set('gsf_gender', 'label', $this->_('Gender'), 'elementClass', 'Radio', 'multiOptions', $translated->getGenders(), 'separator', ' ');
     $this->set('gsf_email', 'label', $this->_('E-Mail'), 'itemDisplay', array('MUtil_Html_AElement', 'ifmail'), 'size', 30, 'validators[email]', 'SimpleEmail');
     $this->set('gsf_id_primary_group', 'label', $this->_('Primary function'), 'multiOptions', $editing ? $user->getAllowedStaffGroups() : $dbLookup->getStaffGroups());
     if ($detailed) {
         // Now try to load the current organization and find out if it has a default user definition
         // otherwise use the defaultStaffDefinition
         $organization = $this->loader->getOrganization($defaultOrgId ? $defaultOrgId : $user->getCurrentOrganizationId());
         $this->set('gsf_id_organization', 'default', $organization->getId());
         $this->set('gul_user_class', 'label', $this->_('User Definition'), 'default', $organization->get('gor_user_class', $this->defaultStaffDefinition), 'multiOptions', $this->loader->getUserLoader()->getAvailableStaffDefinitions());
         if ($editing) {
             $this->set('gul_user_class', 'order', 1, 'required', true);
         }
         $this->set('gsf_iso_lang', 'label', $this->_('Language'), 'default', $this->project->locale['default'], 'multiOptions', $this->util->getLocalized()->getLanguages());
         $this->set('gul_can_login', 'label', $this->_('Can login'), 'default', 1, 'description', $this->_('Users can only login when this box is checked.'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
         $this->set('gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'description', $this->_('If checked the user will logoff when answering a survey.'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
         $this->set('gsf_mail_watcher', 'label', $this->_('Check cron job mail'), 'description', $this->_('If checked the user will be mailed when the cron job does not run on time.'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
     }
     $this->set('gsf_active', 'label', $this->_('Active'), 'elementClass', 'None', 'multiOptions', $yesNo);
     $this->setDeleteValues('gsf_active', 0, 'gul_can_login', 0);
     if (!$user->hasPrivilege('pr.staff.edit.all')) {
         $this->set('gsf_id_organization', 'elementClass', 'Exhibitor');
     }
     return $this;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:65,代码来源:StaffModel.php

示例3: loadFormData

 /**
  * Hook that loads the form data from $_POST or the model
  *
  * Or from whatever other source you specify here.
  */
 protected function loadFormData()
 {
     parent::loadFormData();
     if (isset($this->formData['gor_id_organization']) && $this->formData['gor_id_organization']) {
         $model = $this->getModel();
         // Strip self from list of organizations
         $multiOptions = $model->get('gor_accessible_by', 'multiOptions');
         unset($multiOptions[$this->formData['gor_id_organization']]);
         $model->set('gor_accessible_by', 'multiOptions', $multiOptions);
         // Show allowed organisations
         $org = $this->loader->getOrganization($this->formData['gor_id_organization']);
         $allowedOrgs = $org->getAllowedOrganizations();
         //Strip self
         unset($allowedOrgs[$this->formData['gor_id_organization']]);
         $display = join(', ', $allowedOrgs);
         if (!$display) {
             $display = \MUtil_Html::create('em', $this->_('No access to other organizations.'));
         }
         $model->set('allowed', 'value', $display);
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:26,代码来源:OrganizationEditSnippet.php

示例4: getCaption

 /**
  * Returns the caption for this table
  *
  * @param boolean $onlyNotCurrent Only return a string when the organization is different
  * @return string
  */
 protected function getCaption($onlyNotCurrent = false)
 {
     $orgId = $this->request->getParam(\MUtil_Model::REQUEST_ID2);
     if ($orgId == $this->loader->getCurrentUser()->getCurrentOrganizationId()) {
         if ($onlyNotCurrent) {
             return;
         } else {
             return $this->_('Respondent information');
         }
     } else {
         return sprintf($this->_('%s respondent information'), $this->loader->getOrganization($orgId)->getName());
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:19,代码来源:RespondentDetailSnippetAbstract.php

示例5: loadFormData

 /**
  * Hook that loads the form data from $_POST or the model
  *
  * Or from whatever other source you specify here.
  */
 protected function loadFormData()
 {
     parent::loadFormData();
     if ($this->request->isPost()) {
         if (!$this->_saveButton || !$this->_saveButton->isChecked()) {
             if (isset($this->formData['grs_ssn']) && $this->formData['grs_ssn']) {
                 $filter = array('grs_ssn' => $this->formData['grs_ssn'], 'gr2o_id_organization' => true);
                 if ($this->formData['gr2o_id_organization']) {
                     $orgId = $this->formData['gr2o_id_organization'];
                 } else {
                     $orgId = $this->model->get('gr2o_id_organization', 'default');
                 }
                 $order = array($this->db->quoteInto("CASE WHEN gr2o_id_organization = ? THEN 1 ELSE 2 END", $orgId) => SORT_ASC);
                 $data = $this->model->loadFirst($filter, $order);
                 if ($data && !isset($this->formData[$this->saveButtonId])) {
                     // \MUtil_Echo::track($this->formData);
                     // \MUtil_Echo::track($data);
                     // Do not use this value
                     unset($data['grs_ssn']);
                     if ($data['gr2o_id_organization'] == $orgId) {
                         // gr2o_patient_nr
                         // gr2o_id_organization
                         $this->addMessage($this->_('Known respondent.'));
                         //*
                         foreach ($data as $name => $value) {
                             if (substr($name, 0, 4) == 'grs_' || substr($name, 0, 5) == 'gr2o_') {
                                 if (array_key_exists($name, $this->formData)) {
                                     $this->formData[$name] = $value;
                                 }
                                 $cname = $this->model->getKeyCopyName($name);
                                 if (array_key_exists($cname, $this->formData)) {
                                     $this->formData[$cname] = $value;
                                 }
                             }
                         }
                         // */
                     } else {
                         $org = $this->loader->getOrganization($data['gr2o_id_organization']);
                         $this->addMessage(sprintf($this->_('Respondent data retrieved from %s.'), $org->getName()));
                         foreach ($data as $name => $value) {
                             if (substr($name, 0, 4) == 'grs_' && array_key_exists($name, $this->formData)) {
                                 $this->formData[$name] = $value;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:55,代码来源:RespondentFormSnippet.php

示例6: save

 /**
  * Save a single model item.
  *
  * @param array $newValues The values to store for a single model item.
  * @param array $filter If the filter contains old key values these are used
  * to decide on update versus insert.
  * @return array The values as they are after saving (they may change).
  */
 public function save(array $newValues, array $filter = null, array $saveTables = null)
 {
     // If the respondent id is not set, check using the
     // patient number and then the ssn
     if (!(isset($newValues['grs_id_user']) && $newValues['grs_id_user'])) {
         $id = false;
         if (isset($newValues['gr2o_patient_nr'], $newValues['gr2o_id_organization'])) {
             $sql = 'SELECT gr2o_id_user
                     FROM gems__respondent2org
                     WHERE gr2o_patient_nr = ? AND gr2o_id_organization = ?';
             $id = $this->db->fetchOne($sql, array($newValues['gr2o_patient_nr'], $newValues['gr2o_id_organization']));
         }
         if (!$id && isset($newValues['grs_ssn']) && $this->hashSsn !== self::SSN_HIDE) {
             if (self::SSN_HASH === $this->hashSsn) {
                 $search = $this->saveSSN($newValues['grs_ssn']);
             } else {
                 $search = $newValues['grs_ssn'];
             }
             $sql = 'SELECT grs_id_user FROM gems__respondents WHERE grs_ssn = ?';
             $id = $this->db->fetchOne($sql, $search);
             // Check for change in patient ID
             if ($id && isset($newValues['gr2o_id_organization'])) {
                 $sql = 'SELECT gr2o_patient_nr
                         FROM gems__respondent2org
                         WHERE gr2o_id_user = ? AND gr2o_id_organization = ?';
                 $patientId = $this->db->fetchOne($sql, array($id, $newValues['gr2o_id_organization']));
                 if ($patientId) {
                     $copyId = $this->getKeyCopyName('gr2o_patient_nr');
                     $newValues[$copyId] = $patientId;
                 }
             }
         }
         if ($id) {
             $newValues['grs_id_user'] = $id;
             $newValues['gr2o_id_user'] = $id;
         }
         // If empty, then set by \Gems_Model->createGemsUserId()
     }
     $result = parent::save($newValues, $filter, $saveTables);
     if (isset($result['gr2o_id_organization']) && isset($result['grs_id_user'])) {
         // Tell the organization it has at least one user
         $org = $this->loader->getOrganization($result['gr2o_id_organization']);
         if ($org) {
             $org->setHasRespondents($this->currentUser->getUserId());
         }
         $this->handleRespondentChanged($result['gr2o_patient_nr'], $org, $result['grs_id_user']);
     }
     return $result;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:57,代码来源:RespondentModel.php

示例7: getOrganization

 /**
  *
  * @return \Gems_User_Organization
  */
 public function getOrganization()
 {
     return $this->loader->getOrganization($this->organizationId);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:8,代码来源:Respondent.php


注:本文中的Gems_Loader::getOrganization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。