Get the module controller instance for a specific refpath in a page
@param {String} pageId Page identifier
@param {String} moduleId Module's refpath as specified in the configuration
@return {aria.template.ModuleCtrl} Instance of module controller
489795
function (pageId, moduleId) {
            var isCommon = (moduleId.indexOf("common:") != -1);
            var refpath = this.buildModuleRefpath(moduleId.replace(/^common:/, ""), isCommon, pageId);
            return this._utils.resolvePath(refpath, this);
        }
1072893
@Nullable
    final Controller findController(@NonNull String instanceId) {
        if (this.instanceId.equals(instanceId)) {
            return this;
        }

        for (Router router : childRouters) {
            Controller matchingChild = router.getControllerWithInstanceId(instanceId);
            if (matchingChild != null) {
                return matchingChild;
            }
        }
        return null;
    }
261847
function (pageRequest) {
            var map = this.__urlMap.urlToPageId, pageId = pageRequest.pageId, url = pageRequest.url;
            if (pageId) {
                return pageId;
            }
            if (url) {
                var returnUrl = map[url] || map[url + "/"] || map[url.replace(/\/$/, "")];
                if (returnUrl) {
                    return returnUrl;
                }
            }
            return this.__config.homePageId;
        }
943647
function (filePath) {
        var name = ES6ModuleFile.prototype.getModuleName.apply(this, arguments);

        if (_.isFunction(this.opts.moduleName)) {
            name = this.opts.moduleName(name, filePath);
        }

        return name;
    }
1148532
function(refPath) {
		var require = function(relModuleId) {
			var moduleId = resolveModuleId(relModuleId, refPath),
				module = getModule(moduleId);

			if (!module) {
				throw "Module not loaded";
			}
			else if (module.error) {
				throw "Error loading module";
			}

			if (!module.exports) {
				module.exports = {};
				var moduleDir = moduleId.substring(0, moduleId.lastIndexOf('/')+1),
					injects = module.injects,
					args = [];

				for (var i = 0, n = injects.length; i<n; i++) {
					if (injects[i] == 'require') {
						args.push(createRequireFunc(moduleDir));
					}
					else if (injects[i] == 'exports') {
						args.push(module.exports);
					}
					else if (injects[i] == 'module') {
						args.push(module.module);
					}
				}

				module.factory.apply(null, args);
			}
			return module.exports;
		};

		require.ensure = function(deps, cb) {
			ensureImpl(deps, cb, refPath);
		};

		if (_mainProgram != null) {
			require.main = getModule(_mainProgram).module;
		}

		return require;
	}
541549
static function instance( $module_id, $module_type, $module_unique_affix ) {
			$key = 'm_' . $module_id;

			if ( ! isset( self::$_instances[ $key ] ) ) {
				self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
			}

			return self::$_instances[ $key ];
		}
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);
    }
1335923
function () {
            var tplcfg = this._tplcfg;
            if (!tplcfg) {
                // the module controller may arrive after the widget has been disposed
                // do nothing in this case
                return;
            }
            if (this._needCreatingModuleCtrl) {
                // initialize the module controller
                var moduleCtrl = this._cfg.moduleCtrl;
                aria.templates.ModuleCtrlFactory.createModuleCtrl(moduleCtrl, {
                    fn : this._onTplLoad,
                    scope : this,
                    args : {
                        autoDispose : moduleCtrl.autoDispose
                    }
                });
            } else {
                this._onTplLoad({
                    moduleCtrl : tplcfg.moduleCtrl
                }, {
                        autoDispose : false
                    });
            }
        }
547179
function(moduleName) {
		var fs = require("fs");
		var ret = false;
    	var dirSeparator = require("path").sep
    	module.paths.forEach(function(nodeModulesPath) {
        	if(fs.existsSync(nodeModulesPath + dirSeparator + moduleName) === true) {
            	ret = true;
            	return false;
        	}
    	});
    	return ret;
	}
1055354
public DbModule getModule(final String moduleId) {
        final DbModule dbModule = repositoryHandler.getModule(moduleId);

        if (dbModule == null) {
            throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
                    .entity("Module " + moduleId + " does not exist.").build());
        }

        return dbModule;
    }
