private function genAllControllers() { $list = array_unique($this->mControllers); $sb = new StringBuilder(); $directoryName = "Components"; foreach ($list as $item) { if (JwtUtil::fileExists($this->root . sprintf("Scripts/Components/%s/%sCtrl.js", $item, $item))) { $sb->AppendLine(); $sb->AppendFormat("import %s from 'Scripts/%s/%s/%sCtrl.js';", $item, $directoryName, $item, $item); } } $list = array_unique($this->layoutControllers); $directoryName = "Layouts"; foreach ($list as $item) { if (JwtUtil::fileExists($this->root . sprintf("Scripts/Layouts/%s/%sCtrl.js", $item, $item))) { $sb->appendLine(); $sb->appendFormat("import %s from 'Scripts/%s/%s/%sCtrl.js';", $item, $directoryName, $item, $item); } } $sb->appendLine(); $sb->appendLine(); $sb->appendFormat("var moduleName='%s.controllers';", $this->app->Name); $sb->appendLine(); $sb->appendLine(); $sb->append("angular.module(moduleName,[])"); $list = array_unique($this->mControllers); foreach ($list as $item) { if (JwtUtil::fileExists($this->root . sprintf("Scripts/Components/%s/%sCtrl.js", $item, $item))) { $sb->appendLine(); $sb->appendFormat(".controller('%sCtrl', %s)", $item, $item); } if (JwtUtil::fileExists(sprintf($this->root . "Scripts/Components/%s/%s.css", $item, $item))) { $this->componentsCSS->appendFormat("@import '../Scripts/Components/%s/%s.css';", $item, $item); $this->componentsCSS->appendLine(); } } $list = array_unique($this->layoutControllers); foreach ($list as $item) { if (JwtUtil::fileExists($this->root . sprintf("Scripts/Layouts/%s/%sCtrl.js", $item, $item))) { $sb->appendLine(); $sb->appendFormat(".controller('%sCtrl', %s)", $item, $item); } if (JwtUtil::fileExists(sprintf($this->root . "Scripts/Layouts/%s/%s.css", $item, $item))) { $this->componentsCSS->appendFormat("@import '../Scripts/Layouts/%s/%s.css';", $item, $item); $this->componentsCSS->appendLine(); } } $sb->append(";"); $sb->appendLine(); $sb->appendLine(); $sb->append("export default moduleName;"); JwtUtil::putContent($this->root . "Scripts/app.controllers.js", $sb->toString()); }