示例#1
0
 public function actionIndex()
 {
     $content = '';
     $name = '';
     $path = [];
     if (isset($_GET['active'])) {
         $path = explode(".", $_GET['active']);
         if (count($path) < 2) {
             $ref = new ReflectionClass($_GET['active']);
             $filename = $ref->getFileName();
             if (strpos($filename, Yii::getPathOfAlias('app')) === 0) {
                 $this->redirect(['/dev/genModel/index', 'active' => 'app.' . $_GET['active']]);
             } else {
                 if (strpos($filename, Yii::getPathOfAlias('application')) === 0) {
                     $this->redirect(['/dev/genModel/index', 'active' => 'plansys.' . $_GET['active']]);
                 }
             }
             throw new CHttpException(404);
             return false;
         }
         $module = array_shift($path);
         $name = $path[count($path) - 1];
         $path = implode(".", $path);
         $filePath = Yii::getPathOfAlias(($module == 'plansys' ? 'application' : 'app') . ".models." . $path) . ".php";
         $content = file_get_contents($filePath);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('DevGenModelIndex', ['content' => $content, 'name' => $name]);
 }
示例#2
0
 public function actionIndex($value = '')
 {
     if (isset($_GET['active'])) {
         $path = explode('.', $_GET['active']);
         $filePath = Yii::getPathOfAlias(($path[0] == 'plansys' ? 'application' : 'app') . ".views.layouts.email." . $path[1]) . ".php";
         $content = file_get_contents($filePath);
         Asset::registerJS('application.static.js.lib.ace');
         $this->renderForm('genemail.DevEmailBuilderIndex', ['content' => $content, 'name' => count($path) > 1 ? $path[1] : '', 'template' => $path[1]]);
     } else {
         $this->renderForm("genemail.DevEmailBuilderIndex");
     }
 }
示例#3
0
 public function actionIndex()
 {
     $model = new DevGenModule();
     if (isset($_GET['active'])) {
         $model->load($_GET['active']);
         if (is_null($model->module)) {
             $model = new DevGenModule();
         } else {
             $model->checkSync();
             if (isset($_GET['gi'])) {
                 $model->module->generateImport(true);
                 $model->imports = $model->module->loadImport();
                 $model->checkSync();
             }
         }
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('DevGenModule', $model, ['module' => $model, 'controllers' => $model->getControllers()]);
 }
示例#4
0
 public function actionCode($c, $s = null)
 {
     $ext = ".php";
     $script = null;
     if (isset($s)) {
         $file = explode(".", $c);
         $scriptToken = explode(".", $s);
         $ext = "." . array_pop($scriptToken);
         array_pop($file);
         $script = implode(".", $file) . "." . implode(".", $scriptToken);
         $filePath = Yii::getPathOfAlias(implode(".", $file)) . DIRECTORY_SEPARATOR . $s;
         if (!file_exists($filePath)) {
             file_put_contents($filePath, "");
             $content = "";
         } else {
             $content = file_get_contents($filePath);
         }
     } else {
         $content = file_get_contents(Yii::getPathOfAlias($c) . $ext);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('DevEditScript', null, ['content' => $content, 'mode' => $ext == '.php' ? 'php' : 'javascript', 'status' => 'Ctrl+S to Save', 'name' => $c, 'script' => $script, 'ext' => $ext, 'shortname' => isset($s) ? $s : Helper::explodeLast('.', $c)], ['layout' => '//layouts/blank']);
 }
示例#5
0
 public function actionIndex()
 {
     $part = [];
     $name = "";
     $content = "";
     if (isset($_GET['active'])) {
         $part = explode(".", $_GET['active']);
         $name = array_pop($part);
         $module = $part[0] == "plansys" ? "application" : "app";
         $filePath = "";
         if (count($part) == 1) {
             $filePath = Yii::getPathOfAlias("{$module}.controllers.{$name}") . ".php";
         } else {
             if (count($part) == 2) {
                 $filePath = Yii::getPathOfAlias("{$module}.modules.{$part[1]}.controllers.{$name}") . ".php";
             }
         }
         if (is_file($filePath)) {
             $content = file_get_contents($filePath);
         }
         Asset::registerJS('application.static.js.lib.ace');
     }
     $this->renderForm("DevGenCtrlIndex", ['name' => $name, 'content' => $content]);
 }
示例#6
0
文件: Text.php 项目: reggi49/plansys
 public function actionCodePopUp()
 {
     Asset::registerJS('application.static.js.lib.ace');
     Yii::app()->controller->renderForm('TextPopUp', null, [], ['layout' => '//layouts/blank']);
 }
示例#7
0
 public function actionUpdate($id = null)
 {
     $model = DevServiceForm::load($id);
     if (!$model) {
         throw new CHttpException(404);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $instances = ServiceManager::getRunningInstance($id);
     $this->renderForm('DevServiceForm', $model, ['isRunning' => count($instances) > 0, 'instances' => $instances, 'log' => ServiceManager::readLog($id)]);
 }
示例#8
0
 public function actionUpdate($class)
 {
     $this->layout = "//layouts/blank";
     $path = $class;
     $class_path = explode(".", $class);
     $class = $class_path[count($class_path) - 1];
     $properties = FormBuilder::load('DevMenuEditor');
     $properties->registerScript();
     Asset::registerJS('application.static.js.lib.ace');
     $this->render('form', array('class' => $class, 'path' => $path));
 }
 public function actionUpdate($id = null)
 {
     $content = '';
     $name = '';
     $command = '';
     $commandFull = '';
     $commandPrefix = '';
     $file = '';
     $period = '';
     $periodType = '';
     $cmd = [];
     if (isset($id)) {
         $cmd = Setting::get('process.' . $id);
         if (count($cmd) > 0) {
             $id = $id;
             $name = $cmd['name'];
             $commandFull = $cmd['command'];
             $tmp = explode(" ", $cmd['command']);
             $commandPrefix = array_shift($tmp);
             $command = implode(" ", $tmp);
             $period = $cmd['period'];
             $periodType = $cmd['periodType'];
             $file = $cmd['file'];
             $prefix = Helper::explodeFirst("-", Helper::camelToSnake(Helper::explodeLast(".", $file)));
             //$filePath = Yii::getPathOfAlias((count($path)>2 ? "application.modules.". $path[1] . ".commands." . $path[2]  : "application.commands.". $path[1])) . ".php";
             $filePath = Yii::getPathOfAlias($file) . ".php";
             $content = file_get_contents($filePath);
         } else {
             $this->redirect(['/dev/processManager/']);
         }
     } else {
         $this->redirect(['/dev/processManager/']);
     }
     if (isset($_POST['DevSettingsProcessManagerForm'])) {
         $cmd = $_POST['DevSettingsProcessManagerForm'];
         $id = $_POST['processSettingsId'];
         $prefix = $_POST['processCommandPrefix'];
         Setting::set("process." . $id . ".name", $cmd['processName']);
         Setting::set("process." . $id . ".command", $prefix . ' ' . $cmd['processCommand']);
         Setting::set("process." . $id . ".period", $cmd['processPeriod']);
         Setting::set("process." . $id . ".periodType", $cmd['processPeriodType']);
         Setting::set("process." . $id . ".periodCount", ProcessHelper::periodConverter($cmd['processPeriod'], $cmd['processPeriodType']));
         $this->redirect(['/dev/processManager/']);
     }
     Asset::registerJS('application.static.js.lib.ace');
     $this->renderForm('settings.DevSettingsProcessManagerForm', ['content' => $content, 'name' => $file, 'prefix' => $name, 'processName' => $name, 'processCommand' => $command, 'processCommandPrefix' => $commandPrefix, 'processCommandFull' => $commandFull, 'processSettingsId' => $id, 'periodType' => $periodType, 'period' => $period]);
 }