生成仓库
@author nash.tang <112614251@qq.com>

@param $group
@param $module
@param $model
@param $mode
@param $output
@param string $file
@param string $customTemplate
502966
public function generateRepository($group, $module, $model, $mode, $output, $file = "", $customTemplate = "")
    {
        $generator = new RepositoryGenerator($group, $module, $model, $mode, $output, $file, $customTemplate);
        $generator->run();
    }
332885
protected function renderTemplate($input, $outputFile, $template, $templates, $data = [])
    {
        $paths = [$templates];

        if ($templates = $input->getOption('templates')) {
            $paths []= $templates;
        }

        $paths = array_filter($paths);

        $loader = new Twig_Loader_Filesystem($paths);
        $twig = new Twig_Environment($loader);


        $template = $twig->loadTemplate($template);

        $dataOption = $input->getOption('data');

        if (file_exists($dataOption)) {
            $dataOption = file_get_contents($dataOption);
        }

        $dataOption = json_decode(stripcslashes($dataOption), true);

        if (!is_array($dataOption)) {
            $dataOption = [];
        }

        $data = array_merge($data, $dataOption);

        @mkdir(dirname($outputFile), 0755, true);
        file_put_contents($outputFile, $template->render($data));
    }
1012865
public function run($module = '', $group = '')
    {
        if (is_object($module)) {
            $this->CI = &$module;
        }
        return parent::run($group);
    }
873530
public function defaultTemplate ($module, $controller, $action)
	{

		// Start template path with the controller module

		$template	= $module? $module . '/' : '';

		// Add the controller path and convert \ to /

		$template	.= $controller? str_replace ('\\', '/', $controller) . '/': '';

		// If there is no template file yet just use the action

		$template	.= $action;

		// Lowercase and add tpl extension

		$template	= strtolower ($template) . '.tpl';

		// Return template

		return $template;

	}
1193751
function createTemplateEngine(output) {
    var plugins = output.getPlugins();
    var book = output.getBook();
    var rootFolder = book.getContentRoot();
    var logger = book.getLogger();

    var filters = Plugins.listFilters(plugins);
    var blocks = Plugins.listBlocks(plugins);

    // Extend with default
    blocks = defaultBlocks.merge(blocks);
    filters = defaultFilters.merge(filters);

    // Create loader
    var transformFn = Templating.replaceShortcuts.bind(null, blocks);
    var loader = new Templating.ConrefsLoader(rootFolder, transformFn, logger);

    // Create API context
    var context = Api.encodeGlobal(output);

    return new TemplateEngine({
        filters:    filters,
        blocks:     blocks,
        loader:     loader,
        context:    context
    });
}
71138
static function ModuleCustomTemplatesFolder(TemplateModule $module)
    {
        $parentFolder = Path::Combine(PHINE_PATH, 'App/Phine/ModuleTemplates');
        $bundleFolder = Path::Combine($parentFolder, $module->MyBundle());
        return Path::Combine($bundleFolder, $module->MyName());
    }
390938
public function createGroupTrailer($query_name, $trailer_column, $value_column, $trailer_custom = false, $show_in_html = "yes", $show_in_pdf = "yes")
    {
        $this->checkGroupName("createGroupTrailer", $query_name);
        //$this->check_column_name("createGroupTrailer", $trailer_column);
        $this->checkColumnName("createGroupTrailer", $value_column);

        $grp = ReporticoUtility::getGroupColumn($query_name, $this->groups);
        $qc = ReporticoUtility::getQueryColumn($value_column, $this->columns);
        //$trl = ReporticoUtility::getQueryColumn($trailer_column, $this->columns )) )
        $grp->addTrailer($trailer_column, $qc, $trailer_custom, $show_in_html, $show_in_pdf);
    }
454835
public function handle(Input $input, Output $output)
    {
        $module = $input->getArgument('module');

        try {
            if (!class_exists("{$module}\\{$module}")) throw new \Exception("Error: Module {$module} is not exist", 1);

            $reflector = new \ReflectionClass("{$module}\\{$module}");
            $templates = dirname(dirname($reflector->getFileName())) . "/templates";

            $this->createBaseTemplate(get_files("{$templates}/base"));
            $this->createAppTemplate(get_files("{$templates}/app"));
            $this->createAssetSassTemplate(get_files("{$templates}/assets/sass"));
            $this->createAssetJsTemplate(get_files("{$templates}/assets/js"));
            $this->createConfigTemplate(get_files("{$templates}/config"));
            $this->createDbMigrationTemplate(get_files("{$templates}/db/migrations"));
            $this->createDbSeederTemplate(get_files("{$templates}/db/seeds"));
            $this->createViewTemplate(get_files("{$templates}/views"));
        } catch (\Exception $e) {
            $output->writeln($e->getMessage());
        }
    }
