PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
admin
/
controllers
<?php class ModuleController 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','print', ), 'roles' => array($module->generalManagerRole), ), array('deny', // deny all users 'users' => array('*'), ), ); } public function actionIndex() { $model = new ModuleList('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['ModuleList'])) { $model->attributes = $_GET['ModuleList']; } $this->breadcrumbs = array( 'Module', ); $this->render('index', array( 'model' => $model, )); } public function actionUpdate_data() { $this->breadcrumbs = array( Yii::t('amin', 'Module'), ); $model = new ModuleDataForm(); if (isset($_POST['ModuleDataForm'])) { $model->attributes = $_POST['ModuleDataForm']; //$model->file = CUploadedFile::getInstance($model,'file'); 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 = ModuleList::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $data = ModuleData::model()->find('module_name=:name', array(":name"=>$t->name)); if (isset($data)) { foreach ($model->getAttributes() as $name => $value) { if(isset($data->$name)) $model->$name = $data->$name; } } $model->module_name = $t->name; $this->render('update_data', array('model' => $model)); } public function actionUpdate() { $this->breadcrumbs = array( Yii::t('amin', 'Module'), ); $model = new ModuleForm('update'); if (isset($_POST['ModuleForm'])) { $model->attributes = $_POST['ModuleForm']; $model->file = CUploadedFile::getInstance($model,'file'); 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 = ModuleList::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $attributes = array(); foreach ($model->getAttributes() as $name => $value) { if(isset($t->$name)) $model->$name = $t->$name; } $this->render('update', array('model' => $model)); } public function actionExport() { $this->breadcrumbs = array( Yii::t('amin', 'Module'), ); if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = ModuleList::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $t->export(); } public function actionRefactor() { $modules = ModuleList::model()->findAll(); foreach($modules as $module) { $mysql = DbMigration::exportModuleData($this); $folders = array( array('webroot.scripts.editor.modules', $module->name.'.js','backend.js'), array('webroot.admin.views.builder.modules', $module->name.'.php','backend.php'), array('webroot.admin.widgets.modules', 'CWidget'.ucfirst($module->name).'.php','frontend_class.php'), array('webroot.admin.widgets.views.modules', $module->name.'.php','frontend_view.php'), array('webroot.admin.widgets.views.modules.script', $module->name.'.php','frontend_script.php'), //array('webroot.exportmodule', 'exportmodulesql.sql','sql.sql'), ); $dir = Yii::getPathofAlias('webroot.modules'); if(!file_exists($dir)) { @mkdir($dir); } $dir = Yii::getPathofAlias('webroot.modules.'.$module->name); if(!file_exists($dir)) { @mkdir($dir); } foreach ($folders as $folder) { $file = Yii::getPathofAlias($folder[0]).DIRECTORY_SEPARATOR.$folder[1]; if(file_exists($file)) { @copy($file,$dir.DIRECTORY_SEPARATOR.$folder[2]); //$relativePath = $dir; //$relativePath = str_replace(array("/", "\\"), "/", $relativePath); } } } } public function actionDelete() { if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = ModuleList::model()->findByPk((int) $id); if ($t == null) { $url = $this->createUrl('index'); $this->redirect($url); } $t->delete(); echo 1; } public function actionAjaxUpdate() { $act = $_GET['act']; $autoIdAll = array(); if (isset($_POST['autoId'])) { $autoIdAll = $_POST['autoId']; } if (count($autoIdAll) > 0) { foreach ($autoIdAll as $autoId) { $model = ModuleList::model()->findByPk((int) $autoId); if ($act == 'doDelete') { $model->delete(); } if ($model->save()) { echo 'ok'; } else { throw new Exception('Sorry', 500); } } } } public function actionPrint() { $module = ModuleList::model()->findAll(); foreach ($module as $m) { echo "'".$m->name."',"; } } public function actionCreate() { $model = new ModuleForm('create'); if (isset($_POST['ModuleForm'])) { $model->attributes = $_POST['ModuleForm']; if ($model->save()) { $url = $this->createUrl('index'); $this->redirect($url); } } $this->render('create', array('model' => $model)); } }
[+]
..
[-] 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]