# Modifikasi ActionView di Controller tersebut
public function actionView($id)
{
$ortu=$this->newOrtu($id);
$pendidikan=$this->newPendidikan($id);
//add other tab;
$this->render(‘view’,array(
‘model’=>$this->loadModel($id),
‘modelOrtu’=>$ortu,
‘modelPendidikan’=>$pendidikan,
//pass all tab parameter to the View;
));
}
public function newOrtu($id)
{
$model=new AMahasiswaOrtu;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST[‘AMahasiswaOrtu’]))
{
$model->attributes=$_POST[‘AMahasiswaOrtu’];
$model->parent_id=$id; //Save the subModule Parent ID = Module ID
if($model->save())
$this->refresh();
}
return $model;
}
//public function newPendidikan($id)
//{
// …….
//DO the same with another subtab model
#2. Add this into View
widget(‘zii.widgets.jui.CJuiTabs’, array(
‘tabs’ => array(
‘Detail’ =>$this->renderPartial(“_tabDetail”, array(“model”=>$model), true), //Standard View generated by Gii
‘Orang Tua’ =>$this->renderPartial(“_tabOrangTua”, array(“model”=>$model,”modelOrtu”=>$modelOrtu), true),
‘Pendidikan’ =>$this->renderPartial(“_tabPendidikan”, array(“model”=>$model,”modelPendidikan”=>$modelPendidikan), true),
//as much as your tab … add here
),
‘options’ => array(
‘collapsible’ => true,
),
));
?>
#3. create _tabDetail.php on the same folder with view.php and move all detail
widget(‘zii.widgets.CDetailView’, array(
‘data’=>$model,
‘attributes’=>array(
‘nim’,
‘nama’,
……
//and so on
#4. create _tabOrangTua.php and create CGridView in it
widget(‘zii.widgets.grid.CGridView’, array(
‘id’=>’amahasiswa-ortu-grid’,
‘dataProvider’=>AMahasiswaOrtu::model()->search($model->id), //Call DataProvider from SubTab Model. Must Modification the class on that model…
//’filter’=>$model, //must be disabled
‘columns’=>array(
array(
‘class’=>’CButtonColumn’,
‘template’=>'{update}{delete}’,
‘updateButtonUrl’=>’Yii::app()->createUrl(“aMahasiswa/updateOrtu”,array(“id”=>$data->id,”parent_id”=>$data->parent_id))’,
‘deleteButtonUrl’=>’Yii::app()->createUrl(“aMahasiswa/deleteOrtu”,array(“id”=>$data->id))’,
),
‘nm_ayah’,
……
//all field
#4a. Remember simple modification on Ortu Model. see this
public function search($id) //Add $id as parameter
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare(‘parent_id’,$id); //filter it here
return new CActiveDataProvider(get_class($this), array(
‘criteria’=>$criteria,
));
}
}
#5. create the same view for another subTab. Pendidikan, Pengalaman, History, Riwayat, dsb…