703602
function init( $group, opts = {} ) {
    if ( !this.form ) {
        throw new Error( 'Widgets module not correctly instantiated with form property.' );
    }

    options = opts;
    formHtml = this.form.view.html; // not sure why this is only available in init

    const group = $group && $group.length ? $group[ 0 ] : formHtml;

    widgets.forEach( Widget => {
        _instantiate( Widget, group );
    } );

    return true;
}
25270
public function setMacroTemplateGroupFilter($filter, $macroTemplate = null)
    {
        if(!isset($this->groupFilters[$filter])){
            throw new \RuntimeException(sprintf("The group filter %s is not added.", $filter));
        }

        $groupFilter = $this->groupFilters[$filter];
        $groupFilter->setMacroTemplate($macroTemplate);
    }
498056
public static function loadTemplate($module, $action, $templateName)
    {
        if ( ! is_string($module) || ! is_string($action) || ! is_string($templateName)) {
            return array();
        }
        if (($templates = self::loadCache($module, $action)) === false) {
            $filepath = Config::path("template/{$module}/") . $action . '.php';
            if ( ! file_exists($filepath)) {
                return array();
            }
            $templates = require $filepath;
            if ( ! is_array($templates)) {
                return array();
            }
            self::preserveCache($module, $action, $templates);
        }

        if (array_key_exists($templateName, $templates)) {
            return $templates[$templateName];
        }

        return array();
    }
998607
public function generateRoute($group, $module, $model, $mode, $output, $file = "", $customTemplate = "")
    {
        $generator = new RouteGenerator($group, $module, $model, $mode, $output, $file, $customTemplate);
        $generator->run();
    }
1349998
@GwtIncompatible("Unnecessary")
  private JsonFileSpec createJsonFileFromModule(JSModule module) throws IOException {
    compiler.resetAndIntitializeSourceMap();

    StringBuilder output = new StringBuilder();
    writeModuleOutput(output, module);

    JsonFileSpec jsonFile = new JsonFileSpec(output.toString(),
        getModuleOutputFileName(module));

    StringBuilder moduleSourceMap = new StringBuilder();

    compiler.getSourceMap().appendTo(moduleSourceMap,
        getModuleOutputFileName(module));

    jsonFile.setSourceMap(moduleSourceMap.toString());

    return jsonFile;
  }
800139
def write_module_file(name, path, package):
    '''
    '''
    file_path = join(path, '%s.rst' % name)
    mod_file = open(file_path, 'w')

    mod_file.write('%s\n' % AUTOGEN)
    mod_file.write('%s\n' % name.title())
    mod_file.write('=' * len(name))
    mod_file.write('\n\n')
    mod_file.write('.. toctree::\n')
    mod_file.write('   :maxdepth: 1\n\n')
    mod_file.write('.. automodule:: %s.%s\n' % (package, name))
    mod_file.write('   :members:\n')
    mod_file.write('   :undoc-members:\n')
    mod_file.write('   :show-inheritance:\n')
124930
public function actionCreate($module=NULL,$id=NULL){
    $model = new Entity;

    if ($model->load(Yii::$app->request->post()) && $model->save()) 
    {
      if (\Yii::$app->request->isAjax) 
      {
        header('Content-type: application/json');
        echo Json::encode(['status'=>'DONE','model'=>$model]);
        exit();
      }
      else
      {
        return $this->redirect(['view', 'id' => $model->id]);
      }
    } 
    else 
    {
      if(!is_null($module) && !is_null($id))
      {
        $model->mod_table = $module;
        $model->mod_id = $id;  
      }
      return $this->renderAjax('@frenzelgmbh/cmentity/widgets/views/iviews/_form', [
          'model' => $model,
      ]);
    }
  }
271323
public function generateNameForCache($module, $action, GroupInterface $group)
    {
        return md5($module.'_'.$action.'_'.strtolower($group->getName()));
    }
599459
public static function create_template($template) {
        global $PAGE;

        $params = self::validate_parameters(self::create_template_parameters(), array('template' => $template));
        $params = $params['template'];
        $context = self::get_context_from_params($params);
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        unset($params['contextlevel']);
        unset($params['instanceid']);
        $params = (object) $params;
        $params->contextid = $context->id;

        $result = api::create_template($params);
        $exporter = new template_exporter($result);
        $record = $exporter->export($output);
        return $record;
    }