From eb0e938e3b6fcf2050b0c150a4875cffa0fc0986 Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 11 Mar 2024 07:31:06 +0000 Subject: [PATCH] * Add createManageLink function fot subject browse. --- module/tree/model.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/module/tree/model.php b/module/tree/model.php index 1bfc7de000..18966b62e8 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1198,6 +1198,32 @@ class treeModel extends model return $data; } + /** + * Create the manage link of a module. + * + * @param string $type + * @param object $module + * @access public + * @return object + */ + public function createManageLink(string $type, object $module): object + { + static $users; + if(empty($users)) $users = $this->loadModel('user')->getPairs('noletter'); + + $name = $module->name; + if(strpos('bug,case', $type) !== false) $name .= '[' . strtoupper(substr($type, 0, 1)) . ']'; + if($type == 'bug' && $module->owner) $name .= '[' . $users[$module->owner] . ']'; + + $data = new stdclass(); + $data->id = (string)$module->id; + $data->parent = (string)$module->parent; + $data->name = $name; + $data->url = helper::createLink('subject', 'browse', "currentModuleID={$module->id}"); + + return $data; + } + /** * 设置Bug模块树的点击链接。 * Click link to set Bug module tree.