The followings are the available columns in table:
Inheritance: extends BaseTree
 public function actionAddLetterContactRule()
 {
     $rule = new OphTrOperationbooking_Letter_Contact_Rule();
     $errors = array();
     if (!empty($_POST)) {
         $rule->attributes = $_POST['OphTrOperationbooking_Letter_Contact_Rule'];
         if (!$rule->save()) {
             $errors = $rule->getErrors();
         } else {
             Audit::add('admin', 'create', $rule->id, null, array('module' => 'OphTrOperationbooking', 'model' => 'OphTrOperationbooking_Letter_Contact_Rule'));
             $this->redirect(array('/OphTrOperationbooking/admin/viewLetterContactRules'));
         }
     } else {
         if (isset($_GET['parent_rule_id'])) {
             $rule->parent_rule_id = $_GET['parent_rule_id'];
         }
     }
     $this->jsVars['OE_rule_model'] = 'LetterContactRule';
     $this->render('editlettercontactrule', 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;
 }