* Add fetchModule to distinguish rawModule.

This commit is contained in:
daitingting
2022-07-06 08:42:21 +00:00
parent 5aabaa4c1e
commit e06b64e997
4 changed files with 31 additions and 2 deletions
+20
View File
@@ -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.
*
+9
View File
@@ -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.
*
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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;