public function actionDeleteLetterWarningRule($id) { if (!($rule = OphTrOperationbooking_Admission_Letter_Warning_Rule::model()->findByPk($id))) { throw new Exception("Letter warning rule not found: {$id}"); } $errors = array(); if (!empty($_POST)) { if (@$_POST['delete']) { if (!$rule->delete()) { $errors = $rule->getErrors(); } else { Audit::add('admin', 'delete', $id, null, array('module' => 'OphTrOperationbooking', 'model' => 'OphTrOperationbooking_Admission_Letter_Warning_Rule')); $this->redirect(array('/OphTrOperationbooking/admin/viewLetterWarningRules')); } } } $this->jsVars['OE_rule_model'] = 'LetterWarningRule'; $this->render('deleteletterwarningrule', array('rule' => $rule, 'errors' => $errors)); }
<div class="row field-row"> <div class="large-<?php echo $form->layoutColumns['label']; ?> column"> <div class="field-label"> Descendants: </div> </div> <div class="large-<?php echo 12 - $form->layoutColumns['label']; ?> column"> <div class="panel" style="margin:0"> <?php $this->widget('CTreeView', array('data' => OphTrOperationbooking_Admission_Letter_Warning_Rule::model()->findAllAsTree($rule, true, 'textPlain'))); ?> </div> </div> </div> <?php } ?> <?php echo $form->errorSummary($rule); ?> <?php echo $form->formActions(array('delete' => $rule->id ? 'Delete' : false)); ?> <?php $this->endWidget();
public function getWarningHTML($type) { $return = ''; $subspecialty_id = $this->session->firm ? $this->session->firm->serviceSubspecialtyAssignment->subspecialty_id : null; if ($rule = OphTrOperationbooking_Admission_Letter_Warning_Rule::getRule($type, $this->session->theatre->site_id, $this->operation->event->episode->patient->isChild($this->session->date), $this->session->theatre_id, $subspecialty_id, $this->session->firm_id)) { if ($rule->strong) { $return .= '<strong>'; } if ($rule->emphasis) { $return .= '<em>'; } $return .= $rule->warning_text; if ($rule->emphasis) { $return .= '</em>'; } if ($rule->strong) { $return .= '</strong>'; } } return $return; }