Sets the Controller for each module
435227
public function setController(AController $controller) {
        if (count(self::$_modules) > 0) {
            foreach (self::$_modules as $module) {
                $module->setController($controller);
            }
        }
    }
1177960
protected function setModuleEditor($module_id)
    {
        $this->data_module = $this->module->get($module_id);

        if (empty($this->data_module)) {
            $this->outputHttpStatus(404);
        }

        if ($this->data_module['type'] !== 'theme') {
            $this->outputHttpStatus(403);
        }
    }
1366254
static function getController($module_name,$controller_name,$request,$view) {
        static $ctrls = NULL;
        $module_name  = strtolower($module_name);
        $controller_name = strtolower($controller_name);
        if (!$ctrls[$module_name][$controller_name]) {
            $controller = ucfirst($controller_name) . 'Controller';
            $controller_class = '\\' . self::getName() . '\\Controller\\' . ucfirst($module_name) . '\\' . $controller;
            if (!class_exists($controller_class)) {
                throw new Controller\NoControllerException;
            }
            $c = new $controller_class($request,$view);
            $ctrls[$module_name][$controller_name] = $c;
        }
        return $ctrls[$module_name][$controller_name];
    }
1328922
private function _setModule()
	{
		if (preg_match('/^[a-z0-9_-]+$/', $this->_requestVars[0])) {
			$this->_module = $this->_requestVars[0];
        } else {
        	$this->_module = $this->_requestVars[0] = self::DEFAULT_MODULE;
        }

        return $this;
	}
1252288
public function prepareController()
    {
        // Do the layout switch here, when view is set the layout can still be changed, but
        // Bootstrap can no longer be switched on/off
        if ($this instanceof \Gems_Project_Layout_MultiLayoutInterface) {
            $this->layoutSwitch();
        }

        if ($this->useBootstrap) {
            $bootstrap = \MUtil_Bootstrap::bootstrap(array('fontawesome' => true));
            \MUtil_Bootstrap::enableView($this->view);
        }

        if (\MUtil_Console::isConsole()) {
            /* @var $layout \Zend_Layout */
            $layout = $this->view->layout();

            $layout->setLayoutPath(GEMS_LIBRARY_DIR . "/layouts/scripts");
            $layout->setLayout('cli');
        }
    }
1199254
private function controller($module, $controller, $injetion = null) {

        // Check if exist
        if(class_exists($namespace = 'App\\Modules\\' . ucfirst($module) . '\\Controllers\\' . $controller)) {

            return (new $namespace($injetion));
        }
    }
1289462
protected function setModuleAssets(Controller $controller)
    {
        $controller->addAssetLibrary('jquery_mobile');
        $controller->setJs(__DIR__ . '/js/common.js');
        $controller->setCss(__DIR__ . '/css/common.css');
    }
463622
protected function setControllerView()
    {
        if (View::exists($this->className)) {
            $this->controllerView = new View($this->className);
        } else {
            $this->controllerView = new View\Template('{@content}');
        }
    }
1028968
function registerControllers (ModuleInfo $moduleInfo, array $mappings)
  {
    $ctr =& $this->controllers;
    foreach ($mappings as $path => $class) {
      $path       = "$moduleInfo->path/{$this->viewEngineSettings->moduleViewsPath()}/$path";
      $ctr[$path] = $class;
    }
    return $this;
  }
116016
protected function setModuleAssets($controller)
    {
        if ($controller->path('^admin/tool/editor') && $this->module->isEnabled('codemirror')) {
            $this->getCodemirrorModule()->addLibrary($controller);
            $controller->setJs('system/modules/editor/js/common.js');
        }
    }
492279
private function getRawAndModuleControllers($controller, $module) {
        if ('/' == $module || '' == $module) {
            $rController = $controller;
            $allController = '*';
        } elseif (null === $module) {
            $rController = \mpf\WebApp::get()->request()->getModule() . '/' . $controller;
            $allController = \mpf\WebApp::get()->request()->getModule() . '/*';
        } else {
            $rController = $module . '/' . $controller;
            $allController = $module . '/*';
        }
        return array($rController, $allController);
    }
1014661
def set_controller_value(self, index_or_name, value):
        
        if not isinstance(index_or_name, int):
            index = self.get_controller_index(index_or_name)
        else:
            index = index_or_name
        self.dll.SetControllerValue(index, ctypes.c_float(value))
964931
private function setRoutes()
    {
        foreach($this->myModules as $module) {
            $scModule = snake_case( $module, '-' );
            $subModules = config("{$scModule}.permissions");
            if ( ! is_null($subModules)) {
                foreach($subModules as $sub => $routes) {
                    $hasRoutes = array_filter(array_keys($routes['routes']),function($item)
                    {
                        return hasPermission($item);
                    });
                    if(count($hasRoutes) > 0) {
                        $this->routes[$scModule . '_' . $sub] = $routes;
                    }
                }
            }
        }
    }
798935
function(controller, callback) {

            // Add the given name to the controller
            controller.name = name;
            controller.module = module;

            // Set default value on the controller instance
            controller.basePath = self.getBasePath(
                controller, path, module
            );

            // Add the canonical path
            controller.canonicalPath = self.getCanonicalPath(
                path, name, module
            );

            callback(null, controller);
        }
898083
public function setController(Controller $controller)
    {
        $this->_Controller = $controller;
        $this->setEventManager($controller->getEventManager());
    }
1209679
function loadControllers() {
  
  // Note: runs on app context
  
  // Get controllers/
  var cpath = this.mvcpath + 'controllers/',
      files = protos.util.getFiles(cpath);

  // Create controllers and attach to app
  var controllerCtor = protos.lib.controller;
  for (var controller, key, file, instance, className, Ctor, i=0; i < files.length; i++) {
    file = files[i];
    key = file.replace(this.regex.jsFile, '');
    className = file.replace(this.regex.jsFile, '');
    Ctor = protos.require(cpath + className, true); // Don't use module cache (allow reloading)
    Ctor = createControllerFunction.call(this, Ctor);
    instance = new Ctor(this);
    instance.className = instance.constructor.name;
    this.controllers[key.replace(/_controller$/, '')] = instance;
  }

  this.controller = this.controllers.main;
  
  this.emit('controllers_loaded', this.controllers);

}
1199915
def make_controller(cls, config, session, left_menu_items=None):
        """"""
        m = config.model
        Controller = config.defaultCrudRestController

        class ModelController(Controller):
            model        = m
            table        = config.table_type(session)
            table_filler = config.table_filler_type(session)
            new_form     = config.new_form_type(session)
            new_filler   = config.new_filler_type(session)
            edit_form    = config.edit_form_type(session)
            edit_filler  = config.edit_filler_type(session)
            allow_only   = config.allow_only

            if hasattr(config.layout, 'crud_resources'):
                resources = config.layout.crud_resources

            def _before(self, *args, **kw):
                super(self.__class__, self)._before(*args, **kw)

                tmpl_context.make_pager_args = make_pager_args

                if request.response_type not in ('application/json',):
                    default_renderer = AdminController._get_default_renderer()
                    for action in ('get_all', 'new', 'edit'):
                        for template in config.layout.crud_templates.get(action, []):
                            if template.startswith(default_renderer):
                                override_template(getattr(self, action), template)

        return ModelController(session, left_menu_items)