summaryrefslogtreecommitdiff
path: root/framework/cli/views/shell
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2012-04-13 23:11:05 +0200
committerPatrick Seeger <pseeger@ccwn.org>2012-04-13 23:11:05 +0200
commit341cc4dd9c53ffbfb863e026dd58549c1082c7a7 (patch)
tree1bbbed20313bafb9b063b6b4d894fe580d8b000f /framework/cli/views/shell
yii-framework 1.1.10 hinzugefügtHEADmaster
Diffstat (limited to 'framework/cli/views/shell')
-rw-r--r--framework/cli/views/shell/controller/controller.php47
-rw-r--r--framework/cli/views/shell/controller/view.php26
-rw-r--r--framework/cli/views/shell/crud/_form.php42
-rw-r--r--framework/cli/views/shell/crud/_search.php35
-rw-r--r--framework/cli/views/shell/crud/_view.php29
-rw-r--r--framework/cli/views/shell/crud/admin.php73
-rw-r--r--framework/cli/views/shell/crud/controller.php190
-rw-r--r--framework/cli/views/shell/crud/create.php27
-rw-r--r--framework/cli/views/shell/crud/index.php31
-rw-r--r--framework/cli/views/shell/crud/test.php47
-rw-r--r--framework/cli/views/shell/crud/update.php31
-rw-r--r--framework/cli/views/shell/crud/view.php39
-rw-r--r--framework/cli/views/shell/form/action.php37
-rw-r--r--framework/cli/views/shell/form/form.php39
-rw-r--r--framework/cli/views/shell/model/fixture.php25
-rw-r--r--framework/cli/views/shell/model/model.php113
-rw-r--r--framework/cli/views/shell/model/test.php21
-rw-r--r--framework/cli/views/shell/module/components/.yii0
-rw-r--r--framework/cli/views/shell/module/controllers/DefaultController.php9
-rw-r--r--framework/cli/views/shell/module/messages/.yii0
-rw-r--r--framework/cli/views/shell/module/models/.yii0
-rw-r--r--framework/cli/views/shell/module/module.php28
-rw-r--r--framework/cli/views/shell/module/views/default/index.php14
-rw-r--r--framework/cli/views/shell/module/views/layouts/.yii0
24 files changed, 903 insertions, 0 deletions
diff --git a/framework/cli/views/shell/controller/controller.php b/framework/cli/views/shell/controller/controller.php
new file mode 100644
index 0000000..295fc5f
--- /dev/null
+++ b/framework/cli/views/shell/controller/controller.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * This is the template for generating a controller class file.
+ * The following variables are available in this template:
+ * - $className: the class name of the controller
+ * - $actions: a list of action names for the controller
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+class <?php echo $className; ?> extends Controller
+{
+<?php foreach($actions as $action): ?>
+ public function action<?php echo ucfirst($action); ?>()
+ {
+ $this->render('<?php echo $action; ?>');
+ }
+
+<?php endforeach; ?>
+ // -----------------------------------------------------------
+ // Uncomment the following methods and override them if needed
+ /*
+ public function filters()
+ {
+ // return the filter configuration for this controller, e.g.:
+ return array(
+ 'inlineFilterName',
+ array(
+ 'class'=>'path.to.FilterClass',
+ 'propertyName'=>'propertyValue',
+ ),
+ );
+ }
+
+ public function actions()
+ {
+ // return external action classes, e.g.:
+ return array(
+ 'action1'=>'path.to.ActionClass',
+ 'action2'=>array(
+ 'class'=>'path.to.AnotherActionClass',
+ 'propertyName'=>'propertyValue',
+ ),
+ );
+ }
+ */
+} \ No newline at end of file
diff --git a/framework/cli/views/shell/controller/view.php b/framework/cli/views/shell/controller/view.php
new file mode 100644
index 0000000..0bcc212
--- /dev/null
+++ b/framework/cli/views/shell/controller/view.php
@@ -0,0 +1,26 @@
+<?php
+echo "<?php\n";
+$controller=substr($controller,0,strlen($controller)-10);
+$label=ucwords(trim(strtolower(str_replace(array('-','_','.'),' ',preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $controller)))));
+
+if($action==='index')
+{
+ echo "\$this->breadcrumbs=array(
+ '$label',
+);";
+}
+else
+{
+ $route=$controller.'/index';
+ $route[0]=strtolower($route[0]);
+ $action=ucfirst($action);
+ echo "\$this->breadcrumbs=array(
+ '$label'=>array('$route'),
+ '$action',
+);";
+}
+?>
+?>
+<h1><?php echo '<?php'; ?> echo $this->id . '/' . $this->action->id; ?></h1>
+
+<p>You may change the content of this page by modifying the file <tt><?php echo '<?php'; ?> echo __FILE__; ?></tt>.</p>
diff --git a/framework/cli/views/shell/crud/_form.php b/framework/cli/views/shell/crud/_form.php
new file mode 100644
index 0000000..e0de820
--- /dev/null
+++ b/framework/cli/views/shell/crud/_form.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * This is the template for generating the form view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<div class="form">
+
+<?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
+ 'id'=>'".$this->class2id($modelClass)."-form',
+ 'enableAjaxValidation'=>false,
+)); ?>\n"; ?>
+
+ <p class="note">Fields with <span class="required">*</span> are required.</p>
+
+ <?php echo "<?php echo \$form->errorSummary(\$model); ?>\n"; ?>
+
+<?php
+foreach($columns as $column)
+{
+ if($column->isPrimaryKey)
+ continue;
+?>
+ <div class="row">
+ <?php echo "<?php echo ".$this->generateActiveLabel($modelClass,$column)."; ?>\n"; ?>
+ <?php echo "<?php echo ".$this->generateActiveField($modelClass,$column)."; ?>\n"; ?>
+ <?php echo "<?php echo \$form->error(\$model,'{$column->name}'); ?>\n"; ?>
+ </div>
+
+<?php
+}
+?>
+ <div class="row buttons">
+ <?php echo "<?php echo CHtml::submitButton(\$model->isNewRecord ? 'Create' : 'Save'); ?>\n"; ?>
+ </div>
+
+<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
+
+</div><!-- form --> \ No newline at end of file
diff --git a/framework/cli/views/shell/crud/_search.php b/framework/cli/views/shell/crud/_search.php
new file mode 100644
index 0000000..fd81c35
--- /dev/null
+++ b/framework/cli/views/shell/crud/_search.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * This is the template for generating the form view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<div class="wide form">
+
+<?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
+ 'action'=>Yii::app()->createUrl(\$this->route),
+ 'method'=>'get',
+)); ?>\n"; ?>
+
+<?php foreach($columns as $column): ?>
+<?php
+ $field=$this->generateInputField($modelClass,$column);
+ if(strpos($field,'password')!==false)
+ continue;
+?>
+ <div class="row">
+ <?php echo "<?php echo \$form->label(\$model,'{$column->name}'); ?>\n"; ?>
+ <?php echo "<?php echo ".$this->generateActiveField($modelClass,$column)."; ?>\n"; ?>
+ </div>
+
+<?php endforeach; ?>
+ <div class="row buttons">
+ <?php echo "<?php echo CHtml::submitButton('Search'); ?>\n"; ?>
+ </div>
+
+<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
+
+</div><!-- search-form --> \ No newline at end of file
diff --git a/framework/cli/views/shell/crud/_view.php b/framework/cli/views/shell/crud/_view.php
new file mode 100644
index 0000000..02f383d
--- /dev/null
+++ b/framework/cli/views/shell/crud/_view.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * This is the template for generating the partial view for rendering a single model.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<div class="view">
+
+<?php
+echo "\t<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$ID}')); ?>:</b>\n";
+echo "\t<?php echo CHtml::link(CHtml::encode(\$data->{$ID}), array('view', 'id'=>\$data->{$ID})); ?>\n\t<br />\n\n";
+$count=0;
+foreach($columns as $column)
+{
+ if($column->isPrimaryKey)
+ continue;
+ if(++$count==7)
+ echo "\t<?php /*\n";
+ echo "\t<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$column->name}')); ?>:</b>\n";
+ echo "\t<?php echo CHtml::encode(\$data->{$column->name}); ?>\n\t<br />\n\n";
+}
+if($count>=7)
+ echo "\t*/ ?>\n";
+?>
+
+</div> \ No newline at end of file
diff --git a/framework/cli/views/shell/crud/admin.php b/framework/cli/views/shell/crud/admin.php
new file mode 100644
index 0000000..ae0bc0f
--- /dev/null
+++ b/framework/cli/views/shell/crud/admin.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * This is the template for generating the admin view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<?php
+echo "<?php\n";
+$label=$this->class2name($modelClass,true);
+echo "\$this->breadcrumbs=array(
+ '$label'=>array('index'),
+ 'Manage',
+);\n";
+?>
+
+$this->menu=array(
+ array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
+ array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
+);
+
+Yii::app()->clientScript->registerScript('search', "
+$('.search-button').click(function(){
+ $('.search-form').toggle();
+ return false;
+});
+$('.search-form form').submit(function(){
+ $.fn.yiiGridView.update('<?php echo $this->class2id($modelClass); ?>-grid', {
+ data: $(this).serialize()
+ });
+ return false;
+});
+");
+?>
+
+<h1>Manage <?php echo $this->class2name($modelClass,true); ?></h1>
+
+<p>
+You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
+or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
+</p>
+
+<?php echo "<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>"; ?>
+
+<div class="search-form" style="display:none">
+<?php echo "<?php \$this->renderPartial('_search',array(
+ 'model'=>\$model,
+)); ?>\n"; ?>
+</div><!-- search-form -->
+
+<?php echo "<?php"; ?> $this->widget('zii.widgets.grid.CGridView', array(
+ 'id'=>'<?php echo $this->class2id($modelClass); ?>-grid',
+ 'dataProvider'=>$model->search(),
+ 'filter'=>$model,
+ 'columns'=>array(
+<?php
+$count=0;
+foreach($columns as $column)
+{
+ if(++$count==7)
+ echo "\t\t/*\n";
+ echo "\t\t'".$column->name."',\n";
+}
+if($count>=7)
+ echo "\t\t*/\n";
+?>
+ array(
+ 'class'=>'CButtonColumn',
+ ),
+ ),
+)); ?>
diff --git a/framework/cli/views/shell/crud/controller.php b/framework/cli/views/shell/crud/controller.php
new file mode 100644
index 0000000..cd7f79f
--- /dev/null
+++ b/framework/cli/views/shell/crud/controller.php
@@ -0,0 +1,190 @@
+<?php
+/**
+ * This is the template for generating the controller class file for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $controllerClass: the controller class name
+ * - $modelClass: the model class name
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+class <?php echo $controllerClass; ?> extends Controller
+{
+ /**
+ * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
+ * using two-column layout. See 'protected/views/layouts/column2.php'.
+ */
+ public $layout='//layouts/column2';
+
+ /**
+ * @var CActiveRecord the currently loaded data model instance.
+ */
+ private $_model;
+
+ /**
+ * @return array action filters
+ */
+ public function filters()
+ {
+ return array(
+ 'accessControl', // perform access control for CRUD operations
+ );
+ }
+
+ /**
+ * Specifies the access control rules.
+ * This method is used by the 'accessControl' filter.
+ * @return array access control rules
+ */
+ public function accessRules()
+ {
+ return array(
+ array('allow', // allow all users to perform 'index' and 'view' actions
+ 'actions'=>array('index','view'),
+ 'users'=>array('*'),
+ ),
+ array('allow', // allow authenticated user to perform 'create' and 'update' actions
+ 'actions'=>array('create','update'),
+ 'users'=>array('@'),
+ ),
+ array('allow', // allow admin user to perform 'admin' and 'delete' actions
+ 'actions'=>array('admin','delete'),
+ 'users'=>array('admin'),
+ ),
+ array('deny', // deny all users
+ 'users'=>array('*'),
+ ),
+ );
+ }
+
+ /**
+ * Displays a particular model.
+ */
+ public function actionView()
+ {
+ $this->render('view',array(
+ 'model'=>$this->loadModel(),
+ ));
+ }
+
+ /**
+ * Creates a new model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ */
+ public function actionCreate()
+ {
+ $model=new <?php echo $modelClass; ?>;
+
+ // Uncomment the following line if AJAX validation is needed
+ // $this->performAjaxValidation($model);
+
+ if(isset($_POST['<?php echo $modelClass; ?>']))
+ {
+ $model->attributes=$_POST['<?php echo $modelClass; ?>'];
+ if($model->save())
+ $this->redirect(array('view','id'=>$model-><?php echo $ID; ?>));
+ }
+
+ $this->render('create',array(
+ 'model'=>$model,
+ ));
+ }
+
+ /**
+ * Updates a particular model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ */
+ public function actionUpdate()
+ {
+ $model=$this->loadModel();
+
+ // Uncomment the following line if AJAX validation is needed
+ // $this->performAjaxValidation($model);
+
+ if(isset($_POST['<?php echo $modelClass; ?>']))
+ {
+ $model->attributes=$_POST['<?php echo $modelClass; ?>'];
+ if($model->save())
+ $this->redirect(array('view','id'=>$model-><?php echo $ID; ?>));
+ }
+
+ $this->render('update',array(
+ 'model'=>$model,
+ ));
+ }
+
+ /**
+ * Deletes a particular model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ */
+ public function actionDelete()
+ {
+ if(Yii::app()->request->isPostRequest)
+ {
+ // we only allow deletion via POST request
+ $this->loadModel()->delete();
+
+ // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
+ if(!isset($_GET['ajax']))
+ $this->redirect(array('index'));
+ }
+ else
+ throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
+ }
+
+ /**
+ * Lists all models.
+ */
+ public function actionIndex()
+ {
+ $dataProvider=new CActiveDataProvider('<?php echo $modelClass; ?>');
+ $this->render('index',array(
+ 'dataProvider'=>$dataProvider,
+ ));
+ }
+
+ /**
+ * Manages all models.
+ */
+ public function actionAdmin()
+ {
+ $model=new <?php echo $modelClass; ?>('search');
+ $model->unsetAttributes(); // clear any default values
+ if(isset($_GET['<?php echo $modelClass; ?>']))
+ $model->attributes=$_GET['<?php echo $modelClass; ?>'];
+
+ $this->render('admin',array(
+ 'model'=>$model,
+ ));
+ }
+
+ /**
+ * Returns the data model based on the primary key given in the GET variable.
+ * If the data model is not found, an HTTP exception will be raised.
+ */
+ public function loadModel()
+ {
+ if($this->_model===null)
+ {
+ if(isset($_GET['id']))
+ $this->_model=<?php echo $modelClass; ?>::model()->findbyPk($_GET['id']);
+ if($this->_model===null)
+ throw new CHttpException(404,'The requested page does not exist.');
+ }
+ return $this->_model;
+ }
+
+ /**
+ * Performs the AJAX validation.
+ * @param CModel the model to be validated
+ */
+ protected function performAjaxValidation($model)
+ {
+ if(isset($_POST['ajax']) && $_POST['ajax']==='<?php echo $this->class2id($modelClass); ?>-form')
+ {
+ echo CActiveForm::validate($model);
+ Yii::app()->end();
+ }
+ }
+}
diff --git a/framework/cli/views/shell/crud/create.php b/framework/cli/views/shell/crud/create.php
new file mode 100644
index 0000000..64e3cac
--- /dev/null
+++ b/framework/cli/views/shell/crud/create.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * This is the template for generating the create view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<?php
+echo "<?php\n";
+$label=$this->class2name($modelClass,true);
+echo "\$this->breadcrumbs=array(
+ '$label'=>array('index'),
+ 'Create',
+);\n";
+?>
+
+$this->menu=array(
+ array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
+ array('label'=>'Manage <?php echo $modelClass; ?>', 'url'=>array('admin')),
+);
+?>
+
+<h1>Create <?php echo $modelClass; ?></h1>
+
+<?php echo "<?php echo \$this->renderPartial('_form', array('model'=>\$model)); ?>"; ?>
diff --git a/framework/cli/views/shell/crud/index.php b/framework/cli/views/shell/crud/index.php
new file mode 100644
index 0000000..658896e
--- /dev/null
+++ b/framework/cli/views/shell/crud/index.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * This is the template for generating the index view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<?php
+echo "<?php\n";
+$label=$this->class2name($modelClass,true);
+$route=$modelClass.'/index';
+$route[0]=strtolower($route[0]);
+echo "\$this->breadcrumbs=array(
+ '$label',
+);\n";
+?>
+
+$this->menu=array(
+ array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
+ array('label'=>'Manage <?php echo $modelClass; ?>', 'url'=>array('admin')),
+);
+?>
+
+<h1><?php echo $label; ?></h1>
+
+<?php echo "<?php"; ?> $this->widget('zii.widgets.CListView', array(
+ 'dataProvider'=>$dataProvider,
+ 'itemView'=>'_view',
+)); ?>
diff --git a/framework/cli/views/shell/crud/test.php b/framework/cli/views/shell/crud/test.php
new file mode 100644
index 0000000..fbb1fd9
--- /dev/null
+++ b/framework/cli/views/shell/crud/test.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * This is the template for generating the functional test for controller.
+ * The following variables are available in this template:
+ * - $controllerID: the controller ID
+ * - $fixtureName: the fixture name
+ * - $modelClass: the model class name
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+class <?php echo $modelClass; ?>Test extends WebTestCase
+{
+ public $fixtures=array(
+ '<?php echo $fixtureName; ?>'=>'<?php echo $modelClass; ?>',
+ );
+
+ public function testShow()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/view&id=1');
+ }
+
+ public function testCreate()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/create');
+ }
+
+ public function testUpdate()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/update&id=1');
+ }
+
+ public function testDelete()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/view&id=1');
+ }
+
+ public function testList()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/index');
+ }
+
+ public function testAdmin()
+ {
+ $this->open('?r=<?php echo $controllerID; ?>/admin');
+ }
+}
diff --git a/framework/cli/views/shell/crud/update.php b/framework/cli/views/shell/crud/update.php
new file mode 100644
index 0000000..88aee25
--- /dev/null
+++ b/framework/cli/views/shell/crud/update.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * This is the template for generating the update view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<?php
+echo "<?php\n";
+$nameColumn=$this->guessNameColumn($columns);
+$label=$this->class2name($modelClass,true);
+echo "\$this->breadcrumbs=array(
+ '$label'=>array('index'),
+ \$model->{$nameColumn}=>array('view','id'=>\$model->{$ID}),
+ 'Update',
+);\n";
+?>
+
+$this->menu=array(
+ array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
+ array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
+ array('label'=>'View <?php echo $modelClass; ?>', 'url'=>array('view', 'id'=>$model-><?php echo $ID; ?>)),
+ array('label'=>'Manage <?php echo $modelClass; ?>', 'url'=>array('admin')),
+);
+?>
+
+<h1>Update <?php echo $modelClass." <?php echo \$model->{$ID}; ?>"; ?></h1>
+
+<?php echo "<?php echo \$this->renderPartial('_form', array('model'=>\$model)); ?>"; ?> \ No newline at end of file
diff --git a/framework/cli/views/shell/crud/view.php b/framework/cli/views/shell/crud/view.php
new file mode 100644
index 0000000..692b328
--- /dev/null
+++ b/framework/cli/views/shell/crud/view.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * This is the template for generating the 'view' view for crud.
+ * The following variables are available in this template:
+ * - $ID: the primary key name
+ * - $modelClass: the model class name
+ * - $columns: a list of column schema objects
+ */
+?>
+<?php
+echo "<?php\n";
+$nameColumn=$this->guessNameColumn($columns);
+$label=$this->class2name($modelClass,true);
+echo "\$this->breadcrumbs=array(
+ '$label'=>array('index'),
+ \$model->{$nameColumn},
+);\n";
+?>
+
+$this->menu=array(
+ array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
+ array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
+ array('label'=>'Update <?php echo $modelClass; ?>', 'url'=>array('update', 'id'=>$model-><?php echo $ID; ?>)),
+ array('label'=>'Delete <?php echo $modelClass; ?>', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model-><?php echo $ID; ?>),'confirm'=>'Are you sure you want to delete this item?')),
+ array('label'=>'Manage <?php echo $modelClass; ?>', 'url'=>array('admin')),
+);
+?>
+
+<h1>View <?php echo $modelClass." #<?php echo \$model->{$ID}; ?>"; ?></h1>
+
+<?php echo "<?php"; ?> $this->widget('zii.widgets.CDetailView', array(
+ 'data'=>$model,
+ 'attributes'=>array(
+<?php
+foreach($columns as $column)
+ echo "\t\t'".$column->name."',\n";
+?>
+ ),
+)); ?>
diff --git a/framework/cli/views/shell/form/action.php b/framework/cli/views/shell/form/action.php
new file mode 100644
index 0000000..367c8ba
--- /dev/null
+++ b/framework/cli/views/shell/form/action.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * This is the template for generating the action script for the form.
+ * The following variables are available in this template:
+ * - $modelClass: the model class name
+ * - $viewName: the name of the view
+ */
+?>
+<?php
+$actionName=$modelClass;
+if(strrpos($modelClass,'Form')===strlen($modelClass)-4)
+ $actionName=substr($modelClass,0,strlen($modelClass)-4);
+?>
+public function action<?php echo $actionName; ?>()
+{
+ $model=new <?php echo $modelClass; ?>;
+
+ // uncomment the following code to enable ajax-based validation
+ /*
+ if(isset($_POST['ajax']) && $_POST['ajax']==='<?php echo $this->class2id($modelClass); ?>-form')
+ {
+ echo CActiveForm::validate($model);
+ Yii::app()->end();
+ }
+ */
+
+ if(isset($_POST['<?php echo $modelClass; ?>']))
+ {
+ $model->attributes=$_POST['<?php echo $modelClass; ?>'];
+ if($model->validate())
+ {
+ // form inputs are valid, do something here
+ return;
+ }
+ }
+ $this->render('<?php echo $viewName; ?>',array('model'=>$model));
+} \ No newline at end of file
diff --git a/framework/cli/views/shell/form/form.php b/framework/cli/views/shell/form/form.php
new file mode 100644
index 0000000..cbf63bb
--- /dev/null
+++ b/framework/cli/views/shell/form/form.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * This is the template for generating the form view for the specified model.
+ * The following variables are available in this template:
+ * - $modelClass: the model class name
+ * - $attributes: a list of attribute names to receive form inputs
+ */
+?>
+<div class="form">
+
+<?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
+ 'id'=>'".$this->class2id($modelClass)."-form',
+ 'enableAjaxValidation'=>false,
+)); ?>\n"; ?>
+
+ <p class="note">Fields with <span class="required">*</span> are required.</p>
+
+ <?php echo "<?php echo \$form->errorSummary(\$model); ?>\n"; ?>
+
+<?php
+foreach($attributes as $attribute)
+{
+?>
+ <div class="row">
+ <?php echo "<?php echo \$form->labelEx(\$model,'$attribute'); ?>\n"; ?>
+ <?php echo "<?php echo \$form->textField(\$model,'$attribute'); ?>\n"; ?>
+ <?php echo "<?php echo \$form->error(\$model,'$attribute'); ?>\n"; ?>
+ </div>
+
+<?php
+}
+?>
+ <div class="row buttons">
+ <?php echo "<?php echo CHtml::submitButton('Submit'); ?>\n"; ?>
+ </div>
+
+<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
+
+</div><!-- form --> \ No newline at end of file
diff --git a/framework/cli/views/shell/model/fixture.php b/framework/cli/views/shell/model/fixture.php
new file mode 100644
index 0000000..a159585
--- /dev/null
+++ b/framework/cli/views/shell/model/fixture.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * This is the template for generating the fixture file for a model class.
+ * The following variables are available in this template:
+ * - $table: the table schema
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+return array(
+ /*
+ 'sample1'=>array(
+<?php foreach($table->columns as $name=>$column) {
+ if($table->sequenceName===null || $table->primaryKey!==$column->name)
+ echo "\t\t'$name' => '',\n";
+} ?>
+ ),
+ 'sample2'=>array(
+<?php foreach($table->columns as $name=>$column) {
+ if($table->sequenceName===null || $table->primaryKey!==$column->name)
+ echo "\t\t'$name' => '',\n";
+} ?>
+ ),
+ */
+);
diff --git a/framework/cli/views/shell/model/model.php b/framework/cli/views/shell/model/model.php
new file mode 100644
index 0000000..b1137db
--- /dev/null
+++ b/framework/cli/views/shell/model/model.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * This is the template for generating a model class file.
+ * The following variables are available in this template:
+ * - $className: the class name
+ * - $tableName: the table name
+ * - $columns: a list of table column schema objects
+ * - $rules: a list of validation rules (string)
+ * - $labels: a list of labels (column name => label)
+ * - $relations: a list of relations (string)
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+/**
+ * This is the model class for table "<?php echo $tableName; ?>".
+ *
+ * The followings are the available columns in table '<?php echo $tableName; ?>':
+<?php foreach($columns as $column): ?>
+ * @property <?php echo $column->type.' $'.$column->name."\n"; ?>
+<?php endforeach; ?>
+ */
+class <?php echo $className; ?> extends CActiveRecord
+{
+ /**
+ * Returns the static model of the specified AR class.
+ * @return <?php echo $className; ?> the static model class
+ */
+ public static function model($className=__CLASS__)
+ {
+ return parent::model($className);
+ }
+
+ /**
+ * @return string the associated database table name
+ */
+ public function tableName()
+ {
+ return '<?php echo $tableName; ?>';
+ }
+
+ /**
+ * @return array validation rules for model attributes.
+ */
+ public function rules()
+ {
+ // NOTE: you should only define rules for those attributes that
+ // will receive user inputs.
+ return array(
+<?php foreach($rules as $rule): ?>
+ <?php echo $rule.",\n"; ?>
+<?php endforeach; ?>
+ // The following rule is used by search().
+ // Please remove those attributes that should not be searched.
+ array('<?php echo implode(', ', array_keys($columns)); ?>', 'safe', 'on'=>'search'),
+ );
+ }
+
+ /**
+ * @return array relational rules.
+ */
+ public function relations()
+ {
+ // NOTE: you may need to adjust the relation name and the related
+ // class name for the relations automatically generated below.
+ return array(
+<?php foreach($relations as $name=>$relation): ?>
+ <?php echo "'$name' => $relation,\n"; ?>
+<?php endforeach; ?>
+ );
+ }
+
+ /**
+ * @return array customized attribute labels (name=>label)
+ */
+ public function attributeLabels()
+ {
+ return array(
+<?php foreach($labels as $column=>$label): ?>
+ <?php echo "'$column' => '$label',\n"; ?>
+<?php endforeach; ?>
+ );
+ }
+
+ /**
+ * Retrieves a list of models based on the current search/filter conditions.
+ * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
+ */
+ public function search()
+ {
+ // Warning: Please modify the following code to remove attributes that
+ // should not be searched.
+
+ $criteria=new CDbCriteria;
+
+<?php
+foreach($columns as $name=>$column)
+{
+ if($column->type==='string')
+ {
+ echo "\t\t\$criteria->compare('$name',\$this->$name,true);\n\n";
+ }
+ else
+ {
+ echo "\t\t\$criteria->compare('$name',\$this->$name);\n\n";
+ }
+}
+?>
+ return new CActiveDataProvider('<?php echo $className; ?>', array(
+ 'criteria'=>$criteria,
+ ));
+ }
+} \ No newline at end of file
diff --git a/framework/cli/views/shell/model/test.php b/framework/cli/views/shell/model/test.php
new file mode 100644
index 0000000..93aa17e
--- /dev/null
+++ b/framework/cli/views/shell/model/test.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * This is the template for generating the unit test for a model class.
+ * The following variables are available in this template:
+ * - $className: the class name
+ * - $fixtureName: the fixture name
+ */
+?>
+<?php echo "<?php\n"; ?>
+
+class <?php echo $className; ?>Test extends CDbTestCase
+{
+ public $fixtures=array(
+ '<?php echo $fixtureName; ?>'=>'<?php echo $className; ?>',
+ );
+
+ public function testCreate()
+ {
+
+ }
+} \ No newline at end of file
diff --git a/framework/cli/views/shell/module/components/.yii b/framework/cli/views/shell/module/components/.yii
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/framework/cli/views/shell/module/components/.yii
diff --git a/framework/cli/views/shell/module/controllers/DefaultController.php b/framework/cli/views/shell/module/controllers/DefaultController.php
new file mode 100644
index 0000000..957551e
--- /dev/null
+++ b/framework/cli/views/shell/module/controllers/DefaultController.php
@@ -0,0 +1,9 @@
+<?php
+
+class DefaultController extends Controller
+{
+ public function actionIndex()
+ {
+ $this->render('index');
+ }
+} \ No newline at end of file
diff --git a/framework/cli/views/shell/module/messages/.yii b/framework/cli/views/shell/module/messages/.yii
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/framework/cli/views/shell/module/messages/.yii
diff --git a/framework/cli/views/shell/module/models/.yii b/framework/cli/views/shell/module/models/.yii
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/framework/cli/views/shell/module/models/.yii
diff --git a/framework/cli/views/shell/module/module.php b/framework/cli/views/shell/module/module.php
new file mode 100644
index 0000000..c8f6e02
--- /dev/null
+++ b/framework/cli/views/shell/module/module.php
@@ -0,0 +1,28 @@
+<?php echo "<?php\n"; ?>
+
+class <?php echo $moduleClass; ?> extends CWebModule
+{
+ public function init()
+ {
+ // this method is called when the module is being created
+ // you may place code here to customize the module or the application
+
+ // import the module-level models and components
+ $this->setImport(array(
+ '<?php echo $moduleID; ?>.models.*',
+ '<?php echo $moduleID; ?>.components.*',
+ ));
+ }
+
+ public function beforeControllerAction($controller, $action)
+ {
+ if(parent::beforeControllerAction($controller, $action))
+ {
+ // this method is called before any module controller action is performed
+ // you may place customized code here
+ return true;
+ }
+ else
+ return false;
+ }
+}
diff --git a/framework/cli/views/shell/module/views/default/index.php b/framework/cli/views/shell/module/views/default/index.php
new file mode 100644
index 0000000..b726985
--- /dev/null
+++ b/framework/cli/views/shell/module/views/default/index.php
@@ -0,0 +1,14 @@
+<?php
+$this->breadcrumbs=array(
+ $this->module->id,
+);
+?>
+<h1><?php echo $this->uniqueId . '/' . $this->action->id; ?></h1>
+
+<p>
+This is the view content for action "<?php echo $this->action->id; ?>".
+The action belongs to the controller "<?php echo get_class($this); ?>" in the "<?php echo $this->module->id; ?>" module.
+</p>
+<p>
+You may customize this page by editing <tt><?php echo __FILE__; ?></tt>
+</p> \ No newline at end of file
diff --git a/framework/cli/views/shell/module/views/layouts/.yii b/framework/cli/views/shell/module/views/layouts/.yii
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/framework/cli/views/shell/module/views/layouts/.yii