The followings are the available columns in table 'setting_installation':
Inheritance: extends BaseActiveRecordVersioned
Example #1
0
 /**
  * Override action value when action is step to be update.
  *
  * @param BaseEventTypeElement                $element
  * @param string                              $action
  * @param BaseCActiveBaseEventTypeCActiveForm $form
  * @param array                               $data
  * @param array                               $view_data
  * @param bool                                $return
  * @param bool                                $processOutput
  */
 protected function renderElement($element, $action, $form, $data, $view_data = array(), $return = false, $processOutput = false)
 {
     if ($action == 'step') {
         $action = 'update';
     }
     $class_array = '';
     if (!empty($element)) {
         $cls = get_class($element);
         if (!empty($cls)) {
             $class_array = explode('\\', get_class($element));
         }
     }
     $active_check_value = "";
     if (!empty($class_array)) {
         if (array_pop($class_array) === 'Element_OphCiExamination_CataractSurgicalManagement') {
             $active_check = \SettingInstallation::model()->find('t.key="city_road_satellite_view"');
             if (!empty($active_check)) {
                 $active_check_value = $active_check->value;
             }
         }
     }
     $view_data = array_merge(array('active_check' => $active_check_value), $view_data);
     parent::renderElement($element, $action, $form, $data, $view_data, $return, $processOutput);
 }
 protected function loadSetting($key)
 {
     $element_type = ElementType::model()->find('class_name=?', array(get_class($this)));
     if (!($metadata = SettingMetadata::model()->find('element_type_id=? and `key`=?', array($element_type->id, $key)))) {
         return false;
     }
     if ($setting = SettingUser::model()->find('user_id=? and element_type_id=? and `key`=?', array(Yii::app()->session['user']->id, $element_type->id, $key))) {
         return $this->parseSetting($setting, $metadata);
     }
     $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']);
     if ($setting = SettingFirm::model()->find('firm_id=? and element_type_id=? and `key`=?', array($firm->id, $element_type->id, $key))) {
         return $this->parseSetting($setting, $metadata);
     }
     if ($subspecialty_id = $firm->getSubspecialtyID()) {
         if ($setting = SettingSubspecialty::model()->find('subspecialty_id=? and element_type_id=? and `key`=?', array($subspecialty_id, $element_type->id, $key))) {
             return $this->parseSetting($setting, $metadata);
         }
     }
     if ($specialty = $firm->getSpecialty()) {
         if ($setting = SettingSpecialty::model()->find('specialty_id=? and element_type_id=? and `key`=?', array($specialty->id, $element_type->id, $key))) {
             return $this->parseSetting($setting, $metadata);
         }
     }
     $site = Site::model()->findByPk(Yii::app()->session['selected_site_id']);
     if ($setting = SettingSite::model()->find('site_id=? and element_type_id=? and `key`=?', array($site->id, $element_type->id, $key))) {
         return $this->parseSetting($setting, $metadata);
     }
     if ($setting = SettingInstitution::model()->find('institution_id=? and element_type_id=? and `key`=?', array($site->institution_id, $element_type->id, $key))) {
         return $this->parseSetting($setting, $metadata);
     }
     if ($setting = SettingInstallation::model()->find('element_type_id=? and `key`=?', array($element_type->id, $key))) {
         return $this->parseSetting($setting, $metadata);
     }
     return $metadata->default_value;
 }
Example #3
0
 /**
  * @param $episodeId
  * @param $userId
  * @param $examination
  * @param $examinationEvent
  * @throws \CDbException
  */
 protected function createMessage($episodeId, $userId, $examination, $examinationEvent)
 {
     if (isset(\Yii::app()->modules['OphCoMessaging']) && ($examination['patient']['comments'] || $examination['patient']['ready_for_second_eye'] === false)) {
         $episode = \Episode::model()->findByPk($episodeId);
         $recipient = \User::model()->findByPk($episode->firm->consultant_id);
         if ($recipient) {
             $sender = \User::model()->findByPk($userId);
             $type = OphCoMessaging_Message_MessageType::model()->findByAttributes(array('name' => 'General'));
             if ($examination['patient']['ready_for_second_eye'] === false) {
                 $ready = 'No';
             } elseif ($examination['patient']['ready_for_second_eye'] === true) {
                 $ready = 'Yes';
             } else {
                 $ready = 'Not Applicable';
             }
             $messageCreator = new MessageCreator($episode, $sender, $recipient, $type);
             $messageCreator->setMessageTemplate('application.modules.OphCoMessaging.views.templates.optom');
             $messageCreator->setMessageData(array('optom' => $examination['op_tom']['name'] . ' (' . $examination['op_tom']['goc_number'] . ')', 'ready' => $ready, 'comments' => $examination['patient']['comments'], 'patient' => $episode->patient));
             $message = $messageCreator->save('', array('event' => $examinationEvent->id));
             $emailSetting = \SettingInstallation::model()->find('`key` = "optom_comment_alert"');
             if ($emailSetting && $emailSetting->value) {
                 $recipients = explode(',', $emailSetting->value);
                 $messageCreator->emailAlert($recipients, 'New Optom Comment', $message->message_text);
             }
         }
     }
 }
 public function actionEditSetting()
 {
     if (!($metadata = SettingMetadata::model()->find('`key`=?', array(@$_GET['key'])))) {
         $this->redirect(array('/admin/settings'));
     }
     $errors = array();
     if (Yii::app()->request->isPostRequest) {
         foreach (SettingMetadata::model()->findAll('element_type_id is null') as $metadata) {
             if (@$_POST[$metadata->key]) {
                 if (!($setting = $metadata->getSetting($metadata->key, null, true))) {
                     $setting = new SettingInstallation();
                     $setting->key = $metadata->key;
                 }
                 $setting->value = @$_POST[$metadata->key];
                 if (!$setting->save()) {
                     $errors = $setting->errors;
                 } else {
                     $this->redirect(array('/admin/settings'));
                 }
             }
         }
     }
     $this->render('/admin/edit_setting', array('metadata' => $metadata, 'errors' => $errors));
 }