action.php 690 Bytes
Newer Older
Qiang Xue committed
1
<?php
Qiang Xue committed
2 3 4

use yii\helpers\Inflector;

Qiang Xue committed
5
/**
Qiang Xue committed
6 7 8 9
 * This is the template for generating an action view file.
 *
 * @var yii\base\View $this
 * @var yii\gii\generators\form\Generator $generator
Qiang Xue committed
10
 */
11 12

echo "<?php\n";
Qiang Xue committed
13
?>
14

Qiang Xue committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28
public function action<?php echo Inflector::id2camel(trim(basename($generator->viewName), '_')); ?>()
{
	$model = new <?php echo $generator->modelClass; ?><?php echo empty($generator->scenarioName) ? '' : "(array('scenario' => '{$generator->scenarioName}'))"; ?>;

	if ($model->load($_POST)) {
		if($model->validate()) {
			// form inputs are valid, do something here
			return;
		}
	}
	return $this->render('<?php echo $generator->viewName; ?>', array(
		'model' => $model,
	));
}