public function init() { parent::init(); $extJsSrcDir = Yii::getAlias($this->extJsDir); $extJsSrcExtendDir = Yii::getAlias($this->extJsExtendDir); $dstDir = Yii::getAlias($this->dstPath); $extJsDstDir = $dstDir . DIRECTORY_SEPARATOR . 'extjs'; $extJsExtendDstDir = $dstDir . DIRECTORY_SEPARATOR . 'extjs-extend'; if (!is_dir($dstDir)) { if (!is_dir($dstDir)) { FileHelper::createDirectory($dstDir); } } if (!is_dir($extJsDstDir)) { symlink($extJsSrcDir, $extJsDstDir); } if (!is_dir($extJsExtendDstDir)) { symlink($extJsSrcExtendDir, $extJsExtendDstDir); } $data = DpConfig::find()->all(); $config = []; foreach ($data as $item) { $config[$item['name']] = $item['value']; } $this->config = $config; $this->identity = Yii::$app->user->identity; }
public function actionOptions() { $data = DpConfig::find()->all(); $config = []; foreach ($data as $item) { $config['config[' . $item['name'] . ']'] = $item['value']; } return ['data' => $config]; }
public function init() { parent::init(); // 默认配置 $this->extJs['path'] = ArrayHelper::getValue($this->extJs, 'path', '/dp/extjs'); $this->extJs['extendPath'] = ArrayHelper::getValue($this->extJs, 'extendPath', '/dp/extjs-extend'); $this->extJs['appJsPath'] = ArrayHelper::getValue($this->extJs, 'appJsPath', $this->extJs['extendPath'] . '/app.js'); $this->extJs['bootstrapJsPath'] = ArrayHelper::getValue($this->extJs, 'bootstrapJsPath', $this->extJs['extendPath'] . '/bootstrap.js'); $this->extJs['bootstrapJsonPath'] = ArrayHelper::getValue($this->extJs, 'bootstrapJsonPath', $this->extJs['extendPath'] . '/bootstrap.json'); $this->extJs['bootstrapCssPath'] = ArrayHelper::getValue($this->extJs, 'bootstrapCssPath', $this->extJs['path'] . '/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css'); // js路径 $extJsSrcDir = Yii::getAlias($this->srcExtJsDir); $extJsSrcExtendDir = Yii::getAlias($this->srcExtJsExtendDir); $extJsDstDir = Yii::getAlias('@app/web/' . $this->extJs['path']); $extJsExtendDstDir = Yii::getAlias('@app/web/' . $this->extJs['extendPath']); // 创建符号连接所需的目录 $extJsDstUpDir = dirname($extJsDstDir); if (!is_dir($extJsDstUpDir)) { @rmdir($extJsDstUpDir); if (!is_dir($extJsDstUpDir)) { FileHelper::createDirectory($extJsDstUpDir); } } $extJsExtendDstUpDir = dirname($extJsExtendDstDir); if (!is_dir($extJsExtendDstUpDir)) { @rmdir($extJsExtendDstUpDir); if (!is_dir($extJsExtendDstUpDir)) { FileHelper::createDirectory($extJsExtendDstUpDir); } } // js目录创建符号连接 if (!is_dir($extJsDstDir)) { symlink($extJsSrcDir, $extJsDstDir); } if (!is_dir($extJsExtendDstDir)) { symlink($extJsSrcExtendDir, $extJsExtendDstDir); } $data = DpConfig::find()->all(); $config = []; foreach ($data as $item) { $config[$item['name']] = $item['value']; } $this->config = $config; $this->identity = Yii::$app->user->identity; }