<?php
Yii::import('system.gii.CCodeGenerator');

class ControllerGenerator extends CCodeGenerator
{
	public $codeModel='modules.platform.gii.controller.iControllerCode';

    public function init()
    {
        parent::init();
        //$this->setViewPath(Yii::getPathOfAlias('gii.generators.controller.views'));
    }

    public function actionIndex()
	{
		$model = $this->prepare();
		if($model->files!=array() && isset($_POST['generate'], $_POST['answers']))
		{
			$model->answers = $_POST['answers'];
			$model->status = $model->save() ? CCodeModel::STATUS_SUCCESS : CCodeModel::STATUS_ERROR;
		}

		$this->render('index',array('model'=>$model));
	}
}