dropDownList
c dropDownList вроде разобрался
вью
echo CHtml::dropDownList('listname',$mysmen,
array('1' => '1 смена', '2' => '2 смена','3' => '3 смена'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('quality/smen'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#content', //selector to update
'data' => array
(
'smen' => 'js:this.value',
)
//leave out the data key to pass all form values through
)));
контролер
public function actionSmen()
{
$smen = Yii::app()->request->getParam('smen');
$model=new Quality('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Quality']))
$model->attributes=$_GET['Quality'];
$this->renderPartial('admin',array(
'model'=>$model,
));
}
проверяем пост
(isset($_POST['smen'])) ? $mysmen =$_POST['smen']: $mysmen = today_smen($todaysmen);
CJuiDatePicker
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'from_date',
'value' => $date,
'language' => 'ru',
'options' => array(
'showAnim' => 'fold',
'dateFormat' => 'yy-mm-dd',
//'onSelect' => 'js: function(dateText, inst) {window.location.search = "date=" + this.value; return false;}',
'onSelect' => 'js: function(dateText, inst) {' .
CHtml::ajax(array('type' => 'POST', 'datatype' => 'html', 'url' => array('Reports_ajax'),
'data' => array('date' => 'js: dateText'),
'success' => 'function(html){ $("#content").html(html);
return false; }'
)
) .
'}',
),
));
тогда контроллер
public function actionSmen()
{
$smen = Yii::app()->request->getParam('smen');
$smen = Yii::app()->request->getParam('date');
$model=new Quality('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Quality']))
$model->attributes=$_GET['Quality'];
$this->renderPartial('admin',array(
'model'=>$model,
));
}
и проверяем
(isset($_POST['date']) && $_POST['date']) ? $date = $_POST['date'] : $date = date('Y-m-d');