* Refactor my::feedback.

This commit is contained in:
liumengyi
2023-11-23 15:27:34 +08:00
parent 8e53b60ce6
commit 93c8e4207d
2 changed files with 79 additions and 61 deletions
+15 -61
View File
@@ -1095,7 +1095,8 @@ EOF;
}
/**
* Feedback .
* 反馈列表。
* Feedback list.
*
* @param string $browseType
* @param int $param
@@ -1106,67 +1107,25 @@ EOF;
* @access public
* @return void
*/
public function feedback($browseType = 'assigntome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function feedback(string $browseType = 'assigntome', int $param = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
{
$this->loadModel('feedback');
$this->session->set('feedbackList', $this->app->getURI(true), 'feedback');
$queryID = $browseType == 'bysearch' ? (int)$param : 0;
$this->app->loadClass('pager', true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$feedbacks = $browseType != 'bysearch' ?$this->loadModel('feedback')->getList($browseType, $orderBy, $pager) : $this->loadModel('feedback')->getBySearch($queryID, $orderBy, $pager);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'workFeedback');
$this->myZen->assignRelatedData($feedbacks);
$this->myZen->buildSearchFormForFeedback($queryID, $orderBy);
$this->loadModel('datatable');
$this->lang->datatable->moduleSetting = str_replace($this->lang->module, $this->lang->feedback->moduleAB, $this->lang->datatable->moduleSetting);
$this->lang->datatable->showModule = str_replace($this->lang->module, $this->lang->feedback->moduleAB, $this->lang->datatable->showModule);
$this->lang->datatable->showModuleList = str_replace($this->lang->module, $this->lang->feedback->moduleAB, $this->lang->datatable->showModuleList);
$this->session->set('feedbackList', $this->app->getURI(true), 'feedback');
$queryID = $browseType == 'bysearch' ? (int)$param : 0;
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
if($browseType != 'bysearch')
{
$feedbacks = $this->feedback->getList($browseType, $orderBy, $pager);
}
else
{
$feedbacks = $this->feedback->getBySearch($queryID, $orderBy, $pager);
}
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'workFeedback');
$storyIdList = $bugIdList = $todoIdList = $taskIdList = $ticketIdList = array();
foreach($feedbacks as $feedback)
{
if($feedback->solution == 'tobug') $bugIdList[] = $feedback->result;
if($feedback->solution == 'tostory') $storyIdList[] = $feedback->result;
if($feedback->solution == 'totodo') $todoIdList[] = $feedback->result;
if($feedback->solution == 'totask') $taskIdList[] = $feedback->result;
if($feedback->solution == 'ticket') $ticketIdList[] = $feedback->result;
}
$bugs = $bugIdList ? $this->loadModel('bug')->getByIdList($bugIdList) : array();
$stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array();
$todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array();
$tasks = $taskIdList ? $this->loadModel('task')->getByIdList($taskIdList) : array();
$tickets = $ticketIdList ? $this->loadModel('ticket')->getByList($ticketIdList) : array();
$products = $this->loadModel('product')->getPairs();
$this->config->feedback->search['module'] = 'workFeedback';
$this->config->feedback->search['actionURL'] = inlink('work', "mode=feedback&browseType=bysearch&param=myQueryID&orderBy=$orderBy");
$this->config->feedback->search['queryID'] = $queryID;
$this->config->feedback->search['onMenuBar'] = 'no';
$this->config->feedback->search['params']['product']['values'] = $products;
$this->config->feedback->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu(0, $viewType = 'feedback', $startModuleID = 0);
$this->config->feedback->search['params']['processedBy']['values'] = $this->feedback->getFeedbackPairs('admin');
unset($this->config->feedback->search['fields']['assignedTo']);
unset($this->config->feedback->search['fields']['closedBy']);
unset($this->config->feedback->search['fields']['closedDate']);
unset($this->config->feedback->search['fields']['closedReason']);
unset($this->config->feedback->search['fields']['processedBy']);
unset($this->config->feedback->search['fields']['processedDate']);
unset($this->config->feedback->search['fields']['solution']);
$this->loadModel('search')->setSearchParams($this->config->feedback->search);
$this->view->title = $this->lang->my->feedback;
$this->view->mode = 'feedback';
$this->view->browseType = $browseType;
@@ -1174,17 +1133,12 @@ EOF;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->view->param = $param;
$this->view->bugs = $bugs;
$this->view->todos = $todos;
$this->view->stories = $stories;
$this->view->tasks = $tasks;
$this->view->tickets = $tickets;
$this->view->depts = $this->dept->getOptionMenu();
$this->view->users = $this->user->getPairs('noletter|nodeleted|noclosed');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0, 'noclosed');
$this->view->allProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->fetchPairs('id', 'name');
$this->view->modulePairs = $this->tree->getModulePairs(0, 'feedback');
$this->view->modules = $this->tree->getOptionMenu(0, $viewType = 'feedback', 0);
$this->view->modules = $this->tree->getOptionMenu(0, 'feedback', 0);
$this->display();
}