Hi all,
A link in my menu allows to display a page where is called a cjuitabs widget thanks to an action in a controller A. In each tab I display, through a renderPartial(), a view from controller B, C and D.
Controller A action tabs:
$model=array();
$model['D']=new table_D('search');
$model['D']->unsetAttributes(); // clear any default values
$model['B']=new table_B('search');
$model['B']->unsetAttributes(); // clear any default values
$model['C']=new table_C('search');
$model['C']->unsetAttributes(); // clear any default values
if(isset($_GET['table_D']))
$model['D']->attributes=$_GET['table_D'];
if(isset($_GET['table_C']))
$model['C']->attributes=$_GET['table_C'];
if(isset($_GET['table_B']))
$model['B']->attributes=$_GET['table_B'];
$this->render('action_tabs',array(
'model'=>$model,
));
In order to do that, I created an array with the three new model A, B and C then I use renderPartial using this array… however I don’t think this is the right way to do it.
in action_tabs:
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
Yii::t("strings","view B")=>$this->renderPartial('../B/admin',array('model'=>$model['B']),true),
Yii::t('strings','view C')=>$this->renderPartial('../C/admin',array('model'=>$model['C']),true),
Yii::t('strings','view D')=>$this->renderPartial('../D/admin',array('model'=>$model['D']),true),
),
'options'=>array(
'cookie'=>array('expires'=>'1','path'=>"/"),
),
));
For every tab there is a button which allows to make some specific actions (like $this->createUrl(…)) called from controller B, C or D. However as my cjuitabs widget has been called from controller A, it’s impossible to call actions for C or B or D cause all things referring to “$this” are from controller A.
For example, in each of my tabs, I use a variable which gives the table name of the corresponding controller which is displaying. Here, instead of have for every tabs "table_B", "table_C" or "table_D" I will have in every tabs "table_A"… then I would like to have name of table B in tabs B, table C in tabs C … if you have any idea…
I’m probably not using the good way to do what I want…
(one other question, do you think it’s possible do call a cjuidialog box from a tab ?)
thanks