3
class DefaultController extends CController
5
public $layout='/layouts/column1';
7
public function getPageTitle()
9
if($this->action->id==='index')
10
return 'Gii: a Web-based code generator for Yii';
12
return 'Gii - '.ucfirst($this->action->id).' Generator';
15
public function actionIndex()
17
$this->render('index');
20
public function actionError()
22
if($error=Yii::app()->errorHandler->error)
24
if(Yii::app()->request->isAjaxRequest)
25
echo $error['message'];
27
$this->render('error', $error);
32
* Displays the login page
34
public function actionLogin()
36
$model=Yii::createComponent('gii.models.LoginForm');
38
// collect user input data
39
if(isset($_POST['LoginForm']))
41
$model->attributes=$_POST['LoginForm'];
42
// validate user input and redirect to the previous page if valid
43
if($model->validate() && $model->login())
44
$this->redirect(Yii::app()->createUrl('gii'));
46
// display the login form
47
$this->render('login',array('model'=>$model));
51
* Logs out the current user and redirect to homepage.
53
public function actionLogout()
55
Yii::app()->user->logout(false);
56
$this->redirect(Yii::app()->createUrl('gii'));
b'\\ No newline at end of file'