PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
controllers
<?php class LanguageController extends PController { public $layout = 'admin_column'; public function filters() { return array( 'accessControl', ); } public function accesssRules() { $module = $this->getModule(); return array( array('allow', 'actions' => array( 'ajaxupdate','index','create','view','delete','update','category','addcategory','synctofile','createStructure', ), 'roles' => array($module->languageManagerRole), ), array('deny', // deny all users 'users' => array('*'), ), ); } public function actionIndex() { $this->breadcrumbs = array( Yii::t('admin', 'Language'), ); $model = new Language('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Language'])) { $model->attributes = $_GET['Language']; } $this->render('index', array( //'filtersForm' => $filtersForm, 'model' => $model, )); } public function actionEditable() { $name = $_POST['name']; $pk = $_POST['pk']; $value = $_POST['value']; $lang = Language::model()->findByPk((int) $pk); if (isset($lang)) { $lang->display_name = $value; $lang->save(); echo 'OK'; } echo 'Failed'; } public function actionUpdate() { $model = new LanguageForm('update'); if (isset($_POST['LanguageForm'])) { $model->attributes = $_POST['LanguageForm']; 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 = Language::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $this->breadcrumbs = array( Yii::t('admin', 'Lanugage') => array('language/index'), $t->display_name, ); $attributes = array(); foreach ($model->getAttributes() as $name => $value) { $model->$name = $t->$name; } $this->render('update', array('model' => $model)); } public function actionDelete() { if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = Language::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } if ($t->name != Yii::app()->params['language']) { $t->delete(); } echo 'ok'; } public function actionCreate() { $this->breadcrumbs = array( Yii::t('admin', 'Language') => array('language/index'), Yii::t('admin', 'Create'), ); $model = new LanguageForm('create'); if (isset($_POST['LanguageForm'])) { $model->attributes = $_POST['LanguageForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } $this->render('create', array('model' => $model)); } public function actionSynctoFile() { $this->sync(); echo 'ok'; } public function sync() { $terms = Term::model()->findAll(); $languages = Language::model()->findAll(); foreach ($languages as $language) { $content = ''; foreach ($terms as $term) { if (isset($term['value_'.$language->name]) && $term->javascript == 1) { $content .= 't.set("'.$term->name.'","'.$term['value_'.$language->name].'");'; } } $script_directory = 'scripts'; $file_name = 'terms_'.$language->name.'.js'; $filePath = Yii::getPathofAlias('webroot.scripts').DIRECTORY_SEPARATOR.$file_name; $out = fopen($filePath, 'wb'); fwrite($out, $content); fclose($out); $content = html_entity_decode("<?php \n"); $content .= "return array(\n"; foreach ($terms as $term) { if (isset($term['value_'.$language->name])) { $content .= '"'.trim($term->name).'"=>"'.$term['value_'.$language->name].'",'; $content.="\n"; } } $content .= ');'; $file_name = $language->name.'.php'; $filePath = Yii::getPathofAlias('webroot.languages.').DIRECTORY_SEPARATOR.$file_name; $out = fopen($filePath, 'wb'); fwrite($out, $content); } } }
[+]
..
[-] 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]