build module
@access public
@param  string $module
@param  array  $list ['controller'=>..., 'model'=>..., ]
@param  string $namespace
@param  bool   $suffix
@return void
507401
static public function buildModule($module = '', $list = [], $namespace = 'App', $suffix = false)
    {
        $appPath = static::getAppPath();
        
        $module = $module ? $module : '';
        if (!$list) $list = static::defaultModuleConfig();
        
        // module dir
        if (!is_dir($appPath . $module)) {
            mkdir($appPath . strtolower($module));
        }
        
        // controller, model, view
        foreach ($list as $path => $file) {
            $file = (array) $file;
            
            $modulePath = $appPath . $module . '/';
            if ('__dir__' === $path) {
                // dir
                foreach ($file as $dir) {
                    if (!is_dir($modulePath . $dir)) {
                        mkdir($modulePath . $dir, 0755, true);
                    }
                }
            } elseif ('__file__' === $path) {
                // dummy file
                foreach ($file as $name) {
                    if (!is_file($modulePath . $name)) {
                        file_put_contents($modulePath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? "<?php\n" : '');
                    }
                }
            } else {
                // mvc part
                foreach ($file as $name) {
                    $name   = trim($name);
                    switch ($path) {
                        case 'controller': 
                            static::buildController($module, $name, $namespace);
                            break;
                        case 'model': 
                            static::buildModel($module, $name, $namespace);
                            break;
                        case 'view': 
                            static::buildView($module, $name);
                            break;
                        default:    
                            static::buildClass($type, $module, $name, $namespace);
                    }
                }
            }
        }
        
        if (basename(Config::getStoragePath()) != $module) {
            // common moduel
            self::buildCommon($module, $namespace);
        }
    }
470170
public function addModule($module, array $options = NULL) {
        // We need to try the user's modules first, so they can override built-in ones.
        $full_module = '\\modules\\' . strtolower($module) . '\\' . ucwords($module);
        if(!class_exists($full_module)) {
            $full_module = 'assegai\\modules\\' . $module . '\\' . ucwords($module);
            if(!class_exists($full_module)) { // Very last chance.
                $full_module = 'Module_' . $module;
            }
        }

        if($full_module::instanciate())
        {
            $module_instance = null;
            $module_injector = new injector\Container($this->injector);
            $deps = array();
            
            if(method_exists($full_module, 'dependencies')) {
                $deps = $full_module::dependencies();
            } else { // We'll make up a dependency for you.
                $deps = array(
                    array(
                        'name' => 'module_' . $module,
                        'class' => $full_module,
                        'mother' => 'module',
                    ),
                );
            }

            $module_injector->loadConf($deps);
            $module_instance = $module_injector->give('module_' . $module);
            $module_instance->setDependencies($this->server, $this);
            $module_instance->setOptions($options);

            $this->add_to_list($module, $module_instance);
        }
    }
1170674
public function displayModuleOnAllPages($module)
	{
		$this->amOnPage('administrator/index.php?option=com_modules');
		$this->searchForItem($module);
		$this->click(array('link' => $module));
		$this->waitForElement(array('link' => 'Menu Assignment'), 30);
		$this->click(array('link' => 'Menu Assignment'));
		$this->waitForElement(array('id' => 'jform_menus-lbl'), 30);
		$this->click(array('id' => 'jform_assignment_chzn'));
		$this->click(array('xpath' => "//li[@data-option-array-index='0']"));
		$this->click(array('xpath' => "//div[@id='toolbar-apply']/button"));
		$this->waitForText('Module saved', 30, array('id' => 'system-message-container'));
	}
406938
public function addViewComponent($package, $namespace, $path)
    {
        $files = $this->app->make('files');
        $view  = $this->app->make('view');
        foreach ($this->getAppViewPaths($package) as $appView) {
            if ($files->isDirectory($appView)) {
                $view->addNamespace($namespace, $appView);
            }
        }

        $view->addNamespace($namespace, $path);
    }
