I am creating hospital System..
Here when admitted patient's discharge date is null, then only i want to make visible DISCHARGE button in Cgrid view CColumn Button.
discharge date is going into indoor model.
PatientController Code:
public function actionAdmin()
{
$model=new Patient('search');
$discharge_date=Indoor::model()->find(array('condition'=>'patient_id=:id','params'=>array(':id'=>????????????)));
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Patient']))
$model->attributes=$_GET['Patient'];
$this->render('admin',array(
'model'=>$model,
'discharge_date'=>$discharge_date->discharge_date,
));
}
patient/admin:
array(
'class'=>'CButtonColumn',
'template'=>'{update} {view} {collection} {discharge}',
'buttons'=>array
(
'collection' => array
(
'label'=>'Collection',
'url'=>'Yii::app()->createUrl("invoice/index", array("id"=>$data->id))',
'options'=>array('class'=>'btn btn-success btn-mini'),
),
'discharge' => array
(
'label'=>'Discharge',
'url'=>'Yii::app()->createUrl("invoice/index", array("id"=>$data->id))',
'options'=>array('class'=>'btn btn-info btn-mini'),
'visible'=>'is_null($discharge_date)?true:false;'
),
),
please tell should i use for loop to get each patient's id in controller?? now i have written '?????????' for it..
n what is error in visible code???
thanks in advance..
删除单引号,然后它将正常工作...尝试这个
'visible'=> is_null($discharge_date)?true:false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.