| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616 |
- <?php
- /**
- * The control file of dashboard module of ZenTaoPMS.
- *
- * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
- * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
- * @author Chunsheng Wang <chunsheng@cnezsoft.com>
- * @package dashboard
- * @version $Id: control.php 5020 2013-07-05 02:03:26Z wyd621@gmail.com $
- * @link https://www.zentao.net
- */
- class my extends control
- {
- /**
- * Construct function.
- *
- * @access public
- * @return void
- */
- public function __construct($module = '', $method = '')
- {
- parent::__construct($module, $method);
- $this->loadModel('user');
- $this->loadModel('dept');
- }
- /**
- * Index page, goto todo.
- *
- * @access public
- * @return void
- */
- public function index()
- {
- $this->view->title = $this->lang->my->common;
- echo $this->fetch('block', 'dashboard', 'dashboard=my');
- }
- /**
- * 积分列表。
- * Get score list
- *
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function score($recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- $scores = $this->loadModel('score')->getListByAccount($this->app->user->account, $pager);
- $this->view->title = $this->lang->score->common;
- $this->view->user = $this->user->getById($this->app->user->account);
- $this->view->pager = $pager;
- $this->view->scores = $scores;
- $this->display();
- }
- /**
- * 日程列表。
- * My calendar.
- *
- * @access public
- * @return void
- */
- public function calendar()
- {
- $this->locate($this->createLink('my', 'todo', 'type=all&userID=&status=all'));
- }
- /**
- * 待处理列表。
- * My work view.
- *
- * @param string $mode
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function work($mode = 'task', $type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- if(in_array($mode, array('testcase', 'feedback')) && $type == 'assignedTo') $type = 'assigntome';
- $this->lang->my->featureBar[$this->app->rawMethod] = $this->lang->my->featureBar[$this->app->rawMethod][strtolower($mode)];
- echo $this->fetch('my', $mode, "type={$type}¶m={$param}&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- }
- /**
- * 贡献列表。
- * My contribute view.
- *
- * @param string $mode
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function contribute($mode = 'task', $type = 'openedBy', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- if((in_array($mode, array('issue', 'risk', 'reviewissue'))) && $type == 'openedBy') $type = 'createdBy';
- if($mode == 'testtask' && $type == 'openedBy') $type = 'done';
- if(($mode == 'doc' || $mode == 'testcase') && $type == 'openedBy') $type = 'openedbyme';
- $this->lang->my->featureBar[$this->app->rawMethod] = $this->lang->my->featureBar[$this->app->rawMethod][strtolower($mode)];
- echo $this->fetch('my', $mode, "type={$type}¶m={$param}&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- }
- /**
- * 待办列表。
- * My todos.
- *
- * @param string $type
- * @param string $userID
- * @param string $status
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function todo($type = 'before', $userID = '', $status = 'all', $orderBy = "date_desc,status,begin", $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- $uri = $this->app->getURI(true);
- $this->session->set('todoList', $uri, 'my');
- $this->session->set('bugList', $uri, 'my');
- $this->session->set('taskList', $uri, 'my');
- $this->session->set('storyList', $uri, 'my');
- $this->session->set('testtaskList', $uri, 'my');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = new pager($recTotal, $recPerPage, $pageID);
- if(empty($userID)) $userID = $this->app->user->id;
- $user = $this->user->getById($userID, 'id');
- $account = $user->account;
- /* Append id for second sort, get todos and tasks. */
- $sort = common::appendOrder($orderBy);
- if($type == 'before') $status = 'undone';
- $todos = $this->loadModel('todo')->getList($type, $account, $status, 0, $pager, $sort);
- $tasks = $this->loadModel('task')->getUserSuspendedTasks($account);
- $count = array('wait' => 0, 'doing' => 0);
- foreach($todos as $key => $todo)
- {
- if($todo->type == 'task' && isset($tasks[$todo->objectID])) unset($todos[$key]);
- if($todo->status == 'wait' || $todo->status == 'doing') $count[$todo->status] ++;
- if($todo->date == '2030-01-01') $todo->date = $this->lang->todo->future;
- }
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->todo;
- $this->view->todos = $todos;
- $this->view->date = (int)$type == 0 ? date(DT_DATE1) : date(DT_DATE1, strtotime($type));
- $this->view->type = $type;
- $this->view->status = $status;
- $this->view->user = $user;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->account = $this->app->user->account;
- $this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
- $this->view->time = date::now();
- $this->view->waitCount = $count['wait'];
- $this->view->doingCount = $count['doing'];
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->display();
- }
- /**
- * 需求列表。
- * My stories.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function story($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- if($this->app->viewType != 'json') $this->session->set('storyList', $this->app->getURI(true), 'my');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- if(strpos($sort, 'planTitle') !== false) $sort = str_replace('planTitle', 'plan', $sort);
- if(strpos($sort, 'pri_') !== false) $sort = str_replace('pri_', 'priOrder_', $sort);
- $queryID = $type == 'bysearch' ? (int)$param : 0;
- $this->loadModel('story');
- if($type == 'assignedBy')
- {
- $stories = $this->my->getAssignedByMe($this->app->user->account, $pager, $sort, 'story');
- }
- elseif($type == 'bysearch')
- {
- $stories = $this->my->getStoriesBySearch($queryID, $this->app->rawMethod, $sort, $pager);
- }
- else
- {
- $stories = $this->story->getUserStories($this->app->user->account, $type, $sort, $pager, 'story', false, 'all');
- }
- if(!empty($stories)) $stories = $this->story->mergeReviewer($stories);
- foreach($stories as $story) $story->estimate = $story->estimate . $this->config->hourUnit;
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $actionURL = $this->createLink('my', $currentMethod, "mode=story&type=bysearch¶m=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- $this->my->buildStorySearchForm($queryID, $actionURL, $currentMethod);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->story;
- $this->view->stories = $stories;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->mode = 'story';
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->gradeGroup = $this->story->getGradeGroup();
- $this->view->showGrade = $this->config->edition == 'ipd';
- $this->display();
- }
- /**
- * 业务需求列表。
- * My epics.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function epic($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- if($this->app->viewType != 'json') $this->session->set('storyList', $this->app->getURI(true), 'my');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- if(strpos($sort, 'productTitle') !== false) $sort = str_replace('productTitle', 'product', $sort);
- if(strpos($sort, 'pri_') !== false) $sort = str_replace('pri_', 'priOrder_', $sort);
- $queryID = ($type == 'bysearch') ? (int)$param : 0;
- $this->loadModel('story');
- $this->loadModel('epic');
- if($type == 'assignedBy')
- {
- $stories = $this->my->getAssignedByMe($this->app->user->account, $pager, $sort, 'epic');
- }
- elseif($type == 'bysearch')
- {
- $stories = $this->my->getEpicsBySearch($queryID, $this->app->rawMethod, $sort, $pager);
- }
- else
- {
- $stories = $this->story->getUserStories($this->app->user->account, $type, $sort, $pager, 'epic', false, 'all');
- }
- if(!empty($stories)) $stories = $this->story->mergeReviewer($stories);
- foreach($stories as $story) $story->estimate = $story->estimate . $this->config->hourUnit;
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $actionURL = $this->createLink('my', $currentMethod, "mode=epic&type=bysearch¶m=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- $this->my->buildEpicSearchForm($queryID, $actionURL, $currentMethod);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->story;
- $this->view->stories = $stories;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->mode = 'epic';
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->gradeGroup = $this->story->getGradeGroup();
- $this->view->showGrade = $this->config->edition == 'ipd';
- $this->display();
- }
- /**
- * 用户需求列表。
- * My requirements.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function requirement($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- if($this->app->viewType != 'json') $this->session->set('storyList', $this->app->getURI(true), 'my');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- if(strpos($sort, 'productTitle') !== false) $sort = str_replace('productTitle', 'product', $sort);
- if(strpos($sort, 'pri_') !== false) $sort = str_replace('pri_', 'priOrder_', $sort);
- $queryID = ($type == 'bysearch') ? (int)$param : 0;
- $this->loadModel('story');
- $this->loadModel('requirement');
- if($type == 'assignedBy')
- {
- $stories = $this->my->getAssignedByMe($this->app->user->account, $pager, $sort, 'requirement');
- }
- elseif($type == 'bysearch')
- {
- $stories = $this->my->getRequirementsBySearch($queryID, $this->app->rawMethod, $sort, $pager);
- }
- else
- {
- $stories = $this->story->getUserStories($this->app->user->account, $type, $sort, $pager, 'requirement', false, 'all');
- }
- if(!empty($stories)) $stories = $this->story->mergeReviewer($stories);
- foreach($stories as $story) $story->estimate = $story->estimate . $this->config->hourUnit;
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $actionURL = $this->createLink('my', $currentMethod, "mode=requirement&type=bysearch¶m=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- $this->my->buildRequirementSearchForm($queryID, $actionURL, $currentMethod);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->story;
- $this->view->stories = $stories;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->mode = 'requirement';
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->gradeGroup = $this->story->getGradeGroup();
- $this->view->showGrade = $this->config->edition == 'ipd';
- $this->display();
- }
- /**
- * 任务列表。
- * My tasks
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function task($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- if($type != 'bySearch') $this->session->set('myTaskType', $type);
- if($this->app->viewType != 'json') $this->session->set('taskList', $this->app->getURI(true), 'my');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* append id for second sort. */
- $sort = common::appendOrder($orderBy);
- if(strpos($orderBy, 'estimateLabel') !== false || strpos($orderBy, 'consumedLabel') !== false || strpos($orderBy, 'leftLabel') !== false) $sort = str_replace('Label', '', $sort);
- /* Get tasks. */
- $this->loadModel('task');
- $queryID = $type == 'bySearch' ? (int)$param : 0;
- if($type == 'assignedBy')
- {
- $tasks = $this->my->getAssignedByMe($this->app->user->account, $pager, $sort, 'task');
- }
- elseif($type == 'bySearch')
- {
- $tasks = $this->my->getTasksBySearch($this->app->user->account, 0, $pager, $sort, $queryID);
- }
- else
- {
- $tasks = $this->task->getUserTasks($this->app->user->account, $type, 0, $pager, $sort, $queryID);
- }
- $summary = $this->loadModel('execution')->summary($tasks);
- $tasks = $this->myZen->buildTaskData($tasks);
- $actionURL = $this->createLink('my', $this->app->rawMethod, "mode=task&browseType=bySearch&queryID=myQueryID");
- $this->my->buildTaskSearchForm($queryID, $actionURL, $this->app->rawMethod . 'Task');
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->task;
- $this->view->tabID = 'task';
- $this->view->tasks = $this->app->viewType == 'json' ? array_values($tasks) : $tasks;
- $this->view->summary = $summary;
- $this->view->type = $type;
- $this->view->kanbanList = $this->execution->getPairs(0, 'kanban');
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->pager = $pager;
- $this->view->mode = 'task';
- $this->view->orderBy = $orderBy;
- $this->view->param = $param;
- $this->display();
- }
- /**
- * bug 列表。
- * My bugs.
- *
- * @param string $type
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- * @param int $param
- */
- public function bug($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. load Lang. */
- $this->loadModel('bug');
- $queryID = $type == 'bySearch' ? (int)$param : 0;
- if($type != 'bySearch') $this->session->set('myBugType', $type);
- if($this->app->viewType != 'json') $this->session->set('bugList', $this->app->getURI(true), 'qa');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- if(strpos($sort, 'pri_') !== false) $sort = str_replace('pri_', 'priOrder_', $sort);
- if(strpos($sort, 'severity_') !== false) $sort = str_replace('severity_', 'severityOrder_', $sort);
- if($type == 'assignedBy')
- {
- $bugs = $this->my->getAssignedByMe($this->app->user->account, $pager, $sort, 'bug');
- }
- else
- {
- $bugs = $this->bug->getUserBugs($this->app->user->account, $type, $sort, 0, $pager, 0, $queryID);
- }
- $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', false);
- $bugs = $this->bug->batchAppendDelayedDays($bugs);
- $actionURL = $this->createLink('my', $this->app->rawMethod, "mode=bug&browseType=bySearch&queryID=myQueryID");
- $this->my->buildBugSearchForm($queryID, $actionURL);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- if($type == 'resolvedBy')
- {
- $unclosedCount = 0;
- foreach($bugs as $bug)
- {
- if($bug->status != 'closed') $unclosedCount ++;
- }
- $this->view->summary = sprintf($this->lang->bug->notice->unClosedSummary, count($bugs), $unclosedCount);
- $this->view->checkedSummary = str_replace('{total}', (string)count($bugs), $this->lang->bug->notice->checkedSummary);
- }
- /* 检查是否需要确认撤销/移除。*/
- /* Build confirmeObject. */
- if($this->config->edition == 'ipd') $bugs = $this->loadModel('story')->getAffectObject($bugs, 'bug');
- /* assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->bug;
- $this->view->bugs = $bugs;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->memberPairs = $this->user->getPairs('noletter|nodeleted|noclosed');
- $this->view->tabID = 'bug';
- $this->view->type = $type;
- $this->view->recTotal = $recTotal;
- $this->view->recPerPage = $recPerPage;
- $this->view->pageID = $pageID;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->mode = 'bug';
- $this->view->param = $param;
- $this->display();
- }
- /**
- * 测试单列表。
- * My test task.
- *
- * @param string $type wait|done
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function testtask($type = 'wait', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Load pager. */
- $this->app->loadClass('pager', $static = true);
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Save session. */
- if($this->app->viewType != 'json')
- {
- $uri = $this->app->getURI(true);
- $this->session->set('testtaskList', $uri, 'qa');
- $this->session->set('reportList', $uri, 'qa');
- $this->session->set('buildList', $uri, 'execution');
- }
- /* Append id for second sort. */
- $this->app->loadLang('project');
- $sort = common::appendOrder($orderBy);
- $count = array('wait' => 0, 'doing' => 0, 'blocked' => 0);
- $tasks = $this->loadModel('testtask')->getByUser($this->app->user->account, $pager, $sort, $type == 'assignedTo' ? 'wait' : $type);
- foreach($tasks as $task)
- {
- if($task->status == 'wait' || $task->status == 'doing' || $task->status == 'blocked') $count[$task->status] ++;
- if($task->build == 'trunk' || empty($task->buildName)) $task->buildName = $this->lang->trunk;
- if(empty($task->executionMultiple)) $task->executionName = $task->projectName . "({$this->lang->project->disableExecution})";
- }
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->myTestTask;
- $this->view->tasks = $tasks;
- $this->view->type = $type;
- $this->view->waitCount = $count['wait'];
- $this->view->testingCount = $count['doing'];
- $this->view->blockedCount = $count['blocked'];
- $this->view->mode = 'testtask';
- $this->view->pager = $pager;
- $this->view->param = $param;
- $this->view->orderBy = $orderBy;
- $this->display();
- }
- /**
- * 用例列表。
- * My test case.
- *
- * @param string $type assigntome|openedbyme
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function testcase($type = 'assigntome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session. */
- $uri = $this->app->getURI(true);
- $this->session->set('caseList', $uri, 'qa');
- $this->session->set('bugList', $uri . "#app={$this->app->tab}", 'qa');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- $queryID = $type == 'bysearch' ? (int)$param : 0;
- $this->loadModel('testcase');
- $cases = array();
- if($type == 'assigntome') $cases = $this->testcase->getByAssignedTo($this->app->user->account, 'skip|run', $sort, $pager);
- if($type == 'openedbyme') $cases = $this->testcase->getByOpenedBy($this->app->user->account, 'skip', $sort, $pager);
- if($type == 'bysearch' && $this->app->rawMethod == 'contribute') $cases = $this->my->getTestcasesBySearch($queryID, 'contribute', $orderBy, $pager);
- if($type == 'bysearch' && $this->app->rawMethod == 'work') $cases = $this->my->getTestcasesBySearch($queryID, 'work', $orderBy, $pager);
- $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
- $cases = $this->myZen->buildCaseData($cases, $type);
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $actionURL = $this->createLink('my', $currentMethod, "mode=testcase&type=bysearch¶m=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- $this->my->buildTestCaseSearchForm($queryID, $actionURL, $currentMethod);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->myTestCase;
- $this->view->cases = $cases;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->tabID = 'test';
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->recTotal = $recTotal;
- $this->view->recPerPage = $recPerPage;
- $this->view->pageID = $pageID;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->mode = 'testcase';
- $this->display();
- }
- /**
- * 文档列表。
- * Doc page of my.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function doc($type = 'openedbyme', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Save session, load lang. */
- $uri = $this->app->getURI(true);
- $this->session->set('productList', $uri, 'product');
- $this->session->set('executionList', $uri, 'execution');
- $this->session->set('projectList', $uri, 'project');
- if($this->app->viewType != 'json') $this->session->set('docList', $uri, 'doc');
- /* Load pager. */
- $this->app->loadClass('pager', true);
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- $queryID = $type == 'bySearch' ? (int)$param : 0;
- $docs = $this->loadModel('doc')->getDocsByBrowseType($type, $queryID, 0, $sort, $pager);
- $actionURL = $this->createLink('my', $this->app->rawMethod, "mode=doc&browseType=bySearch&queryID=myQueryID");
- $this->loadModel('doc')->buildSearchForm(0, array(), $queryID, $actionURL, 'contribute');
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->doc;
- $this->view->docs = $docs;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->type = $type;
- $this->view->recTotal = $recTotal;
- $this->view->recPerPage = $recPerPage;
- $this->view->pageID = $pageID;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->param = $param;
- $this->display();
- }
- /**
- * 我的项目列表。
- * My projects.
- *
- * @param string $status doing|wait|suspended|closed|openedbyme
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @param string $orderBy
- * @access public
- * @return void
- */
- public function project($status = 'doing', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
- {
- $this->app->loadLang('project');
- $uri = $this->app->getURI(true);
- $this->app->session->set('programList', $uri, 'program');
- $this->app->session->set('projectList', $uri, 'my');
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- /* Get PM id list. */
- $accounts = array();
- $projects = $this->user->getProjects($this->app->user->account, $status, $orderBy, $pager);
- foreach($projects as $project)
- {
- if(!empty($project->PM) && !in_array($project->PM, $accounts)) $accounts[] = $project->PM;
- }
- $PMList = $this->user->getListByAccounts($accounts, 'account');
- foreach($projects as $project) $project->PMUserID = isset($PMList[$project->PM]) ? (int)$PMList[$project->PM]->id : 0;
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->project;
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->projects = $projects;
- $this->view->PMList = $PMList;
- $this->view->pager = $pager;
- $this->view->status = $status;
- $this->view->recTotal = $recTotal;
- $this->view->recPerPage = $recPerPage;
- $this->view->pageID = $pageID;
- $this->view->orderBy = $orderBy;
- $this->view->usersAvatar = $this->user->getAvatarPairs('');
- $this->display();
- }
- /**
- * 我的执行列表。
- * My executions.
- *
- * @param string $type undone|done
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function execution($type = 'undone', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
- {
- $this->app->loadLang('execution');
- /* Set the pager. */
- $this->app->loadClass('pager', $static = true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- $executions = $this->user->getExecutions($this->app->user->account, $type, $orderBy, $pager);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->execution;
- $this->view->tabID = 'project';
- $this->view->executions = $executions;
- $this->view->parentGroup = $this->loadModel('execution')->getChildIdGroup(array_keys($executions));
- $this->view->type = $type;
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->mode = 'execution';
- $this->display();
- }
- /**
- * 问题列表。
- * My issues.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function issue($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- /* Set session. */
- $this->app->session->set('issueList', $this->app->getURI(true), 'project');
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- /* Build the search form. */
- $queryID = $type == 'bysearch' ? (int)$param : 0;
- $actionURL = $this->createLink('my', $this->app->rawMethod, "mode=issue&type=bysearch¶m=myQueryID");
- $this->loadModel('issue')->buildSearchForm($actionURL, $queryID);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->issue;
- $this->view->mode = 'issue';
- $this->view->users = $this->user->getPairs('noclosed|noletter');
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->issues = $type == 'assignedBy' ? $this->my->getAssignedByMe($this->app->user->account, $pager, $orderBy, 'issue') : $this->loadModel('issue')->getUserIssues($type, $queryID, $this->app->user->account, $orderBy, $pager);
- $this->view->projectList = $this->loadModel('project')->getPairsByProgram();
- $this->display();
- }
- /**
- * 风险列表。
- * My risks.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function risk($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->loadModel('risk');
- /* Set session. */
- $this->app->session->set('riskList', $this->app->getURI(true), 'project');
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $queryID = $type == 'bysearch' ? (int)$param : 0;
- $actionURL = $this->createLink('my', $currentMethod, "mode=risk&type=bysearch¶m=myQueryID");
- $this->my->buildRiskSearchForm($queryID, $actionURL, $currentMethod);
- /* Get risks by type*/
- if($type == 'assignedBy')
- {
- $risks = $this->my->getAssignedByMe($this->app->user->account, $pager, $orderBy, 'risk');
- }
- elseif($type == 'bysearch')
- {
- $risks = $this->my->getRisksBySearch($queryID, $currentMethod, $orderBy, $pager);
- }
- else
- {
- $risks = $this->risk->getUserRisks($type, $this->app->user->account, $orderBy, $pager);
- }
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->risk;
- $this->view->risks = $risks;
- $this->view->users = $this->user->getPairs('noclosed|noletter');
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->mode = 'risk';
- $this->view->projectList = array(0 => '') + $this->loadModel('project')->getPairsByProgram();
- $this->display();
- }
- /**
- * 评审意见列表。
- * My reviewissues.
- *
- * @param string $type
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function reviewissue($type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->loadModel('reviewissue');
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- /* Build the search form. */
- $currentMethod = $this->app->rawMethod;
- $queryID = $type == 'bysearch' ? (int)$param : 0;
- $actionURL = $this->createLink('my', $currentMethod, "mode=reviewissue&type=bysearch¶m=myQueryID");
- $this->my->buildReviewissueSearchForm($queryID, $actionURL);
- /* Get reviewissues by type*/
- if($type == 'assignedBy')
- {
- $reviewissues = $this->my->getAssignedByMe($this->app->user->account, $pager, $orderBy, 'reviewissue');
- }
- elseif($type == 'bysearch')
- {
- $reviewissues = $this->my->getReviewissuesBySearch($queryID, $currentMethod, $orderBy, $pager);
- }
- else
- {
- $reviewissues = $this->reviewissue->getUserReviewissues($type, $this->app->user->account, $orderBy, $pager);
- }
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->reviewissue;
- $this->view->reviewissues = $reviewissues;
- $this->view->users = $this->user->getPairs('noclosed|noletter');
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->type = $type;
- $this->view->param = $param;
- $this->view->mode = 'reviewissue';
- $this->view->projectList = array(0 => '') + $this->loadModel('project')->getPairsByProgram();
- $this->display();
- }
- /**
- * 评审列表。
- * My audits.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function audit($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->loadModel('epic');
- $this->loadModel('requirement');
- $this->session->set('storyList', $this->app->getURI(true), 'my');
- $this->app->loadClass('pager', true);
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- $typeList = array();
- if($this->app->rawMethod == 'contribute')
- {
- $reviewList = $this->my->getReviewedList($browseType, $orderBy, $pager);
- }
- else
- {
- $typeList = $this->my->getReviewingTypeList();
- if(!isset($typeList->$browseType)) $browseType = 'all';
- $this->lang->my->featureBar['audit'] = (array)$typeList;
- $reviewList = $this->my->getReviewingList($browseType, $orderBy, $pager);
- }
- $flows = array();
- if(in_array($this->config->edition, array('max', 'ipd')))
- {
- $this->app->loadLang('approval');
- $flows = $this->my->getFlowPairs();
- }
- $this->view->title = $this->lang->review->common;
- $this->view->users = $this->user->getPairs('noclosed|noletter');
- $this->view->reviewList = $reviewList;
- $this->view->recTotal = $recTotal;
- $this->view->recPerPage = $recPerPage;
- $this->view->pageID = $pageID;
- $this->view->browseType = $browseType;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->param = $param;
- $this->view->mode = 'audit';
- $this->view->flows = $flows;
- $this->view->products = $this->loadModel('product')->getPairs('', 0, '', 'all');;
- $this->view->projects = $this->loadModel('project')->getPairs();
- $this->display();
- }
- /**
- * 质量保证计划列表。
- * My auditplans.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function auditplan($browseType = 'myChecking', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- if(!$browseType) $browseType = 'myChecking';
- /* Set session. */
- $this->session->set('auditplanList', $this->app->getURI(true));
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- $auditplans = $this->loadModel('auditplan')->getList(0, $browseType, $param, $orderBy, $pager);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->auditplan;
- $this->view->browseType = $browseType;
- $this->view->param = $param;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->mode = 'auditplan';
- $this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
- $this->view->executions = $this->loadModel('execution')->getPairs();
- $this->view->processList = $this->loadModel('pssp')->getProcessPairs();
- $this->view->activityList = $this->pssp->getActivityPairs();
- $this->view->outputList = $this->pssp->getOutputPairs();
- $this->view->auditplans = $auditplans;
- $this->view->projects = $this->loadModel('project')->getPairs();
- $this->display();
- }
- /**
- * 不符合项列表。
- * My ncs.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function nc($browseType = 'assignedToMe', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- if(!$browseType) $browseType = 'assignedToMe';
- /* Set session. */
- $this->session->set('ncList', $this->app->getURI(true));
- $this->loadModel('nc');
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- $status = $this->app->rawMethod == 'contribute' ? '' : 'active';
- $ncList = $browseType == 'assignedBy' ? $this->my->getAssignedByMe($this->app->user->account, $pager, $orderBy, 'nc') : $this->my->getNcList($browseType, $orderBy, $pager, $status);
- foreach($ncList as $nc) $ncIdList[] = $nc->id;
- $this->session->set('ncIdList', isset($ncIdList) ? $ncIdList : '');
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->nc;
- $this->view->browseType = $browseType;
- $this->view->ncs = $ncList;
- $this->view->users = $this->user->getPairs('noclosed|noletter');
- $this->view->projects = $this->loadModel('project')->getPairsByProgram();
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->param = $param;
- $this->view->mode = 'nc';
- $this->display();
- }
- /**
- * 会议列表。
- * My meeting list.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function myMeeting($browseType = 'futureMeeting', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->session->set('meetingList', $this->app->getURI(true), 'my');
- /* Load pager. */
- $this->app->loadClass('pager', $static = true);
- if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- /* Build the search form. */
- $queryID = $browseType == 'bysearch' ? (int)$param : 0;
- $actionURL = $this->createLink('my', 'work', "mode=mymeeting&browseType=bysearch¶m=myQueryID");
- $this->loadModel('meeting')->buildSearchForm($queryID, $actionURL);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->myMeeting;
- $this->view->browseType = $browseType;
- $this->view->meetings = $this->meeting->getListByUser($browseType, $orderBy, $queryID, $pager);
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->depts = $this->dept->getOptionMenu();
- $this->view->users = $this->user->getPairs('all,noletter');
- $this->view->queryID = $queryID;
- $this->view->param = $param;
- $this->view->mode = 'myMeeting';
- $this->view->projects = array(0 => '') + $this->loadModel('project')->getPairsByProgram(0, 'all', true);
- $this->view->executions = array(0 => '') + $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
- $this->view->rooms = $this->loadModel('meetingroom')->getPairs();
- $this->display();
- }
- /**
- * 反馈列表。
- * Feedback list.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function feedback($browseType = 'assigntome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $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);
- $this->loadModel('feedback');
- if($browseType == 'assignedby')
- {
- $feedbacks = $this->my->getAssignedByMe($this->app->user->account, $pager, $orderBy, 'feedback');
- }
- elseif($browseType == 'bysearch')
- {
- $feedbacks = $this->my->getFeedbacksBySearch($queryID, $orderBy, $pager);
- }
- else
- {
- $feedbacks = $this->feedback->getList($browseType, $orderBy, $pager);
- }
- $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'feedback', false);
- $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->myZen->assignRelatedData($feedbacks);
- $this->myZen->buildSearchFormForFeedback($queryID, $orderBy);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->my->feedback;
- $this->view->mode = 'feedback';
- $this->view->type = $browseType;
- $this->view->feedbacks = $feedbacks;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->param = $param;
- $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('id, name')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->fetchPairs();
- $this->view->modulePairs = $this->loadModel('tree')->getModulePairs(0, 'feedback');
- $this->view->modules = $this->tree->getOptionMenu(0, 'feedback', 0);
- $this->view->demands = ($feedbacks and $this->config->vision == 'or') ? $this->loadModel('demand')->getByList(array_keys($feedbacks)) : array();
- $this->display();
- }
- /**
- * 工单列表。
- * My ticket.
- *
- * @param string $browseType
- * @param int $param
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function ticket($browseType = 'assignedtome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $this->session->set('ticketList', $this->app->getURI(true), 'ticket');
- $this->session->set('ticketBrowseType', $browseType);
- $this->app->loadClass('pager', $static = true);
- $pager = pager::init($recTotal, $recPerPage, $pageID);
- $queryID = $browseType == 'bysearch' ? (int)$param : 0;
- if($browseType != 'bysearch')
- {
- $tickets = $this->loadModel('ticket')->getList($browseType, $orderBy, $pager);
- }
- else
- {
- $tickets = $this->loadModel('ticket')->getBySearch($queryID, $orderBy, $pager);
- }
- foreach($tickets as $ticket) $ticket->feedbackTip = $ticket->feedback != 0 ? '#' . $ticket->feedback : '';
- $actionURL = $this->createLink('my', $this->app->rawMethod, "mode=ticket&type=bysearch¶m=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
- $this->my->buildTicketSearchForm($queryID, $actionURL);
- $this->myZen->showWorkCount($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->ticket->browse;
- $this->view->products = $this->loadModel('feedback')->getGrantProducts();
- $this->view->users = $this->user->getPairs('noclosed|nodeleted|noletter');
- $this->view->tickets = $tickets;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->param = $param;
- $this->view->browseType = $browseType;
- $this->view->mode = 'ticket';
- $this->display();
- }
- /**
- * 团队列表。
- * My team.
- *
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function team($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
- {
- $this->lang->navGroup->my = 'system';
- /* Set the pager. */
- $this->app->loadClass('pager', true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
- /* Append id for second sort. */
- $sort = common::appendOrder($orderBy);
- /* Get users by dept. */
- $deptID = $this->app->user->admin ? 0 : $this->app->user->dept;
- $users = $this->loadModel('company')->getUsers('inside', 'bydept', 0, $deptID, $sort, $pager);
- foreach($users as $user) unset($user->password); // Remove passwd.
- $this->view->title = $this->lang->my->team;
- $this->view->users = $users;
- $this->view->userPairs = $this->loadModel('user')->getPairs('noletter|noclosed');
- $this->view->deptID = $deptID;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->display();
- }
- /**
- * 编辑个人信息。
- * Edit profile
- *
- * @access public
- * @return void
- */
- public function editProfile()
- {
- if($this->app->user->account == 'guest') return print(js::alert('guest') . js::locate('back'));
- if(!empty($_POST))
- {
- /* 设置语言项以便 form 类检查必填项时输出正确的字段名。*/
- /* Set language item for form class to check required fields. */
- $this->lang->my->realname = $this->lang->user->realname;
- $this->lang->my->verifyPassword = $this->lang->user->verifyPassword;
- $user = form::data($this->config->my->form->editProfile)
- ->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
- ->add('group', $this->app->user->groups)
- ->add('id', $this->app->user->id)
- ->get();
- $this->user->update($user);
- if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
- if(isInModal()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
- return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->createLink('my', 'profile')));
- }
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->editProfile;
- $this->view->user = $this->user->getById($this->app->user->account);
- $this->view->rand = updateSessionRandom();
- $this->display();
- }
- /**
- * 修改密码。
- * Change password.
- *
- * @access public
- * @return void
- */
- public function changePassword()
- {
- if($this->app->user->account == 'guest') return print(js::alert('guest') . js::locate('back'));
- $this->app->loadLang('admin');
- $isonlybody = isInModal();
- if(!$isonlybody) unset($this->lang->my->menu);
- if(!empty($_POST))
- {
- /* 确保必填项提示信息能显示正确的字段名。*/
- $this->lang->my->originalPassword = $this->lang->user->originalPassword;
- $this->lang->my->password1 = $this->lang->user->password1;
- $this->lang->my->password2 = $this->lang->user->password2;
- $user = form::data($this->config->my->form->changePassword)
- ->setIF($this->post->password1 != false, 'password', substr($this->post->password1, 0, 32))
- ->get();
- $this->user->updatePassword($user);
- if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
- if($isonlybody) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
- return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->createLink('index', 'index')));
- }
- $this->view->isonlybody = $isonlybody;
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->changePassword;
- $this->view->user = $this->user->getById($this->app->user->account);
- $this->view->rand = updateSessionRandom();
- $this->display();
- }
- /**
- * 管理联系人。
- * Manage contacts.
- *
- * @param int $listID
- * @access public
- * @return void
- */
- public function manageContacts($listID = 0)
- {
- if($_POST)
- {
- $this->lang->my->listName = $this->lang->user->contacts->listName;
- $this->lang->my->userList = $this->lang->user->contacts->selectedUsers;
- if($listID)
- {
- $userContact = form::data($this->config->my->form->manageContacts)->add('account', $this->app->user->account)->add('id', $listID)->get();
- $this->user->updateContactList($userContact);
- }
- else
- {
- $userContact = form::data($this->config->my->form->manageContacts)->add('account', $this->app->user->account)->get();
- $this->user->createContactList($userContact);
- }
- if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
- if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
- if(isInModal()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "renderContactList"));
- if($this->app->tab == 'project') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true));
- return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('manageContacts', "listID={$listID}")));
- }
- $list = $listID ? $this->user->getContactListByID($listID) : null;
- $userList = !empty($list->userList) ? $list->userList : '';
- if($list)
- {
- $mode = $list->account == $this->app->user->account ? 'edit' : ($this->app->user->admin ? 'adminView' : 'view');
- $label = $mode == 'edit' ? $this->lang->my->manageContacts : $this->lang->my->viewContacts;
- $tip = $mode == 'edit' ? $this->lang->my->manageSelf : $this->lang->my->adminView;
- }
- else
- {
- $mode = 'create';
- $label = $this->lang->my->createContacts;
- $tip = '';
- }
- $userParams = empty($this->config->user->showDeleted) ? 'noletter|noempty|noclosed|noclosed|nodeleted' : 'noletter|noempty|noclosed|noclosed';
- $users = $this->user->getPairs($userParams, $mode == 'new' ? '' : $userList);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $label;
- $this->view->lists = $this->user->getContactLists($this->app->user->account, 'list');
- $this->view->users = $users;
- $this->view->mode = $mode;
- $this->view->label = $label;
- $this->view->tip = $tip;
- $this->view->list = $list;
- $this->display();
- }
- /**
- * 删除一个联系人列表。
- * Delete a contact list.
- *
- * @param int $listID
- * @access public
- * @return void
- */
- public function deleteContacts($listID)
- {
- $this->user->deleteContactList($listID);
- return $this->send(array('result' => 'success', 'load' => true));
- }
- /**
- * 构建联系人列表。
- * Build contact lists.
- *
- * @param string $dropdownName
- * @param string $attr
- * @access public
- * @return void
- * @param string $showManage
- */
- public function buildContactLists($dropdownName = 'mailto', $attr = '', $showManage = 'yes')
- {
- $this->view->contactLists = $this->user->getContactLists();
- $this->view->dropdownName = $dropdownName;
- $this->view->attr = $attr;
- $this->view->showManage = $showManage;
- $this->display();
- }
- /**
- * 查看我的个人档案。
- * View my profile.
- *
- * @access public
- * @return void
- */
- public function profile()
- {
- if($this->app->user->account == 'guest') return print(js::alert('guest') . js::locate('back'));
- $user = $this->user->getById($this->app->user->account);
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->profile;
- $this->view->user = $user;
- $this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
- $this->view->deptPath = $this->dept->getParents($user->dept);
- $this->display();
- }
- /**
- * 查看个性化设置。
- * User preference setting.
- *
- * @access public
- * @return void
- * @param string $showTip
- */
- public function preference($showTip = 'true')
- {
- $this->loadModel('setting');
- if($_POST)
- {
- $keyList = array('URSR', 'programLink', 'productLink', 'projectLink', 'executionLink', 'docLink');
- foreach($_POST as $key => $value)
- {
- if(!in_array($key, $keyList)) continue;
- if($key != 'URSR' && !isset($this->lang->my->{$key . 'List'}[$value])) continue;
- if($key == 'URSR') $value = (int)$value;
- $this->setting->setItem("{$this->app->user->account}.common.$key", $value);
- }
- $this->setting->setItem("{$this->app->user->account}.common.preferenceSetted", 1);
- return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => '$.apps.updateAppsMenu'));
- }
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->preference;
- $this->view->showTip = $showTip;
- $this->view->URSRList = $this->loadModel('custom')->getURSRPairs();
- $this->view->URSR = $this->setting->getURSR();
- $this->view->programLink = isset($this->config->programLink) ? $this->config->programLink : 'program-browse';
- $this->view->productLink = isset($this->config->productLink) ? $this->config->productLink : 'product-all';
- $this->view->projectLink = isset($this->config->projectLink) ? $this->config->projectLink : 'project-browse';
- $this->view->executionLink = isset($this->config->executionLink) ? $this->config->executionLink : 'execution-task';
- $this->view->docLink = isset($this->config->docLink) ? $this->config->docLink : 'doc-lastViewedSpace';
- $this->view->preferenceSetted = isset($this->config->preferenceSetted) ? true : false;
- $this->display();
- }
- /**
- * 我的动态列表。
- * My dynamic.
- *
- * @param string $type
- * @param int $recTotal
- * @param string $date
- * @param string $direction
- * @access public
- * @return void
- */
- public function dynamic($type = 'today', $recTotal = 0, $date = '', $direction = 'next')
- {
- /* Append id for second sort. */
- $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc';
- $date = empty($date) ? '' : date('Y-m-d', (int)$date);
- $actions = $this->loadModel('action')->getDynamicByAccount($this->app->user->account, $type, $orderBy, 50, $date, $direction);
- $dateGroups = $this->action->buildDateGroup($actions, $direction);
- if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount($type);
- /* Assign. */
- $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->dynamic;
- $this->view->type = $type;
- $this->view->orderBy = $orderBy;
- $this->view->dateGroups = $dateGroups;
- $this->view->direction = $direction;
- $this->view->recTotal = $recTotal;
- $this->view->users = $this->user->getPairs('noletter|nodeleted');
- $this->display();
- }
- /**
- * 上传头像。
- * Upload avatar.
- *
- * @access public
- * @return void
- */
- public function uploadAvatar()
- {
- if($_SERVER['REQUEST_METHOD'] == 'POST')
- {
- $result = $this->user->uploadAvatar();
- if($result['result'] == 'fail') $this->send($result);
- return $this->send(array('result' => 'success', 'callback' => "loadModal('" . $this->createLink('user', 'cropavatar', "imageID={$result['fileID']}") . "', 'profile');"));
- }
- }
- /**
- * 取消与然之的绑定。
- * Unbind ranzhi.
- *
- * @param string $confirm
- * @access public
- * @return void
- */
- public function unbind($confirm = 'no')
- {
- if($confirm == 'no')
- {
- return print(js::confirm($this->lang->user->confirmUnbind, $this->createLink('my', 'unbind', "confirm=yes")));
- }
- else
- {
- $this->user->unbind($this->app->user->account);
- return print(js::locate($this->createLink('my', 'profile'), 'parent'));
- }
- }
- /**
- * Ajax: 切换界面.
- * Switch vision by ajax.
- *
- * @param string $vision
- * @access public
- * @return void
- */
- public function ajaxSwitchVision($vision)
- {
- $_SESSION['vision'] = $vision;
- $this->loadModel('setting')->setItem("{$this->app->user->account}.common.global.vision", $vision);
- if(empty($this->config->hideVisionTips)) $this->setting->setItem("{$this->app->user->account}.common.global.hideVisionTips", 1);
- $this->config->vision = $vision;
- $_SESSION['user']->rights = $this->user->authorize($this->app->user->account);
- setcookie('vision', $vision, $this->config->cookieLife, $this->config->webRoot, '', false, false);
- return $this->send(array('result' => 'success', 'load' => helper::createLink('index', 'index')));
- }
- /**
- * Ajax: 保存界面切换引导.
- * Save hideVisionTips by ajax.
- *
- * @param string $vision
- * @access public
- * @return void
- */
- public function ajaxSaveVisionTips()
- {
- $this->loadModel('setting')->setItem("{$this->app->user->account}.common.global.hideVisionTips", 1);
- return $this->send(array('result' => 'success', 'load' => helper::createLink('index', 'index')));
- }
- }
|