281614
public function store($module, $name, $value)
    {
        $this->initializeOnDemand();

        if (!$this->has($module, $name)) {
            if ($this->configMapper->insert($module, $name, $value)) {
                $this->arrayConfig->add($module, $name, $value);
                return true;
            }

        } else {
            if ($this->configMapper->update($module, $name, $value)) {
                $this->arrayConfig->update($module, $name, $value);
                return true;
            }
        }

        // By default
        return false;
    }
1129766
function setModules($modules)
    {
        if (! is_array($modules) )
            throw new \InvalidArgumentException(sprintf(
                'Modules Must be Array list of module names; given (%s).'
                , $modules
            ));
        
        $this->modules = $modules;
    }
834306
public function createModule(Module $module)
    {
        $dst = $this->rootDir.'/../src/Terrific/Module/'.StringUtils::camelize($module->getName());

        if($this->toolbarMode === ToolbarListener::DEMO) {
            // prevent module creation in demo mode
            throw new \Exception('This action is not supported in demo mode');
        } else {
            if($this->moduleTemplate) {
                $this->copy($this->moduleTemplate, $dst, $module);
            }

            $this->copy($this->defaultTemplate, $dst, $module);
        }
    }
643878
public function add($module, $name, $value)
    {
        array_push($this->data, array(
            ConstProviderInterface::CONFIG_PARAM_MODULE => $module,
            ConstProviderInterface::CONFIG_PARAM_NAME => $name,
            ConstProviderInterface::CONFIG_PARAM_VALUE => $value
        ));
    }
763569
function loadModuleList() {
  $.getScript( modulesPath+"portal-ng-modules.js" )
    .done(
      function( script, textStatus ) {
        log( 'loadModuleList', textStatus );
        ajaxOngoing--;
      }
    )
    .fail(
      function( jqxhr, settings, exception ) {
        logErr( 'loadModuleList', exception );
        ajaxOngoing--;
      }
    );
}
282851
public function createModuleClass($module, $names, OutputInterface $output)
    {
        $source = realpath(__DIR__ . '/../src/module.txt');
        $file = file_get_contents($source);
        $file = str_replace("!module", ucfirst($names), $file);
        $file = str_replace("!date",date('d/m/Y'),$file);
        $file = str_replace("!time",date('HH:mm:ss'),$file);
        if (!file_exists($module."/".$names."/Modules.php")) {
            $fh = fopen($module."/".$names."/Modules.php", "w");
            fwrite($fh, $file);
            fclose($fh);

            $className = ucfirst($names) . ".php";

            return $output->writeln("Created config $className in modules");
        } else {
            return $output->writeln("Class modules already Exists!");
        }
    }
814995
protected void addModulesList(Collection<ModuleElement> modules, String text, String tableSummary, Content body) {
        Content table = (configuration.isOutputHtml5())
                ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
                : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
        table.addContent(getSummaryTableHeader(moduleTableHeader, "col"));
        Content tbody = new HtmlTree(HtmlTag.TBODY);
        addModulesList(modules, tbody);
        table.addContent(tbody);
        Content anchor = getMarkerAnchor(text);
        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor);
        div.addContent(table);
        if (configuration.allowTag(HtmlTag.MAIN)) {
            htmlTree.addContent(div);
        } else {
            body.addContent(div);
        }
    }
1246877
private function loadRequiredModules(
		Module $module,
		&$modules,
		array $moduleList,
		DependencyInjectionContainer $dic) {
		foreach ($module->getRequiredModules() as $requiredModule) {
			if (!\in_array($requiredModule, $moduleList)) {
				$this->loadModule($requiredModule, $modules, $moduleList, $dic);
				if ($module instanceof RequiredModuleAwareModule) {
					$module->addRequiredModule($dic->make($requiredModule));
				}
			}
		}
	}
746110
public static function add_module( $module ) {
		if ( ! in_array( $module, self::$modules, true ) ) {
			self::$modules[] = $module;
		}
	}
