The followings are the available columns in table 'anaesthetic_agent':
Inheritance: extends BaseActiveRecordVersioned
	</div>
	<form id="admin_anaesthetic_agent">
		<input type="hidden" name="YII_CSRF_TOKEN" value="<?php 
echo Yii::app()->request->csrfToken;
?>
" />
		<table class="grid">
			<thead>
			<tr>
				<th>Agent Name</th>
				<th>Action</th>
			</tr>
			</thead>
			<tbody>
			<?php 
foreach (AnaestheticAgent::model()->findAll(array('order' => 'display_order asc')) as $i => $anaestheticAgent) {
    ?>
				<tr>
					<td><?php 
    echo $anaestheticAgent->name;
    ?>
</td>
					<td>
						<a href="/admin/editAnaestheticAgent/<?php 
    echo $anaestheticAgent->id;
    ?>
">Edit</a>
						&nbsp;|&nbsp;
						<a href="/admin/deleteAnaestheticAgent/<?php 
    echo $anaestheticAgent->id;
    ?>
Esempio n. 2
0
 /**
  * @covers AnaestheticAgent::model
  */
 public function testModel()
 {
     $this->assertEquals('AnaestheticAgent', get_class(AnaestheticAgent::model()), 'Class name should match model.');
 }
 public function actionSearch()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $criteria = new CDbCriteria();
         if (isset($_GET['term'])) {
             $term = $_GET['term'];
             $criteria->addCondition(array('LOWER(name) LIKE :term'), 'OR');
             $params[':term'] = '%' . strtolower(strtr($term, array('%' => '\\%'))) . '%';
         }
         $criteria->order = 'name';
         $criteria->select = 'id, name';
         $criteria->params = $params;
         $results = AnaestheticAgent::model()->active()->findAll($criteria);
         $return = array();
         foreach ($results as $resultRow) {
             $return[] = array('label' => $resultRow->name, 'value' => $resultRow->name, 'id' => $resultRow->id);
         }
         echo CJSON::encode($return);
     }
 }
 public function getName()
 {
     return AnaestheticAgent::model()->findByPk($this->anaesthetic_agent_id)->name;
 }
Esempio n. 5
0
 /**
  * Retrieve AnaestheticAgent instances relevant to the current site and subspecialty. The relation flag indicates
  * whether we are retrieve the full list of defaults.
  *
  * @param string $relation
  *
  * @return array
  */
 protected function getAnaestheticAgentsBySiteAndSubspecialty($relation = 'siteSubspecialtyAssignments')
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('site_id = :siteId and subspecialty_id = :subspecialtyId');
     $criteria->params[':siteId'] = Yii::app()->session['selected_site_id'];
     $criteria->params[':subspecialtyId'] = $this->firm->getSubspecialtyID();
     $criteria->order = 'name';
     return AnaestheticAgent::model()->active()->with(array($relation => array('joinType' => 'JOIN')))->findAll($criteria);
 }
 public function actionDeleteAnaestheticAgent($id)
 {
     $agent = AnaestheticAgent::model()->findByPk($id);
     if (!$agent) {
         throw new CHttpException(404, 'Anaesthetic Agent not found: ' . $id);
     }
     if (Yii::app()->request->isPostRequest) {
         $agent->active = 0;
         if (!$agent->save()) {
             throw new CHttpException(500, 'Unable to delete Anaesthetic Agent: ' . $agent->name);
         }
         Audit::add('admin', 'delete', $id, null, array('model' => 'AnaestheticAgent'));
         $this->redirect('/admin/viewAnaestheticAgent');
     }
     Audit::add('admin', 'view', $id, null, array('model' => 'AnaestheticAgent'));
     $this->render('/admin/deleteanaestheticagent', array('agent' => $agent));
 }