示例#1
0
文件: main.php 项目: reggi49/plansys
<?php

## Setting initialization
Setting::initPath();
$basePath = Setting::getBasePath();
$modules = Setting::getModules();
## define config
$config = array('basePath' => $basePath, 'name' => !Setting::get('app.name') ? "Plansys" : Setting::get('app.name'), 'preload' => array('log', 'EJSUrlManager'), 'import' => array('app.models.*', 'application.models.*', 'application.forms.*', 'app.forms.*', 'app.components.utility.*', 'application.components.*', 'application.components.ui.*', 'application.components.ui.FormFields.*', 'application.components.ui.Widgets.*', 'application.components.utility.*', 'application.components.models.*', 'application.components.codegen.*', 'application.components.repo.*', 'application.behaviors.*', 'ext.YiiJasper.*'), 'runtimePath' => Setting::getRuntimePath(), 'sourceLanguage' => 'en_us', 'language' => 'id', 'modulePath' => Setting::getModulePath(), 'controllerMap' => Setting::getControllerMap(), 'modules' => array_merge($modules, array('nfy' => array('class' => 'nfy.NfyModule'))), 'aliases' => array('nfy' => Setting::getBasePath() . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'nfy'), 'components' => array('assetManager' => array('basePath' => Setting::getAssetPath()), 'img' => array('class' => 'application.extensions.simpleimage.CSimpleImage'), 'ldap' => Setting::getLDAP(), 'nfy' => array('class' => 'nfy.components.NfyDbQueue', 'id' => 'Notifications', 'timeout' => 30), 'todo' => array('class' => 'application.components.ui.Widgets.TodoWidget'), 'EJSUrlManager' => array('class' => 'ext.JSUrlManager.EJSUrlManager'), 'user' => array('allowAutoLogin' => true, 'class' => 'WebUser'), 'db' => Setting::getDB(), 'errorHandler' => array('class' => 'ErrorHandler'), 'log' => array('class' => 'CLogRouter', 'routes' => array(array('class' => 'CFileLogRoute', 'levels' => 'error, warning'))), 'widgetFactory' => array(), 'cache' => array('class' => 'system.caching.CFileCache'), 'clientScript' => array('packages' => array('jquery' => array('basePath' => "application.static.js.lib", 'js' => array('jquery.js'), 'coreScriptPosition' => CClientScript::POS_HEAD))), 'ePdf' => array('class' => 'ext.yiipdf.EYiiPdf', 'params' => array('HTML2PDF' => array('librarySourcePath' => 'application.extensions.html2pdf.*', 'classFile' => 'html2pdf.class.php')))), 'params' => array());
$config = Setting::finalizeConfig($config);
return $config;
示例#2
0
 public function prepareFormName($class, $module = null)
 {
     if (isset($module)) {
         if (is_string($module)) {
             $moduleList = Setting::getModules();
             if (isset($moduleList[$module])) {
                 $moduleAlias = $moduleList[$module]['class'];
                 $moduleClass = Helper::explodeLast(".", $moduleAlias);
                 Yii::import($moduleAlias);
                 if (@class_exists($moduleClass)) {
                     $module = new $moduleClass($module, null);
                 }
             }
         }
         if (!is_object($module)) {
             $module = null;
         }
     } else {
         if (!isset($module)) {
             if (isset($this->module)) {
                 $module = $this->module;
             }
         }
     }
     if (strpos($class, '.') > 0) {
         $className = Helper::explodeLast(".", $class);
         if (!class_exists($className, false)) {
             try {
                 Yii::import($class);
             } catch (CException $e) {
                 if ($module) {
                     $moduleAlias = Helper::getAlias($module->basePath);
                     Yii::import($moduleAlias . ".forms." . $class);
                 } else {
                     $reflection = new ReflectionClass($this);
                     $path = $reflection->getFileName();
                     if (strpos($path, Yii::getPathOfAlias('app')) === 0) {
                         Yii::import('app.forms.' . $class);
                     } else {
                         if (strpos($path, Yii::getPathOfAlias('application')) === 0) {
                             Yii::import('application.forms.' . $class);
                         }
                     }
                 }
             }
         }
         $class = $className;
     } else {
         if (isset($module)) {
             $module = $module->id;
             if (stripos($class, $module) !== 0) {
                 if (!@class_exists($class)) {
                     $class = ucfirst($module) . ucfirst($class);
                 }
             }
         }
     }
     return $class;
 }
示例#3
0
 public static function getCommandMap($modules = null)
 {
     $commands = [];
     $modules = is_null($modules) ? Setting::getModules() : $modules;
     foreach ($modules as $m) {
         $moduleClass = explode(".", $m['class']);
         array_pop($moduleClass);
         $moduleName = array_pop($moduleClass);
         array_push($moduleClass, $moduleName);
         $modulePath = implode(".", $moduleClass);
         $path = Yii::getPathOfAlias($modulePath . ".commands");
         if (is_dir($path)) {
             $cmds = glob($path . DIRECTORY_SEPARATOR . "*.php");
             foreach ($cmds as $c) {
                 $dir = explode(DIRECTORY_SEPARATOR, $c);
                 $file = array_pop($dir);
                 $cmd = lcfirst(str_replace("Command.php", "", $file));
                 $commands[$moduleName . "." . $cmd] = ['class' => Helper::getAlias($c)];
             }
         }
     }
     return $commands;
 }
示例#4
0
 public static function getCommandMap($modules = null)
 {
     $commands = [];
     $modules = is_null($modules) ? Setting::getModules() : $modules;
     foreach ($modules as $m) {
         $moduleClass = explode(".", $m['class']);
         array_pop($moduleClass);
         $moduleName = array_pop($moduleClass);
         array_push($moduleClass, $moduleName);
         $modulePath = implode(".", $moduleClass);
         $path = Yii::getPathOfAlias($modulePath . ".commands");
         if (is_dir($path)) {
             $cmds = glob($path . DIRECTORY_SEPARATOR . "*.php");
             foreach ($cmds as $c) {
                 $dir = explode(DIRECTORY_SEPARATOR, $c);
                 $file = array_pop($dir);
                 $cmd = lcfirst(str_replace("Command.php", "", $file));
                 $commands[$moduleName . "." . $cmd] = ['class' => Helper::getAlias($c)];
             }
         }
     }
     $commands['migrate'] = ['class' => 'system.cli.commands.MigrateCommand', 'migrationPath' => 'application.migrations', 'connectionID' => 'db', 'migrationTable' => 'p_migration'];
     return $commands;
 }