1042757
public function updateModuleAddonFromDir($module = array())
	{
		$config = '';
		$moduleCaches = $this->getModulesFromDir();
		if(count($module) > 0 && is_array($module)) {
			$moduleCaches = $module;
		}

		if(count($moduleCaches) > 0) {
			$config .= "<?php \n";
			$config .= "return array(\n\t'modules' => array(\n";
			for($i = 0; $i < count($moduleCaches); $i++) {
				if($i !== (count($moduleCaches) - 1))
					$config .= "\t\t'" . $moduleCaches[$i] . "',\n";
				else
					$config .= "\t\t'" . $moduleCaches[$i] . "'\n";
			}
			$config .= "\t),\n);";
			$config .= "\n?>";
		}

		$fileHandle = fopen($this->configPath, 'w');
		fwrite($fileHandle, $config, strlen($config));
		fclose($fileHandle);
	}
32220
@Override
    public void generate(final Module module, final Element element) {
        if (!(module instanceof SimpleListExtension)) {
            return;
        }

        final SimpleListExtension sle = (SimpleListExtension) module;
        addNotNullElement(element, "treatAs", sle.getTreatAs());

        final Group[] groups = sle.getGroupFields();
        final Element listInfo = new Element("listinfo", ModuleParser.NS);

        for (int i = 0; groups != null && i < groups.length; i++) {
            final Element group = new Element("group", ModuleParser.NS);

            if (groups[i].getNamespace() != Namespace.NO_NAMESPACE) {
                addNotNullAttribute(group, "ns", groups[i].getNamespace().getURI());
            }

            addNotNullAttribute(group, "element", groups[i].getElement());
            addNotNullAttribute(group, "label", groups[i].getLabel());
            listInfo.addContent(group);
        }

        final Sort[] sorts = sle.getSortFields();

        for (int i = 0; sorts != null && i < sorts.length; i++) {
            final Element sort = new Element("sort", ModuleParser.NS);

            if (sorts[i].getNamespace() != Namespace.NO_NAMESPACE) {
                addNotNullAttribute(sort, "ns", sorts[i].getNamespace().getURI());
            }

            addNotNullAttribute(sort, "element", sorts[i].getElement());
            addNotNullAttribute(sort, "label", sorts[i].getLabel());
            addNotNullAttribute(sort, "data-type", sorts[i].getDataType());

            if (sorts[i].getDefaultOrder()) {
                addNotNullAttribute(sort, "default", "true");
            }

            listInfo.addContent(sort);
        }

        if (!listInfo.getChildren().isEmpty()) {
            element.addContent(listInfo);
        }
    }
959150
public void buildModuleDescription(XMLNode node, Content moduleContentTree) {
        if (!configuration.nocomment) {
            moduleWriter.addModuleDescription(moduleContentTree);
        }
    }
728515
public function outputModule($module, $args = array(), $moduleSettings = array(), $echo = true)
    {
        if (!isset($args['id'])) {
            $args['id'] = 'no-id';
        }

        if (!is_object($module)) {
            return false;
        }

        $class = \Modularity\ModuleManager::$classes[$module->post_type];
        $module = new $class($module, $args);
        $module = $this->fillMissingParams($module, $moduleSettings);

        if (!$echo || !isset($moduleSettings['cache_ttl'])) {
            $moduleSettings['cache_ttl'] = 0;
        }

        $cache = new \Modularity\Helper\Cache($module->ID, array($module, $args['id']), $moduleSettings['cache_ttl']);

        if (empty($moduleSettings['cache_ttl']) || $cache->start()) {
            $moduleMarkup = $this->getModuleMarkup($module, $args);

            if (isset($module->columnWidth) && !empty($module->columnWidth)) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', '</div>', $args, $module->post_type, $module->ID);
            } elseif (isset($this->options[$args['id']]['after_module']) && !empty($this->options[$args['id']]['after_module'])) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', '</div>', $args, $module->post_type, $module->ID);
            } elseif (isset($args['after_widget'])) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', $args['after_widget'], $args, $module->post_type, $module->ID);
            }

            $moduleMarkup = apply_filters('Modularity/Display/Markup', $moduleMarkup, $module);
            $moduleMarkup = apply_filters('Modularity/Display/' . $module->post_type . '/Markup', $moduleMarkup, $module);

            if (!$echo) {
                return $moduleMarkup;
            }

            echo $moduleMarkup;

            if (!empty($moduleSettings['cache_ttl'])) {
                $cache->stop();
            }
        }

        return true;
    }