Note that there are some explanatory texts on larger screens.

plurals
  1. POyii extension : how to show the user's role at user grid view?
    text
    copied!<p>Q : How to show the user's role at user grid view?</p> <p>Description : I'm using user and rights extension. I would like to show the user's role at grid view of user/admin. and filter by user's role. How can I?</p> <p>this is my view</p> <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array( 'id'=&gt;'user-grid', 'dataProvider'=&gt;$model-&gt;search(), 'filter'=&gt;$model, 'columns'=&gt;array( array( 'name' =&gt; 'username', 'type'=&gt;'raw', 'value' =&gt; 'CHtml::link(UHtml::markSearch($data,"username"),array("admin/view","id"=&gt;$data-&gt;id))', ), array( 'name'=&gt;'email', 'type'=&gt;'raw', 'value'=&gt;'CHtml::link(UHtml::markSearch($data,"email"), "mailto:".$data-&gt;email)', ), 'create_at', 'lastvisit_at', array( 'name'=&gt;'status', 'value'=&gt;'User::itemAlias("UserStatus",$data-&gt;status)', 'filter' =&gt; User::itemAlias("UserStatus"), ), array( 'class'=&gt;'CButtonColumn', ), ), )); </code></pre> <p>This is my controller</p> <pre><code>public function actionIndex() { $rasdataProvider = new RAssignmentDataProvider(); $dataProvider=new CActiveDataProvider('User', array( 'criteria'=&gt;array( 'condition'=&gt;'status&gt;'.User::STATUS_BANNED, ), 'pagination'=&gt;array( 'pageSize'=&gt;Yii::app()-&gt;controller-&gt;module-&gt;user_page_size, ), )); $this-&gt;render('index',array( 'dataProvider'=&gt;$dataProvider, 'rasdataProvider'=&gt;$rasdataProvider, )); } </code></pre> <p>update #1 </p> <p>this is the relation of user.php</p> <pre><code> public function relations() { $relations = Yii::app()-&gt;getModule('user')-&gt;relations; if (!isset($relations['profile'])) $relations['profile'] = array(self::HAS_ONE, 'Profile', 'user_id'); return $relations; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload