model() 공개 정적인 메소드

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the
리턴 the static model class
예제 #1
0
				<label for="">Firm:</label>
			</div>
			<div class="large-5 column end">
				<?php 
echo CHtml::dropDownList('inline_firm_id', '', Firm::model()->getListWithSpecialties(), array('empty' => '- Don\'t change -'));
?>
				<span class="error"></span>
			</div>
		</div>
		<div class="row field-row">
			<div class="large-2 column">
				<label for="">Theatre:</label>
			</div>
			<div class="large-5 column end">
				<?php 
echo CHtml::dropDownList('inline_theatre_id', '', CHtml::listData(OphTrOperationbooking_Operation_Theatre::model()->active()->findAll(), 'id', 'name'), array('empty' => '- Don\'t change -'));
?>
				<span class="error"></span>
			</div>
		</div>
		<div class="row field-row">
			<div class="large-2 column">
				<label for="">Start date:</label>
			</div>
			<div class="large-2 column end">
				<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'inline_start_date', 'id' => 'inline_start_date', 'options' => array('showAnim' => 'fold', 'dateFormat' => Helper::NHS_DATE_FORMAT_JS), 'value' => ''));
?>
				<span class="error"></span>
			</div>
		</div>
 * @copyright Copyright (c) 2011-2013, OpenEyes Foundation
 * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
 */
?>
<div class="element-fields">
	<div class="row">
		<div class="large-6 column">
	<?php 
echo $form->dropDownList($element, 'site_id', CHtml::listData(Site::model()->findAll(array('condition' => "active=1 and short_name !=''", 'order' => 'short_name')), 'id', 'short_name'), array('empty' => '- None -'), false);
?>
		</div>
		<div class="large-6 column">
	<?php 
if (array_key_exists('OphTrOperationbooking', Yii::app()->modules) && in_array('ophtroperationbooking_operation_theatre', Yii::app()->db->getSchema()->getTableNames())) {
    $siteId = $element->site_id ? $element->site_id : Yii::app()->session['selected_site_id'];
    echo $form->dropDownList($element, 'theatre_id', CHtml::listData(OphTrOperationbooking_Operation_Theatre::model()->findAll(array('condition' => 'active=1 and site_id=' . $siteId, 'order' => 'name')), 'id', 'name'), array('empty' => '- None -'), false);
}
?>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$('#Element_OphTrOperationnote_SiteTheatre_site_id').change(function(){
			$.ajax({
				type: 'GET',
				url: '/OphTrOperationnote/Default/getTheatreOptions',
				data: {
						siteId: $(this).val()
					},
				success: function( result ){
예제 #3
0
	<form id="theatres">
		<table class="grid">
			<thead>
			<tr>
				<th><input type="checkbox" id="checkall" class="theatres" /></th>
				<th>Site</th>
				<th>Name</th>
				<th>Code</th>
				<th>Ward</th>
			</tr>
			</thead>
			<tbody>
			<?php 
$criteria = new CDbCriteria();
$criteria->order = 'display_order asc';
foreach (OphTrOperationbooking_Operation_Theatre::model()->active()->findAll() as $i => $theatre) {
    ?>
				<tr class="clickable sortable" data-attr-id="<?php 
    echo $theatre->id;
    ?>
" data-uri="OphTrOperationbooking/admin/editTheatre/<?php 
    echo $theatre->id;
    ?>
">
					<td><input type="checkbox" name="theatre[]" value="<?php 
    echo $theatre->id;
    ?>
" class="theatres" /></td>
					<td><?php 
    echo $theatre->site->name;
    ?>
예제 #4
0
 /**
  * Helper method to fetch theatres by site ID.
  *
  * @param int $site_id
  *
  * @return array
  */
 protected function getFilteredTheatres($site_id)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('site_id = :site_id');
     $criteria->params[':site_id'] = $site_id;
     $criteria->order = 'display_order';
     return CHtml::listData(OphTrOperationbooking_Operation_Theatre::model()->active()->findAll($criteria), 'id', 'name');
 }
예제 #5
0
<div class="box admin">
	<h2><?php 
echo $sequence->id ? 'Edit' : 'Add';
?>
 sequence</h2>
	<?php 
$form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'adminform', 'enableAjaxValidation' => false, 'focus' => '#username', 'layoutColumns' => array('label' => 2, 'field' => 5)));
?>
	<?php 
echo $form->errorSummary($sequence);
?>
	<?php 
echo $form->dropDownList($sequence, 'firm_id', Firm::model()->getListWithSpecialties(), array('empty' => '- Emergency -'));
?>
	<?php 
echo $form->dropDownList($sequence, 'theatre_id', CHtml::listData(OphTrOperationbooking_Operation_Theatre::model()->activeOrPk($sequence->theatre_id)->findAll(array('order' => 'name')), 'id', 'nameWithSite'), array('empty' => '- None -'));
?>
	<?php 
echo $form->datePicker($sequence, 'start_date', array(), array('null' => true), array('field' => 2));
?>
	<?php 
echo $form->datePicker($sequence, 'end_date', array(), array('null' => true), array('field' => 2));
?>
	<?php 
echo $form->dropDownList($sequence, 'weekday', array(1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', 7 => 'Sunday'), array('empty' => '- Weekday -'));
?>
	<?php 
echo $form->textField($sequence, 'start_time', array('class' => 'time-picker'), array(), array('field' => 2));
?>
	<?php 
echo $form->textField($sequence, 'end_time', array('class' => 'time-picker'), array(), array('field' => 2));
예제 #6
0
 public function actionGetTheatreOptions()
 {
     $siteId = $this->request->getParam('siteId');
     if ($siteId > 0) {
         $optionValues = OphTrOperationbooking_Operation_Theatre::model()->findAll(array('condition' => 'active=1 and site_id=' . $siteId, 'order' => 'name'));
         //var_dump($optionValues);
         echo CHtml::dropDownList('theatre_id', false, CHtml::listData($optionValues, 'id', 'name'), array('empty' => '-- Please select --'));
     }
 }
예제 #7
0
 public function actionDeleteTheatres()
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $_POST['theatre']);
     $theatres = OphTrOperationbooking_Operation_Theatre::model()->findAll($criteria);
     foreach ($theatres as $theatre) {
         $theatre->active = false;
         if (!$theatre->save()) {
             throw new Exception('Unable to mark theatre deleted: ' . print_r($theatre->getErrors(), true));
         }
         Audit::add('admin', 'delete', $_POST['theatre'], null, array('module' => 'OphTrOperationbooking', 'model' => 'OphTrOperationbooking_Operation_Theatre'));
     }
     echo '1';
 }
 public function getTheatres($date, $firm_id = false)
 {
     if (empty($date)) {
         throw new Exception('Date is required.');
     }
     $criteria = new CDbCriteria();
     if (empty($firm_id) || $firm_id == 'EMG') {
         $criteria->addCondition('sessions.firm_id is null');
     } else {
         $criteria->addCondition('sessions.firm_id = :firmId');
         $criteria->params[':firmId'] = $firm_id;
     }
     $criteria->addCondition('sessions.date = :date');
     $criteria->params[':date'] = $date;
     $criteria->order = 'sessions.start_time';
     return OphTrOperationbooking_Operation_Theatre::model()->with('sessions')->active()->findAll($criteria);
 }