本文整理汇总了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);
}