public function getTextOperationName() { if ($rule = OphTrOperationbooking_Operation_Name_Rule::model()->find('theatre_id=?', array($this->booking->session->theatre_id))) { return $this->getPatient()->childPrefix . $rule->name; } if ($rule = OphTrOperationbooking_Operation_Name_Rule::model()->find('theatre_id is null')) { return $this->getPatient()->childPrefix . $rule->name; } return $this->getPatient()->childPrefix . 'operation'; }
public function actionDeleteOperationNameRules() { if (!empty($_POST['operation_name'])) { foreach ($_POST['operation_name'] as $rule_id) { if ($_rule = OphTrOperationbooking_Operation_Name_Rule::model()->findByPk($rule_id)) { if (!$_rule->delete()) { throw new Exception('Unable to delete rule rule: ' . print_r($_rule->getErrors(), true)); } } } Audit::add('admin', 'delete', null, null, array('module' => 'OphTrOperationbooking', 'model' => 'OphTrOperationbooking_Operation_Name_Rule')); } echo '1'; }
<div class="box admin"> <h2>Operation name rules</h2> <form id="operation_name_rules"> <table class="grid"> <thead> <tr> <th><input type="checkbox" id="checkall" class="operation_name_rules" /></th> <th>Theatre</th> <th>Operation name</th> </tr> </thead> <tbody> <?php $criteria = new CDbCriteria(); $criteria->order = 'display_order asc'; foreach (OphTrOperationbooking_Operation_Name_Rule::model()->findAll() as $i => $rule) { ?> <tr class="clickable sortable" data-attr-id="<?php echo $rule->id; ?> ?>" data-uri="OphTrOperationbooking/admin/editoperationnamerule/<?php echo $rule->id; ?> "> <td><input type="checkbox" name="operation_name[]" value="<?php echo $rule->id; ?> " class="operation_name_rules" /></td> <td><?php echo $rule->theatre->name; ?>