diff --git a/framework/control.class.php b/framework/control.class.php index 602d69722a..b937a96342 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -312,6 +312,26 @@ class control extends baseControl chdir($currentPWD); } + /** + * 获取一个方法的输出内容,这样我们可以在一个方法里获取其他模块方法的内容。 + * 如果模块名为空,则调用该模块、该方法;如果设置了模块名,调用指定模块指定方法。 + * + * Get the output of one module's one method as a string, thus in one module's method, can fetch other module's content. + * If the module name is empty, then use the current module and method. If set, use the user defined module and method. + * + * @param string $moduleName module name. + * @param string $methodName method name. + * @param array $params params. + * @access public + * @return string the parsed html. + */ + public function fetch($moduleName = '', $methodName = '', $params = array(), $appName = '') + { + if($moduleName != $this->moduleName) $this->app->fetchModule = $moduleName; + + return parent::fetch($moduleName, $methodName, $params, $appName); + } + /** * Build operate menu of a method. * diff --git a/framework/router.class.php b/framework/router.class.php index 456845c4cc..2ce88d9cd5 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -46,6 +46,15 @@ class router extends baseRouter */ public $isFlow = false; + /** + * Fetch的模块名。 + * The fetched module name. + * + * @var string + * @access public + */ + public $fetchModule; + /** * Get the $moduleRoot var. * diff --git a/lib/dao/dao.class.php b/lib/dao/dao.class.php index 537484e1a5..0695c65d0d 100644 --- a/lib/dao/dao.class.php +++ b/lib/dao/dao.class.php @@ -48,7 +48,7 @@ class dao extends baseDAO /* Check current module is buildin workflow. */ if(isset($config->workflow->buildin->modules)) { - $currentModule = $app->rawModule; + $currentModule = $app->fetchModule ? $app->fetchModule : $app->rawModule; foreach($config->workflow->buildin->modules as $appModules) { if(!empty($appModules->$currentModule)) diff --git a/lib/filter/filter.class.php b/lib/filter/filter.class.php index fbf1775f0c..269176ae6f 100644 --- a/lib/filter/filter.class.php +++ b/lib/filter/filter.class.php @@ -51,7 +51,7 @@ class fixer extends baseFixer { global $app, $dbh; $flowFields = array(); - $moduleName = $app->rawModule; + $moduleName = $app->fetchModule ? $app->fetchModule : $app->rawModule; $stmt = $dbh->query("SELECT * FROM " . TABLE_WORKFLOWFIELD . " WHERE `module` = '{$moduleName}' and `buildin` = '0'"); while($flowField = $stmt->fetch()) $flowFields[$flowField->field] = $flowField;