/** * Init the edit admin page, because we have a custom save URL, so we need to use * Admin in more then 1 function. * * @param bool $id * * @return Admin */ protected function initAdmin($id = false) { $admin = new Admin(DrugSet::model(), $this); if ($id) { $admin->setModelId($id); } $element = Element_OphDrPrescription_Details::model(); $admin->setCustomSaveURL('/OphDrPrescription/DrugSetAdmin/SaveDrugSet'); $admin->setCustomCancelURL('/OphDrPrescription/DrugSetAdmin/DrugSets'); $admin->setEditFields(array('active' => 'checkbox', 'name' => 'text', 'subspecialty' => array('widget' => 'DropDownList', 'options' => CHtml::listData(Subspecialty::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'setItems' => array('widget' => 'CustomView', 'viewName' => '/default/form_Element_OphDrPrescription_Details', 'viewArguments' => array('element' => $element)))); return $admin; }
public function actionGetDrugs() { $commonDrugs = array(); $drugs = Element_OphDrPrescription_Details::model()->commonDrugs(); if ($drugs) { foreach ($drugs as $drug) { $commonDrugs[] = array('id' => $drug->id, 'label' => $drug->name); } } echo CJSON::encode($commonDrugs); Yii::app()->end(); }
/** * @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))); }
public function canUpdate($event_id) { $details = Element_OphDrPrescription_Details::model()->find('event_id=?', array($event_id)); return $details->isEditable(); }
$this->event_actions[] = EventAction::button('Print', 'print', null, array('id' => 'et_print', 'class' => 'button small')); } ?> <?php $this->renderPartial('//base/_messages'); ?> <?php if ($this->event->delete_pending) { ?> <div class="alert-box alert with-icon"> This event is pending deletion and has been locked. </div> <?php } elseif (Element_OphDrPrescription_Details::model()->find('event_id=?', array($this->event->id))->draft) { ?> <div class="alert-box alert with-icon"> This prescription is a draft and can still be edited </div> <?php } ?> <?php $this->renderOpenElements($this->action->id); ?> <?php $this->renderOptionalElements($this->action->id); ?>
* This file is part of OpenEyes. * OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * 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/>. * * @link http://www.openeyes.org.uk * * @author OpenEyes <*****@*****.**> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2015, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ ?> <?php $element = Element_OphDrPrescription_Details::model(); $form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'prescription-create', 'action' => '/OphDrPrescription/PrescriptionCommon/SaveDrugSetAdmin', 'enableAjaxValidation' => false)); ?> <div class="box admin"> <h2>Edit Drug Sets</h2> <?php if (Yii::app()->user->hasFlash('info.save_message')) { ?> <div class="alert-box with-icon warning"> <?php echo Yii::app()->user->getFlash('info.save_message'); ?> </div> <?php }
/** * Mark a prescription element as printed - called when printing a prescription that has already * been printed. * * @TODO: is this necessary if the print action is already marking the prescription printed? * * @throws Exception */ public function actionMarkPrinted() { $event_id = Yii::app()->request->getParam('event_id'); if (!$event_id) { throw new Exception('Prescription id not provided'); } if (!($prescription = Element_OphDrPrescription_Details::model()->find('event_id=?', array($event_id)))) { throw new Exception('Prescription not found for event id: ' . $event_id); } if ($prescription->print == 1) { $prescription->print = 0; if (!$prescription->save()) { throw new Exception('Unable to save prescription: ' . print_r($prescription->getErrors(), true)); } } $this->printInit($event_id); $this->printLog($event_id, false); echo '1'; }