Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the | ||
리턴 | the | static model class |
public function actionDeleteLetterContactRule($id) { if (!($rule = OphTrOperationbooking_Letter_Contact_Rule::model()->findByPk($id))) { throw new Exception("Letter contact 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_Letter_Contact_Rule')); $this->redirect(array('/OphTrOperationbooking/admin/viewLetterContactRules')); } } } $this->jsVars['OE_rule_model'] = 'LetterContactRule'; $this->render('deletelettercontactrule', array('rule' => $rule, 'errors' => $errors)); }
?> </div> </div> </div> </div> <?php $this->endWidget(); ?> <?php if ($rule->children) { ?> <p><strong><span style="color: #f00;">WARNING:</span> this rule has one or more descendants, if you proceed these will all be deleted.</strong></p> <div class="panel"> <?php $this->widget('CTreeView', array('data' => OphTrOperationbooking_Letter_Contact_Rule::model()->findAllAsTree($rule, true, 'textPlain'))); ?> </div> <?php } ?> <p><strong><big>Are you sure you want to delete this rule<?php if ($rule->children) { ?> and its descendants<?php } ?> ?</big></strong></p> <?php
public function getLetterContact() { $site_id = $this->booking->theatre->site_id; $subspecialty_id = $this->event->episode->firm->serviceSubspecialtyAssignment->subspecialty_id; $theatre_id = $this->booking->session->theatre_id; $firm_id = $this->booking->session->firm_id; $is_child = $this->getPatient()->isChild($this->booking->session->date); $criteria = new CDbCriteria(); $criteria->addCondition('parent_rule_id is null'); $criteria->order = 'rule_order asc'; foreach (OphTrOperationbooking_Letter_Contact_Rule::model()->findAll($criteria) as $rule) { if ($rule->applies($site_id, $subspecialty_id, $theatre_id, $firm_id, $is_child)) { return $rule->parse($site_id, $subspecialty_id, $theatre_id, $firm_id, $is_child); } } return false; }