Skip to content

Instantly share code, notes, and snippets.

@muya
muya / yiiCGridView.php
Last active December 17, 2015 18:48
Example of a Yii CGridView Widget used in the StudentPortal Project
/**
* CGridView widget
*/
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'users-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'userID',
'firstName',
@muya
muya / yii-actionAdmin.php
Last active December 17, 2015 18:40
Snippet for Yii's actionAdmin function in the Controller class
/**
* UsersController actionAdmin function
*/
public function actionAdmin() {
$model = new Users('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['Users']))
$model->attributes = $_GET['Users'];
$this->render('admin', array(