forked from lex3m/estate
/
MainController.php
executable file
·64 lines (56 loc) · 1.8 KB
/
MainController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**********************************************************************************************
* CMS Open Real Estate
* -----------------
* version : 1.8.1
* copyright : (c) 2014 Monoray
* website : http://www.monoray.ru/
* contact us : http://www.monoray.ru/contact
*
* This file is part of CMS Open Real Estate
*
* Open Real Estate is free software. This work is licensed under a GNU GPL.
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Open Real Estate is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
***********************************************************************************************/
class MainController extends ModuleUserController{
public $modelName = 'Menu';
public function actions() {
return array(
'captcha' => array(
'class' => 'MathCCaptchaAction',
'backColor' => 0xFFFFFF,
),
);
}
public function actionIndex(){
if(Yii::app()->user->getState("isAdmin")){
$this->redirect(array('/menumanager/backend/main/admin'));
return;
}
$this->redirect(array('/site/index'));
}
public function actionView($id = 0, $url = ''){
if($url && issetModule('seo')){
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if(!$seo){
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$model = $this->loadModel($id);
if($model){
if(Yii::app()->request->getParam('is_ajax')){
$this->renderPartial('/view', array('model' => $model), false, true);
}else{
$this->render('/view', array('model' => $model));
}
} else {
Yii::app()->user->setFlash('error', tc('Page not found.'));
$this->redirect(array('/site/index'));
}
}
}