diff --git a/module/bug/control.php b/module/bug/control.php index ec20d19324..62ecf4664c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -13,7 +13,12 @@ class bug extends control { private $products = array(); - /* 构造函数,加载story, release, tree等模块。*/ + /** + * Construct function, load some modules auto. + * + * @access public + * @return void + */ public function __construct() { parent::__construct(); @@ -32,26 +37,43 @@ class bug extends control $this->view->products = $this->products; } - /* bug首页。*/ + /** + * The index page, locate to browse. + * + * @access public + * @return void + */ public function index() { $this->locate($this->createLink('bug', 'browse')); } - /* 浏览一个产品下面的bug。*/ + /** + * Browse bugs. + * + * @param int $productID + * @param string $browseType + * @param int $param + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - /* 设置产品id和模块id。*/ + /* Set browseType, productID, moduleID and queryID. */ $browseType = strtolower($browseType); $productID = $this->product->saveState($productID, key($this->products)); $moduleID = ($browseType == 'bymodule') ? (int)$param : 0; $queryID = ($browseType == 'bysearch') ? (int)$param : 0; - /* 设置菜单,登记session。*/ + /* Set menu and save session. */ $this->bug->setMenu($this->products, $productID); $this->session->set('bugList', $this->app->getURI(true)); - /* 加载分页类。*/ + /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); @@ -131,13 +153,13 @@ class bug extends control { if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1'); } - $bugQuery = str_replace("`product` = 'all'", '1', $this->session->bugQuery); // 如果指定了搜索所有的产品,去掉这个查询条件。 + $bugQuery = str_replace("`product` = 'all'", '1', $this->session->bugQuery); // Search all product. $bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery) ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); } - /* 处理查询语句,获取条件部分,并记录session。需求待确认的,不参与报表统计。*/ + /* Process the sql, get the conditon partion, save it to session. Thus the report page can use the same condition. */ if($browseType != 'needconfirm') { $sql = explode('WHERE', $this->dao->get()); @@ -145,7 +167,7 @@ class bug extends control $this->session->set('bugReportCondition', $sql[0]); } - /* 设置搜索表单。*/ + /* Build the search form. */ $this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID"); $this->config->bug->search['queryID'] = $queryID; $this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct); @@ -157,7 +179,7 @@ class bug extends control $users = $this->user->getPairs('noletter'); - /* 设置自定义字段。*/ + /* Get custome fields. */ $customFields = $this->cookie->bugFields != false ? $this->cookie->bugFields : $this->config->bug->list->defaultFields; $customed = !($customFields == $this->config->bug->list->defaultFields); @@ -183,7 +205,15 @@ class bug extends control $this->display(); } - /* 统计报表。*/ + /** + * The report page. + * + * @param int $productID + * @param string $browseType + * @param int $moduleID + * @access public + * @return void + */ public function report($productID, $browseType, $moduleID) { $this->loadModel('report'); @@ -215,7 +245,14 @@ class bug extends control $this->display(); } - /* 创建Bug。extras是其他的参数,key和value之间使用=连接,多个键值对之间使用,隔开。*/ + /** + * Create a bug. + * + * @param int $productID + * @param string $extras others params, forexample, projectID=10,moduleID=10 + * @access public + * @return void + */ public function create($productID, $extras = '') { if(empty($this->products)) $this->locate($this->createLink('product', 'create')); @@ -229,16 +266,16 @@ class bug extends control die(js::locate($this->createLink('bug', 'browse', "productID={$this->post->product}&type=byModule¶m={$this->post->module}"), 'parent')); } - /* 设置当前的产品,设置菜单。*/ + /* Get product, then set menu. */ $productID = $this->product->saveState($productID, key($this->products)); $this->bug->setMenu($this->products, $productID); - /* 去掉几个类型的设置。*/ + /* Remove the unused types. */ unset($this->lang->bug->typeList['designchange']); unset($this->lang->bug->typeList['newfeature']); unset($this->lang->bug->typeList['trackthings']); - /* 初始化变量。*/ + /* Init vars. */ $moduleID = 0; $projectID = 0; $taskID = 0; @@ -254,13 +291,15 @@ class bug extends control $mailto = ''; $keywords = ''; - /* 解析extra参数。*/ + /* Parse the extras. */ $extras = str_replace(array(',', ' '), array('&', ''), $extras); parse_str($extras); - /* 如果设置了runID,获得最后一次的resultID。*/ + /* If set runID, get the last result info as the template. */ if($runID > 0) $resultID = $this->dao->select('id')->from(TABLE_TESTRESULT)->where('run')->eq($runID)->orderBy('id desc')->limit(1)->fetch('id'); if(isset($resultID) and $resultID > 0) extract($this->bug->getBugInfoFromResult($resultID)); + + /* If bugID setted, use this bug as template. */ if(isset($bugID)) { $bug = $this->bug->getById($bugID); @@ -272,7 +311,7 @@ class bug extends control $buildID = $bug->openedBuild; } - /* 如果指定了项目,则查找项目范围内的build和story。*/ + /* If projectID is setted, get builds and stories of this project. */ if($projectID) { $builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty'); @@ -284,7 +323,6 @@ class bug extends control $stories = $this->story->getProductStoryPairs($productID); } - /* 位置信息。*/ $this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->create; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->bug->create; @@ -314,25 +352,32 @@ class bug extends control $this->display(); } - /* 查看一个bug。*/ + /** + * View a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function view($bugID) { - /* 查找bug信息及相关产品信息。*/ + /* Judge bug exits or not. */ $bug = $this->bug->getById($bugID); if(!$bug) die(js::error($this->lang->notFound) . js::locate('back')); + /* Get product info. */ $productID = $bug->product; $productName = $this->products[$productID]; - /* 设置菜单。*/ + /* Set menu. */ $this->bug->setMenu($this->products, $productID); - /* 位置信息。*/ + /* Header and positon. */ $this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->view; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName); $this->view->position[] = $this->lang->bug->view; - /* 赋值。*/ + /* Assign. */ $this->view->productID = $productID; $this->view->productName = $productName; $this->view->modulePath = $this->tree->getParents($bug->module); @@ -344,10 +389,15 @@ class bug extends control $this->display(); } - /* 编辑一个Bug。*/ + /** + * Edit a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function edit($bugID) { - /* 更新bug信息。*/ if(!empty($_POST)) { $changes = $this->bug->update($bugID); @@ -365,25 +415,28 @@ class bug extends control die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - /* 查找当前bug信息和产品模块信息。*/ + /* Get the info of bug, current product and modue. */ $bug = $this->bug->getById($bugID); $productID = $bug->product; $currentModuleID = $bug->module; - /* 修改类型的配置。*/ + /** + * Remove designchange, newfeature, trackings from the typeList, because should be tracked in story or task. + * These thress types if upgrade from bugfree2.x. + */ if($bug->type != 'designchange') unset($this->lang->bug->typeList['designchange']); if($bug->type != 'newfeature') unset($this->lang->bug->typeList['newfeature']); if($bug->type != 'trackthings') unset($this->lang->bug->typeList['trackthings']); - /* 设置菜单。*/ + /* Set the menu. */ $this->bug->setMenu($this->products, $productID); - /* 位置。*/ + /* Set header and position. */ $this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->edit; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->bug->edit; - /* 赋值。*/ + /* Assign. */ $this->view->bug = $bug; $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; @@ -401,10 +454,15 @@ class bug extends control $this->display(); } - /* 解决bug。*/ + /** + * Resolve a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function resolve($bugID) { - /* 更新bug信息。*/ if(!empty($_POST)) { $this->bug->resolve($bugID); @@ -414,19 +472,14 @@ class bug extends control die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - /* 查找bug和产品信息。*/ $bug = $this->bug->getById($bugID); $productID = $bug->product; - - /* 设置菜单。*/ $this->bug->setMenu($this->products, $productID); - /* 位置。*/ $this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->bug->resolve; - /* 赋值。*/ $this->view->bug = $bug; $this->view->users = $this->user->getPairs('nodeleted'); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); @@ -434,10 +487,15 @@ class bug extends control $this->display(); } - /* 激活bug。*/ + /** + * Activate a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function activate($bugID) { - /* 更新bug信息。*/ if(!empty($_POST)) { $this->bug->activate($bugID); @@ -448,19 +506,14 @@ class bug extends control die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - /* 获得bug和产品信息。*/ $bug = $this->bug->getById($bugID); $productID = $bug->product; - - /* 设置菜单。*/ $this->bug->setMenu($this->products, $productID); - /* 当前位置。*/ $this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->activate; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->bug->activate; - /* 赋值。*/ $this->view->bug = $bug; $this->view->users = $this->user->getPairs('nodeleted'); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); @@ -469,10 +522,15 @@ class bug extends control $this->display(); } - /* 激活bug。*/ + /** + * Close a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function close($bugID) { - /* 更新bug信息。*/ if(!empty($_POST)) { $this->bug->close($bugID); @@ -482,11 +540,8 @@ class bug extends control die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - /* bug和产品信息。*/ $bug = $this->bug->getById($bugID); $productID = $bug->product; - - /* 设置菜单。*/ $this->bug->setMenu($this->products, $productID); $this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->close; @@ -499,7 +554,13 @@ class bug extends control $this->display(); } - /* 确认需求变动。*/ + /** + * Confirm story change. + * + * @param int $bugID + * @access public + * @return void + */ public function confirmStoryChange($bugID) { $bug = $this->bug->getById($bugID); @@ -508,7 +569,14 @@ class bug extends control die(js::reload('parent')); } - /* 删除bug。*/ + /** + * Delete a bug. + * + * @param int $bugID + * @param string $confirm yes|no + * @access public + * @return void + */ public function delete($bugID, $confirm = 'no') { if($confirm == 'no') @@ -522,7 +590,12 @@ class bug extends control } } - /* 保存模板。*/ + /** + * Save current template. + * + * @access public + * @return string + */ public function saveTemplate() { $this->bug->saveUserBugTemplate(); @@ -530,21 +603,37 @@ class bug extends control die($this->fetch('bug', 'buildTemplates')); } - /* 生成模板选择页面。*/ + /** + * Build the user templates selection code. + * + * @access public + * @return void + */ public function buildTemplates() { $this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account); $this->display('bug', 'buildTemplates'); } - /* 删除一个bug模板。*/ + /** + * Delete a user template. + * + * @param int $templateID + * @access public + * @return void + */ public function deleteTemplate($templateID) { $this->dao->delete()->from(TABLE_USERTPL)->where('id')->eq($templateID)->andWhere('account')->eq($this->app->user->account)->exec(); die(); } - /* 自定义显示字段。*/ + /** + * Custom fields. + * + * @access public + * @return void + */ public function customFields() { if($_POST) @@ -554,7 +643,7 @@ class bug extends control setcookie('bugFields', $customFields, $this->config->cookieLife); die(js::reload('parent')); } - /* 设定自定义字段列表。*/ + $customFields = $this->cookie->bugFields ? $this->cookie->bugFields : $this->config->bug->list->defaultFields; $this->view->allFields = $this->bug->getFieldPairs($this->config->bug->list->allFields); @@ -563,7 +652,13 @@ class bug extends control die($this->display()); } - /* 获得用户的bug列表。*/ + /** + * AJAX: get bugs of a user in html select. + * + * @param string $account + * @access public + * @return string + */ public function ajaxGetUserBugs($account = '') { if($account == '') $account = $this->app->user->account; @@ -571,17 +666,31 @@ class bug extends control die(html::select('bug', $bugs, '', 'class=select-1')); } - /* 获得模块的默认指派人。*/ + /** + * AJAX: Get bug owner of a module. + * + * @param int $moduleID + * @param int $productID + * @access public + * @return string + */ public function ajaxGetModuleOwner($moduleID, $productID = 0) { if($moduleID) die($this->dao->findByID($moduleID)->from(TABLE_MODULE)->fetch('owner')); die($this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('bugOwner')); } - /* 发送邮件。*/ + /** + * Send email. + * + * @param int $bugID + * @param int $actionID + * @access private + * @return void + */ private function sendmail($bugID, $actionID) { - /* 设定toList和ccList。*/ + /* Set toList and ccList. */ $bug = $this->bug->getByID($bugID); $toList = $bug->assignedTo; $ccList = trim($bug->mailto, ','); @@ -605,18 +714,18 @@ class bug extends control $toList = $bug->resolvedBy; } - /* 获得action信息。*/ + /* Get action info. */ $action = $this->action->getById($actionID); $history = $this->action->getHistory($actionID); $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); if(strtolower($action->action) == 'opened') $action->comment = $bug->steps; - /* 赋值,获得邮件内容。*/ + /* Create the mail content. */ $this->view->bug = $bug; $this->view->action = $action; $mailContent = $this->parse($this->moduleName, 'sendmail'); - /* 发信。*/ + /* Send it. */ $this->loadModel('mail')->send($toList, 'BUG #' . $bug->id . $this->lang->colon . $bug->title, $mailContent, $ccList); if($this->mail->isError()) echo js::error($this->mail->getError()); } diff --git a/module/bug/model.php b/module/bug/model.php index db26526473..70a7ea78b6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -13,24 +13,30 @@ lang->bug->menu as $key => $menu) { - if($key == 'product') - { - common::setMenuVars($this->lang->bug->menu, 'product', $selectHtml . $this->lang->arrow); - } - else - { - common::setMenuVars($this->lang->bug->menu, $key, $productID); - } + $replace = ($key == 'product') ? $selectHtml . $this->lang->arrow : $productID; + common::setMenuVars($this->lang->bug->menu, $key, $replace); } } - /* 创建一个Bug。*/ + /** + * Create a bug. + * + * @access public + * @return int|bool + */ public function create() { $now = helper::now(); @@ -56,7 +62,16 @@ class bugModel extends model return false; } - /* 获得某一个产品,某一个模块下面的所有bug。*/ + /** + * Get bugs of a module. + * + * @param int $productID + * @param string|array $moduleIds + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ public function getModuleBugs($productID, $moduleIds = 0, $orderBy = 'id_desc', $pager = null) { return $this->dao->select('*')->from(TABLE_BUG) @@ -66,7 +81,13 @@ class bugModel extends model ->orderBy($orderBy)->page($pager)->fetchAll(); } - /* 获取一个bug的详细信息。*/ + /** + * Get info of a bug. + * + * @param int $bugID + * @access public + * @return object + */ public function getById($bugID) { $bug = $this->dao->select('t1.*, t2.name AS projectName, t3.title AS storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, t4.name AS taskName') @@ -79,7 +100,7 @@ class bugModel extends model foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = ''; if($bug->mailto) { - $bug->mailto = ltrim(trim($bug->mailto), ','); // 去掉开始的,。 + $bug->mailto = ltrim(trim($bug->mailto), ','); // Remove the first , $bug->mailto = str_replace(' ', '', $bug->mailto); $bug->mailto = rtrim($bug->mailto, ',') . ','; $bug->mailto = str_replace(',', ', ', $bug->mailto); @@ -91,7 +112,13 @@ class bugModel extends model return $bug; } - /* 更新bug信息。*/ + /** + * Update a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function update($bugID) { $oldBug = $this->getById($bugID); @@ -132,7 +159,13 @@ class bugModel extends model if(!dao::isError()) return common::createChanges($oldBug, $bug); } - /* 解决Bug。*/ + /** + * Resolve a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function resolve($bugID) { $oldBug = $this->getById($bugID); @@ -157,7 +190,13 @@ class bugModel extends model ->exec(); } - /* 激活Bug。*/ + /** + * Activate a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function activate($bugID) { $oldBug = $this->getById($bugID); @@ -181,7 +220,13 @@ class bugModel extends model $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); } - /* 关闭Bug。*/ + /** + * Close a bug. + * + * @param int $bugID + * @access public + * @return void + */ public function close($bugID) { $oldBug = $this->getById($bugID); @@ -200,7 +245,13 @@ class bugModel extends model $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); } - /* 从bug列表中提取所有出现过的账户。*/ + /** + * Extract accounts from some bugs. + * + * @param int $bugs + * @access public + * @return array + */ public function extractAccountsFromList($bugs) { $accounts = array(); @@ -215,7 +266,13 @@ class bugModel extends model return array_unique($accounts); } - /* 从一条bug中提取所有出现过的账户。*/ + /** + * Extract accounts from a bug. + * + * @param object $bug + * @access public + * @return array + */ public function extractAccountsFromSingle($bug) { $accounts = array(); @@ -227,7 +284,13 @@ class bugModel extends model return array_unique($accounts); } - /* 获得用户的Bug id=>title列表。*/ + /** + * Get bug pairs of a user. + * + * @param int $account + * @access public + * @return array + */ public function getUserBugPairs($account) { $bugs = array(); @@ -246,7 +309,15 @@ class bugModel extends model return $bugs; } - /* 获得某个项目的bug列表。*/ + /** + * Get bugs of a project. + * + * @param int $projectID + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ public function getProjectBugs($projectID, $orderBy = 'id_desc', $pager = null) { return $this->dao->select('*')->from(TABLE_BUG) @@ -255,7 +326,13 @@ class bugModel extends model ->orderBy($orderBy)->page($pager)->fetchAll(); } - /* 通过某一次测试结果获得bug的标题和步骤。*/ + /** + * Get bug info from a result. + * + * @param int $resultID + * @access public + * @return array + */ public function getBugInfoFromResult($resultID) { $title = ''; @@ -285,7 +362,12 @@ class bugModel extends model return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story); } - /* 按项目统计bug数。*/ + /** + * Get report data of bugs per project + * + * @access public + * @return array + */ public function getDataOfBugsPerProject() { $datas = $this->dao->select('project as name, count(project) as value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('project')->orderBy('value DESC')->fetchAll('name'); @@ -295,7 +377,12 @@ class bugModel extends model return $datas; } - /* 按产品模块统计bug数。*/ + /** + * Get report data of bugs per module + * + * @access public + * @return array + */ public function getDataOfBugsPerModule() { $datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('module')->orderBy('value DESC')->fetchAll('name'); @@ -305,13 +392,23 @@ class bugModel extends model return $datas; } - /* 按bug创建日期统计。*/ + /** + * Get report data of opened bugs per day. + * + * @access public + * @return array + */ public function getDataOfOpenedBugsPerDay() { return $this->dao->select('DATE_FORMAT(openedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('name')->orderBy('openedDate')->fetchAll(); } - /* 按bug解决日期统计。*/ + /** + * Get report data of resolved bugs per day. + * + * @access public + * @return array + */ public function getDataOfResolvedBugsPerDay() { return $this->dao->select('DATE_FORMAT(resolvedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG) @@ -321,7 +418,12 @@ class bugModel extends model ->fetchAll(); } - /* 按bug关闭日期统计。*/ + /** + * Get report data of closed bugs per day. + * + * @access public + * @return array + */ public function getDataOfClosedBugsPerDay() { return $this->dao->select('DATE_FORMAT(closedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG) @@ -330,7 +432,12 @@ class bugModel extends model ->orderBy('closedDate')->fetchAll(); } - /* 按bug创建者统计。*/ + /** + * Get report data of openeded bugs per user. + * + * @access public + * @return array + */ public function getDataOfOpenedBugsPerUser() { $datas = $this->dao->select('openedBy AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); @@ -340,7 +447,12 @@ class bugModel extends model return $datas; } - /* 按bug解决者统计。*/ + /** + * Get report data of resolved bugs per user. + * + * @access public + * @return array + */ public function getDataOfResolvedBugsPerUser() { $datas = $this->dao->select('resolvedBy AS name, COUNT(*) AS value') @@ -354,7 +466,12 @@ class bugModel extends model return $datas; } - /* 按bug关闭者统计。*/ + /** + * Get report data of closed bugs per user. + * + * @access public + * @return array + */ public function getDataOfClosedBugsPerUser() { $datas = $this->dao->select('closedBy AS name, COUNT(*) AS value') @@ -369,7 +486,12 @@ class bugModel extends model return $datas; } - /* 按bug严重程度统计。*/ + /** + * Get report data of bugs per severity. + * + * @access public + * @return array + */ public function getDataOfBugsPerSeverity() { $datas = $this->dao->select('severity AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); @@ -378,7 +500,12 @@ class bugModel extends model return $datas; } - /* 按bug解决方案统计。*/ + /** + * Get report data of bugs per resolution. + * + * @access public + * @return array + */ public function getDataOfBugsPerResolution() { $datas = $this->dao->select('resolution AS name, COUNT(*) AS value') @@ -392,7 +519,12 @@ class bugModel extends model return $datas; } - /* 按bug状态统计。*/ + /** + * Get report data of bugs per status. + * + * @access public + * @return array + */ public function getDataOfBugsPerStatus() { $datas = $this->dao->select('status AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); @@ -401,7 +533,12 @@ class bugModel extends model return $datas; } - /* 按bug类型统计。*/ + /** + * Get report data of bugs per type. + * + * @access public + * @return array + */ public function getDataOfBugsPerType() { $datas = $this->dao->select('type AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->session->bugReportCondition)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); @@ -410,7 +547,12 @@ class bugModel extends model return $datas; } - /* 按assignedTo统计。*/ + /** + * getDataOfBugsPerAssignedTo + * + * @access public + * @return void + */ public function getDataOfBugsPerAssignedTo() { $datas = $this->dao->select('assignedTo AS name, COUNT(*) AS value') @@ -423,13 +565,18 @@ class bugModel extends model return $datas; } - /* 合并公共的chart设置和当前chart的设置。*/ + /** + * Merge the default chart settings and the settings of current chart. + * + * @param string $chartType + * @access public + * @return void + */ public function mergeChartOption($chartType) { $chartOption = $this->lang->bug->report->$chartType; $commonOption = $this->lang->bug->report->options; - /* 设置图表的标题和展示方式。*/ $chartOption->graph->caption = $this->lang->bug->report->charts[$chartType]; if(!isset($chartOption->swf)) $chartOption->swf = $commonOption->swf; if(!isset($chartOption->width)) $chartOption->width = $commonOption->width; @@ -439,7 +586,13 @@ class bugModel extends model foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value; } - /* 获得用户的Bug模板列表。*/ + /** + * Get bug templates of a user. + * + * @param string $account + * @access public + * @return array + */ public function getUserBugTemplates($account) { $templates = $this->dao->select('id, title, content') @@ -450,7 +603,12 @@ class bugModel extends model return $templates; } - /* 保存用户的BUG模板。*/ + /** + * Save user template. + * + * @access public + * @return void + */ public function saveUserBugTemplate() { $template = fixer::input('post') @@ -461,7 +619,13 @@ class bugModel extends model $this->dao->insert(TABLE_USERTPL)->data($template)->autoCheck('title, content', 'notempty')->check('title', 'unique')->exec(); } - /* 给一个字段的列表,返回字段和相应语言解释的键值对。*/ + /** + * Return the file => label pairs of some fields. + * + * @param string $fields + * @access public + * @return array + */ public function getFieldPairs($fields) { $fields = explode(',', $fields);