本文整理匯總了PHP中factory::getModule方法的典型用法代碼示例。如果您正苦於以下問題:PHP factory::getModule方法的具體用法?PHP factory::getModule怎麽用?PHP factory::getModule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類factory
的用法示例。
在下文中一共展示了factory::getModule方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initModule
/**
* Init the module requested
*/
private static function initModule() {
if (!self::$module) {
self::$module = factory::getModule(self::$uriInfo['module'], array(), self::$scaffold, self::$cfg->allowScaffold);
if (self::$module instanceof module_scaffold_controller && !self::$cfg->allowScaffold) {
// Need to test if the action was expressly defined
$ref = new nReflection();
$className = 'module_'.self::$uriInfo['module'].'_controller';
$prefix = null;
$action = self::$uriInfo['action'];
if (array_key_exists(NYROENV, self::$module->getCfg()->basicPrefixExec) &&
in_array($action, self::$module->getCfg()->getInArray('basicPrefixExec', NYROENV)))
$prefix = ucfirst(NYROENV);
else if (self::$module->getCfg()->prefixExec && !in_array($action, self::$module->getCfg()->noPrefixExec))
$prefix = self::$module->getCfg()->prefixExec;
$exec = 'exec'.$prefix.ucFirst($action);
if ($ref->rebuild($className)) {
if ($ref->getMethod($exec)->getDeclaringClass()->name != $className)
throw new module_exception('Request - initModule: '.self::$uriInfo['module'].'.'.$exec.' not found.');
}
}
if (self::$scaffold) {
self::$uriInfo['moduleScaffold'] = self::$uriInfo['module'];
self::$uriInfo['module'] = 'scaffold';
}
}
}
示例2: afterInit
protected function afterInit() {
$t = factory::get('tpl');
$this->module = factory::getModule(request::get('module'));
nReflection::callMethod($this->module, request::get('action').'Action', request::get('param'));
}
示例3: render
/**
* Render an other tpl. To be used inside the tpl
*
* @param array $prm Possibile keys:
* - string module Module to used (default: module used for the current tpl)
* - string action Action to call
* - other parameters must be used for the call to the module_abstract::exec method or module_abstract::publish
*/
public function render($prm) {
if (!is_array($prm)){
$tmp = explode('/', $prm);
$prm = array();
$prm['module'] = isset($tmp[0]) ? $tmp[0] : null;
$prm['action'] = isset($tmp[1]) ? $tmp[1] : null;
$prm['param'] = isset($tmp[2]) ? $tmp[2] : null;
}
$prm = array_merge(array('module'=>$this->cfg->module), $prm);
$module = factory::getModule($prm['module'], array('render'=>true));
$module->exec($prm);
return $module->publish($prm);
}