Tuesday, September 30, 2014

Call function at CGridView in yii

 array(
                'header'=>'client',
                'type'=>'raw',
                'value'=>'$data->getClientinformation($data->client_id)',
  'filter'=>$model->getClientinfilter(),
            ),
public function getClientinformation($client_id){
 $user = Yii::app()->db2->createCommand()
    ->select('name')
    ->from('client')
    ->where('id=:id', array(':id'=>$client_id))
 ->queryAll();
 return $user[0]['name'];

  }


public function getClientinfilter(){
   
 // return 'jibon';
  
  $command = Yii::app()->db2->createCommand();
  $userArray = $command->select('id, name')->from('client')->order('name')->queryAll();
  return CHtml::dropdownlist('GalleryBooking[client_id]','',CHtml::listData($userArray,'id','name'), array('empty' => ''));

  
  }



No comments:

Post a Comment