public function GetItems($name) { $list = null; switch ($name) { case "Layouts": $list = JwtUtil::getSubDirectories($this->rootPath . "Scripts/Layouts"); array_unshift($list, "Select a layout"); break; case "Widgets": $list = JwtUtil::getSubDirectories($this->rootPath . "Scripts/Components"); array_unshift($list, "Select a widgets"); break; case "Components": $list = JwtUtil::getSubDirectories($this->rootPath . "Scripts/Directives"); array_unshift($list, "Select a component"); break; case "Modules": $list = JwtUtil::getSubDirectories($this->rootPath . "Scripts/Modules"); array_unshift($list, "Select a module"); break; } return $list; }
private function genAppDirectives() { $dir = JwtUtil::getSubDirectories($this->root . "Scripts/Directives"); $import1 = new StringBuilder(); $builder = new StringBuilder(); foreach ($dir as $item) { $import1->appendFormat("import %s from 'Scripts/Directives/%s/%s.js';", $item, $item, $item); $import1->appendLine(); $builder->appendFormat(".directive('%s', %s.builder)", $item, $item); $builder->appendLine(); if (JwtUtil::fileExists(sprintf($this->root . "Scripts/Directives/%s/%s.css", $item, $item))) { $this->componentsCSS->appendFormat("@import '../Scripts/Directives/%s/%s.css';", $item, $item); $this->componentsCSS->appendLine(); } } $res = new StringBuilder(); $res->append($import1->toString()); $res->appendLine(); $res->appendLine(); $res->appendFormat("var moduleName='%s.Directives';", $this->app->Name); $res->appendLine(); $res->appendLine(); $res->append("angular.module(moduleName, [])"); $res->appendLine(); $res->append($builder->toString()); $res->append(";"); $res->appendLine(); $res->appendLine(); $res->append("export default moduleName;"); JwtUtil::putContent($this->root . "Scripts/app.directives.js", $res->toString()); }