zii-widgets

How to put default value in CJuidatepicker in Yii?

扶醉桌前 提交于 2020-01-16 01:16:09
问题 I have the code below to display a calendar input in Yii form. <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array( 'name' => 'publish_date', 'attribute' => 'publish_date', 'model'=>$model, 'options'=> array( 'dateFormat' =>'yy-mm-dd', 'defaultDate' => '2014-3-4', 'altFormat' =>'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'appendText' => 'yyyy-mm-dd', ), )); ?> The default value work on the calendar but I want to show it by default in the calendar input too when the form

Retreving specific row from database in yii

岁酱吖の 提交于 2019-12-24 21:27:55
问题 I am working on a job site,And want to show only the jobs posted by a particular user in cgridview.My actuall aim is to authenticate the user so that only jobs posted by him/her will be visible in cgridview.I have done the following stuff,but not working. In controller: public function actionViewJob() { $user_id = Yii::app()->session['user_id']; /* For User Authentication */ if (Yii::app()->user->getId() === null) $this->redirect(array('site/login')); /* For User Authentication */ /* Have

What is wrong with the statement,in Yii?

大兔子大兔子 提交于 2019-12-11 06:58:52
问题 I have a folowing code in my controller , public function actionViewJob() { $user_id = Yii::app()->session['user_id']; /* For User Authentication */ if (Yii::app()->user->getId() === null) $this->redirect(array('site/login')); /* For User Authentication */ $model=ViewJob::model()->findAll(array('user_id'=>Yii::app()->user->id)); $params = array('model' => $model, ); $this->render('viewjob', $params); I am getting error /* Property "CDbCriteria.user_id" is not defined. */ but when I am using

Yii CGrid pagination and sorting with CArrayDataProvider doesnt work

不打扰是莪最后的温柔 提交于 2019-12-09 13:01:48
问题 I built a custom function in my model and return the raw data: function(){ ... $connection=Yii::app()->db; $command=$connection->createCommand($sql); $rows=$command->queryAll(); return $rows; } $campModel = $model->function.. I then use those rows in CArrayDataProvider: $dataProvider=new CArrayDataProvider($campModel); Finally i'm trying to view using CGrid: $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'bo-campaigns-grid', 'dataProvider'=>$campModel,... I'm guessing this has to do