model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : CommissioningBodyType
return CommissioningBodyType the static model class
 /**
  * Lists local authorities from Commissioning Body Service
  *
  * @throws CHttpException
  */
 public function actionList()
 {
     \Audit::add('admin-CommissioningBodyService', 'list');
     if (!($commissioning_bt = \CommissioningBodyType::model()->findByAttributes(array('shortname' => 'LA')))) {
         throw new \CHttpException(500, 'Local Authority Commissioning Body Type is not configured.');
     }
     $service_type = \CommissioningBodyServiceType::model()->findByAttributes(array('shortname' => 'SSD'));
     $data['title'] = 'CVI Social Services Depts.';
     $data['commissioning_bt'] = $commissioning_bt;
     $data['service_type'] = $service_type;
     $data['return_url'] = '/OphCoCvi/localAuthoritiesAdmin/list';
     $data['base_data_url'] = 'OphCoCvi/localAuthoritiesAdmin/';
     $this->render('//admin/commissioning_body_services', $data);
 }
Exemplo n.º 2
0
 public function actionDeleteCommissioningBodyServiceTypes()
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', @$_POST['commissioning_body_service_type']);
     if (!($er = CommissioningBodyServiceType::model()->deleteAll($criteria))) {
         throw new Exception("Unable to delete CommissioningBodyServiceTypes: " . print_r($er->getErrors(), true));
     }
     Audit::add('admin-CommissioningBodyServiceType', 'delete');
     echo "1";
 }
 */
?>
<div class="box admin">
	<h2>Commissioning body service types</h2>
	<form id="admin_commissioning_body_service_types">
		<table class="grid">
			<thead>
				<tr>
					<th><input type="checkbox" id="checkall" class="commissioning_body_service_type" /></th>
					<th>Code</th>
					<th>Name</th>
				</tr>
			</thead>
			<tbody>
				<?php 
foreach (CommissioningBodyServiceType::model()->findAll(array('order' => 'name asc')) as $i => $cb) {
    ?>
					<tr class="clickable" data-id="<?php 
    echo $cb->id;
    ?>
" data-uri="admin/editCommissioningBodyServiceType?commissioning_body_service_type_id=<?php 
    echo $cb->id;
    ?>
">
						<td><input type="checkbox" name="commissioning_body_service_type[]" value="<?php 
    echo $cb->id;
    ?>
" class="wards" /></td>
						<td><?php 
    echo $cb->shortname;
    ?>