public function actionIsCommonOphthalmic($id) { $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']); if ($cd = CommonOphthalmicDisorder::model()->find('disorder_id=? and subspecialty_id=?', array($id, $firm->serviceSubspecialtyAssignment->subspecialty_id))) { echo "<option value=\"{$cd->disorder_id}\" data-order=\"{$cd->display_order}\">" . $cd->disorder->term . "</option>"; } }
/** * @param Firm $firm * @param Episode $episode * @param EventType $event_type * * @return bool */ public function canCreateEvent(Firm $firm = null, Episode $episode = null, EventType $event_type = null) { if ($event_type) { if ($event_type->disabled) { return false; } if (!$event_type->support_services && !$firm->getSubspecialtyID()) { // Can't create a non-support service event for a support-service firm return false; } } if ($firm && $episode) { return $this->canEditEpisode($firm, $episode); } return true; }
public function actionApplications() { $date_from = date(Helper::NHS_DATE_FORMAT, strtotime('-1 year')); $date_to = date(Helper::NHS_DATE_FORMAT); if (isset($_GET['yt0'])) { $firm = null; if (@$_GET['firm_id'] && (int) $_GET['firm_id']) { $firm_id = (int) $_GET['firm_id']; if (!($firm = Firm::model()->findByPk($firm_id))) { throw new CException("Unknown firm {$firm_id}"); } } if (@$_GET['date_from'] && date('Y-m-d', strtotime($_GET['date_from']))) { $date_from = date('Y-m-d', strtotime($_GET['date_from'])); } if (@$_GET['date_to'] && date('Y-m-d', strtotime($_GET['date_to']))) { $date_to = date('Y-m-d', strtotime($_GET['date_to'])); } $results = $this->getApplications($date_from, $date_to, $firm); $filename = 'therapyapplication_report_' . date('YmdHis') . '.csv'; $this->sendCsvHeaders($filename); echo $this->array2Csv($results); } else { $subspecialty = Subspecialty::model()->find('ref_spec=:ref_spec', array(':ref_spec' => 'MR')); $context = array('firms' => Firm::model()->getList($subspecialty->id), 'date_from' => $date_from, 'date_to' => $date_to); $this->render('applications', $context); } }
/** * @param int $patient_id * @param int $medication_id */ public function actionForm($patient_id, $medication_id = null) { if ($medication_id == 'adherence') { $this->renderPartial('adherence_form', array("patient" => $this->fetchModel('Patient', $patient_id)), false, true); } else { $this->renderPartial('form', array("patient" => $this->fetchModel('Patient', $patient_id), "medication" => $this->fetchModel('Medication', $medication_id, true), "firm" => Firm::model()->findByPk($this->selectedFirmId)), false, true); } }
/** * Sets the firm property on the controller from the session * * @throws HttpException */ protected function setFirmFromSession() { if (!($firm_id = Yii::app()->session->get('selected_firm_id'))) { throw new HttpException('Firm not selected'); } if (!$this->firm || $this->firm->id != $firm_id) { $this->firm = Firm::model()->findByPk($firm_id); } }
public function actionList() { $search = $this->request->getParam("search"); $session = new CHttpSession(); $session->open(); $firmId = $this->request->getParam("firm_id"); $subspecialtyId = $this->request->getParam("subspecialty_id"); if ($firmId > 0 && (isset($search['filterid']['subspecialty_id']['value']) && $search['filterid']['subspecialty_id']['value'] > 0)) { $session['lastSubspecialtyId'] = $search['filterid']['subspecialty_id']['value']; $this->redirect('/oeadmin/LeafletSubspecialtyFirm/list?search[filterid][firm_id][value]=' . $firmId . '&subspecialty_id=' . $search['filterid']['subspecialty_id']['value']); } $lastSubspecialtyId = $session['lastSubspecialtyId']; // check if it's been already set if (!($lastSubspecialtyId > 0)) { if (isset($search['filterid']['subspecialty_id']['value'])) { $session['lastSubspecialtyId'] = $search['filterid']['subspecialty_id']['value']; } else { $session['lastSubspecialtyId'] = Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id; } } // || ($this->request->getParam("subspecialty_id")!=$session['lastSubspecialtyId'] && $search['filterid']['firm_id']['value']=="") if ($subspecialtyId > 0 && $subspecialtyId != $session['lastSubspecialtyId'] && isset($search['filterid']['firm_id']['value']) || $subspecialtyId == $session['lastSubspecialtyId'] && $search['filterid']['firm_id']['value'] == "") { $session['lastSubspecialtyId'] = ""; $this->redirect('/oeadmin/LeafletSubspecialtyFirm/list?search[filterid][subspecialty_id][value]=' . $subspecialtyId); } if (isset($search['filterid']['firm_id']['value']) && $search['filterid']['firm_id']['value'] > 0) { $excludeSubspecialty = true; $excludeFirm = false; $admin = new AdminListAutocomplete(OphTrConsent_Leaflet_Firm::model(), $this); $admin->setCustomDeleteURL('/oeadmin/LeafletSubspecialtyFirm/deleteFirm'); } else { $excludeSubspecialty = false; $excludeFirm = true; $admin = new AdminListAutocomplete(OphTrConsent_Leaflet_Subspecialty::model(), $this); $admin->setCustomDeleteURL('/oeadmin/LeafletSubspecialtyFirm/deleteSubspecialty'); } $admin->setListFields(array('id', 'leaflet.name')); $admin->setCustomSaveURL('/oeadmin/LeafletSubspecialtyFirm/add'); $admin->setModelDisplayName('Leaflet-Subspecialty-Firm Assignment'); if ($subspecialtyId > 0) { $defaultSubspecialty = $subspecialtyId; } else { $defaultSubspecialty = Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id; } $admin->setFilterFields(array(array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => $defaultSubspecialty, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name', 'excludeSearch' => $excludeSubspecialty), array('label' => 'Firm', 'dropDownName' => 'firm_id', 'defaultValue' => null, 'listModel' => Firm::model(), 'listIdField' => 'id', 'listDisplayField' => 'name', 'emptyLabel' => '-- All --', 'dependsOnFilterName' => 'subspecialty_id', 'dependsOnDbFieldName' => 'subspecialty_id', 'dependsOnJoinedTable' => 'serviceSubspecialtyAssignment', 'excludeSearch' => $excludeFirm))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id))); } $admin->setAutocompleteField(array('fieldName' => 'leaflet_id', 'allowBlankSearch' => 1, 'jsonURL' => '/oeadmin/LeafletSubspecialtyFirm/search', 'placeholder' => 'search for leaflets')); //$admin->searchAll(); $admin->listModel(); }
public function init() { $modulePath = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.OphDrPrescription.assets')); Yii::app()->clientScript->registerScriptFile($modulePath . '/js/report.js', CClientScript::POS_HEAD); if (!$this->subspecialtyId) { $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']); if (isset($firm->serviceSubspecialtyAssignment->subspecialty_id)) { $this->subspecialtyId = $firm->serviceSubspecialtyAssignment->subspecialty_id; } } if (!$this->siteId) { $this->siteId = Yii::app()->session['selected_site_id']; } }
public function actionList() { $admin = new AdminListAutocomplete(SiteSubspecialtyDrug::model(), $this); $admin->setListFields(array('id', 'drugs.name', 'drugs.dose_unit')); $admin->setCustomDeleteURL('/OphDrPrescription/admin/commondrugsdelete'); $admin->setCustomSaveURL('/OphDrPrescription/admin/commondrugsadd'); $admin->setModelDisplayName('Common Drugs List'); $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name'))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('site_id' => Yii::app()->session['selected_site_id'], 'subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id))); } $admin->setAutocompleteField(array('fieldName' => 'drug_id', 'jsonURL' => '/OphDrPrescription/default/DrugList', 'placeholder' => 'search for drugs')); //$admin->searchAll(); $admin->listModel(); }
public function actionList() { $admin = new AdminListAutocomplete(SiteSubspecialtyAnaestheticAgentDefault::model(), $this); $admin->setListFields(array('id', 'agents.name')); $admin->setCustomDeleteURL('/oeadmin/AnaestheticAgentDefaults/delete'); $admin->setCustomSaveURL('/oeadmin/AnaestheticAgentDefaults/add'); $admin->setModelDisplayName('Operation Note Anaesthetic Agent Defaults'); $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name'))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'site_id' => Yii::app()->session['selected_site_id']))); } $admin->setAutocompleteField(array('fieldName' => 'anaesthetic_agent_id', 'allowBlankSearch' => 1, 'jsonURL' => '/oeadmin/AnaestheticAgentDefaults/search', 'placeholder' => 'search for adding anaesthetic agent')); //$admin->searchAll(); $admin->listModel(); }
public function actionList() { $admin = new AdminListAutocomplete(OphTrConsent_Leaflet_Subspecialty::model(), $this); $admin->setListFields(array('id', 'leaflet.name')); $admin->setCustomDeleteURL('/oeadmin/LeafletSubspecialty/delete'); $admin->setCustomSaveURL('/oeadmin/LeafletSubspecialty/add'); $admin->setModelDisplayName('Leaflet-Subspecialty Assignment'); $admin->setFilterFields(array(array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name'))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id))); } $admin->setAutocompleteField(array('fieldName' => 'leaflet_id', 'jsonURL' => '/oeadmin/LeafletSubspecialty/search', 'placeholder' => 'search for leaflets')); //$admin->searchAll(); $admin->listModel(); }
public function criteria($count = false) { $criteria = new CDbCriteria(); if (@$_REQUEST['hos_num']) { $criteria->addCondition('`dil`.`patient_number` = :hos_num'); $criteria->params[':hos_num'] = $_REQUEST['hos_num']; } if (@$_REQUEST['file_name']) { $criteria->addCondition('file_name = :file_name'); $criteria->params[':file_name'] = $_REQUEST['file_name']; } if (@$_REQUEST['firm_id']) { $firm = Firm::model()->findByPk($_REQUEST['firm_id']); $firm_ids = array(); foreach (Firm::model()->findAll('name=?', array($firm->name)) as $firm) { $firm_ids[] = $firm->id; } if (!empty($firm_ids)) { $criteria->addInCondition('firm_id', $firm_ids); } } if (@$_REQUEST['action']) { $criteria->addCondition('action_id=:action_id'); $criteria->params[':action_id'] = $_REQUEST['action']; } if (@$_REQUEST['target_type']) { $criteria->addCondition('type_id=:type_id'); $criteria->params[':type_id'] = $_REQUEST['target_type']; } if (@$_REQUEST['event_type_id']) { $criteria->addCondition('event_type_id=:event_type_id'); $criteria->params[':event_type_id'] = $_REQUEST['event_type_id']; } if (@$_REQUEST['date_from']) { $date_from = Helper::convertNHS2MySQL($_REQUEST['date_from']) . ' 00:00:00'; $criteria->addCondition('`t`.created_date >= :date_from'); $criteria->params[':date_from'] = $date_from; } if (@$_REQUEST['date_to']) { $date_to = Helper::convertNHS2MySQL($_REQUEST['date_to']) . ' 23:59:59'; $criteria->addCondition('`t`.created_date <= :date_to'); $criteria->params[':date_to'] = $date_to; } // !($count) && $criteria->join = 'left join event on t.event_id = event.id left join event_type on event.event_type_id = event_type.id'; return $criteria; }
public function actionList() { $admin = new AdminListAutocomplete(OphTrOperationnote_PostopSiteSubspecialtyDrug::model(), $this); $admin->setListFields(array('id', 'postopdrugs.name', 'default')); $admin->setCustomDeleteURL('/oeadmin/PostOpDrugMappings/delete'); $admin->setCustomSaveURL('/oeadmin/PostOpDrugMappings/add'); $admin->setCustomSetDefaultURL('/oeadmin/PostOpDrugMappings/setDefault'); $admin->setCustomRemoveDefaultURL('/oeadmin/PostOpDrugMappings/RemoveDefault'); $admin->setModelDisplayName('Per-operative Drugs Mapping'); $admin->setFilterFields(array(array('label' => 'Site', 'dropDownName' => 'site_id', 'defaultValue' => Yii::app()->session['selected_site_id'], 'listModel' => Site::model(), 'listIdField' => 'id', 'listDisplayField' => 'short_name'), array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name'))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id, 'site_id' => Yii::app()->session['selected_site_id']))); } $admin->setAutocompleteField(array('fieldName' => 'drug_id', 'jsonURL' => '/oeadmin/PostOpDrugMappings/search', 'placeholder' => 'search for adding per op drug')); //$admin->searchAll(); $admin->listModel(); }
public function run() { if ($this->element) { $this->class = CHTML::modelName($this->element); } else { $this->class = get_class($this); } if (empty($_POST) || !array_key_exists($this->class, $_POST)) { if (empty($this->element->event_id)) { if ($this->default) { // It's a new event so fetch the most recent element_diagnosis $firmId = Yii::app()->session['selected_firm_id']; $firm = Firm::model()->findByPk($firmId); if (isset(Yii::app()->getController()->patient)) { $patientId = Yii::app()->getController()->patient->id; $episode = Episode::getCurrentEpisodeByFirm($patientId, $firm, true); if ($episode && ($disorder = $episode->diagnosis)) { // There is a diagnosis for this episode $this->value = $disorder->id; $this->label = $disorder->term; } } } } else { if (isset($this->element->disorder)) { $this->value = $this->element->disorder->id; $this->label = $this->element->disorder->term; } } } elseif (array_key_exists($this->field, $_POST[$this->class])) { if (preg_match('/[^\\d]/', $_POST[$this->class][$this->field])) { if ($disorder = Disorder::model()->find('term=? and specialty_id is not null', array($_POST[$this->class][$this->field]))) { $this->value = $disorder->id; $this->label = $disorder->term; } } else { $this->value = $_POST[$this->class][$this->field]; if ($disorder = Disorder::model()->findByPk($this->value)) { $this->label = $disorder->term; } } } parent::run(); }
/** * Finds the best matching workflow * @param integer $firm_id * @param integer $status_id * @return OphCiExamination_Workflow */ public static function findWorkflow($firm_id, $status_id) { $subspecialty_id = null; if ($firm = \Firm::model()->findByPk($firm_id)) { $subspecialty_id = $firm->serviceSubspecialtyAssignment ? $firm->serviceSubspecialtyAssignment->subspecialty_id : null; } if ($rule = OphCiExamination_Workflow_Rule::model()->find('subspecialty_id=? and firm_id=? and episode_status_id=?', array($subspecialty_id, $firm_id, $status_id))) { return $rule->workflow; } if ($rule = OphCiExamination_Workflow_Rule::model()->find('subspecialty_id=? and episode_status_id=?', array($subspecialty_id, $status_id))) { return $rule->workflow; } if ($rule = OphCiExamination_Workflow_Rule::model()->find('subspecialty_id=?', array($subspecialty_id))) { return $rule->workflow; } if ($rule = OphCiExamination_Workflow_Rule::model()->find('subspecialty_id is null and episode_status_id is null')) { return $rule->workflow; } throw new \CException('Cannot find default workflow rule'); }
/** * @description Common drugs administration page - it lists the common drugs based on site and subspecialty * * @return html (rendered page) */ public function actionCommonDrugs() { /* * We try to set default values for the selects */ if (isset($_GET['site_id'])) { $activeSite = $_GET['site_id']; } else { $activeSite = Yii::app()->session['selected_site_id']; } if (isset($_GET['subspecialty_id'])) { $activeSubspecialty = $_GET['subspecialty_id']; } else { $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']); if (isset($firm->serviceSubspecialtyAssignment->subspecialty_id)) { $activeSubspecialty = $firm->serviceSubspecialtyAssignment->subspecialty_id; } else { $activeSubspecialty = null; } } $this->render('druglist', array('selectedsite' => $activeSite, 'selectedsubspecialty' => $activeSubspecialty, 'site_subspecialty_drugs' => Element_OphDrPrescription_Details::model()->commonDrugsBySiteAndSpec($activeSite, $activeSubspecialty))); }
/** * @param int $patientId * @param int $medicationId */ public function actionForm($patientId, $medicationId = null, $prescriptionItemId = null) { if ($medicationId == 'adherence') { $this->renderPartial('adherence_form', array('patient' => $this->fetchModel('Patient', $patientId)), false, true); } else { if ($medicationId) { $medication = $this->fetchModel('Medication', $medicationId, true); } elseif ($prescriptionItemId) { if ($api = Yii::app()->moduleAPI->get('OphDrPrescription')) { $medication = $api->getMedicationForPrescriptionItem($patientId, $prescriptionItemId); if (!$medication) { throw new CHttpException(404, 'Could not get medication for prescription item.'); } } else { throw new CHttpException(400, 'Missing prescription item or module'); } } else { $medication = new Medication(); } $this->renderPartial('form', array('patient' => $this->fetchModel('Patient', $patientId), 'medication' => $medication, 'firm' => Firm::model()->findByPk($this->selectedFirmId)), false, true); } }
public function testActionSchedule() { $this->markTestIncomplete(); $_GET['id'] = 2; $this->controller->initAction('schedule'); $this->controller->expects($this->once())->method('processJsVars'); $this->controller->actionSchedule(); foreach (array('event', 'operation', 'firm', 'firmList', 'date', 'selectedDate', 'sessions', 'theatres', 'session', 'bookings', 'bookable', 'errors') as $key) { $this->assertArrayHasKey($key, $this->controller->renderParams); } $this->assertEquals($this->controller->renderParams['event']->id, 2); $this->assertEquals($this->controller->renderParams['operation']->id, 2); $this->assertEquals($this->controller->renderParams['firm']->id, 1); $this->assertEquals($this->controller->renderParams['firmList'], Firm::model()->listWithSpecialties); $this->assertEquals($this->controller->renderParams['date'], Element_OphTrOperationbooking_Operation::model()->find('event_id=?', array(2))->minDate); $this->assertNull($this->controller->renderParams['selectedDate']); $this->assertEquals($this->controller->renderParams['sessions'], array()); $this->assertNull($this->controller->renderParams['theatres']); $this->assertNull($this->controller->renderParams['session']); $this->assertNull($this->controller->renderParams['bookings']); $this->assertNull($this->controller->renderParams['bookable']); $this->assertNull($this->controller->renderParams['errors']); }
?> <div class="alert-box hide" id="update_inline"> <a href="#">Update selected sequences</a> </div> <?php $form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'inline_edit', 'enableAjaxValidation' => false, 'htmlOptions' => array('style' => 'display: none;', 'class' => 'panel'))); ?> <div class="row field-row"> <div class="large-2 column"> <label for="">Firm:</label> </div> <div class="large-5 column end"> <?php echo CHtml::dropDownList('inline_firm_id', '', Firm::model()->getListWithSpecialties(), array('empty' => '- Don\'t change -')); ?> <span class="error"></span> </div> </div> <div class="row field-row"> <div class="large-2 column"> <label for="">Theatre:</label> </div> <div class="large-5 column end"> <?php echo CHtml::dropDownList('inline_theatre_id', '', CHtml::listData(OphTrOperationbooking_Operation_Theatre::model()->active()->findAll(), 'id', 'name'), array('empty' => '- Don\'t change -')); ?> <span class="error"></span> </div> </div>
/** * Ajax action to get user data list. */ public function actionUsers() { $users = array(); $criteria = new CDbCriteria(); $criteria->addCondition(array('active = :active')); $criteria->addCondition(array("LOWER(concat_ws(' ',first_name,last_name)) LIKE :term")); $params[':active'] = 1; $params[':term'] = '%' . strtolower(strtr($_GET['term'], array('%' => '\\%'))) . '%'; $criteria->params = $params; $criteria->order = 'first_name, last_name'; $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']); $consultant = null; // only want a consultant for medical firms if ($specialty = $firm->getSpecialty()) { if ($specialty->medical) { $consultant = $firm->consultant; } } foreach (User::model()->findAll($criteria) as $user) { if ($contact = $user->contact) { $consultant_name = false; // if we have a consultant for the firm, and its not the matched user, attach the consultant name to the entry if ($consultant && $user->id != $consultant->id) { $consultant_name = trim($consultant->contact->title . ' ' . $consultant->contact->first_name . ' ' . $consultant->contact->last_name); } $users[] = array('id' => $user->id, 'value' => trim($contact->title . ' ' . $contact->first_name . ' ' . $contact->last_name . ' ' . $contact->qualifications) . ' (' . $user->role . ')', 'fullname' => trim($contact->title . ' ' . $contact->first_name . ' ' . $contact->last_name . ' ' . $contact->qualifications), 'role' => $user->role, 'consultant' => $consultant_name); } } echo json_encode($users); }
/** * @param Firm $firm * @return array * @throws CException */ public static function getListWithSecondaryTo(Firm $firm) { if (empty($firm)) { throw new CException('Firm is required'); } $disorders = array(); $secondary_to = array(); if ($ss_id = $firm->getSubspecialtyID()) { $cods = self::model()->with(array('disorder', 'secondary_to_disorders'))->findAllByAttributes(array('subspecialty_id' => $ss_id), array('order' => 'disorder.term')); foreach ($cods as $cod) { $disorders[] = $cod->disorder; if ($secondary_tos = $cod->secondary_to_disorders) { $secondary_to[$cod->disorder_id] = CHtml::listData($secondary_tos, 'id', 'term'); } } } return array(CHtml::listData($disorders, 'id', 'term'), $secondary_to); }
/** * set base js vars for use in the standard scripts for the controller */ public function processJsVars() { if ($this->patient) { $this->jsVars['OE_patient_id'] = $this->patient->id; } if ($this->event) { $this->jsVars['OE_event_id'] = $this->event->id; $this->jsVars['OE_print_url'] = Yii::app()->createUrl($this->getModule()->name . "/default/print/" . $this->event->id); } $this->jsVars['OE_asset_path'] = $this->assetPath; $firm = Firm::model()->findByPk(Yii::app()->session['selected_firm_id']); $subspecialty_id = $firm->serviceSubspecialtyAssignment ? $firm->serviceSubspecialtyAssignment->subspecialty_id : null; $this->jsVars['OE_subspecialty_id'] = $subspecialty_id; parent::processJsVars(); }
$form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'adminform', 'enableAjaxValidation' => false, 'htmlOptions' => array('class' => 'sliding'), 'focus' => '#contactname', 'layoutColumns' => array('label' => 2, 'field' => 5))); ?> <?php echo $form->errorSummary($rule); ?> <?php echo $form->dropDownList($rule, 'parent_rule_id', CHtml::listData(OphTrOperationbooking_Waiting_List_Contact_Rule::model()->getListAsTree(), 'id', 'treeName'), array('empty' => '- None -')); ?> <?php echo $form->textField($rule, 'rule_order', array(), array(), array('field' => 2)); ?> <?php echo $form->dropDownList($rule, 'site_id', Site::model()->getListForCurrentInstitution('name'), array('empty' => '- Not set -')); ?> <?php echo $form->dropDownList($rule, 'firm_id', Firm::model()->getListWithSpecialties(), array('empty' => '- Not set -')); ?> <?php echo $form->dropDownList($rule, 'service_id', CHtml::listData(Service::model()->findAll(array('order' => 'name')), 'id', 'name'), array('empty' => '- Not set -')); ?> <?php echo $form->textField($rule, 'name'); ?> <?php echo $form->textField($rule, 'telephone', array(), array(), array('field' => 3)); ?> <?php if ($rule->children) { ?> <div class="row field-row"> <div class="large-<?php
* OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. * * @package OpenEyes * @link http://www.openeyes.org.uk * @author OpenEyes <*****@*****.**> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2013, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ if (!empty(Yii::app()->session['user'])) { $user = Yii::app()->session['user']; } else { $user = User::model()->findByPk(Yii::app()->user->id); } $firm = Firm::model()->findByPk($this->selectedFirmId); if (file_exists("/etc/hostname")) { $hostname = trim(file_get_contents("/etc/hostname")); } else { $hostname = trim(`hostname`); } if (is_object($user)) { $username = "******"; $firm = "{$firm->name} ({$firm->id})"; } else { $username = '******'; $firm = 'Not logged in'; } $commit = preg_replace('/[\\s\\t].*$/s', '', @file_get_contents(Yii::app()->basePath . "/../.git/FETCH_HEAD")); $ex = explode('/', file_get_contents(".git/HEAD")); $branch = array_pop($ex);
public function actionAddNewEpisode() { if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) { throw new Exception("Patient not found: " . @$_POST['patient_id']); } if (!empty($_POST['firm_id'])) { $firm = Firm::model()->findByPk($_POST['firm_id']); if (!($episode = $patient->getOpenEpisodeOfSubspecialty($firm->getSubspecialtyID()))) { $episode = $patient->addEpisode($firm); } $this->redirect(array('/patient/episode/' . $episode->id)); } return $this->renderPartial('//patient/add_new_episode', array('patient' => $patient, 'firm' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])), false, true); }
?> end"> <?php echo $form->textArea($element, 're', array('rows' => 2, 'label' => false, 'nowrapper' => true), empty($_POST) ? strlen($element->re) == 0 : strlen(@$_POST['ElementLetter']['re']) == 0, array('class' => 'address')); ?> </div> </div> <div class="row field-row"> <div class="large-<?php echo $layoutColumns['label']; ?> column"> <?php $firm = Firm::model()->with('serviceSubspecialtyAssignment')->findByPk(Yii::app()->session['selected_firm_id']); $event_types = array(); foreach (EventType::model()->with('elementTypes')->findAll() as $event_type) { $event_types[$event_type->class_name] = array(); foreach ($event_type->elementTypes as $elementType) { $event_types[$event_type->class_name][] = $elementType->class_name; } } if (isset($_GET['patient_id'])) { $patient = Patient::model()->findByPk($_GET['patient_id']); } else { $patient = Yii::app()->getController()->patient; } $with = array('firmLetterStrings' => array('condition' => 'firm_id is null or firm_id = :firm_id', 'params' => array(':firm_id' => $firm->id), 'order' => 'firmLetterStrings.display_order asc'), 'subspecialtyLetterStrings' => array('condition' => 'subspecialty_id is null', 'order' => 'subspecialtyLetterStrings.display_order asc'), 'siteLetterStrings' => array('condition' => 'site_id is null or site_id = :site_id', 'params' => array(':site_id' => Yii::app()->session['selected_site_id']), 'order' => 'siteLetterStrings.display_order')); if ($firm->getSubspecialtyID()) { $with['subspecialtyLetterStrings']['condition'] = 'subspecialty_id is null or subspecialty_id = :subspecialty_id';
public function actionDeleteFirms() { $result = 1; if (!empty($_POST['firms'])) { foreach (Firm::model()->findAllByPk($_POST['firms']) as $firm) { try { $firm_id = $firm->id; if (!$firm->delete()) { $result = 0; } else { Audit::add('admin-Firm', 'delete', $firm_id); } } catch (Exception $e) { $result = 0; } } } echo $result; }
<div class="box admin"> <h2><?php echo $erod->id ? 'Edit' : 'Add'; ?> EROD rule</h2> <?php $form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'adminform', 'enableAjaxValidation' => false, 'focus' => '#username', 'layoutColumns' => array('label' => 2, 'field' => 5))); ?> <?php echo $form->errorSummary($erod); ?> <?php echo $form->dropDownList($erod, 'subspecialty_id', CHtml::listData($erod->getSubspecialtyOptions(), 'id', 'name'), array('style' => 'margin-bottom:6px;', 'empty' => '- Subspecialty -')); ?> <?php echo $form->multiSelectList($erod, 'Firms', 'firms', 'item_id', Firm::model()->getListWithSpecialties(), array(), array('empty' => '- Firms -', 'label' => 'Firms')); ?> <?php echo $form->formActions(); ?> <?php $this->endWidget(); ?> </div> <script type="text/javascript"> handleButton($('#et_cancel'),function(e) { e.preventDefault(); window.location.href = baseUrl+'/OphTrOperationbooking/admin/viewERODRules'; }); handleButton($('#et_save'),function(e) {
/** * Return all firms that the user has access rights to * * @return Firm[] */ public function getAvailableFirms() { $crit = new CDbCriteria(); $crit->compare('active', 1); if (!$this->global_firm_rights) { $crit->join = "left join firm_user_assignment fua on fua.firm_id = t.id and fua.user_id = :user_id " . "left join user_firm_rights ufr on ufr.firm_id = t.id and ufr.user_id = :user_id " . "left join service_subspecialty_assignment ssa on ssa.id = t.service_subspecialty_assignment_id " . "left join user_service_rights usr on usr.service_id = ssa.service_id and usr.user_id = :user_id "; $crit->addCondition("fua.id is not null or ufr.id is not null or usr.id is not null"); $crit->params['user_id'] = $this->id; } return Firm::model()->findAll($crit); }
public function actionAddFirm() { $user = User::model()->findByPk(Yii::app()->user->id); if (@$_POST['firm_id'] == 'all') { $firms = $user->getAvailableFirms(); } else { $firms = Firm::model()->findAllByPk(@$_POST['firm_id']); } foreach ($firms as $firm) { if (!($us = UserFirm::model()->find('firm_id=? and user_id=?', array($firm->id, Yii::app()->user->id)))) { $us = new UserFirm(); $us->firm_id = $firm->id; $us->user_id = Yii::app()->user->id; if (!$us->save()) { throw new Exception("Unable to save UserFirm: " . print_r($us->getErrors(), true)); } $user->has_selected_firms = 1; if (!$user->save()) { throw new Exception("Unable to save user: "******"1"; }
<?php echo $error; ?> </li> </ul> </div> <?php } ?> <section class="element element-data"> <h3 class="data-title">Principal diagnosis:</h3> <div class="row"> <div class="large-5 column end"> <?php $form->widget('application.widgets.DiagnosisSelection', array('field' => 'disorder_id', 'options' => CommonOphthalmicDisorder::getList(Firm::model()->findByPk($this->selectedFirmId)), 'code' => 130, 'layout' => 'episodeSummary')); ?> </div> </div> </section> <?php if (!empty($_POST)) { $eye_id = @$_POST['eye_id']; } else { $eye_id = $episode->eye_id; } ?> <section class="element element-data"> <fieldset> <legend class="data-title">Principal eye:</legend>