jquery - Display CJUI tabs based on condition in Yii -


iam using cjui tabs tab display. implement condition based display of tabs based on user logged in. have 2 user admin , customer. if customer logged in need hide tab. since customer has no permission acess data.iam creating tabs using method :-

  $usertype = yii::app()->user->getstate('usertype'); // user type     if ($usertype == 'customer') {     // hide $tab4     } else {     // show $tab4     }   $this->widget('zii.widgets.jui.ctab', array(         'tabs' => array(             'summary' => $this->renderpartial('summary', null, true),             'portfolio' => $this->renderpartial('portfolio', null, true),             'contact' => $this->renderpartial('contact', null, true),             $tab4 => $this->renderpartial('team', null, true),         ), 

how can show/hide tab4 based on condition ?

only add tabs want display in array

$usertype = yii::app()->user->getstate('usertype'); // user type  $tablist = array(); // tab list show $tablist['summary']   = $this->renderpartial('summary', null, true); $tablist['portfolio'] = $this->renderpartial('portfolio', null, true); $tablist['contact']   = $this->renderpartial('contact', null, true); $tablist['summary']   = $this->renderpartial('summary', null, true);  if ($usertype == 'admin') { // 'admin' show tab 'team'     $tablist['team'] = $this->renderpartial('team', null, true); }  $this->widget('zii.widgets.jui.ctab', array(                'tabs' => $tablist, ), 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -