| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641 |
- <?php
- /**
- * The model file of tutorial 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 Yidong Wang <yidong@cnezsoft.com>
- * @package tutorial
- * @version $Id$
- * @link https://www.zentao.net
- */
- class tutorialModel extends model
- {
- /**
- * 检查新手模式配置。
- * Check novice mode config.
- *
- * @access public
- * @return bool
- */
- public function checkNovice()
- {
- $account = $this->app->user->account;
- if($account == 'guest') return false;
- if(!empty($this->app->user->modifyPassword)) return false;
- $count = $this->dao->select('COUNT(1) AS count')->from(TABLE_ACTION)->where('actor')->eq($account)->fetch('count');
- if($count < 10) return true;
- $this->loadModel('setting')->setItem($account . '.common.global.novice', 0);
- return false;
- }
- /**
- * 获取新手模式产品键值对。
- * Get tutorial product pairs.
- *
- * @access public
- * @return array
- */
- public function getProductPairs()
- {
- return array(1 => 'Test product');
- }
- /**
- * 获取新手模式模块键值对。
- * Get module pairs for tutorial.
- *
- * @access public
- * @return array
- */
- public function getModulePairs()
- {
- return array(1 => 'Test module');
- }
- /**
- * 获取新手模式产品信息。
- * Get tutorial product.
- *
- * @access public
- * @return object
- */
- public function getProduct()
- {
- $product = new stdclass();
- $product->id = 1;
- $product->program = 0;
- $product->line = 0;
- $product->plan = 0;
- $product->name = 'Test product';
- $product->code = 'test';
- $product->type = 'normal';
- $product->status = 'normal';
- $product->desc = '';
- $product->shadow = '0';
- $product->PO = $this->app->user->account;
- $product->QD = '';
- $product->RD = '';
- $product->acl = 'open';
- $product->createdBy = $this->app->user->account;
- $product->createdDate = helper::now();
- $product->createdVersion = '8.1.3';
- $product->order = 10;
- $product->deleted = '0';
- $product->branch = '';
- $product->reviewer = $this->app->user->account;
- $product->branches = array();
- $product->plans = array('1' => 'Test plan');
- $product->totalEpics = 0;
- $product->totalRequirements = 0;
- $product->feedback = 0;
- $product->ticket = 0;
- $product->workflowGroup = 1;
- list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
- if($guideTask == 'branchManage')
- {
- $product->type = 'branch';
- $product->name = 'Test branch product';
- }
- return $product;
- }
- /**
- * 获取新手模式产品统计数据。
- * Get product stats for tutorial.
- *
- * @param bool $isArray
- * @access public
- * @return array
- */
- public function getProductStats($isArray = false)
- {
- $product = $this->getProduct();
- $product->totalStories = 0;
- $product->draftStories = 0;
- $product->activeStories = 0;
- $product->changingStories = 0;
- $product->reviewingStories = 0;
- $product->releases = 0;
- $product->unresolvedBugs = 0;
- $product->fixedBugs = 0;
- $product->lineName = 0;
- $product->executions = 0;
- $product->coverage = 0;
- $product->activeBugs = 0;
- $product->latestReleaseDate = 0;
- $product->latestRelease = 0;
- $product->plans = 0;
- $productStat[$product->id] = $isArray ? json_decode(json_encode($product), true) : $product;
- return $productStat;
- }
- /**
- * 获取新手模式项目。
- * Get project for tutorial;
- *
- * @access public
- * @return object
- */
- public function getProject()
- {
- $project = new stdclass();
- $project->id = 2;
- $project->project = 0;
- $project->model = 'scrum';
- $project->type = 'project';
- $project->name = 'Test Project';
- $project->code = '';
- $project->lifetime = '';
- $project->begin = date('Y-m-d', strtotime('-7 days'));
- $project->end = date('Y-m-d', strtotime('+7 days'));
- $project->realBegan = '';
- $project->realEnd = '';
- $project->days = 10;
- $project->status = 'wait';
- $project->pri = '1';
- $project->desc = '';
- $project->goal = '';
- $project->acl = 'open';
- $project->parent = 0;
- $project->path = ",2,";
- $project->grade = 1;
- $project->PM = $this->app->user->account;
- $project->PO = $this->app->user->account;
- $project->QD = $this->app->user->account;
- $project->RD = $this->app->user->account;
- $project->openedBy = $this->app->user->account;
- $project->whitelist = '';
- $project->budget = 0;
- $project->displayCards = 0;
- $project->fluidBoard = 0;
- $project->deleted = '0';
- $project->hasProduct = 1;
- $project->multiple = '1';
- $project->stageBy = 'project';
- $project->progress = 0;
- $project->consumed = 0;
- $project->estimate = 0;
- $project->left = 0;
- $project->storyType = 'story,requirement,epic';
- $project->charter = 0;
- $project->market = 1;
- $project->budgetUnit = 'CNY';
- $project->deliverable = '';
- $project->isTpl = 0;
- $project->linkType = '';
- $project->workflowGroup = 0;
- list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
- if($guide && strpos($guide, 'scrumProjectManage') !== false)
- {
- $project->name = 'Scrum Project';
- $project->model = 'scrum';
- }
- if($guide && strpos($guide, 'waterfallProjectManage') !== false)
- {
- $project->name = 'Waterfall Project';
- $project->model = 'waterfall';
- }
- if($guide && strpos($guide, 'kanbanProjectManage') !== false)
- {
- $project->name = 'Kanban Project';
- $project->model = 'kanban';
- }
- if($guide && strpos($guide, 'taskManage') !== false)
- {
- $project->name = 'No multiple Project';
- $project->model = 'scrum';
- $project->multiple = '0';
- }
- if($guide && strpos($guide, 'marketManage') !== false)
- {
- $project->name = 'Test research';
- $project->model = 'research';
- }
- return $project;
- }
- /**
- * 获取新手模式项目键值对。
- * Get tutorial project pairs.
- *
- * @access public
- * @return array
- */
- public function getProjectPairs()
- {
- return array(2 => 'Test Project');
- }
- /**
- * 获取新手模式项目统计数据。
- * Get project stats for tutorial
- *
- * @param string $browseType
- * @access public
- * @return array
- */
- public function getProjectStats($browseType = '')
- {
- $project = $this->getProject();
- $project->progress = 0;
- $project->estimate = 0;
- $project->consumed = 0;
- $project->left = 0;
- $project->leftTasks = '—';
- $project->teamMembers = array_keys($this->getTeamMembers());
- $project->teamCount = count($project->teamMembers);
- if($browseType && $browseType != 'all') $project->name .= '-' . $browseType; // Fix bug #21096
- $projectStat[$project->id] = $project;
- return $projectStat;
- }
- /**
- * 获取新手模式迭代燃尽图数据。
- * Get execution burn data for tutorial
- *
- * @param array $dateList
- * @access public
- * @return array
- */
- public function getExecutionBurnData($dateList)
- {
- $burnData = array();
- $left = 7;
- $value = 6;
- foreach($dateList as $date)
- {
- $burn = new stdClass();
- $burn->name = $date;
- $burn->value = $value --;
- $burn->left = $left --;
- $burnData[$date] = $burn;
- }
- return $burnData;
- }
- /**
- * 获取新手模式执行统计数据。
- * Get execution stats for tutorial.
- *
- * @param string $browseType
- * @access public
- * @return array
- */
- public function getExecutionStats($browseType = '')
- {
- $execution = $this->getExecution();
- $execution->progress = 0;
- $execution->estimate = 0;
- $execution->consumed = 0;
- $execution->left = 0;
- $execution->leftTasks = '—';
- $execution->teamMembers = array_keys($this->getTeamMembers());
- $execution->teamCount = count($execution->teamMembers);
- $execution->hasProduct = '1';
- $execution->multiple = '';
- $execution->order = 1;
- $execution->burns = array();
- $execution->type = 'sprint';
- $execution->projectName = '';
- $execution->projectModel = 'scrum';
- $execution->deliverable = '';
- if($browseType && $browseType != 'all') $execution->name .= '-' . $browseType;
- $executionStat[0] = $execution;
- return $executionStat;
- }
- /**
- * 获取新手模式研发需求键值对。
- * Get tutorial story pairs.
- *
- * @access public
- * @return array
- */
- public function getStoryPairs()
- {
- $stories = $this->getStories();
- $storyPairs = array();
- foreach($stories as $story) $storyPairs[$story->id] = $story->title;
- return $storyPairs;
- }
- /**
- * 获取新手模式研发需求。
- * Get tutorial story.
- *
- * @access public
- * @return object
- */
- public function getStory()
- {
- $story = new stdclass();
- $story->id = 3;
- $story->product = 1;
- $story->branch = 0;
- $story->parent = array(2);
- $story->category = 0;
- $story->module = '';
- $story->plan = '';
- $story->planTitle = '';
- $story->color = '';
- $story->source = 'po';
- $story->sourceNote = '';
- $story->fromBug = 0;
- $story->title = 'Test active story';
- $story->keywords = '';
- $story->type = 'story';
- $story->grade = 1;
- $story->pri = 3;
- $story->estimate = 1;
- $story->status = 'active';
- $story->stage = 'wait';
- $story->openedBy = $this->app->user->account;
- $story->openedDate = helper::now();
- $story->assignedTo = '';
- $story->assignedDate = '';
- $story->reviewedBy = $this->app->user->account;
- $story->reviewedDate = helper::now();
- $story->closedBy = '';
- $story->closedDate = '';
- $story->closedReason = '';
- $story->toBug = 0;
- $story->childStories = '';
- $story->linkStories = '';
- $story->duplicateStory = 0;
- $story->version = 1;
- $story->deleted = '0';
- $story->order = '0';
- $story->URChanged = false;
- $story->mailto = '';
- $story->isParent = 0;
- $story->roadmap = 0;
- $story->root = 1;
- $story->path = ',1,2,3,';
- $story->lastEditedBy = '';
- $story->lastEditedDate = '';
- $story->twins = '';
- $story->executions = array();
- $story->spec = '';
- $story->verify = '';
- $story->files = array();
- $story->docs = '';
- $story->docVersions = '';
- return $story;
- }
- /**
- * 获取新手模式业务需求。
- * Get tutorial epic.
- *
- * @access public
- * @return object
- */
- public function getEpic()
- {
- $epic = $this->getStory();
- $epic->id = 1;
- $epic->title = 'Test epic';
- $epic->type = 'epic';
- $epic->isParent = 1;
- $epic->parent = array(0);
- $epic->root = 1;
- $epic->path = ',1,';
- return $epic;
- }
- /**
- * 获取新手模式用户需求。
- * Get tutorial requirement.
- *
- * @access public
- * @return object
- */
- public function getRequirement()
- {
- $requirement = $this->getStory();
- $requirement->id = 2;
- $requirement->title = 'Test requirement';
- $requirement->type = 'requirement';
- $requirement->status = 'active';
- $requirement->isParent = 1;
- $requirement->parent = array(1);
- $requirement->root = 1;
- $requirement->path = ',1,2,';
- return $requirement;
- }
- /**
- * 根据需求ID获取需求详情。
- * Get story by ID.
- *
- * @access public
- * @return object
- * @param int $storyID
- */
- public function getStoryByID($storyID)
- {
- if($storyID == 1) return $this->getEpic();
- if($storyID == 2) return $this->getRequirement();
- return $this->getStory();
- }
- /**
- * 获取需求层级。
- * Get story grade.
- *
- * @access public
- * @return object
- */
- public function getStoryGrade()
- {
- $storyGrade = new stdClass();
- $storyGrade->type = 'story';
- $storyGrade->grade = 1;
- $storyGrade->name = 'SR';
- $storyGrade->status = 'enable';
- $requirementGrade = new stdClass();
- $requirementGrade->type = 'requirement';
- $requirementGrade->grade = 1;
- $requirementGrade->name = 'UR';
- $requirementGrade->status = 'enable';
- $epicGrade = new stdClass();
- $epicGrade->type = 'epic';
- $epicGrade->grade = 1;
- $epicGrade->name = 'BR';
- $epicGrade->status = 'enable';
- return array($storyGrade, $requirementGrade, $epicGrade);
- }
- /**
- * 获取需求层级键值对。
- * Get story grade pairs.
- *
- * @access public
- * @return array
- * @param string $type
- */
- public function getGradePairs($type)
- {
- if($type == 'story') return array(1 => 'SR');
- if($type == 'requirement') return array(1 => 'UR');
- if($type == 'epic') return array(1 => 'BR');
- return array();
- }
- /**
- * 获取新手模式故事点。
- * Get tutorial stories.
- *
- * @access public
- * @return array
- */
- public function getStories()
- {
- $activeStory = $this->getStory();
- $reviewingStory = $this->getStory();
- $reviewingStory->id = 4;
- $reviewingStory->status = 'reviewing';
- $reviewingStory->notReview = array($this->app->user->account);
- $reviewingStory->title = 'Test reviewing story';
- $reviewingStory->path = ',1,2,4,';
- $stories = array();
- if($this->app->config->systemMode != 'light')
- {
- $stories[1] = $this->getEpic();
- $stories[2] = $this->getRequirement();
- }
- if($this->app->config->vision == 'rnd')
- {
- $stories[3] = $activeStory;
- $stories[4] = $reviewingStory;
- }
- if($this->app->config->vision == 'or')
- {
- $reviewingRequirement = $this->getRequirement();
- $reviewingRequirement->id = 5;
- $reviewingRequirement->status = 'reviewing';
- $reviewingRequirement->notReview = array($this->app->user->account);
- $reviewingRequirement->title = 'Test reviewing requirement';
- $reviewingRequirement->path = ',1,5,';
- $reviewingRequirement->isParent = 0;
- $stories[5] = $reviewingRequirement;
- }
- return $stories;
- }
- /**
- * 获取新手模式执行键值对。
- * Get tutorial Execution pairs.
- *
- * @access public
- * @return array
- */
- public function getExecutionPairs()
- {
- return array(2 => 'Test Project', 3 => 'Test execution');
- }
- /**
- * 获取新手模式阶段。
- * Get tutorial stage.
- *
- * @access public
- * @return object
- */
- public function getStage()
- {
- $stage = new stdClass();
- $stage->id = 3;
- $stage->name = 'Development stage';
- $stage->percent = 50;
- $stage->type = 'dev';
- $stage->projectType = 'waterfall';
- $stage->createdBy = '';
- $stage->createdDate = '';
- $stage->editedBy = '';
- $stage->editedDate = '';
- $stage->deleted = 0;
- return $stage;
- }
- /**
- * 获取新手模式阶段列表。
- * Get tutorial stages.
- *
- * @access public
- * @return array
- */
- public function getStages()
- {
- return array(3 => $this->getStage());
- }
- /**
- * 获取新手模式执行。
- * Get tutorial execution.
- *
- * @access public
- * @return object
- */
- public function getExecution()
- {
- /* Fix bug #21097. */
- $hours = new stdclass();
- $hours->totalEstimate = 52;
- $hours->totalConsumed = 43;
- $hours->totalLeft = 7;
- $hours->progress = 86;
- $hours->totalReal = 50;
- $execution = new stdclass();
- $execution->id = 3;
- $execution->project = 2;
- $execution->type = 'sprint';
- $execution->name = 'Test execution';
- $execution->code = 'test';
- $execution->lifetime = '';
- $execution->attribute = '';
- $execution->begin = date('Y-m-d', strtotime('-7 days'));
- $execution->end = date('Y-m-d', strtotime('+7 days'));
- $execution->realBegan = '';
- $execution->realEnd = '';
- $execution->suspendedDate = '';
- $execution->days = 10;
- $execution->status = 'wait';
- $execution->pri = '1';
- $execution->desc = '';
- $execution->goal = '';
- $execution->acl = 'open';
- $execution->parent = 2;
- $execution->path = ',2,3,';
- $execution->grade = 1;
- $execution->PM = $this->app->user->account;
- $execution->PO = $this->app->user->account;
- $execution->QD = $this->app->user->account;
- $execution->RD = $this->app->user->account;
- $execution->deleted = '0';
- $execution->consumed = 0;
- $execution->left = 0;
- $execution->hours = 0;
- $execution->estimate = 0;
- $execution->progress = 0;
- $execution->displayCards = 0;
- $execution->fluidBoard = 0;
- $execution->hours = $hours;
- $execution->burns = array(35, 35);
- $execution->hasProduct = '1';
- $execution->multiple = '';
- $execution->colWidth = '200';
- $execution->openedDate = helper::now();
- $execution->closedDate = helper::now();
- $execution->milestone = 0;
- $execution->workflowGroup = 0;
- $execution->deliverable = '';
- list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
- if($guide && strpos($guide, 'scrumProjectManage') !== false)
- {
- $execution->name = 'Test Sprint';
- $execution->type = 'sprint';
- }
- if($guide && strpos($guide, 'waterfallProjectManage') !== false)
- {
- $execution->name = 'Test Stage';
- $execution->type = 'stage';
- $execution->enabled = 'on';
- $execution->percent = 50;
- $execution->milestone = 0;
- $execution->parallel = 1;
- }
- if($guide && strpos($guide, 'kanbanProjectManage') !== false)
- {
- $execution->name = 'Test Kanban';
- $execution->type = 'kanban';
- }
- if($guide && strpos($guide, 'taskManage') !== false)
- {
- $execution->name = 'No multiple execution';
- $execution->type = 'spring';
- $execution->multiple = 0;
- }
- return $execution;
- }
- /**
- * 获取新手模式执行的产品。
- * Get tutorial execution products.
- *
- * @access public
- * @return array
- */
- public function getExecutionProducts()
- {
- $product = $this->getProduct();
- return array($product->id => $product);
- }
- /**
- * 获取新手模式执行的需求。
- * Get tutorial execution stories.
- *
- * @access public
- * @return array
- */
- public function getExecutionStories()
- {
- $stories = $this->getStories();
- $story = $stories[3];
- return array($story->id => $story);
- }
- /**
- * 获取新手模式执行的需求键值对。
- * Get tutorial execution story pairs.
- *
- * @access public
- * @return array
- */
- public function getExecutionStoryPairs()
- {
- $stories = $this->getStories();
- $story = $stories[3];
- return array($story->id => $story->title);
- }
- /**
- * 获取新手模式团队成员。
- * Get tutorial team members.
- *
- * @access public
- * @return array
- */
- public function getTeamMembers()
- {
- $member = new stdclass();
- $member->project = 2;
- $member->account = $this->app->user->account;
- $member->role = $this->app->user->role;
- $member->join = $this->app->user->join;
- $member->days = 10;
- $member->hours = 7.0;
- $member->totalHours = 70.0;
- $member->realname = $this->app->user->realname;
- $member->limited = 'no';
- $member->userID = $this->app->user->id;
- return array($member->account => $member);
- }
- /**
- * 获取团队成员键值对。
- * Get team members pairs.
- *
- * @access public
- * @return array
- */
- public function getTeamMembersPairs()
- {
- $account = $this->app->user->account;
- return array('' => '', $account => $this->app->user->realname);
- }
- /**
- * 获取新手模式用户键值对。
- * Get tutorial user pairs.
- *
- * @access public
- * @return array
- */
- public function getUserPairs()
- {
- $account = $this->app->user->account;
- $users[$account] = $account;
- $users['test'] = 'Test';
- return $users;
- }
- /**
- * 获取新手模式进度。
- * Get tutorialed.
- *
- * @access public
- * @return string
- */
- public function getTutorialed()
- {
- return $this->dao->select('*')->from(TABLE_CONFIG)->where('module')->eq('tutorial')->andWhere('owner')->eq($this->app->user->account)->andWhere('section')->eq('tasks')->andWhere('`key`')->eq('setting')->fetch('value');
- }
- /**
- * 获取新手模式任务。
- * Get task.
- *
- * @access public
- * @return object
- */
- public function getTask()
- {
- $task = new stdClass();
- $task->id = 1;
- $task->project = 2;
- $task->parent = 0;
- $task->execution = 3;
- $task->module = 0;
- $task->design = 0;
- $task->story = 0;
- $task->storyVersion = 1;
- $task->designVersion = 1;
- $task->fromBug = 0;
- $task->feedback = 0;
- $task->fromIssue = 0;
- $task->name = 'Test task';
- $task->type = 'devel';
- $task->mode = '';
- $task->pri = 3;
- $task->estimate = 0;
- $task->consumed = 0;
- $task->left = 0;
- $task->deadline = '';
- $task->status = 'wait';
- $task->subStatus = '';
- $task->color = '';
- $task->mailto = '';
- $task->keywords = '';
- $task->desc = '';
- $task->version = 1;
- $task->openedBy = 'admin';
- $task->openedDate = '';
- $task->assignedTo = '';
- $task->assignedDate = '';
- $task->estStarted = '';
- $task->realStarted = '';
- $task->finishedBy = '';
- $task->finishedDate = '';
- $task->finishedList = '';
- $task->canceledBy = '';
- $task->canceledDate = '';
- $task->closedBy = '';
- $task->closedDate = '';
- $task->planDuration = 0;
- $task->realDuration = 0;
- $task->closedReason = '';
- $task->lastEditedBy = '';
- $task->lastEditedDate = '';
- $task->activatedDate = '';
- $task->order = 0;
- $task->repo = 0;
- $task->mr = 0;
- $task->entry = '';
- $task->lines = '';
- $task->deleted = 0;
- $task->vision = 'rnd';
- $task->storyID = '';
- $task->storyTitle = '';
- $task->product = '';
- $task->branch = '';
- $task->latestStoryVersion = '';
- $task->storyStatus = '';
- $task->priOrder = 3;
- $task->assignedToRealName = '';
- $task->needConfirm = '';
- $task->progress = 0;
- $task->isParent = 0;
- return $task;
- }
- /**
- * 获取新手模式任务。
- * Get taks.
- *
- * @access public
- * @return array
- */
- public function getTasks()
- {
- $waitTask = $this->getTask();
- $doneTask = $this->getTask();
- $doneTask->id = 2;
- $doneTask->name = 'Done task';
- $doneTask->status = 'done';
- $doneTask->finishedBy = 'test';
- $tasks = array();
- $tasks[$waitTask->id] = $waitTask;
- $tasks[$doneTask->id] = $doneTask;
- return $tasks;
- }
- /**
- * 获取新手模式版本。
- * Get build.
- *
- * @access public
- * @return object
- */
- public function getBuild()
- {
- $build = new stdClass();
- $build->id = 1;
- $build->system = 1;
- $build->project = 2;
- $build->product = 1;
- $build->branch = '0';
- $build->execution = 3;
- $build->builds = '';
- $build->name = 'Test build';
- $build->scmPath = '';
- $build->filePath = '';
- $build->date = '';
- $build->stories = '';
- $build->bugs = '';
- $build->artifactRepoID = 0;
- $build->builder = 'test';
- $build->desc = '';
- $build->createdBy = '';
- $build->createdDate = '';
- $build->deleted = 0;
- $build->executionName = 'Test execution';
- $build->productName = 'Test product';
- $build->productType = 'normal';
- $build->allBugs = '1';
- $build->allStories = '1';
- $build->files = array();
- return $build;
- }
- /**
- * 获取新手模式版本。
- * Get build.
- *
- * @access public
- * @return array
- */
- public function getBuilds()
- {
- $build = $this->getBuild();
- $builds = array();
- $builds[$build->id] = $build;
- return $builds;
- }
- /**
- * 获取新手模式版本键值对。
- * Get build pairs.
- *
- * @access public
- * @return array
- */
- public function getBuildPairs()
- {
- return array(1 => 'Test build');
- }
- /**
- * 获取新手模式测试单。
- * Get run.
- *
- * @access public
- * @return object
- */
- public function getRun()
- {
- $run = new stdClass();
- $run->id = 1;
- $run->task = 1;
- $run->version = 1;
- $run->assignedTo = '';
- $run->lastRunner = '';
- $run->lastRunDate = '';
- $run->lastRunResult = '';
- $run->status = 'normal';
- $run->case = 1;
- return $run;
- }
- /**
- * 获取新手模式用例。
- * Get Cases.
- *
- * @access public
- * @return object
- */
- public function getCase()
- {
- $case = new stdClass();
- $case->project = 2;
- $case->product = 1;
- $case->case = 1;
- $case->count = 1;
- $case->version = 1;
- $case->order = 0;
- $case->id = 1;
- $case->execution = 3;
- $case->branch = 0;
- $case->lib = 0;
- $case->module = 0;
- $case->path = 0;
- $case->story = 0;
- $case->storyVersion = 1;
- $case->title = 'Test case';
- $case->precondition = '';
- $case->keywords = '';
- $case->pri = 3;
- $case->type = 'feature';
- $case->auto = 'no';
- $case->frame = '';
- $case->stage = 'unittest';
- $case->howRun = '';
- $case->script = '';
- $case->scriptedBy = '';
- $case->scriptedDate = '';
- $case->scriptStatus = '';
- $case->scriptLocation = '';
- $case->status = 'normal';
- $case->subStatus = '';
- $case->color = '';
- $case->frequency = 1;
- $case->openedBy = '';
- $case->openedDate = '';
- $case->reviewedBy = '';
- $case->reviewedDate = '';
- $case->lastEditedBy = '';
- $case->lastEditedDate = '';
- $case->linkCase = '';
- $case->fromBug = 0;
- $case->fromCaseID = 0;
- $case->fromCaseVersion = 1;
- $case->deleted = 0;
- $case->lastRunner = '';
- $case->lastRunDate = '';
- $case->lastRunResult = 'fail';
- $case->scene = 0;
- $case->sort = 0;
- $case->bugs = 1;
- $case->results = 1;
- $case->caseFails = 1;
- $case->stepNumber = 1;
- $case->needconfirm = '';
- $case->task = 1;
- $case->case = 1;
- $case->assignedTo = '';
- $case->caseVersion = '';
- $case->storyTitle = '';
- $case->caseStatus = 'normal';
- $case->currentVersion = 1;
- $step1 = new stdClass();
- $step1->name = 1;
- $step1->id = 1;
- $step1->step = 'Test step1';
- $step1->desc = 'Test step1';
- $step1->expect = 'Step1 expect';
- $step1->type = 'step';
- $step1->parent = 0;
- $step1->grade = 1;
- $step2 = new stdClass();
- $step2->name = 2;
- $step2->id = 2;
- $step2->step = 'Test step2';
- $step2->desc = 'Test step2';
- $step2->expect = 'Step2 expect';
- $step2->type = 'step';
- $step2->parent = 0;
- $step2->grade = 1;
- $case->steps = array(1 => $step1, 2 => $step2);
- return $case;
- }
- /**
- * 获取新手模式用例。
- * Get Cases.
- *
- * @access public
- * @return array
- */
- public function getCases()
- {
- $case = $this->getCase();
- $cases = array();
- $cases[$case->id] = $case;
- return $cases;
- }
- /**
- * 获取新手模式用例执行结果。
- * Get result.
- *
- * @access public
- * @return object
- */
- public function getResult()
- {
- $result = new stdClass();
- $result->id = 1;
- $result->run = 0;
- $result->case = 1;
- $result->version = 1;
- $result->job = 0;
- $result->compile = 0;
- $result->caseResult = 'fail';
- $result->stepResults = '';
- $result->ZTFResult = '';
- $result->node = 0;
- $result->lastRunner = $this->app->user->account;
- $result->date = helper::now();
- $result->duration = 0;
- $result->xml = '';
- $result->deploy = 0;
- $result->build = 0;
- $result->task = 0;
- $result->nodeName = '';
- $result->files = array();
- return $result;
- }
- /**
- * 获取新手模式用例执行结果。
- * Get results.
- *
- * @access public
- * @return array
- */
- public function getResults()
- {
- $result = $this->getResult();
- $result->stepResults = array(
- 1 => array(
- 'id' => 1,
- 'parent' => 0,
- 'case' => 1,
- 'version' => 1,
- 'type' => 'step',
- 'desc' => 'Test step1',
- 'expect' => 'Step1 expect',
- 'name' => 1,
- 'grade' => 1,
- 'result' => 'fail',
- 'real' => '',
- 'files' => array()
- ),
- 2 => array(
- 'id' => 2,
- 'parent' => 0,
- 'case' => 1,
- 'version' => 1,
- 'type' => 'step',
- 'desc' => 'Test step2',
- 'expect' => 'Step2 expect',
- 'name' => 2,
- 'grade' => 1,
- 'result' => 'pass',
- 'real' => '',
- 'files' => array()
- )
- );
- return array($result->id => $result);
- }
- /**
- * 获取新手模式测试单。
- * Get testtask.
- *
- * @access public
- * @return object
- */
- public function getTesttask()
- {
- $testtask = new stdClass();
- $testtask->id = 1;
- $testtask->project = 2;
- $testtask->product = 1;
- $testtask->name = 'Test testtask';
- $testtask->execution = 3;
- $testtask->build = 1;
- $testtask->joint = 0;
- $testtask->type = '';
- $testtask->owner = '';
- $testtask->pri = 3;
- $testtask->begin = helper::today();
- $testtask->end = helper::today();
- $testtask->realBegan = '';
- $testtask->realFinishedDate = '';
- $testtask->mailto = '';
- $testtask->desc = '';
- $testtask->report = '';
- $testtask->status = 'wait';
- $testtask->testreport = 0;
- $testtask->auto = 'no';
- $testtask->subStatus = '';
- $testtask->createdBy = $this->app->user->account;
- $testtask->createdDate = helper::now();
- $testtask->deleted = 0;
- $testtask->members = '';
- $testtask->buildName = 'Test build';
- $testtask->productName = 'Test product';
- $testtask->productType = 'normal';
- $testtask->branch = '0';
- $testtask->executionName = 'Test execution';
- $testtask->buildName = 'Test build';
- $testtask->files = array();
- return $testtask;
- }
- /**
- * 获取新手模式测试单列表。
- * Get testtasks.
- *
- * @access public
- * @return array
- */
- public function getTesttasks()
- {
- $testtask = $this->getTesttask();
- $testtasks = array();
- $testtasks[$testtask->id] = $testtask;
- return $testtasks;
- }
- /**
- * 获取新手模式测试单键值对。
- * Get testtask pairs.
- *
- * @access public
- * @return array
- */
- public function getTesttaskPairs()
- {
- return array(1 => 'Test testtask');
- }
- /**
- * 获取新手模式测试报告。
- * Get testreport.
- *
- * @access public
- * @return object
- */
- public function getTestReport()
- {
- $testreport = new stdClass();
- $testreport->id = 1;
- $testreport->project = 2;
- $testreport->product = 1;
- $testreport->execution = 3;
- $testreport->tasks = '1';
- $testreport->builds = '1';
- $testreport->title = 'Test testreport';
- $testreport->begin = helper::today();
- $testreport->end = helper::today();
- $testreport->owner = $this->app->user->account;
- $testreport->members = '';
- $testreport->stories = '';
- $testreport->bugs = '';
- $testreport->cases = '';
- $testreport->report = '';
- $testreport->objectType = 'execution';
- $testreport->objectID = 3;
- $testreport->createdBy = $this->app->user->account;
- $testreport->createdDate = helper::now();
- $testreport->deleted = 0;
- $testreport->taskName = 'Test testtask';
- return $testreport;
- }
- /**
- * 获取新手模式测试报告列表。
- * Get testreports.
- *
- * @access public
- * @return array
- */
- public function getTestReports()
- {
- $testreport = $this->getTestReport();
- $testreports = array();
- $testreports[$testreport->id] = $testreport;
- return $testreports;
- }
- /**
- * 获取新手模式Bug。
- * Get bug.
- *
- * @access public
- * @return object
- */
- public function getBug()
- {
- $bug = new stdClass();
- $bug->id = 1;
- $bug->project = 2;
- $bug->product = 1;
- $bug->injection = 0;
- $bug->identify = 0;
- $bug->branch = 0;
- $bug->module = 0;
- $bug->execution = 3;
- $bug->plan = 0;
- $bug->story = 0;
- $bug->storyVersion = 0;
- $bug->task = 0;
- $bug->toTask = 0;
- $bug->toStory = 0;
- $bug->title = 'Test bug-active';
- $bug->keywords = '';
- $bug->severity = 3;
- $bug->pri = 3;
- $bug->type = 'codeerror';
- $bug->os = '';
- $bug->browser = '';
- $bug->hardware = '';
- $bug->found = '';
- $bug->steps = '';
- $bug->status = 'active';
- $bug->subStatus = '';
- $bug->color = '';
- $bug->confirmed = 0;
- $bug->activatedCount= 0;
- $bug->activatedDate = '';
- $bug->feedbackBy = '';
- $bug->notifyEmail = '';
- $bug->mailto = '';
- $bug->openedBy = '';
- $bug->openedDate = '';
- $bug->openedBuild = '1';
- $bug->assignedTo = 'Test';
- $bug->assignedDate = '';
- $bug->deadline = '';
- $bug->resolvedBy = '';
- $bug->resolution = '';
- $bug->resolvedBuild = '';
- $bug->resolvedDate = '';
- $bug->closedBy = '';
- $bug->closedDate = '';
- $bug->duplicateBug = 0;
- $bug->relatedBug = '';
- $bug->case = 0;
- $bug->caseVersion = 0;
- $bug->feedback = 0;
- $bug->result = 0;
- $bug->repo = 0;
- $bug->mr = 0;
- $bug->entry = '';
- $bug->lines = '';
- $bug->v1 = '';
- $bug->v2 = '';
- $bug->repoType = '';
- $bug->issueKey = '';
- $bug->testtask = 0;
- $bug->lastEditedBy = '';
- $bug->lastEditedDate= '';
- $bug->deleted = 0;
- $bug->priOrder = 3;
- $bug->severityOrder = 3;
- $bug->isParent = '';
- return $bug;
- }
- /**
- * 获取新手模式Bug列表。
- * Get bugs.
- *
- * @access public
- * @return array
- */
- public function getBugs()
- {
- $activeBug = $this->getBug();
- $activeBug->id = 1;
- $activeBug->status = 'active';
- $activeBug->title = 'Test bug-active';
- $resolvedBug = $this->getBug();
- $resolvedBug->id = 2;
- $resolvedBug->status = 'resolved';
- $resolvedBug->title = 'Test bug-resolved';
- $bugs = array();
- $bugs[$activeBug->id] = $activeBug;
- $bugs[$resolvedBug->id] = $resolvedBug;
- return $bugs;
- }
- /**
- * 获取新手模式问题。
- * Get issue.
- *
- * @access public
- * @return object
- */
- public function getIssue()
- {
- $issue = new stdClass();
- $issue->id = 1;
- $issue->resolvedBy = '';
- $issue->project = 2;
- $issue->execution = 0;
- $issue->title = 'Test issue-unconfirmed';
- $issue->desc = '';
- $issue->pri = 3;
- $issue->severity = 1;
- $issue->type = 'design';
- $issue->activity = '';
- $issue->deadline = '';
- $issue->resolution = '';
- $issue->resolutionComment= '';
- $issue->objectID = '';
- $issue->resolvedDate = '';
- $issue->status = 'unconfirmed';
- $issue->owner = 'admin';
- $issue->lib = 0;
- $issue->from = 0;
- $issue->version = 1;
- $issue->createdBy = '';
- $issue->createdDate = '';
- $issue->editedBy = '';
- $issue->editedDate = '';
- $issue->activateBy = '';
- $issue->activateDate = '';
- $issue->closedBy = '';
- $issue->closedDate = '';
- $issue->assignedTo = '';
- $issue->assignedBy = '';
- $issue->assignedDate = '';
- $issue->approvedDate = '';
- $issue->deleted = 0;
- return $issue;
- }
- /**
- * 获取新手模式问题列表。
- * Get issues.
- *
- * @access public
- * @return array
- */
- public function getIssues()
- {
- $unconfirmedIssue = $this->getIssue();
- $confirmedIssue = $this->getIssue();
- $confirmedIssue->id = 2;
- $confirmedIssue->title = 'Test issue-confirmed';
- $confirmedIssue->status = 'confirmed';
- $issues = array();
- $issues[$unconfirmedIssue->id] = $unconfirmedIssue;
- $issues[$confirmedIssue->id] = $confirmedIssue;
- return $issues;
- }
- /**
- * 获取新手模式风险。
- * Get risk.
- *
- * @access public
- * @return object
- */
- public function getRisk()
- {
- $risk = new stdClass();
- $risk->id = 1;
- $risk->project = 2;
- $risk->execution = 0;
- $risk->name = 'Test risk';
- $risk->source = '';
- $risk->category = '';
- $risk->strategy = '';
- $risk->status = 'active';
- $risk->impact = 3;
- $risk->probability = 3;
- $risk->rate = 9;
- $risk->pri = 'middle';
- $risk->identifiedDate = '';
- $risk->prevention = '';
- $risk->remedy = '';
- $risk->plannedClosedDate= '';
- $risk->actualClosedDate = '';
- $risk->lib = 0;
- $risk->from = 0;
- $risk->version = 1;
- $risk->createdBy = '';
- $risk->createdDate = '';
- $risk->editedBy = '';
- $risk->editedDate = '';
- $risk->resolution = '';
- $risk->resolvedBy = '';
- $risk->activateBy = '';
- $risk->activateDate = '';
- $risk->assignedTo = '';
- $risk->closedBy = '';
- $risk->closedDate = '';
- $risk->cancelBy = '';
- $risk->cancelDate = '';
- $risk->cancelReason = '';
- $risk->hangupBy = '';
- $risk->hangupDate = '';
- $risk->trackedBy = '';
- $risk->trackedDate = '';
- $risk->assignedDate = '';
- $risk->approvedDate = '';
- $risk->deleted = 0;
- return $risk;
- }
- /**
- * 获取新手模式风险列表。
- * Get risks.
- *
- * @access public
- * @return array
- */
- public function getRisks()
- {
- $risk = $this->getRisk();
- return array($risk->id => $risk);
- }
- /**
- * 获取新手模式设计。
- * Get design.
- *
- * @access public
- * @return array
- */
- public function getDesign()
- {
- $design = new stdClass();
- $design->id = 1;
- $design->project = 2;
- $design->product = 0;
- $design->commit = '';
- $design->commitedBy = '';
- $design->execution = 0;
- $design->name = 'Test Design';
- $design->status = '';
- $design->createdBy = $this->app->user->account;
- $design->createdDate = helper::now();
- $design->editedBy = '';
- $design->editedDate = '';
- $design->assignedTo = '';
- $design->assignedBy = '';
- $design->assignedDate = '';
- $design->deleted = 0;
- $design->story = 0;
- $design->desc = 'Design Description';
- $design->version = 1;
- $design->type = 'HLDS';
- $design->files = array();
- $design->productName = 'Test product';
- $design->docs = '';
- $design->docVersions = '';
- return $design;
- }
- /**
- * 获取新手模式设计列表。
- * Get designs.
- *
- * @access public
- * @return array
- */
- public function getDesigns()
- {
- $design = $this->getDesign();
- return array($design->id => $design);
- }
- /**
- * 获取新手模式评审。
- * Get review.
- *
- * @access public
- * @return object
- */
- public function getReview()
- {
- $review = new stdClass();
- $review->id = 1;
- $review->project = 2;
- $review->title = 'Test Review';
- $review->object = 1;
- $review->template = 0;
- $review->doc = 0;
- $review->docVersion = 0;
- $review->status = 'pass';
- $review->reviewedBy = '';
- $review->auditedBy = '';
- $review->createdBy = '';
- $review->createdDate = '';
- $review->begin = '';
- $review->deadline = '';
- $review->lastReviewedBy = '';
- $review->lastReviewedDate= '';
- $review->lastAuditedBy = '';
- $review->lastAuditedDate = '';
- $review->lastEditedBy = '';
- $review->lastEditedDate = '';
- $review->result = '';
- $review->auditResult = '';
- $review->deleted = 0;
- $review->version = '01';
- $review->category = 'PP';
- $review->product = 1;
- $review->approval = 1;
- $review->isPending = '';
- return $review;
- }
- /**
- * 获取新手模式评审列表。
- * Get reviews.
- *
- * @access public
- * @return array
- */
- public function getReviews()
- {
- return array(1 => $this->getReview());
- }
- /**
- * 获取新手模式看板默认区域。
- * Get region pairs.
- *
- * @access public
- * @return array
- */
- public function getRegionPairs()
- {
- $this->loadModel('kanban');
- return array(1 => $this->lang->kanbanregion->default);
- }
- /**
- * 获取新手模式看板组。
- * Get groups.
- *
- * @access public
- * @return array
- */
- public function getGroups()
- {
- $groups = array();
- $groups[1] = array();
- foreach(array(1, 2, 3) as $key)
- {
- $group = new stdClass();
- $group->id = $key;
- $group->kanban = 3;
- $group->region = 1;
- $group->order = $key;
- $groups[1][$key] = $group;
- }
- return $groups;
- }
- /**
- * 获取新手模式看板泳道。
- * Get lane.
- *
- * @access public
- * @return object
- */
- public function getLaneGroup()
- {
- $this->loadModel('kanban');
- $laneGroup = array();
- foreach(array(1 => 'story', 2 => 'task', 3 => 'bug') as $key => $objectType)
- {
- $lane = array();
- $lane['execution'] = 3;
- $lane['region'] = 1;
- $lane['id'] = $key;
- $lane['type'] = $objectType;
- $lane['name'] = $key;
- $lane['title'] = $this->config->kanban->default->{$objectType}->name;
- $lane['color'] = $this->config->kanban->default->{$objectType}->color;
- $lane['order'] = $this->config->kanban->default->{$objectType}->order;
- $laneGroup[$key] = array($lane);
- }
- return $laneGroup;
- }
- /**
- * 获取新手模式看板列。
- * Get columns.
- *
- * @access public
- * @return array
- */
- public function getColumns()
- {
- $this->loadModel('kanban');
- $columnID = 1;
- $columns = array();
- foreach(array(1 => 'story', 2 => 'task', 3 => 'bug') as $key => $objectType)
- {
- $columnList = array();
- foreach($this->lang->kanban->{$objectType . 'Column'} as $type => $name)
- {
- $column = array();
- $column['parent'] = 0;
- $column['region'] = 1;
- $column['group'] = 1;
- $column['color'] = '#333';
- $column['limit'] = -1;
- $column['actionList'] = array('setColumn', 'setWIP', 'deleteColumn');
- $column['id'] = $columnID ++;
- $column['name'] = $column['id'];
- $column['type'] = $type;
- $column['title'] = $name;
- $columnList[] = $column;
- }
- $columns[$key] = $columnList;
- }
- return $columns;
- }
- /**
- * 获取新手模式看板列。
- * Get column.
- *
- * @access public
- * @return object
- */
- public function getColumn()
- {
- $column = new stdClass();
- $column->id = 1;
- $column->parent = 0;
- $column->type = 'backlog';
- $column->region = 1;
- $column->group = 1;
- $column->name = 'Backlog';
- $column->color = '#333';
- $column->limit = -1;
- $column->order = 0;
- $column->archived = 0;
- $column->deleted = 0;
- $column->laneType = 'story';
- return $column;
- }
- /**
- * 获取新手模式看板卡片。
- * Get card.
- *
- * @access public
- * @return array
- */
- public function getCardGroup()
- {
- $card = array();
- $card['id'] = 1;
- $card['name'] = 1;
- $card['pri'] = 3;
- $card['color'] = '';
- $card['assignedTo'] = '';
- $card['parent'] = 0;
- $card['progress'] = 0;
- $card['group'] = '';
- $card['region'] = '';
- $card['begin'] = '';
- $card['end'] = '';
- $card['fromID'] = 0;
- $card['fromType'] = '';
- $card['desc'] = '';
- $card['originDesc'] = '';
- $card['delay'] = 0;
- $card['objectStatus'] = '';
- $card['deleted'] = 0;
- $card['date'] = '';
- $card['estimate'] = 0;
- $card['deadline'] = '';
- $card['severity'] = '';
- $card['avatarList'] = array();
- $card['realnames'] = '';
- $card['order'] = 0;
- $card['acl'] = 'open';
- $card['dbPrivs'] = array();
- $storyCard = $card;
- $storyCard['title'] = 'Test story';
- $storyCard['column'] = 1;
- $storyCard['lane'] = 1;
- $storyCard['status'] = 'active';
- $storyCard['cardType'] = 'story';
- $taskCard = $card;
- $taskCard['title'] = 'Test task';
- $taskCard['column'] = 16;
- $taskCard['lane'] = 2;
- $taskCard['left'] = 0;
- $taskCard['estStarted'] = '';
- $taskCard['mode'] = '';
- $taskCard['status'] = 'wait';
- $taskCard['cardType'] = 'task';
- $bugCard = $card;
- $bugCard['title'] = 'Test bug';
- $bugCard['column'] = 23;
- $bugCard['lane'] = 3;
- $bugCard['status'] = 'active';
- $bugCard['cardType'] = 'bug';
- return array(1 => array(1 => array(1 => array($storyCard))), 2 => array(2 => array(16 => array($taskCard))), 3 => array(3 => array(23 => array($bugCard))));
- }
- /**
- * 获取新手模式计划。
- * Get plan.
- *
- * @access public
- * @return object
- */
- public function getPlan()
- {
- $plan = new stdClass();
- $plan->id = 1;
- $plan->product = 1;
- $plan->branch = '0';
- $plan->parent = 0;
- $plan->title = 'Test plan';
- $plan->status = 'wait';
- $plan->desc = '';
- $plan->begin = helper::today();
- $plan->end = helper::today();
- $plan->finishedDate = '';
- $plan->closedDate = '';
- $plan->order = 0;
- $plan->closedReason = '';
- $plan->createdBy = $this->app->user->account;
- $plan->createdDate = helper::now();
- $plan->deleted = 0;
- $plan->bugs = 0;
- $plan->hour = 0;
- $plan->stories = 0;
- $plan->projects = array();
- $plan->expired = '';
- $plan->branchName = '';
- $plan->isParent = 0;
- return $plan;
- }
- /**
- * 获取新手模式计划列表。
- * Get plans.
- *
- * @access public
- * @return array
- */
- public function getPlans()
- {
- return array(1 => $this->getPlan());
- }
- /**
- * 获取新手模式计划键值对。
- * Get plan pairs.
- *
- * @access public
- * @return array
- */
- public function getPlanPairs()
- {
- return array(1 => $this->getPlan()->title);
- }
- /**
- * 获取新手模式系统。
- * Get system.
- *
- * @access public
- * @return object
- */
- public function getSystem()
- {
- $system = new stdclass();
- $system->id = 1;
- $system->name = 'Test App';
- $system->product = 1;
- $system->integrated = '0';
- $system->latestRelease = 0;
- $system->status = 'active';
- $system->children = '';
- $system->desc = '';
- return $system;
- }
- /**
- * 获取新手模式应用键值对。
- * Get system pairs.
- *
- * @access public
- * @return array
- */
- public function getSystemPairs()
- {
- return array(1 => $this->getSystem()->name);
- }
- /**
- * 获取新手模式产品应用列表。
- * Get product app list.
- *
- * @access public
- * @return array
- */
- public function getSystemList()
- {
- return array(1 => $this->getSystem());
- }
- /**
- * 获取新手模式发布。
- * Get releases.
- *
- * @access public
- * @return object
- */
- public function getRelease()
- {
- $release = new stdClass();
- $release->id = 1;
- $release->system = 1;
- $release->project = 0;
- $release->product = 1;
- $release->branch = '0';
- $release->shadow = 1;
- $release->build = '';
- $release->name = 'Test release';
- $release->marker = 0;
- $release->date = helper::today();
- $release->releasedDate = '';
- $release->stories = '';
- $release->bugs = '';
- $release->leftBugs = '';
- $release->desc = '';
- $release->mailto = '';
- $release->notify = '';
- $release->status = 'wait';
- $release->subStatus = '';
- $release->createdBy = $this->app->user->account;
- $release->createdDate = helper::now();
- $release->deleted = 0;
- $release->productName = 'Test product';
- $release->productType = 'normal';
- $release->builds = array();
- $release->branchName = 'Test branch';
- $release->projectName = '';
- $release->files = array();
- $release->releases = '';
- return $release;
- }
- /**
- * 获取新手模式发布列表。
- * Get releases.
- *
- * @access public
- * @return array
- */
- public function getReleases()
- {
- return array(1 => $this->getRelease());
- }
- /**
- * 获取新手模式项目集键值对。
- * Get program pairs.
- *
- * @access public
- * @return array
- */
- public function getProgramPairs()
- {
- return array(1 => 'Test program');
- }
- /**
- * 获取新手模式项目集。
- * Get program.
- *
- * @access public
- * @return object
- */
- public function getProgram()
- {
- $program = $this->getProject();
- $program->id = 1;
- $program->name = 'Test program';
- $program->project = 0;
- $program->type = 'program';
- $program->parent = 0;
- $program->path = ',1,';
- $program->grade = 1;
- return $program;
- }
- /**
- * 获取新手模式项目集列表。
- * Get programs.
- *
- * @access public
- * @return array
- */
- public function getPrograms()
- {
- return array(1 => $this->getProgram());
- }
- /**
- * 获取新手模式分支键值对。
- * Get branch pairs.
- *
- * @access public
- * @return array
- */
- public function getBranchPairs()
- {
- $this->loadModel('branch');
- return array(0 => $this->lang->branch->main, 1 => 'Test branch');
- }
- /**
- * 获取新手模式项目关联分支。
- * Get branch by project.
- *
- * @access public
- * @return array
- */
- public function getBranchesByProject()
- {
- $branch = new stdClass();
- $branch->project = 2;
- $branch->product = 1;
- $branch->branch = 0;
- $branch->plan = 0;
- $branch->roadmap = 0;
- return array(1 => array($branch));
- }
- /**
- * 获取新手模式分支列表。
- * Get branches.
- *
- * @access public
- * @return array
- */
- public function getBranches()
- {
- $this->loadModel('branch');
- $main = new stdClass();
- $main->id = 0;
- $main->product = 1;
- $main->name = $this->lang->branch->main;
- $main->default = 1;
- $main->status = 'active';
- $main->desc = $this->lang->branch->defaultBranch;
- $main->createdDate = helper::now();
- $main->closedDate = '';
- $main->order = 0;
- $main->deleted = 0;
- $branch = new stdClass();
- $branch->id = 1;
- $branch->product = 1;
- $branch->name = 'Test branch';
- $branch->default = 0;
- $branch->status = 'active';
- $branch->desc = '';
- $branch->createdDate = helper::now();
- $branch->closedDate = '';
- $branch->order = 1;
- $branch->deleted = 0;
- return array($main, $branch);
- }
- /**
- * 获取新手模式反馈。
- * Get feedback.
- *
- * @access public
- * @return object
- */
- public function getFeedback()
- {
- $feedback = new stdClass();
- $feedback->id = 1;
- $feedback->product = 1;
- $feedback->module = 0;
- $feedback->title = 'Test feedback';
- $feedback->type = '';
- $feedback->solution = '';
- $feedback->desc = '';
- $feedback->pri = 3;
- $feedback->status = 'noreview';
- $feedback->subStatus = '';
- $feedback->public = 1;
- $feedback->notify = 1;
- $feedback->notifyEmail = '';
- $feedback->source = '';
- $feedback->likes = '';
- $feedback->result = 0;
- $feedback->faq = 0;
- $feedback->openedBy = $this->app->user->account;
- $feedback->openedDate = helper::now();
- $feedback->reviewedBy = '';
- $feedback->reviewedDate = '';
- $feedback->processedBy = '';
- $feedback->processedDate = '';
- $feedback->closedBy = '';
- $feedback->closedDate = '';
- $feedback->closedReason = '';
- $feedback->editedBy = '';
- $feedback->editedDate = '';
- $feedback->assignedTo = '';
- $feedback->assignedDate = '';
- $feedback->activatedBy = '';
- $feedback->activatedDate = '';
- $feedback->feedbackBy = '';
- $feedback->repeatFeedback = 0;
- $feedback->mailto = '';
- $feedback->keywords = '';
- $feedback->deleted = 0;
- $feedback->dept = 0;
- return $feedback;
- }
- /**
- * 获取新手模式反馈列表。
- * Get feedbacks.
- *
- * @access public
- * @return array
- */
- public function getFeedbacks()
- {
- $waitFeedback = $this->getFeedback();
- $waitFeedback->id = 1;
- $waitFeedback->title = 'Wait feedback';
- $waitFeedback->status = 'wait';
- $noReviewFeedback = $this->getFeedback();
- $noReviewFeedback->id = 2;
- $noReviewFeedback->title = 'Not review feedback';
- $noReviewFeedback->status = 'noreview';
- return array($waitFeedback->id => $waitFeedback, $noReviewFeedback->id => $noReviewFeedback);
- }
- /**
- * 获取新手模式团队空间或我的空间。
- * Get team spaces.
- *
- * @param string $type
- * @access public
- * @return array
- */
- public function getSubSpaces($type = 'custom')
- {
- if($type == 'custom') return array(1 => 'Test Team Space');
- if($type == 'mine') return array(1 => 'Test My Space');
- return array();
- }
- /**
- * 获取新手模式团队空间。
- * Get team spaces.
- *
- * @access public
- * @return array
- */
- public function getDocTemplateSpaces()
- {
- return array(1 => 'Doc Template Space');
- }
- /**
- * 获取新手模式文档库。
- * Get doc lib.
- *
- * @access public
- * @return object
- */
- public function getDocLib()
- {
- $docLib = new stdClass();
- $docLib->id = 2;
- $docLib->type = 'custom';
- $docLib->vision = 'rnd';
- $docLib->parent = 1;
- $docLib->product = 0;
- $docLib->project = 0;
- $docLib->execution = 0;
- $docLib->name = 'Test Doc Lib';
- $docLib->baseUrl = '';
- $docLib->acl = 'open';
- $docLib->groups = '';
- $docLib->users = '';
- $docLib->main = 0;
- $docLib->collector = '';
- $docLib->desc = '';
- $docLib->order = 0;
- $docLib->addedBy = $this->app->user->account;
- $docLib->addedDate = helper::now();
- $docLib->deleted = 0;
- $docLib->allCount = 2;
- return $docLib;
- }
- /**
- * 获取新手模式文档库。
- * Get doc lib.
- *
- * @access public
- * @return array
- */
- public function getDocLibs()
- {
- $docLib = $this->getDocLib();
- return array($docLib->id => $docLib);
- }
- /**
- * 获取新手模式文档库树。
- * Get lib tree.
- *
- * @access public
- * @return array
- */
- public function getLibTree()
- {
- $docLib = new stdClass();
- $docLib->id = 2;
- $docLib->type = 'docLib';
- $docLib->name = 'Test Doc Lib';
- $docLib->parent = 1;
- $docLib->order = 0;
- $docLib->main = 0;
- $docLib->objectType = 'custom';
- $docLib->objectID = 1;
- $docLib->addedBy = $this->app->user->account;
- $docLib->active = 1;
- $docLib->children = array();
- return array($docLib);
- }
- /**
- * 获取新手模式文档。
- * Get doc.
- *
- * @access public
- * @return object
- */
- public function getDoc()
- {
- $doc = new stdClass();
- $doc->id = 1;
- $doc->vision = 'rnd';
- $doc->project = 0;
- $doc->product = 0;
- $doc->execution = 0;
- $doc->lib = 2;
- $doc->template = '';
- $doc->templateType = '';
- $doc->chapterType = '';
- $doc->module = 0;
- $doc->title = 'Test Doc';
- $doc->keywords = '';
- $doc->type = 'text';
- $doc->status = 'normal';
- $doc->parent = 0;
- $doc->path = '';
- $doc->grade = 0;
- $doc->order = 10;
- $doc->views = 1;
- $doc->assetLib = 0;
- $doc->assetLibType = '';
- $doc->from = 0;
- $doc->fromVersion = 1;
- $doc->draft = "This is the description of the document.";
- $doc->collects = 0;
- $doc->addedBy = $this->app->user->account;
- $doc->addedDate = helper::now();
- $doc->assignedTo = '';
- $doc->assignedDate = '';
- $doc->approvedDate = '';
- $doc->editedBy = '';
- $doc->editedDate = '';
- $doc->editingDate = array();
- $doc->editedList = ",{$this->app->user->account}";
- $doc->mailto = '';
- $doc->acl = 'open';
- $doc->groups = '';
- $doc->users = '';
- $doc->version = 2;
- $doc->deleted = 0;
- $doc->collector = '';
- $doc->releasedDate = '';
- $doc->releasedBy = $this->app->user->account;
- $doc->digest = helper::now();
- $doc->content = "This is the description of the document.";
- $doc->contentType = 'html';
- $doc->contentVersion = 2;
- $doc->files = array();
- $doc->moduleName = '';
- $doc->executionName = '';
- $doc->productName = '';
- return $doc;
- }
- /**
- * 获取新手模式文档列表。
- * Get docs.
- *
- * @access public
- * @return array
- */
- public function getDocs()
- {
- $doc = $this->getDoc();
- return array($doc->id => $doc);
- }
- /**
- * 获取新手模式需求池。
- * Get demandpool.
- *
- * @access public
- * @return object
- */
- public function getDemandpool()
- {
- $demandpool = new stdClass();
- $demandpool->id = 1;
- $demandpool->name = 'Test demandpool';
- $demandpool->desc = '';
- $demandpool->status = 'normal';
- $demandpool->products = '1';
- $demandpool->createdBy = $this->app->user->account;
- $demandpool->createdDate = helper::now();
- $demandpool->owner = $this->app->user->account;
- $demandpool->reviewer = ",{$this->app->user->account},test";
- $demandpool->acl = 'open';
- $demandpool->deleted = 0;
- $demandpool->files = array();
- return $demandpool;
- }
- /**
- * 获取新手模式需求池需求。
- * Get demand.
- *
- * @access public
- * @return object
- */
- public function getDemand()
- {
- $demand = new stdClass();
- $demand->id = 1;
- $demand->pool = 1;
- $demand->product = '';
- $demand->parent = 0;
- $demand->pri = 3;
- $demand->title = 'Test Demand';
- $demand->assignedTo = '';
- $demand->status = 'active';
- $demand->childDemands = '';
- $demand->module = 0;
- $demand->category = 'feature';
- $demand->source = '';
- $demand->sourceNote = '';
- $demand->feedbackedBy = '';
- $demand->email = '';
- $demand->assignedDate = '';
- $demand->reviewedBy = '';
- $demand->reviewedDate = '';
- $demand->stage = 'wait';
- $demand->duration = '';
- $demand->BSA = '';
- $demand->story = 0;
- $demand->roadmap = 0;
- $demand->createdBy = $this->app->user->account;
- $demand->createdDate = helper::now();
- $demand->mailto = '';
- $demand->duplicateDemand = '';
- $demand->version = 1;
- $demand->parentVersion = 0;
- $demand->vision = 'or';
- $demand->color = '';
- $demand->changedBy = '';
- $demand->changedDate = '';
- $demand->closedBy = '';
- $demand->closedDate = '';
- $demand->closedReason = '';
- $demand->submitedBy = '';
- $demand->lastEditedBy = '';
- $demand->lastEditedDate = '';
- $demand->activatedDate = '';
- $demand->distributedBy = '';
- $demand->distributedDate = '';
- $demand->feedback = 0;
- $demand->keywords = '';
- $demand->deleted = 0;
- $demand->storyType = 'demand';
- return $demand;
- }
- /**
- * 获取新手模式需求池需求列表。
- * Get demands.
- *
- * @access public
- * @return array
- */
- public function getDemands()
- {
- $activeDemand = $this->getDemand();
- $draftDemand = $this->getDemand();
- $draftDemand->id = 2;
- $draftDemand->status = 'reviewing';
- $draftDemand->title = 'Test Reviewing Demand';
- $draftDemand->notReview = array($this->app->user->account);
- return array($activeDemand->id => $activeDemand, $draftDemand->id => $draftDemand);
- }
- /**
- * 获取新手模式调研任务列表。
- * Get research stage stats.
- *
- * @access public
- * @return array
- */
- public function getResearchStageStats()
- {
- $stage = $this->getExecution();
- $stage->id = 'sid_2';
- $stage->parent = 'sid_1';
- $stage->name = 'Test research stage';
- $stage->path = ',1,2,';
- $stage->project = 1;
- $stage->model = '';
- $stage->type = 'stage';
- $stage->attribute = 'research';
- $stage->canCreateTask = true;
- $waitTask = $this->getTask();
- $waitTask->id = 1;
- $waitTask->name = 'Wait Task';
- $waitTask->type = 'research';
- $waitTask->project = 1;
- $waitTask->execution = 2;
- $waitTask->parent = 'sid_2';
- $waitTask->rawParent = 0;
- $waitTask->isParent = 1;
- $doneTask = $this->getTask();
- $doneTask->id = 2;
- $doneTask->name = 'Done task';
- $doneTask->status = 'done';
- $doneTask->finishedBy = 'test';
- $doneTask->type = 'research';
- $doneTask->project = 1;
- $doneTask->execution = 2;
- $doneTask->parent = 'sid_2';
- $doneTask->rawParent = 0;
- $doneTask->isParent = 1;
- return array($stage, $waitTask, $doneTask);
- }
- /**
- * 获取新手模式市场。
- * Get market.
- *
- * @access public
- * @return object
- */
- public function getMarket()
- {
- $market = new stdClass();
- $market->id = 1;
- $market->name = 'Test Market';
- $market->industry = '';
- $market->scale = 0.00;
- $market->maturity = '';
- $market->speed = '';
- $market->competition = '';
- $market->strategy = '';
- $market->ppm = '';
- $market->desc = '';
- $market->openedBy = $this->app->user->account;
- $market->openedDate = helper::now();
- $market->lastEditedBy = '';
- $market->lastEditedDate = '';
- $market->deleted = 0;
- return $market;
- }
- /**
- * 获取新手模式Charter立项。
- * Get charter.
- *
- * @access public
- * @return object
- */
- public function getCharter()
- {
- $charter = new stdClass();
- $charter->id = 1;
- $charter->name = 'Test charter';
- $charter->level = 3;
- $charter->category = 'IPD';
- $charter->market = 'domestic';
- $charter->check = 0;
- $charter->appliedBy = $this->app->user->account;
- $charter->appliedDate = helper::now();
- $charter->budget = '';
- $charter->budgetUnit = 'CNY';
- $charter->product = ',1,';
- $charter->roadmap = '';
- $charter->spec = '';
- $charter->status = 'wait';
- $charter->createdBy = $this->app->user->account;
- $charter->createdDate = helper::now();
- $charter->charterFiles = '';
- $charter->closedBy = '';
- $charter->closedDate = '';
- $charter->closedReason = '';
- $charter->activatedBy = '';
- $charter->activatedDate = '';
- $charter->reviewedBy = '';
- $charter->reviewedResult = '';
- $charter->reviewedDate = '';
- $charter->meetingDate = '';
- $charter->meetingLocation = '';
- $charter->meetingMinutes = '';
- $charter->deleted = 0;
- return $charter;
- }
- /**
- * 获取新手模式Charter立项列表。
- * Get charter list.
- *
- * @access public
- * @return array
- */
- public function getCharters()
- {
- $charter = $this->getCharter();
- return array($charter->id => $charter);
- }
- /**
- * 获取新手模式代码库键值对。
- * Get repo pairs.
- *
- * @access public
- * @return array
- */
- public function getRepoPairs()
- {
- return array(1 => '[git] Test repo');
- }
- /**
- * 获取新手模式代码库。
- * Get repo.
- *
- * @access public
- * @return object
- */
- public function getRepo()
- {
- $repo = new stdClass();
- $repo->id = 1;
- $repo->product = 1;
- $repo->projects = '1';
- $repo->name = 'Test repo';
- $repo->path = '';
- $repo->prefix = '';
- $repo->encoding = 'utf-8';
- $repo->SCM = 'Git';
- $repo->client = '/usr/bin/git';
- $repo->serviceHost = 0;
- $repo->serviceProject = '';
- $repo->commits = 1;
- $repo->account = '';
- $repo->password = '';
- $repo->encrypt = 'base64';
- $repo->synced = 0;
- $repo->lastSync = '';
- $repo->lastCommit = '';
- $repo->desc = '';
- $repo->extra = '';
- $repo->preMerge = 0;
- $repo->job = 0;
- $repo->fileServerUrl = '';
- $repo->fileServerAccount = '';
- $repo->fileServerPassword = '';
- $repo->deleted = 0;
- $repo->codePath = '';
- return $repo;
- }
- /**
- * 获取新手模式提交记录。
- * Get git commits.
- *
- * @access public
- * @return array
- */
- public function getCommits()
- {
- $commit = new stdClass();
- $commit->id = 1;
- $commit->repo = 1;
- $commit->revision = 'bedeaaf39ef7084b9a455b9d9dba71e2db357201';
- $commit->commit = 1;
- $commit->comment = 'Git comment.';
- $commit->committer = $this->app->user->account;
- $commit->time = helper::now();
- $commit->originalComment = 'Git comment.';
- return array($commit->revision => $commit);
- }
- }
|