You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					55 lines
				
				981 B
			
		
		
			
		
	
	
					55 lines
				
				981 B
			| 
								 
											12 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @link http://www.yiiframework.com/
							 | 
						||
| 
								 | 
							
								 * @copyright Copyright (c) 2008 Yii Software LLC
							 | 
						||
| 
								 | 
							
								 * @license http://www.yiiframework.com/license/
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace yii\gii\controllers;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use yii\web\Controller;
							 | 
						||
| 
								 | 
							
								use yii\web\HttpException;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @author Qiang Xue <qiang.xue@gmail.com>
							 | 
						||
| 
								 | 
							
								 * @since 2.0
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class DefaultController extends Controller
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
									public $layout = 'generator';
							 | 
						||
| 
								 | 
							
									public $generator;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									public function actionIndex()
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										$this->layout = 'main';
							 | 
						||
| 
								 | 
							
										return $this->render('index');
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									public function actionView($id)
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										$generator = $this->loadGenerator($id);
							 | 
						||
| 
								 | 
							
										return $this->render('view', array(
							 | 
						||
| 
								 | 
							
											'generator' => $generator
							 | 
						||
| 
								 | 
							
										));
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									public function actionCode($file)
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									public function actionDiff($file1, $file2)
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									protected function loadGenerator($id)
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										if (isset($this->module->generators[$id])) {
							 | 
						||
| 
								 | 
							
											return $this->generator = $this->module->generators[$id];
							 | 
						||
| 
								 | 
							
										} else {
							 | 
						||
| 
								 | 
							
											throw new HttpException(404, "Code generator not found: $id");
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |