PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
controllers
<?php class TermController extends PController { public $layout = 'admin_column'; public function filters() { return array( 'accessControl', ); } public function accessaRules() { $module = $this->getModule(); return array( array('allow', 'actions' => array( 'ajaxupdate','index','create','view','delete','update', 'refresh', ), 'roles' => array($module->generalManagerRole), ), array('deny', // deny all users 'users' => array('*'), ), ); } public function actionIndex() { $this->breadcrumbs = array( Yii::t('admin', 'Term'), ); $model = new Term('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Term'])) { $model->attributes = $_GET['Term']; } $this->render('index', array( 'model' => $model, )); } public function actionUpdate() { $model = new TermForm('update'); if (isset($_POST['TermForm'])) { $model->attributes = $_POST['TermForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = Term::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $this->breadcrumbs = array( Yii::t('admin', 'Term') => array('term/index'), $t->name, ); $attributes = array(); foreach ($model->getAttributes() as $name => $value) { if (isset($t->$name)) { $model->$name = $t->$name; } $languages = Language::model()->findAll(); foreach ($languages as $lang) { $model->values[$lang->name] = $t['value_'.$lang->name]; } } $this->render('update', array('model' => $model)); } public function actionEditable() { $name = $_POST['name']; $pk = $_POST['pk']; $value = $_POST['value']; $term = Term::model()->findByPk((int) $pk); if (isset($term)) { $term[$name] = $value; $term->save(); echo 'OK'; } echo 'Failed'; } public function actionDelete() { if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = Term::model()->findByPk((int) $id); $t->delete(); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } } public function actionAjaxUpdate() { $act = $_GET['act']; $autoIdAll = array(); if (isset($_POST['autoId'])) { $autoIdAll = $_POST['autoId']; } if (count($autoIdAll) > 0) { foreach ($autoIdAll as $autoId) { $model = Term::model()->findByPk((int) $autoId); if ($act == 'doDelete') { $model->delete(); } if ($model->save()) { echo 'ok'; } else { throw new Exception('Sorry', 500); } } } } public function actionCreate() { $this->breadcrumbs = array( Yii::t('admin', 'Term') => array('term/index'), Yii::t('admin', 'Create'), ); $model = new TermForm('create'); if (isset($_POST['TermForm'])) { $model->attributes = $_POST['TermForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } $this->render('create', array('model' => $model)); } public function actionRefresh() { $terms = Term::model()->findAll(); $lang = Yii::app()->language; foreach ($terms as $term) { unset(Yii::app()->session['Language.'.$lang.'.'.$term->name]); } $url = $this->createUrl('index'); $this->redirect($url); } }
[+]
..
[-] TemplateController.php
[edit]
[-] PlanController.php
[edit]
[-] DomainController.php
[edit]
[-] WebsiteController.php
[edit]
[-] ConfigController.php
[edit]
[-] TransactionController.php
[edit]
[-] MailtemplateController.php
[edit]
[-] DefaultController.php
[edit]
[-] CategoryController.php
[edit]
[-] DashboardController.php
[edit]
[-] UserController.php
[edit]
[-] LanguageController.php
[edit]
[-] ModuleController.php
[edit]
[-] ModulecategoryController.php
[edit]
[-] PlanDescriptionController.php
[edit]
[-] TermController.php
[edit]
[-] SubscriptionController.php
[edit]
[-] InterfaceController.php
[edit]
[-] ColorController.php
[edit]
[-] ShareButtonController.php
[edit]
[-] SkinpresetController.php
[edit]
[-] ContentController.php
[edit]
[-] LogController.php
[edit]
[-] ProfileController.php
[edit]