469855
public static function view_page($pageid) {
        global $DB, $CFG;
        require_once($CFG->dirroot . "/mod/page/lib.php");

        $params = self::validate_parameters(self::view_page_parameters(),
                                            array(
                                                'pageid' => $pageid
                                            ));
        $warnings = array();

        // Request and permission validation.
        $page = $DB->get_record('page', array('id' => $params['pageid']), '*', MUST_EXIST);
        list($course, $cm) = get_course_and_cm_from_instance($page, 'page');

        $context = context_module::instance($cm->id);
        self::validate_context($context);

        require_capability('mod/page:view', $context);

        // Call the page/lib API.
        page_view($page, $course, $cm, $context);

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
547832
function View_setModulesViewsPath(dir) {
            var list, name, moduleToLoad, LoadedModule, moduleInstance;
            if (this.isDir(dir)) {
                list = this.readDir(dir);
                while (true) {
                    name = list.shift();

                    if (!name) {
                        break;
                    }

                    moduleToLoad = dir + '/' + name;

                    try {
                        LoadedModule = di.load(moduleToLoad);
                    } catch (e) {
                        throw new error.HttpError(500, {path: moduleToLoad}, 'Missing module', e);
                    }

                    if (!Type.assert(Type.FUNCTION, LoadedModule)) {
                        throw new error.HttpError(500, {path: moduleToLoad}, 'Module must be function type');
                    }

                    moduleInstance = new LoadedModule(name);

                    if (!(moduleInstance instanceof ModuleInterface)) {
                        throw new error.HttpError(500, moduleInstance, 'Module must be instance of ModuleInterface "core/module"');
                    }

                    this.normalizers.push(moduleInstance.getViewsPath());

                    this.config.themes.forEach(function (name) {
                        this.paths.push(moduleInstance.getViewsPath() + name + '/');
                    }.bind(this));
                }

            }
        }
1317885
public static String getModuleVersion(final String moduleId) {
        final int splitter = moduleId.lastIndexOf(':');
        if(splitter == -1){
            return moduleId;
        }
        return moduleId.substring(splitter+1);
    }
141427
function resolveInstanceById(refId){
  var templateId = refId & 0xFFF;
  var instanceId = refId >> 12;
  var templateInfo = templates[templateId];

  return templateInfo && templateInfo.instances[instanceId];
}
1060792
function(parentModule, kbox, id, app, callback) {

  if (typeof callback === 'undefined' && typeof app === 'function') {
    callback = app;
    app = undefined;
  }

  // Try to load module from node_modules and other directories.
  var parts = id.split('@');
  var pkg = parts[0];
  //var ver = parts[1];

  // Try to load module.
  return requireFromNodeModulesAndOtherDirs(parentModule, kbox, pkg, app)
  // Return.
  .nodeify(callback);

}
1028868
function requireWrapper(baseModule, moduleId)
{
  var componentPath
      // translate module to path alias
    , modulePath = this.checkPath(moduleId)
      // get first part of the module path
    , component = (modulePath || '').split('/')[0]
    ;

  // shortcut for `empty:` path
  if (modulePath == 'empty:')
  {
    return {};
  }

  // check if name and path belong to the app or to node_modules
  if (component && component[0] != '.')
  {
    // - existing file vs. node_modules case
    if (component == modulePath)
    {
      componentPath = path.resolve(this.basePath, modulePath + '.js');
    }
    // - existing folder vs. node_modules member case
    else
    {
      componentPath = path.resolve(this.basePath, component);
    }

    if (fs.existsSync(componentPath))
    {
      // everything fits nicely, get the full thing
      // file might not exist at this point
      // but its legit developer's error
      modulePath = path.resolve(this.basePath, modulePath);
    }
  }

  if (this.disableCache)
  {
    delete require.cache[require.resolve(modulePath)];
  }

  return baseModule.require(modulePath);
}
102829
public static function get_blockids_from_moduleid($moduleid) {
        global $DB;

        // Get the context of the module
        $contextid = context_module::instance($moduleid)->id;

        // Get all the block instances which parentcontextid is the module contextid
        $blockids = array();
        $instances = $DB->get_records('block_instances', array('parentcontextid' => $contextid), '', 'id');
        foreach ($instances as $instance) {
            $blockids[] = $instance->id;
        }
        return $blockids;
    }