model.php 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641
  1. <?php
  2. /**
  3. * The model file of tutorial module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yidong Wang <yidong@cnezsoft.com>
  8. * @package tutorial
  9. * @version $Id$
  10. * @link https://www.zentao.net
  11. */
  12. class tutorialModel extends model
  13. {
  14. /**
  15. * 检查新手模式配置。
  16. * Check novice mode config.
  17. *
  18. * @access public
  19. * @return bool
  20. */
  21. public function checkNovice()
  22. {
  23. $account = $this->app->user->account;
  24. if($account == 'guest') return false;
  25. if(!empty($this->app->user->modifyPassword)) return false;
  26. $count = $this->dao->select('COUNT(1) AS count')->from(TABLE_ACTION)->where('actor')->eq($account)->fetch('count');
  27. if($count < 10) return true;
  28. $this->loadModel('setting')->setItem($account . '.common.global.novice', 0);
  29. return false;
  30. }
  31. /**
  32. * 获取新手模式产品键值对。
  33. * Get tutorial product pairs.
  34. *
  35. * @access public
  36. * @return array
  37. */
  38. public function getProductPairs()
  39. {
  40. return array(1 => 'Test product');
  41. }
  42. /**
  43. * 获取新手模式模块键值对。
  44. * Get module pairs for tutorial.
  45. *
  46. * @access public
  47. * @return array
  48. */
  49. public function getModulePairs()
  50. {
  51. return array(1 => 'Test module');
  52. }
  53. /**
  54. * 获取新手模式产品信息。
  55. * Get tutorial product.
  56. *
  57. * @access public
  58. * @return object
  59. */
  60. public function getProduct()
  61. {
  62. $product = new stdclass();
  63. $product->id = 1;
  64. $product->program = 0;
  65. $product->line = 0;
  66. $product->plan = 0;
  67. $product->name = 'Test product';
  68. $product->code = 'test';
  69. $product->type = 'normal';
  70. $product->status = 'normal';
  71. $product->desc = '';
  72. $product->shadow = '0';
  73. $product->PO = $this->app->user->account;
  74. $product->QD = '';
  75. $product->RD = '';
  76. $product->acl = 'open';
  77. $product->createdBy = $this->app->user->account;
  78. $product->createdDate = helper::now();
  79. $product->createdVersion = '8.1.3';
  80. $product->order = 10;
  81. $product->deleted = '0';
  82. $product->branch = '';
  83. $product->reviewer = $this->app->user->account;
  84. $product->branches = array();
  85. $product->plans = array('1' => 'Test plan');
  86. $product->totalEpics = 0;
  87. $product->totalRequirements = 0;
  88. $product->feedback = 0;
  89. $product->ticket = 0;
  90. $product->workflowGroup = 1;
  91. list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
  92. if($guideTask == 'branchManage')
  93. {
  94. $product->type = 'branch';
  95. $product->name = 'Test branch product';
  96. }
  97. return $product;
  98. }
  99. /**
  100. * 获取新手模式产品统计数据。
  101. * Get product stats for tutorial.
  102. *
  103. * @param bool $isArray
  104. * @access public
  105. * @return array
  106. */
  107. public function getProductStats($isArray = false)
  108. {
  109. $product = $this->getProduct();
  110. $product->totalStories = 0;
  111. $product->draftStories = 0;
  112. $product->activeStories = 0;
  113. $product->changingStories = 0;
  114. $product->reviewingStories = 0;
  115. $product->releases = 0;
  116. $product->unresolvedBugs = 0;
  117. $product->fixedBugs = 0;
  118. $product->lineName = 0;
  119. $product->executions = 0;
  120. $product->coverage = 0;
  121. $product->activeBugs = 0;
  122. $product->latestReleaseDate = 0;
  123. $product->latestRelease = 0;
  124. $product->plans = 0;
  125. $productStat[$product->id] = $isArray ? json_decode(json_encode($product), true) : $product;
  126. return $productStat;
  127. }
  128. /**
  129. * 获取新手模式项目。
  130. * Get project for tutorial;
  131. *
  132. * @access public
  133. * @return object
  134. */
  135. public function getProject()
  136. {
  137. $project = new stdclass();
  138. $project->id = 2;
  139. $project->project = 0;
  140. $project->model = 'scrum';
  141. $project->type = 'project';
  142. $project->name = 'Test Project';
  143. $project->code = '';
  144. $project->lifetime = '';
  145. $project->begin = date('Y-m-d', strtotime('-7 days'));
  146. $project->end = date('Y-m-d', strtotime('+7 days'));
  147. $project->realBegan = '';
  148. $project->realEnd = '';
  149. $project->days = 10;
  150. $project->status = 'wait';
  151. $project->pri = '1';
  152. $project->desc = '';
  153. $project->goal = '';
  154. $project->acl = 'open';
  155. $project->parent = 0;
  156. $project->path = ",2,";
  157. $project->grade = 1;
  158. $project->PM = $this->app->user->account;
  159. $project->PO = $this->app->user->account;
  160. $project->QD = $this->app->user->account;
  161. $project->RD = $this->app->user->account;
  162. $project->openedBy = $this->app->user->account;
  163. $project->whitelist = '';
  164. $project->budget = 0;
  165. $project->displayCards = 0;
  166. $project->fluidBoard = 0;
  167. $project->deleted = '0';
  168. $project->hasProduct = 1;
  169. $project->multiple = '1';
  170. $project->stageBy = 'project';
  171. $project->progress = 0;
  172. $project->consumed = 0;
  173. $project->estimate = 0;
  174. $project->left = 0;
  175. $project->storyType = 'story,requirement,epic';
  176. $project->charter = 0;
  177. $project->market = 1;
  178. $project->budgetUnit = 'CNY';
  179. $project->deliverable = '';
  180. $project->isTpl = 0;
  181. $project->linkType = '';
  182. $project->workflowGroup = 0;
  183. list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
  184. if($guide && strpos($guide, 'scrumProjectManage') !== false)
  185. {
  186. $project->name = 'Scrum Project';
  187. $project->model = 'scrum';
  188. }
  189. if($guide && strpos($guide, 'waterfallProjectManage') !== false)
  190. {
  191. $project->name = 'Waterfall Project';
  192. $project->model = 'waterfall';
  193. }
  194. if($guide && strpos($guide, 'kanbanProjectManage') !== false)
  195. {
  196. $project->name = 'Kanban Project';
  197. $project->model = 'kanban';
  198. }
  199. if($guide && strpos($guide, 'taskManage') !== false)
  200. {
  201. $project->name = 'No multiple Project';
  202. $project->model = 'scrum';
  203. $project->multiple = '0';
  204. }
  205. if($guide && strpos($guide, 'marketManage') !== false)
  206. {
  207. $project->name = 'Test research';
  208. $project->model = 'research';
  209. }
  210. return $project;
  211. }
  212. /**
  213. * 获取新手模式项目键值对。
  214. * Get tutorial project pairs.
  215. *
  216. * @access public
  217. * @return array
  218. */
  219. public function getProjectPairs()
  220. {
  221. return array(2 => 'Test Project');
  222. }
  223. /**
  224. * 获取新手模式项目统计数据。
  225. * Get project stats for tutorial
  226. *
  227. * @param string $browseType
  228. * @access public
  229. * @return array
  230. */
  231. public function getProjectStats($browseType = '')
  232. {
  233. $project = $this->getProject();
  234. $project->progress = 0;
  235. $project->estimate = 0;
  236. $project->consumed = 0;
  237. $project->left = 0;
  238. $project->leftTasks = '—';
  239. $project->teamMembers = array_keys($this->getTeamMembers());
  240. $project->teamCount = count($project->teamMembers);
  241. if($browseType && $browseType != 'all') $project->name .= '-' . $browseType; // Fix bug #21096
  242. $projectStat[$project->id] = $project;
  243. return $projectStat;
  244. }
  245. /**
  246. * 获取新手模式迭代燃尽图数据。
  247. * Get execution burn data for tutorial
  248. *
  249. * @param array $dateList
  250. * @access public
  251. * @return array
  252. */
  253. public function getExecutionBurnData($dateList)
  254. {
  255. $burnData = array();
  256. $left = 7;
  257. $value = 6;
  258. foreach($dateList as $date)
  259. {
  260. $burn = new stdClass();
  261. $burn->name = $date;
  262. $burn->value = $value --;
  263. $burn->left = $left --;
  264. $burnData[$date] = $burn;
  265. }
  266. return $burnData;
  267. }
  268. /**
  269. * 获取新手模式执行统计数据。
  270. * Get execution stats for tutorial.
  271. *
  272. * @param string $browseType
  273. * @access public
  274. * @return array
  275. */
  276. public function getExecutionStats($browseType = '')
  277. {
  278. $execution = $this->getExecution();
  279. $execution->progress = 0;
  280. $execution->estimate = 0;
  281. $execution->consumed = 0;
  282. $execution->left = 0;
  283. $execution->leftTasks = '—';
  284. $execution->teamMembers = array_keys($this->getTeamMembers());
  285. $execution->teamCount = count($execution->teamMembers);
  286. $execution->hasProduct = '1';
  287. $execution->multiple = '';
  288. $execution->order = 1;
  289. $execution->burns = array();
  290. $execution->type = 'sprint';
  291. $execution->projectName = '';
  292. $execution->projectModel = 'scrum';
  293. $execution->deliverable = '';
  294. if($browseType && $browseType != 'all') $execution->name .= '-' . $browseType;
  295. $executionStat[0] = $execution;
  296. return $executionStat;
  297. }
  298. /**
  299. * 获取新手模式研发需求键值对。
  300. * Get tutorial story pairs.
  301. *
  302. * @access public
  303. * @return array
  304. */
  305. public function getStoryPairs()
  306. {
  307. $stories = $this->getStories();
  308. $storyPairs = array();
  309. foreach($stories as $story) $storyPairs[$story->id] = $story->title;
  310. return $storyPairs;
  311. }
  312. /**
  313. * 获取新手模式研发需求。
  314. * Get tutorial story.
  315. *
  316. * @access public
  317. * @return object
  318. */
  319. public function getStory()
  320. {
  321. $story = new stdclass();
  322. $story->id = 3;
  323. $story->product = 1;
  324. $story->branch = 0;
  325. $story->parent = array(2);
  326. $story->category = 0;
  327. $story->module = '';
  328. $story->plan = '';
  329. $story->planTitle = '';
  330. $story->color = '';
  331. $story->source = 'po';
  332. $story->sourceNote = '';
  333. $story->fromBug = 0;
  334. $story->title = 'Test active story';
  335. $story->keywords = '';
  336. $story->type = 'story';
  337. $story->grade = 1;
  338. $story->pri = 3;
  339. $story->estimate = 1;
  340. $story->status = 'active';
  341. $story->stage = 'wait';
  342. $story->openedBy = $this->app->user->account;
  343. $story->openedDate = helper::now();
  344. $story->assignedTo = '';
  345. $story->assignedDate = '';
  346. $story->reviewedBy = $this->app->user->account;
  347. $story->reviewedDate = helper::now();
  348. $story->closedBy = '';
  349. $story->closedDate = '';
  350. $story->closedReason = '';
  351. $story->toBug = 0;
  352. $story->childStories = '';
  353. $story->linkStories = '';
  354. $story->duplicateStory = 0;
  355. $story->version = 1;
  356. $story->deleted = '0';
  357. $story->order = '0';
  358. $story->URChanged = false;
  359. $story->mailto = '';
  360. $story->isParent = 0;
  361. $story->roadmap = 0;
  362. $story->root = 1;
  363. $story->path = ',1,2,3,';
  364. $story->lastEditedBy = '';
  365. $story->lastEditedDate = '';
  366. $story->twins = '';
  367. $story->executions = array();
  368. $story->spec = '';
  369. $story->verify = '';
  370. $story->files = array();
  371. $story->docs = '';
  372. $story->docVersions = '';
  373. return $story;
  374. }
  375. /**
  376. * 获取新手模式业务需求。
  377. * Get tutorial epic.
  378. *
  379. * @access public
  380. * @return object
  381. */
  382. public function getEpic()
  383. {
  384. $epic = $this->getStory();
  385. $epic->id = 1;
  386. $epic->title = 'Test epic';
  387. $epic->type = 'epic';
  388. $epic->isParent = 1;
  389. $epic->parent = array(0);
  390. $epic->root = 1;
  391. $epic->path = ',1,';
  392. return $epic;
  393. }
  394. /**
  395. * 获取新手模式用户需求。
  396. * Get tutorial requirement.
  397. *
  398. * @access public
  399. * @return object
  400. */
  401. public function getRequirement()
  402. {
  403. $requirement = $this->getStory();
  404. $requirement->id = 2;
  405. $requirement->title = 'Test requirement';
  406. $requirement->type = 'requirement';
  407. $requirement->status = 'active';
  408. $requirement->isParent = 1;
  409. $requirement->parent = array(1);
  410. $requirement->root = 1;
  411. $requirement->path = ',1,2,';
  412. return $requirement;
  413. }
  414. /**
  415. * 根据需求ID获取需求详情。
  416. * Get story by ID.
  417. *
  418. * @access public
  419. * @return object
  420. * @param int $storyID
  421. */
  422. public function getStoryByID($storyID)
  423. {
  424. if($storyID == 1) return $this->getEpic();
  425. if($storyID == 2) return $this->getRequirement();
  426. return $this->getStory();
  427. }
  428. /**
  429. * 获取需求层级。
  430. * Get story grade.
  431. *
  432. * @access public
  433. * @return object
  434. */
  435. public function getStoryGrade()
  436. {
  437. $storyGrade = new stdClass();
  438. $storyGrade->type = 'story';
  439. $storyGrade->grade = 1;
  440. $storyGrade->name = 'SR';
  441. $storyGrade->status = 'enable';
  442. $requirementGrade = new stdClass();
  443. $requirementGrade->type = 'requirement';
  444. $requirementGrade->grade = 1;
  445. $requirementGrade->name = 'UR';
  446. $requirementGrade->status = 'enable';
  447. $epicGrade = new stdClass();
  448. $epicGrade->type = 'epic';
  449. $epicGrade->grade = 1;
  450. $epicGrade->name = 'BR';
  451. $epicGrade->status = 'enable';
  452. return array($storyGrade, $requirementGrade, $epicGrade);
  453. }
  454. /**
  455. * 获取需求层级键值对。
  456. * Get story grade pairs.
  457. *
  458. * @access public
  459. * @return array
  460. * @param string $type
  461. */
  462. public function getGradePairs($type)
  463. {
  464. if($type == 'story') return array(1 => 'SR');
  465. if($type == 'requirement') return array(1 => 'UR');
  466. if($type == 'epic') return array(1 => 'BR');
  467. return array();
  468. }
  469. /**
  470. * 获取新手模式故事点。
  471. * Get tutorial stories.
  472. *
  473. * @access public
  474. * @return array
  475. */
  476. public function getStories()
  477. {
  478. $activeStory = $this->getStory();
  479. $reviewingStory = $this->getStory();
  480. $reviewingStory->id = 4;
  481. $reviewingStory->status = 'reviewing';
  482. $reviewingStory->notReview = array($this->app->user->account);
  483. $reviewingStory->title = 'Test reviewing story';
  484. $reviewingStory->path = ',1,2,4,';
  485. $stories = array();
  486. if($this->app->config->systemMode != 'light')
  487. {
  488. $stories[1] = $this->getEpic();
  489. $stories[2] = $this->getRequirement();
  490. }
  491. if($this->app->config->vision == 'rnd')
  492. {
  493. $stories[3] = $activeStory;
  494. $stories[4] = $reviewingStory;
  495. }
  496. if($this->app->config->vision == 'or')
  497. {
  498. $reviewingRequirement = $this->getRequirement();
  499. $reviewingRequirement->id = 5;
  500. $reviewingRequirement->status = 'reviewing';
  501. $reviewingRequirement->notReview = array($this->app->user->account);
  502. $reviewingRequirement->title = 'Test reviewing requirement';
  503. $reviewingRequirement->path = ',1,5,';
  504. $reviewingRequirement->isParent = 0;
  505. $stories[5] = $reviewingRequirement;
  506. }
  507. return $stories;
  508. }
  509. /**
  510. * 获取新手模式执行键值对。
  511. * Get tutorial Execution pairs.
  512. *
  513. * @access public
  514. * @return array
  515. */
  516. public function getExecutionPairs()
  517. {
  518. return array(2 => 'Test Project', 3 => 'Test execution');
  519. }
  520. /**
  521. * 获取新手模式阶段。
  522. * Get tutorial stage.
  523. *
  524. * @access public
  525. * @return object
  526. */
  527. public function getStage()
  528. {
  529. $stage = new stdClass();
  530. $stage->id = 3;
  531. $stage->name = 'Development stage';
  532. $stage->percent = 50;
  533. $stage->type = 'dev';
  534. $stage->projectType = 'waterfall';
  535. $stage->createdBy = '';
  536. $stage->createdDate = '';
  537. $stage->editedBy = '';
  538. $stage->editedDate = '';
  539. $stage->deleted = 0;
  540. return $stage;
  541. }
  542. /**
  543. * 获取新手模式阶段列表。
  544. * Get tutorial stages.
  545. *
  546. * @access public
  547. * @return array
  548. */
  549. public function getStages()
  550. {
  551. return array(3 => $this->getStage());
  552. }
  553. /**
  554. * 获取新手模式执行。
  555. * Get tutorial execution.
  556. *
  557. * @access public
  558. * @return object
  559. */
  560. public function getExecution()
  561. {
  562. /* Fix bug #21097. */
  563. $hours = new stdclass();
  564. $hours->totalEstimate = 52;
  565. $hours->totalConsumed = 43;
  566. $hours->totalLeft = 7;
  567. $hours->progress = 86;
  568. $hours->totalReal = 50;
  569. $execution = new stdclass();
  570. $execution->id = 3;
  571. $execution->project = 2;
  572. $execution->type = 'sprint';
  573. $execution->name = 'Test execution';
  574. $execution->code = 'test';
  575. $execution->lifetime = '';
  576. $execution->attribute = '';
  577. $execution->begin = date('Y-m-d', strtotime('-7 days'));
  578. $execution->end = date('Y-m-d', strtotime('+7 days'));
  579. $execution->realBegan = '';
  580. $execution->realEnd = '';
  581. $execution->suspendedDate = '';
  582. $execution->days = 10;
  583. $execution->status = 'wait';
  584. $execution->pri = '1';
  585. $execution->desc = '';
  586. $execution->goal = '';
  587. $execution->acl = 'open';
  588. $execution->parent = 2;
  589. $execution->path = ',2,3,';
  590. $execution->grade = 1;
  591. $execution->PM = $this->app->user->account;
  592. $execution->PO = $this->app->user->account;
  593. $execution->QD = $this->app->user->account;
  594. $execution->RD = $this->app->user->account;
  595. $execution->deleted = '0';
  596. $execution->consumed = 0;
  597. $execution->left = 0;
  598. $execution->hours = 0;
  599. $execution->estimate = 0;
  600. $execution->progress = 0;
  601. $execution->displayCards = 0;
  602. $execution->fluidBoard = 0;
  603. $execution->hours = $hours;
  604. $execution->burns = array(35, 35);
  605. $execution->hasProduct = '1';
  606. $execution->multiple = '';
  607. $execution->colWidth = '200';
  608. $execution->openedDate = helper::now();
  609. $execution->closedDate = helper::now();
  610. $execution->milestone = 0;
  611. $execution->workflowGroup = 0;
  612. $execution->deliverable = '';
  613. list($guide, $guideTask, $guideStepIndex) = empty($_SERVER['HTTP_X_ZIN_TUTORIAL']) ? array('', '', '') : explode('-', $_SERVER['HTTP_X_ZIN_TUTORIAL']);
  614. if($guide && strpos($guide, 'scrumProjectManage') !== false)
  615. {
  616. $execution->name = 'Test Sprint';
  617. $execution->type = 'sprint';
  618. }
  619. if($guide && strpos($guide, 'waterfallProjectManage') !== false)
  620. {
  621. $execution->name = 'Test Stage';
  622. $execution->type = 'stage';
  623. $execution->enabled = 'on';
  624. $execution->percent = 50;
  625. $execution->milestone = 0;
  626. $execution->parallel = 1;
  627. }
  628. if($guide && strpos($guide, 'kanbanProjectManage') !== false)
  629. {
  630. $execution->name = 'Test Kanban';
  631. $execution->type = 'kanban';
  632. }
  633. if($guide && strpos($guide, 'taskManage') !== false)
  634. {
  635. $execution->name = 'No multiple execution';
  636. $execution->type = 'spring';
  637. $execution->multiple = 0;
  638. }
  639. return $execution;
  640. }
  641. /**
  642. * 获取新手模式执行的产品。
  643. * Get tutorial execution products.
  644. *
  645. * @access public
  646. * @return array
  647. */
  648. public function getExecutionProducts()
  649. {
  650. $product = $this->getProduct();
  651. return array($product->id => $product);
  652. }
  653. /**
  654. * 获取新手模式执行的需求。
  655. * Get tutorial execution stories.
  656. *
  657. * @access public
  658. * @return array
  659. */
  660. public function getExecutionStories()
  661. {
  662. $stories = $this->getStories();
  663. $story = $stories[3];
  664. return array($story->id => $story);
  665. }
  666. /**
  667. * 获取新手模式执行的需求键值对。
  668. * Get tutorial execution story pairs.
  669. *
  670. * @access public
  671. * @return array
  672. */
  673. public function getExecutionStoryPairs()
  674. {
  675. $stories = $this->getStories();
  676. $story = $stories[3];
  677. return array($story->id => $story->title);
  678. }
  679. /**
  680. * 获取新手模式团队成员。
  681. * Get tutorial team members.
  682. *
  683. * @access public
  684. * @return array
  685. */
  686. public function getTeamMembers()
  687. {
  688. $member = new stdclass();
  689. $member->project = 2;
  690. $member->account = $this->app->user->account;
  691. $member->role = $this->app->user->role;
  692. $member->join = $this->app->user->join;
  693. $member->days = 10;
  694. $member->hours = 7.0;
  695. $member->totalHours = 70.0;
  696. $member->realname = $this->app->user->realname;
  697. $member->limited = 'no';
  698. $member->userID = $this->app->user->id;
  699. return array($member->account => $member);
  700. }
  701. /**
  702. * 获取团队成员键值对。
  703. * Get team members pairs.
  704. *
  705. * @access public
  706. * @return array
  707. */
  708. public function getTeamMembersPairs()
  709. {
  710. $account = $this->app->user->account;
  711. return array('' => '', $account => $this->app->user->realname);
  712. }
  713. /**
  714. * 获取新手模式用户键值对。
  715. * Get tutorial user pairs.
  716. *
  717. * @access public
  718. * @return array
  719. */
  720. public function getUserPairs()
  721. {
  722. $account = $this->app->user->account;
  723. $users[$account] = $account;
  724. $users['test'] = 'Test';
  725. return $users;
  726. }
  727. /**
  728. * 获取新手模式进度。
  729. * Get tutorialed.
  730. *
  731. * @access public
  732. * @return string
  733. */
  734. public function getTutorialed()
  735. {
  736. 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');
  737. }
  738. /**
  739. * 获取新手模式任务。
  740. * Get task.
  741. *
  742. * @access public
  743. * @return object
  744. */
  745. public function getTask()
  746. {
  747. $task = new stdClass();
  748. $task->id = 1;
  749. $task->project = 2;
  750. $task->parent = 0;
  751. $task->execution = 3;
  752. $task->module = 0;
  753. $task->design = 0;
  754. $task->story = 0;
  755. $task->storyVersion = 1;
  756. $task->designVersion = 1;
  757. $task->fromBug = 0;
  758. $task->feedback = 0;
  759. $task->fromIssue = 0;
  760. $task->name = 'Test task';
  761. $task->type = 'devel';
  762. $task->mode = '';
  763. $task->pri = 3;
  764. $task->estimate = 0;
  765. $task->consumed = 0;
  766. $task->left = 0;
  767. $task->deadline = '';
  768. $task->status = 'wait';
  769. $task->subStatus = '';
  770. $task->color = '';
  771. $task->mailto = '';
  772. $task->keywords = '';
  773. $task->desc = '';
  774. $task->version = 1;
  775. $task->openedBy = 'admin';
  776. $task->openedDate = '';
  777. $task->assignedTo = '';
  778. $task->assignedDate = '';
  779. $task->estStarted = '';
  780. $task->realStarted = '';
  781. $task->finishedBy = '';
  782. $task->finishedDate = '';
  783. $task->finishedList = '';
  784. $task->canceledBy = '';
  785. $task->canceledDate = '';
  786. $task->closedBy = '';
  787. $task->closedDate = '';
  788. $task->planDuration = 0;
  789. $task->realDuration = 0;
  790. $task->closedReason = '';
  791. $task->lastEditedBy = '';
  792. $task->lastEditedDate = '';
  793. $task->activatedDate = '';
  794. $task->order = 0;
  795. $task->repo = 0;
  796. $task->mr = 0;
  797. $task->entry = '';
  798. $task->lines = '';
  799. $task->deleted = 0;
  800. $task->vision = 'rnd';
  801. $task->storyID = '';
  802. $task->storyTitle = '';
  803. $task->product = '';
  804. $task->branch = '';
  805. $task->latestStoryVersion = '';
  806. $task->storyStatus = '';
  807. $task->priOrder = 3;
  808. $task->assignedToRealName = '';
  809. $task->needConfirm = '';
  810. $task->progress = 0;
  811. $task->isParent = 0;
  812. return $task;
  813. }
  814. /**
  815. * 获取新手模式任务。
  816. * Get taks.
  817. *
  818. * @access public
  819. * @return array
  820. */
  821. public function getTasks()
  822. {
  823. $waitTask = $this->getTask();
  824. $doneTask = $this->getTask();
  825. $doneTask->id = 2;
  826. $doneTask->name = 'Done task';
  827. $doneTask->status = 'done';
  828. $doneTask->finishedBy = 'test';
  829. $tasks = array();
  830. $tasks[$waitTask->id] = $waitTask;
  831. $tasks[$doneTask->id] = $doneTask;
  832. return $tasks;
  833. }
  834. /**
  835. * 获取新手模式版本。
  836. * Get build.
  837. *
  838. * @access public
  839. * @return object
  840. */
  841. public function getBuild()
  842. {
  843. $build = new stdClass();
  844. $build->id = 1;
  845. $build->system = 1;
  846. $build->project = 2;
  847. $build->product = 1;
  848. $build->branch = '0';
  849. $build->execution = 3;
  850. $build->builds = '';
  851. $build->name = 'Test build';
  852. $build->scmPath = '';
  853. $build->filePath = '';
  854. $build->date = '';
  855. $build->stories = '';
  856. $build->bugs = '';
  857. $build->artifactRepoID = 0;
  858. $build->builder = 'test';
  859. $build->desc = '';
  860. $build->createdBy = '';
  861. $build->createdDate = '';
  862. $build->deleted = 0;
  863. $build->executionName = 'Test execution';
  864. $build->productName = 'Test product';
  865. $build->productType = 'normal';
  866. $build->allBugs = '1';
  867. $build->allStories = '1';
  868. $build->files = array();
  869. return $build;
  870. }
  871. /**
  872. * 获取新手模式版本。
  873. * Get build.
  874. *
  875. * @access public
  876. * @return array
  877. */
  878. public function getBuilds()
  879. {
  880. $build = $this->getBuild();
  881. $builds = array();
  882. $builds[$build->id] = $build;
  883. return $builds;
  884. }
  885. /**
  886. * 获取新手模式版本键值对。
  887. * Get build pairs.
  888. *
  889. * @access public
  890. * @return array
  891. */
  892. public function getBuildPairs()
  893. {
  894. return array(1 => 'Test build');
  895. }
  896. /**
  897. * 获取新手模式测试单。
  898. * Get run.
  899. *
  900. * @access public
  901. * @return object
  902. */
  903. public function getRun()
  904. {
  905. $run = new stdClass();
  906. $run->id = 1;
  907. $run->task = 1;
  908. $run->version = 1;
  909. $run->assignedTo = '';
  910. $run->lastRunner = '';
  911. $run->lastRunDate = '';
  912. $run->lastRunResult = '';
  913. $run->status = 'normal';
  914. $run->case = 1;
  915. return $run;
  916. }
  917. /**
  918. * 获取新手模式用例。
  919. * Get Cases.
  920. *
  921. * @access public
  922. * @return object
  923. */
  924. public function getCase()
  925. {
  926. $case = new stdClass();
  927. $case->project = 2;
  928. $case->product = 1;
  929. $case->case = 1;
  930. $case->count = 1;
  931. $case->version = 1;
  932. $case->order = 0;
  933. $case->id = 1;
  934. $case->execution = 3;
  935. $case->branch = 0;
  936. $case->lib = 0;
  937. $case->module = 0;
  938. $case->path = 0;
  939. $case->story = 0;
  940. $case->storyVersion = 1;
  941. $case->title = 'Test case';
  942. $case->precondition = '';
  943. $case->keywords = '';
  944. $case->pri = 3;
  945. $case->type = 'feature';
  946. $case->auto = 'no';
  947. $case->frame = '';
  948. $case->stage = 'unittest';
  949. $case->howRun = '';
  950. $case->script = '';
  951. $case->scriptedBy = '';
  952. $case->scriptedDate = '';
  953. $case->scriptStatus = '';
  954. $case->scriptLocation = '';
  955. $case->status = 'normal';
  956. $case->subStatus = '';
  957. $case->color = '';
  958. $case->frequency = 1;
  959. $case->openedBy = '';
  960. $case->openedDate = '';
  961. $case->reviewedBy = '';
  962. $case->reviewedDate = '';
  963. $case->lastEditedBy = '';
  964. $case->lastEditedDate = '';
  965. $case->linkCase = '';
  966. $case->fromBug = 0;
  967. $case->fromCaseID = 0;
  968. $case->fromCaseVersion = 1;
  969. $case->deleted = 0;
  970. $case->lastRunner = '';
  971. $case->lastRunDate = '';
  972. $case->lastRunResult = 'fail';
  973. $case->scene = 0;
  974. $case->sort = 0;
  975. $case->bugs = 1;
  976. $case->results = 1;
  977. $case->caseFails = 1;
  978. $case->stepNumber = 1;
  979. $case->needconfirm = '';
  980. $case->task = 1;
  981. $case->case = 1;
  982. $case->assignedTo = '';
  983. $case->caseVersion = '';
  984. $case->storyTitle = '';
  985. $case->caseStatus = 'normal';
  986. $case->currentVersion = 1;
  987. $step1 = new stdClass();
  988. $step1->name = 1;
  989. $step1->id = 1;
  990. $step1->step = 'Test step1';
  991. $step1->desc = 'Test step1';
  992. $step1->expect = 'Step1 expect';
  993. $step1->type = 'step';
  994. $step1->parent = 0;
  995. $step1->grade = 1;
  996. $step2 = new stdClass();
  997. $step2->name = 2;
  998. $step2->id = 2;
  999. $step2->step = 'Test step2';
  1000. $step2->desc = 'Test step2';
  1001. $step2->expect = 'Step2 expect';
  1002. $step2->type = 'step';
  1003. $step2->parent = 0;
  1004. $step2->grade = 1;
  1005. $case->steps = array(1 => $step1, 2 => $step2);
  1006. return $case;
  1007. }
  1008. /**
  1009. * 获取新手模式用例。
  1010. * Get Cases.
  1011. *
  1012. * @access public
  1013. * @return array
  1014. */
  1015. public function getCases()
  1016. {
  1017. $case = $this->getCase();
  1018. $cases = array();
  1019. $cases[$case->id] = $case;
  1020. return $cases;
  1021. }
  1022. /**
  1023. * 获取新手模式用例执行结果。
  1024. * Get result.
  1025. *
  1026. * @access public
  1027. * @return object
  1028. */
  1029. public function getResult()
  1030. {
  1031. $result = new stdClass();
  1032. $result->id = 1;
  1033. $result->run = 0;
  1034. $result->case = 1;
  1035. $result->version = 1;
  1036. $result->job = 0;
  1037. $result->compile = 0;
  1038. $result->caseResult = 'fail';
  1039. $result->stepResults = '';
  1040. $result->ZTFResult = '';
  1041. $result->node = 0;
  1042. $result->lastRunner = $this->app->user->account;
  1043. $result->date = helper::now();
  1044. $result->duration = 0;
  1045. $result->xml = '';
  1046. $result->deploy = 0;
  1047. $result->build = 0;
  1048. $result->task = 0;
  1049. $result->nodeName = '';
  1050. $result->files = array();
  1051. return $result;
  1052. }
  1053. /**
  1054. * 获取新手模式用例执行结果。
  1055. * Get results.
  1056. *
  1057. * @access public
  1058. * @return array
  1059. */
  1060. public function getResults()
  1061. {
  1062. $result = $this->getResult();
  1063. $result->stepResults = array(
  1064. 1 => array(
  1065. 'id' => 1,
  1066. 'parent' => 0,
  1067. 'case' => 1,
  1068. 'version' => 1,
  1069. 'type' => 'step',
  1070. 'desc' => 'Test step1',
  1071. 'expect' => 'Step1 expect',
  1072. 'name' => 1,
  1073. 'grade' => 1,
  1074. 'result' => 'fail',
  1075. 'real' => '',
  1076. 'files' => array()
  1077. ),
  1078. 2 => array(
  1079. 'id' => 2,
  1080. 'parent' => 0,
  1081. 'case' => 1,
  1082. 'version' => 1,
  1083. 'type' => 'step',
  1084. 'desc' => 'Test step2',
  1085. 'expect' => 'Step2 expect',
  1086. 'name' => 2,
  1087. 'grade' => 1,
  1088. 'result' => 'pass',
  1089. 'real' => '',
  1090. 'files' => array()
  1091. )
  1092. );
  1093. return array($result->id => $result);
  1094. }
  1095. /**
  1096. * 获取新手模式测试单。
  1097. * Get testtask.
  1098. *
  1099. * @access public
  1100. * @return object
  1101. */
  1102. public function getTesttask()
  1103. {
  1104. $testtask = new stdClass();
  1105. $testtask->id = 1;
  1106. $testtask->project = 2;
  1107. $testtask->product = 1;
  1108. $testtask->name = 'Test testtask';
  1109. $testtask->execution = 3;
  1110. $testtask->build = 1;
  1111. $testtask->joint = 0;
  1112. $testtask->type = '';
  1113. $testtask->owner = '';
  1114. $testtask->pri = 3;
  1115. $testtask->begin = helper::today();
  1116. $testtask->end = helper::today();
  1117. $testtask->realBegan = '';
  1118. $testtask->realFinishedDate = '';
  1119. $testtask->mailto = '';
  1120. $testtask->desc = '';
  1121. $testtask->report = '';
  1122. $testtask->status = 'wait';
  1123. $testtask->testreport = 0;
  1124. $testtask->auto = 'no';
  1125. $testtask->subStatus = '';
  1126. $testtask->createdBy = $this->app->user->account;
  1127. $testtask->createdDate = helper::now();
  1128. $testtask->deleted = 0;
  1129. $testtask->members = '';
  1130. $testtask->buildName = 'Test build';
  1131. $testtask->productName = 'Test product';
  1132. $testtask->productType = 'normal';
  1133. $testtask->branch = '0';
  1134. $testtask->executionName = 'Test execution';
  1135. $testtask->buildName = 'Test build';
  1136. $testtask->files = array();
  1137. return $testtask;
  1138. }
  1139. /**
  1140. * 获取新手模式测试单列表。
  1141. * Get testtasks.
  1142. *
  1143. * @access public
  1144. * @return array
  1145. */
  1146. public function getTesttasks()
  1147. {
  1148. $testtask = $this->getTesttask();
  1149. $testtasks = array();
  1150. $testtasks[$testtask->id] = $testtask;
  1151. return $testtasks;
  1152. }
  1153. /**
  1154. * 获取新手模式测试单键值对。
  1155. * Get testtask pairs.
  1156. *
  1157. * @access public
  1158. * @return array
  1159. */
  1160. public function getTesttaskPairs()
  1161. {
  1162. return array(1 => 'Test testtask');
  1163. }
  1164. /**
  1165. * 获取新手模式测试报告。
  1166. * Get testreport.
  1167. *
  1168. * @access public
  1169. * @return object
  1170. */
  1171. public function getTestReport()
  1172. {
  1173. $testreport = new stdClass();
  1174. $testreport->id = 1;
  1175. $testreport->project = 2;
  1176. $testreport->product = 1;
  1177. $testreport->execution = 3;
  1178. $testreport->tasks = '1';
  1179. $testreport->builds = '1';
  1180. $testreport->title = 'Test testreport';
  1181. $testreport->begin = helper::today();
  1182. $testreport->end = helper::today();
  1183. $testreport->owner = $this->app->user->account;
  1184. $testreport->members = '';
  1185. $testreport->stories = '';
  1186. $testreport->bugs = '';
  1187. $testreport->cases = '';
  1188. $testreport->report = '';
  1189. $testreport->objectType = 'execution';
  1190. $testreport->objectID = 3;
  1191. $testreport->createdBy = $this->app->user->account;
  1192. $testreport->createdDate = helper::now();
  1193. $testreport->deleted = 0;
  1194. $testreport->taskName = 'Test testtask';
  1195. return $testreport;
  1196. }
  1197. /**
  1198. * 获取新手模式测试报告列表。
  1199. * Get testreports.
  1200. *
  1201. * @access public
  1202. * @return array
  1203. */
  1204. public function getTestReports()
  1205. {
  1206. $testreport = $this->getTestReport();
  1207. $testreports = array();
  1208. $testreports[$testreport->id] = $testreport;
  1209. return $testreports;
  1210. }
  1211. /**
  1212. * 获取新手模式Bug。
  1213. * Get bug.
  1214. *
  1215. * @access public
  1216. * @return object
  1217. */
  1218. public function getBug()
  1219. {
  1220. $bug = new stdClass();
  1221. $bug->id = 1;
  1222. $bug->project = 2;
  1223. $bug->product = 1;
  1224. $bug->injection = 0;
  1225. $bug->identify = 0;
  1226. $bug->branch = 0;
  1227. $bug->module = 0;
  1228. $bug->execution = 3;
  1229. $bug->plan = 0;
  1230. $bug->story = 0;
  1231. $bug->storyVersion = 0;
  1232. $bug->task = 0;
  1233. $bug->toTask = 0;
  1234. $bug->toStory = 0;
  1235. $bug->title = 'Test bug-active';
  1236. $bug->keywords = '';
  1237. $bug->severity = 3;
  1238. $bug->pri = 3;
  1239. $bug->type = 'codeerror';
  1240. $bug->os = '';
  1241. $bug->browser = '';
  1242. $bug->hardware = '';
  1243. $bug->found = '';
  1244. $bug->steps = '';
  1245. $bug->status = 'active';
  1246. $bug->subStatus = '';
  1247. $bug->color = '';
  1248. $bug->confirmed = 0;
  1249. $bug->activatedCount= 0;
  1250. $bug->activatedDate = '';
  1251. $bug->feedbackBy = '';
  1252. $bug->notifyEmail = '';
  1253. $bug->mailto = '';
  1254. $bug->openedBy = '';
  1255. $bug->openedDate = '';
  1256. $bug->openedBuild = '1';
  1257. $bug->assignedTo = 'Test';
  1258. $bug->assignedDate = '';
  1259. $bug->deadline = '';
  1260. $bug->resolvedBy = '';
  1261. $bug->resolution = '';
  1262. $bug->resolvedBuild = '';
  1263. $bug->resolvedDate = '';
  1264. $bug->closedBy = '';
  1265. $bug->closedDate = '';
  1266. $bug->duplicateBug = 0;
  1267. $bug->relatedBug = '';
  1268. $bug->case = 0;
  1269. $bug->caseVersion = 0;
  1270. $bug->feedback = 0;
  1271. $bug->result = 0;
  1272. $bug->repo = 0;
  1273. $bug->mr = 0;
  1274. $bug->entry = '';
  1275. $bug->lines = '';
  1276. $bug->v1 = '';
  1277. $bug->v2 = '';
  1278. $bug->repoType = '';
  1279. $bug->issueKey = '';
  1280. $bug->testtask = 0;
  1281. $bug->lastEditedBy = '';
  1282. $bug->lastEditedDate= '';
  1283. $bug->deleted = 0;
  1284. $bug->priOrder = 3;
  1285. $bug->severityOrder = 3;
  1286. $bug->isParent = '';
  1287. return $bug;
  1288. }
  1289. /**
  1290. * 获取新手模式Bug列表。
  1291. * Get bugs.
  1292. *
  1293. * @access public
  1294. * @return array
  1295. */
  1296. public function getBugs()
  1297. {
  1298. $activeBug = $this->getBug();
  1299. $activeBug->id = 1;
  1300. $activeBug->status = 'active';
  1301. $activeBug->title = 'Test bug-active';
  1302. $resolvedBug = $this->getBug();
  1303. $resolvedBug->id = 2;
  1304. $resolvedBug->status = 'resolved';
  1305. $resolvedBug->title = 'Test bug-resolved';
  1306. $bugs = array();
  1307. $bugs[$activeBug->id] = $activeBug;
  1308. $bugs[$resolvedBug->id] = $resolvedBug;
  1309. return $bugs;
  1310. }
  1311. /**
  1312. * 获取新手模式问题。
  1313. * Get issue.
  1314. *
  1315. * @access public
  1316. * @return object
  1317. */
  1318. public function getIssue()
  1319. {
  1320. $issue = new stdClass();
  1321. $issue->id = 1;
  1322. $issue->resolvedBy = '';
  1323. $issue->project = 2;
  1324. $issue->execution = 0;
  1325. $issue->title = 'Test issue-unconfirmed';
  1326. $issue->desc = '';
  1327. $issue->pri = 3;
  1328. $issue->severity = 1;
  1329. $issue->type = 'design';
  1330. $issue->activity = '';
  1331. $issue->deadline = '';
  1332. $issue->resolution = '';
  1333. $issue->resolutionComment= '';
  1334. $issue->objectID = '';
  1335. $issue->resolvedDate = '';
  1336. $issue->status = 'unconfirmed';
  1337. $issue->owner = 'admin';
  1338. $issue->lib = 0;
  1339. $issue->from = 0;
  1340. $issue->version = 1;
  1341. $issue->createdBy = '';
  1342. $issue->createdDate = '';
  1343. $issue->editedBy = '';
  1344. $issue->editedDate = '';
  1345. $issue->activateBy = '';
  1346. $issue->activateDate = '';
  1347. $issue->closedBy = '';
  1348. $issue->closedDate = '';
  1349. $issue->assignedTo = '';
  1350. $issue->assignedBy = '';
  1351. $issue->assignedDate = '';
  1352. $issue->approvedDate = '';
  1353. $issue->deleted = 0;
  1354. return $issue;
  1355. }
  1356. /**
  1357. * 获取新手模式问题列表。
  1358. * Get issues.
  1359. *
  1360. * @access public
  1361. * @return array
  1362. */
  1363. public function getIssues()
  1364. {
  1365. $unconfirmedIssue = $this->getIssue();
  1366. $confirmedIssue = $this->getIssue();
  1367. $confirmedIssue->id = 2;
  1368. $confirmedIssue->title = 'Test issue-confirmed';
  1369. $confirmedIssue->status = 'confirmed';
  1370. $issues = array();
  1371. $issues[$unconfirmedIssue->id] = $unconfirmedIssue;
  1372. $issues[$confirmedIssue->id] = $confirmedIssue;
  1373. return $issues;
  1374. }
  1375. /**
  1376. * 获取新手模式风险。
  1377. * Get risk.
  1378. *
  1379. * @access public
  1380. * @return object
  1381. */
  1382. public function getRisk()
  1383. {
  1384. $risk = new stdClass();
  1385. $risk->id = 1;
  1386. $risk->project = 2;
  1387. $risk->execution = 0;
  1388. $risk->name = 'Test risk';
  1389. $risk->source = '';
  1390. $risk->category = '';
  1391. $risk->strategy = '';
  1392. $risk->status = 'active';
  1393. $risk->impact = 3;
  1394. $risk->probability = 3;
  1395. $risk->rate = 9;
  1396. $risk->pri = 'middle';
  1397. $risk->identifiedDate = '';
  1398. $risk->prevention = '';
  1399. $risk->remedy = '';
  1400. $risk->plannedClosedDate= '';
  1401. $risk->actualClosedDate = '';
  1402. $risk->lib = 0;
  1403. $risk->from = 0;
  1404. $risk->version = 1;
  1405. $risk->createdBy = '';
  1406. $risk->createdDate = '';
  1407. $risk->editedBy = '';
  1408. $risk->editedDate = '';
  1409. $risk->resolution = '';
  1410. $risk->resolvedBy = '';
  1411. $risk->activateBy = '';
  1412. $risk->activateDate = '';
  1413. $risk->assignedTo = '';
  1414. $risk->closedBy = '';
  1415. $risk->closedDate = '';
  1416. $risk->cancelBy = '';
  1417. $risk->cancelDate = '';
  1418. $risk->cancelReason = '';
  1419. $risk->hangupBy = '';
  1420. $risk->hangupDate = '';
  1421. $risk->trackedBy = '';
  1422. $risk->trackedDate = '';
  1423. $risk->assignedDate = '';
  1424. $risk->approvedDate = '';
  1425. $risk->deleted = 0;
  1426. return $risk;
  1427. }
  1428. /**
  1429. * 获取新手模式风险列表。
  1430. * Get risks.
  1431. *
  1432. * @access public
  1433. * @return array
  1434. */
  1435. public function getRisks()
  1436. {
  1437. $risk = $this->getRisk();
  1438. return array($risk->id => $risk);
  1439. }
  1440. /**
  1441. * 获取新手模式设计。
  1442. * Get design.
  1443. *
  1444. * @access public
  1445. * @return array
  1446. */
  1447. public function getDesign()
  1448. {
  1449. $design = new stdClass();
  1450. $design->id = 1;
  1451. $design->project = 2;
  1452. $design->product = 0;
  1453. $design->commit = '';
  1454. $design->commitedBy = '';
  1455. $design->execution = 0;
  1456. $design->name = 'Test Design';
  1457. $design->status = '';
  1458. $design->createdBy = $this->app->user->account;
  1459. $design->createdDate = helper::now();
  1460. $design->editedBy = '';
  1461. $design->editedDate = '';
  1462. $design->assignedTo = '';
  1463. $design->assignedBy = '';
  1464. $design->assignedDate = '';
  1465. $design->deleted = 0;
  1466. $design->story = 0;
  1467. $design->desc = 'Design Description';
  1468. $design->version = 1;
  1469. $design->type = 'HLDS';
  1470. $design->files = array();
  1471. $design->productName = 'Test product';
  1472. $design->docs = '';
  1473. $design->docVersions = '';
  1474. return $design;
  1475. }
  1476. /**
  1477. * 获取新手模式设计列表。
  1478. * Get designs.
  1479. *
  1480. * @access public
  1481. * @return array
  1482. */
  1483. public function getDesigns()
  1484. {
  1485. $design = $this->getDesign();
  1486. return array($design->id => $design);
  1487. }
  1488. /**
  1489. * 获取新手模式评审。
  1490. * Get review.
  1491. *
  1492. * @access public
  1493. * @return object
  1494. */
  1495. public function getReview()
  1496. {
  1497. $review = new stdClass();
  1498. $review->id = 1;
  1499. $review->project = 2;
  1500. $review->title = 'Test Review';
  1501. $review->object = 1;
  1502. $review->template = 0;
  1503. $review->doc = 0;
  1504. $review->docVersion = 0;
  1505. $review->status = 'pass';
  1506. $review->reviewedBy = '';
  1507. $review->auditedBy = '';
  1508. $review->createdBy = '';
  1509. $review->createdDate = '';
  1510. $review->begin = '';
  1511. $review->deadline = '';
  1512. $review->lastReviewedBy = '';
  1513. $review->lastReviewedDate= '';
  1514. $review->lastAuditedBy = '';
  1515. $review->lastAuditedDate = '';
  1516. $review->lastEditedBy = '';
  1517. $review->lastEditedDate = '';
  1518. $review->result = '';
  1519. $review->auditResult = '';
  1520. $review->deleted = 0;
  1521. $review->version = '01';
  1522. $review->category = 'PP';
  1523. $review->product = 1;
  1524. $review->approval = 1;
  1525. $review->isPending = '';
  1526. return $review;
  1527. }
  1528. /**
  1529. * 获取新手模式评审列表。
  1530. * Get reviews.
  1531. *
  1532. * @access public
  1533. * @return array
  1534. */
  1535. public function getReviews()
  1536. {
  1537. return array(1 => $this->getReview());
  1538. }
  1539. /**
  1540. * 获取新手模式看板默认区域。
  1541. * Get region pairs.
  1542. *
  1543. * @access public
  1544. * @return array
  1545. */
  1546. public function getRegionPairs()
  1547. {
  1548. $this->loadModel('kanban');
  1549. return array(1 => $this->lang->kanbanregion->default);
  1550. }
  1551. /**
  1552. * 获取新手模式看板组。
  1553. * Get groups.
  1554. *
  1555. * @access public
  1556. * @return array
  1557. */
  1558. public function getGroups()
  1559. {
  1560. $groups = array();
  1561. $groups[1] = array();
  1562. foreach(array(1, 2, 3) as $key)
  1563. {
  1564. $group = new stdClass();
  1565. $group->id = $key;
  1566. $group->kanban = 3;
  1567. $group->region = 1;
  1568. $group->order = $key;
  1569. $groups[1][$key] = $group;
  1570. }
  1571. return $groups;
  1572. }
  1573. /**
  1574. * 获取新手模式看板泳道。
  1575. * Get lane.
  1576. *
  1577. * @access public
  1578. * @return object
  1579. */
  1580. public function getLaneGroup()
  1581. {
  1582. $this->loadModel('kanban');
  1583. $laneGroup = array();
  1584. foreach(array(1 => 'story', 2 => 'task', 3 => 'bug') as $key => $objectType)
  1585. {
  1586. $lane = array();
  1587. $lane['execution'] = 3;
  1588. $lane['region'] = 1;
  1589. $lane['id'] = $key;
  1590. $lane['type'] = $objectType;
  1591. $lane['name'] = $key;
  1592. $lane['title'] = $this->config->kanban->default->{$objectType}->name;
  1593. $lane['color'] = $this->config->kanban->default->{$objectType}->color;
  1594. $lane['order'] = $this->config->kanban->default->{$objectType}->order;
  1595. $laneGroup[$key] = array($lane);
  1596. }
  1597. return $laneGroup;
  1598. }
  1599. /**
  1600. * 获取新手模式看板列。
  1601. * Get columns.
  1602. *
  1603. * @access public
  1604. * @return array
  1605. */
  1606. public function getColumns()
  1607. {
  1608. $this->loadModel('kanban');
  1609. $columnID = 1;
  1610. $columns = array();
  1611. foreach(array(1 => 'story', 2 => 'task', 3 => 'bug') as $key => $objectType)
  1612. {
  1613. $columnList = array();
  1614. foreach($this->lang->kanban->{$objectType . 'Column'} as $type => $name)
  1615. {
  1616. $column = array();
  1617. $column['parent'] = 0;
  1618. $column['region'] = 1;
  1619. $column['group'] = 1;
  1620. $column['color'] = '#333';
  1621. $column['limit'] = -1;
  1622. $column['actionList'] = array('setColumn', 'setWIP', 'deleteColumn');
  1623. $column['id'] = $columnID ++;
  1624. $column['name'] = $column['id'];
  1625. $column['type'] = $type;
  1626. $column['title'] = $name;
  1627. $columnList[] = $column;
  1628. }
  1629. $columns[$key] = $columnList;
  1630. }
  1631. return $columns;
  1632. }
  1633. /**
  1634. * 获取新手模式看板列。
  1635. * Get column.
  1636. *
  1637. * @access public
  1638. * @return object
  1639. */
  1640. public function getColumn()
  1641. {
  1642. $column = new stdClass();
  1643. $column->id = 1;
  1644. $column->parent = 0;
  1645. $column->type = 'backlog';
  1646. $column->region = 1;
  1647. $column->group = 1;
  1648. $column->name = 'Backlog';
  1649. $column->color = '#333';
  1650. $column->limit = -1;
  1651. $column->order = 0;
  1652. $column->archived = 0;
  1653. $column->deleted = 0;
  1654. $column->laneType = 'story';
  1655. return $column;
  1656. }
  1657. /**
  1658. * 获取新手模式看板卡片。
  1659. * Get card.
  1660. *
  1661. * @access public
  1662. * @return array
  1663. */
  1664. public function getCardGroup()
  1665. {
  1666. $card = array();
  1667. $card['id'] = 1;
  1668. $card['name'] = 1;
  1669. $card['pri'] = 3;
  1670. $card['color'] = '';
  1671. $card['assignedTo'] = '';
  1672. $card['parent'] = 0;
  1673. $card['progress'] = 0;
  1674. $card['group'] = '';
  1675. $card['region'] = '';
  1676. $card['begin'] = '';
  1677. $card['end'] = '';
  1678. $card['fromID'] = 0;
  1679. $card['fromType'] = '';
  1680. $card['desc'] = '';
  1681. $card['originDesc'] = '';
  1682. $card['delay'] = 0;
  1683. $card['objectStatus'] = '';
  1684. $card['deleted'] = 0;
  1685. $card['date'] = '';
  1686. $card['estimate'] = 0;
  1687. $card['deadline'] = '';
  1688. $card['severity'] = '';
  1689. $card['avatarList'] = array();
  1690. $card['realnames'] = '';
  1691. $card['order'] = 0;
  1692. $card['acl'] = 'open';
  1693. $card['dbPrivs'] = array();
  1694. $storyCard = $card;
  1695. $storyCard['title'] = 'Test story';
  1696. $storyCard['column'] = 1;
  1697. $storyCard['lane'] = 1;
  1698. $storyCard['status'] = 'active';
  1699. $storyCard['cardType'] = 'story';
  1700. $taskCard = $card;
  1701. $taskCard['title'] = 'Test task';
  1702. $taskCard['column'] = 16;
  1703. $taskCard['lane'] = 2;
  1704. $taskCard['left'] = 0;
  1705. $taskCard['estStarted'] = '';
  1706. $taskCard['mode'] = '';
  1707. $taskCard['status'] = 'wait';
  1708. $taskCard['cardType'] = 'task';
  1709. $bugCard = $card;
  1710. $bugCard['title'] = 'Test bug';
  1711. $bugCard['column'] = 23;
  1712. $bugCard['lane'] = 3;
  1713. $bugCard['status'] = 'active';
  1714. $bugCard['cardType'] = 'bug';
  1715. return array(1 => array(1 => array(1 => array($storyCard))), 2 => array(2 => array(16 => array($taskCard))), 3 => array(3 => array(23 => array($bugCard))));
  1716. }
  1717. /**
  1718. * 获取新手模式计划。
  1719. * Get plan.
  1720. *
  1721. * @access public
  1722. * @return object
  1723. */
  1724. public function getPlan()
  1725. {
  1726. $plan = new stdClass();
  1727. $plan->id = 1;
  1728. $plan->product = 1;
  1729. $plan->branch = '0';
  1730. $plan->parent = 0;
  1731. $plan->title = 'Test plan';
  1732. $plan->status = 'wait';
  1733. $plan->desc = '';
  1734. $plan->begin = helper::today();
  1735. $plan->end = helper::today();
  1736. $plan->finishedDate = '';
  1737. $plan->closedDate = '';
  1738. $plan->order = 0;
  1739. $plan->closedReason = '';
  1740. $plan->createdBy = $this->app->user->account;
  1741. $plan->createdDate = helper::now();
  1742. $plan->deleted = 0;
  1743. $plan->bugs = 0;
  1744. $plan->hour = 0;
  1745. $plan->stories = 0;
  1746. $plan->projects = array();
  1747. $plan->expired = '';
  1748. $plan->branchName = '';
  1749. $plan->isParent = 0;
  1750. return $plan;
  1751. }
  1752. /**
  1753. * 获取新手模式计划列表。
  1754. * Get plans.
  1755. *
  1756. * @access public
  1757. * @return array
  1758. */
  1759. public function getPlans()
  1760. {
  1761. return array(1 => $this->getPlan());
  1762. }
  1763. /**
  1764. * 获取新手模式计划键值对。
  1765. * Get plan pairs.
  1766. *
  1767. * @access public
  1768. * @return array
  1769. */
  1770. public function getPlanPairs()
  1771. {
  1772. return array(1 => $this->getPlan()->title);
  1773. }
  1774. /**
  1775. * 获取新手模式系统。
  1776. * Get system.
  1777. *
  1778. * @access public
  1779. * @return object
  1780. */
  1781. public function getSystem()
  1782. {
  1783. $system = new stdclass();
  1784. $system->id = 1;
  1785. $system->name = 'Test App';
  1786. $system->product = 1;
  1787. $system->integrated = '0';
  1788. $system->latestRelease = 0;
  1789. $system->status = 'active';
  1790. $system->children = '';
  1791. $system->desc = '';
  1792. return $system;
  1793. }
  1794. /**
  1795. * 获取新手模式应用键值对。
  1796. * Get system pairs.
  1797. *
  1798. * @access public
  1799. * @return array
  1800. */
  1801. public function getSystemPairs()
  1802. {
  1803. return array(1 => $this->getSystem()->name);
  1804. }
  1805. /**
  1806. * 获取新手模式产品应用列表。
  1807. * Get product app list.
  1808. *
  1809. * @access public
  1810. * @return array
  1811. */
  1812. public function getSystemList()
  1813. {
  1814. return array(1 => $this->getSystem());
  1815. }
  1816. /**
  1817. * 获取新手模式发布。
  1818. * Get releases.
  1819. *
  1820. * @access public
  1821. * @return object
  1822. */
  1823. public function getRelease()
  1824. {
  1825. $release = new stdClass();
  1826. $release->id = 1;
  1827. $release->system = 1;
  1828. $release->project = 0;
  1829. $release->product = 1;
  1830. $release->branch = '0';
  1831. $release->shadow = 1;
  1832. $release->build = '';
  1833. $release->name = 'Test release';
  1834. $release->marker = 0;
  1835. $release->date = helper::today();
  1836. $release->releasedDate = '';
  1837. $release->stories = '';
  1838. $release->bugs = '';
  1839. $release->leftBugs = '';
  1840. $release->desc = '';
  1841. $release->mailto = '';
  1842. $release->notify = '';
  1843. $release->status = 'wait';
  1844. $release->subStatus = '';
  1845. $release->createdBy = $this->app->user->account;
  1846. $release->createdDate = helper::now();
  1847. $release->deleted = 0;
  1848. $release->productName = 'Test product';
  1849. $release->productType = 'normal';
  1850. $release->builds = array();
  1851. $release->branchName = 'Test branch';
  1852. $release->projectName = '';
  1853. $release->files = array();
  1854. $release->releases = '';
  1855. return $release;
  1856. }
  1857. /**
  1858. * 获取新手模式发布列表。
  1859. * Get releases.
  1860. *
  1861. * @access public
  1862. * @return array
  1863. */
  1864. public function getReleases()
  1865. {
  1866. return array(1 => $this->getRelease());
  1867. }
  1868. /**
  1869. * 获取新手模式项目集键值对。
  1870. * Get program pairs.
  1871. *
  1872. * @access public
  1873. * @return array
  1874. */
  1875. public function getProgramPairs()
  1876. {
  1877. return array(1 => 'Test program');
  1878. }
  1879. /**
  1880. * 获取新手模式项目集。
  1881. * Get program.
  1882. *
  1883. * @access public
  1884. * @return object
  1885. */
  1886. public function getProgram()
  1887. {
  1888. $program = $this->getProject();
  1889. $program->id = 1;
  1890. $program->name = 'Test program';
  1891. $program->project = 0;
  1892. $program->type = 'program';
  1893. $program->parent = 0;
  1894. $program->path = ',1,';
  1895. $program->grade = 1;
  1896. return $program;
  1897. }
  1898. /**
  1899. * 获取新手模式项目集列表。
  1900. * Get programs.
  1901. *
  1902. * @access public
  1903. * @return array
  1904. */
  1905. public function getPrograms()
  1906. {
  1907. return array(1 => $this->getProgram());
  1908. }
  1909. /**
  1910. * 获取新手模式分支键值对。
  1911. * Get branch pairs.
  1912. *
  1913. * @access public
  1914. * @return array
  1915. */
  1916. public function getBranchPairs()
  1917. {
  1918. $this->loadModel('branch');
  1919. return array(0 => $this->lang->branch->main, 1 => 'Test branch');
  1920. }
  1921. /**
  1922. * 获取新手模式项目关联分支。
  1923. * Get branch by project.
  1924. *
  1925. * @access public
  1926. * @return array
  1927. */
  1928. public function getBranchesByProject()
  1929. {
  1930. $branch = new stdClass();
  1931. $branch->project = 2;
  1932. $branch->product = 1;
  1933. $branch->branch = 0;
  1934. $branch->plan = 0;
  1935. $branch->roadmap = 0;
  1936. return array(1 => array($branch));
  1937. }
  1938. /**
  1939. * 获取新手模式分支列表。
  1940. * Get branches.
  1941. *
  1942. * @access public
  1943. * @return array
  1944. */
  1945. public function getBranches()
  1946. {
  1947. $this->loadModel('branch');
  1948. $main = new stdClass();
  1949. $main->id = 0;
  1950. $main->product = 1;
  1951. $main->name = $this->lang->branch->main;
  1952. $main->default = 1;
  1953. $main->status = 'active';
  1954. $main->desc = $this->lang->branch->defaultBranch;
  1955. $main->createdDate = helper::now();
  1956. $main->closedDate = '';
  1957. $main->order = 0;
  1958. $main->deleted = 0;
  1959. $branch = new stdClass();
  1960. $branch->id = 1;
  1961. $branch->product = 1;
  1962. $branch->name = 'Test branch';
  1963. $branch->default = 0;
  1964. $branch->status = 'active';
  1965. $branch->desc = '';
  1966. $branch->createdDate = helper::now();
  1967. $branch->closedDate = '';
  1968. $branch->order = 1;
  1969. $branch->deleted = 0;
  1970. return array($main, $branch);
  1971. }
  1972. /**
  1973. * 获取新手模式反馈。
  1974. * Get feedback.
  1975. *
  1976. * @access public
  1977. * @return object
  1978. */
  1979. public function getFeedback()
  1980. {
  1981. $feedback = new stdClass();
  1982. $feedback->id = 1;
  1983. $feedback->product = 1;
  1984. $feedback->module = 0;
  1985. $feedback->title = 'Test feedback';
  1986. $feedback->type = '';
  1987. $feedback->solution = '';
  1988. $feedback->desc = '';
  1989. $feedback->pri = 3;
  1990. $feedback->status = 'noreview';
  1991. $feedback->subStatus = '';
  1992. $feedback->public = 1;
  1993. $feedback->notify = 1;
  1994. $feedback->notifyEmail = '';
  1995. $feedback->source = '';
  1996. $feedback->likes = '';
  1997. $feedback->result = 0;
  1998. $feedback->faq = 0;
  1999. $feedback->openedBy = $this->app->user->account;
  2000. $feedback->openedDate = helper::now();
  2001. $feedback->reviewedBy = '';
  2002. $feedback->reviewedDate = '';
  2003. $feedback->processedBy = '';
  2004. $feedback->processedDate = '';
  2005. $feedback->closedBy = '';
  2006. $feedback->closedDate = '';
  2007. $feedback->closedReason = '';
  2008. $feedback->editedBy = '';
  2009. $feedback->editedDate = '';
  2010. $feedback->assignedTo = '';
  2011. $feedback->assignedDate = '';
  2012. $feedback->activatedBy = '';
  2013. $feedback->activatedDate = '';
  2014. $feedback->feedbackBy = '';
  2015. $feedback->repeatFeedback = 0;
  2016. $feedback->mailto = '';
  2017. $feedback->keywords = '';
  2018. $feedback->deleted = 0;
  2019. $feedback->dept = 0;
  2020. return $feedback;
  2021. }
  2022. /**
  2023. * 获取新手模式反馈列表。
  2024. * Get feedbacks.
  2025. *
  2026. * @access public
  2027. * @return array
  2028. */
  2029. public function getFeedbacks()
  2030. {
  2031. $waitFeedback = $this->getFeedback();
  2032. $waitFeedback->id = 1;
  2033. $waitFeedback->title = 'Wait feedback';
  2034. $waitFeedback->status = 'wait';
  2035. $noReviewFeedback = $this->getFeedback();
  2036. $noReviewFeedback->id = 2;
  2037. $noReviewFeedback->title = 'Not review feedback';
  2038. $noReviewFeedback->status = 'noreview';
  2039. return array($waitFeedback->id => $waitFeedback, $noReviewFeedback->id => $noReviewFeedback);
  2040. }
  2041. /**
  2042. * 获取新手模式团队空间或我的空间。
  2043. * Get team spaces.
  2044. *
  2045. * @param string $type
  2046. * @access public
  2047. * @return array
  2048. */
  2049. public function getSubSpaces($type = 'custom')
  2050. {
  2051. if($type == 'custom') return array(1 => 'Test Team Space');
  2052. if($type == 'mine') return array(1 => 'Test My Space');
  2053. return array();
  2054. }
  2055. /**
  2056. * 获取新手模式团队空间。
  2057. * Get team spaces.
  2058. *
  2059. * @access public
  2060. * @return array
  2061. */
  2062. public function getDocTemplateSpaces()
  2063. {
  2064. return array(1 => 'Doc Template Space');
  2065. }
  2066. /**
  2067. * 获取新手模式文档库。
  2068. * Get doc lib.
  2069. *
  2070. * @access public
  2071. * @return object
  2072. */
  2073. public function getDocLib()
  2074. {
  2075. $docLib = new stdClass();
  2076. $docLib->id = 2;
  2077. $docLib->type = 'custom';
  2078. $docLib->vision = 'rnd';
  2079. $docLib->parent = 1;
  2080. $docLib->product = 0;
  2081. $docLib->project = 0;
  2082. $docLib->execution = 0;
  2083. $docLib->name = 'Test Doc Lib';
  2084. $docLib->baseUrl = '';
  2085. $docLib->acl = 'open';
  2086. $docLib->groups = '';
  2087. $docLib->users = '';
  2088. $docLib->main = 0;
  2089. $docLib->collector = '';
  2090. $docLib->desc = '';
  2091. $docLib->order = 0;
  2092. $docLib->addedBy = $this->app->user->account;
  2093. $docLib->addedDate = helper::now();
  2094. $docLib->deleted = 0;
  2095. $docLib->allCount = 2;
  2096. return $docLib;
  2097. }
  2098. /**
  2099. * 获取新手模式文档库。
  2100. * Get doc lib.
  2101. *
  2102. * @access public
  2103. * @return array
  2104. */
  2105. public function getDocLibs()
  2106. {
  2107. $docLib = $this->getDocLib();
  2108. return array($docLib->id => $docLib);
  2109. }
  2110. /**
  2111. * 获取新手模式文档库树。
  2112. * Get lib tree.
  2113. *
  2114. * @access public
  2115. * @return array
  2116. */
  2117. public function getLibTree()
  2118. {
  2119. $docLib = new stdClass();
  2120. $docLib->id = 2;
  2121. $docLib->type = 'docLib';
  2122. $docLib->name = 'Test Doc Lib';
  2123. $docLib->parent = 1;
  2124. $docLib->order = 0;
  2125. $docLib->main = 0;
  2126. $docLib->objectType = 'custom';
  2127. $docLib->objectID = 1;
  2128. $docLib->addedBy = $this->app->user->account;
  2129. $docLib->active = 1;
  2130. $docLib->children = array();
  2131. return array($docLib);
  2132. }
  2133. /**
  2134. * 获取新手模式文档。
  2135. * Get doc.
  2136. *
  2137. * @access public
  2138. * @return object
  2139. */
  2140. public function getDoc()
  2141. {
  2142. $doc = new stdClass();
  2143. $doc->id = 1;
  2144. $doc->vision = 'rnd';
  2145. $doc->project = 0;
  2146. $doc->product = 0;
  2147. $doc->execution = 0;
  2148. $doc->lib = 2;
  2149. $doc->template = '';
  2150. $doc->templateType = '';
  2151. $doc->chapterType = '';
  2152. $doc->module = 0;
  2153. $doc->title = 'Test Doc';
  2154. $doc->keywords = '';
  2155. $doc->type = 'text';
  2156. $doc->status = 'normal';
  2157. $doc->parent = 0;
  2158. $doc->path = '';
  2159. $doc->grade = 0;
  2160. $doc->order = 10;
  2161. $doc->views = 1;
  2162. $doc->assetLib = 0;
  2163. $doc->assetLibType = '';
  2164. $doc->from = 0;
  2165. $doc->fromVersion = 1;
  2166. $doc->draft = "This is the description of the document.";
  2167. $doc->collects = 0;
  2168. $doc->addedBy = $this->app->user->account;
  2169. $doc->addedDate = helper::now();
  2170. $doc->assignedTo = '';
  2171. $doc->assignedDate = '';
  2172. $doc->approvedDate = '';
  2173. $doc->editedBy = '';
  2174. $doc->editedDate = '';
  2175. $doc->editingDate = array();
  2176. $doc->editedList = ",{$this->app->user->account}";
  2177. $doc->mailto = '';
  2178. $doc->acl = 'open';
  2179. $doc->groups = '';
  2180. $doc->users = '';
  2181. $doc->version = 2;
  2182. $doc->deleted = 0;
  2183. $doc->collector = '';
  2184. $doc->releasedDate = '';
  2185. $doc->releasedBy = $this->app->user->account;
  2186. $doc->digest = helper::now();
  2187. $doc->content = "This is the description of the document.";
  2188. $doc->contentType = 'html';
  2189. $doc->contentVersion = 2;
  2190. $doc->files = array();
  2191. $doc->moduleName = '';
  2192. $doc->executionName = '';
  2193. $doc->productName = '';
  2194. return $doc;
  2195. }
  2196. /**
  2197. * 获取新手模式文档列表。
  2198. * Get docs.
  2199. *
  2200. * @access public
  2201. * @return array
  2202. */
  2203. public function getDocs()
  2204. {
  2205. $doc = $this->getDoc();
  2206. return array($doc->id => $doc);
  2207. }
  2208. /**
  2209. * 获取新手模式需求池。
  2210. * Get demandpool.
  2211. *
  2212. * @access public
  2213. * @return object
  2214. */
  2215. public function getDemandpool()
  2216. {
  2217. $demandpool = new stdClass();
  2218. $demandpool->id = 1;
  2219. $demandpool->name = 'Test demandpool';
  2220. $demandpool->desc = '';
  2221. $demandpool->status = 'normal';
  2222. $demandpool->products = '1';
  2223. $demandpool->createdBy = $this->app->user->account;
  2224. $demandpool->createdDate = helper::now();
  2225. $demandpool->owner = $this->app->user->account;
  2226. $demandpool->reviewer = ",{$this->app->user->account},test";
  2227. $demandpool->acl = 'open';
  2228. $demandpool->deleted = 0;
  2229. $demandpool->files = array();
  2230. return $demandpool;
  2231. }
  2232. /**
  2233. * 获取新手模式需求池需求。
  2234. * Get demand.
  2235. *
  2236. * @access public
  2237. * @return object
  2238. */
  2239. public function getDemand()
  2240. {
  2241. $demand = new stdClass();
  2242. $demand->id = 1;
  2243. $demand->pool = 1;
  2244. $demand->product = '';
  2245. $demand->parent = 0;
  2246. $demand->pri = 3;
  2247. $demand->title = 'Test Demand';
  2248. $demand->assignedTo = '';
  2249. $demand->status = 'active';
  2250. $demand->childDemands = '';
  2251. $demand->module = 0;
  2252. $demand->category = 'feature';
  2253. $demand->source = '';
  2254. $demand->sourceNote = '';
  2255. $demand->feedbackedBy = '';
  2256. $demand->email = '';
  2257. $demand->assignedDate = '';
  2258. $demand->reviewedBy = '';
  2259. $demand->reviewedDate = '';
  2260. $demand->stage = 'wait';
  2261. $demand->duration = '';
  2262. $demand->BSA = '';
  2263. $demand->story = 0;
  2264. $demand->roadmap = 0;
  2265. $demand->createdBy = $this->app->user->account;
  2266. $demand->createdDate = helper::now();
  2267. $demand->mailto = '';
  2268. $demand->duplicateDemand = '';
  2269. $demand->version = 1;
  2270. $demand->parentVersion = 0;
  2271. $demand->vision = 'or';
  2272. $demand->color = '';
  2273. $demand->changedBy = '';
  2274. $demand->changedDate = '';
  2275. $demand->closedBy = '';
  2276. $demand->closedDate = '';
  2277. $demand->closedReason = '';
  2278. $demand->submitedBy = '';
  2279. $demand->lastEditedBy = '';
  2280. $demand->lastEditedDate = '';
  2281. $demand->activatedDate = '';
  2282. $demand->distributedBy = '';
  2283. $demand->distributedDate = '';
  2284. $demand->feedback = 0;
  2285. $demand->keywords = '';
  2286. $demand->deleted = 0;
  2287. $demand->storyType = 'demand';
  2288. return $demand;
  2289. }
  2290. /**
  2291. * 获取新手模式需求池需求列表。
  2292. * Get demands.
  2293. *
  2294. * @access public
  2295. * @return array
  2296. */
  2297. public function getDemands()
  2298. {
  2299. $activeDemand = $this->getDemand();
  2300. $draftDemand = $this->getDemand();
  2301. $draftDemand->id = 2;
  2302. $draftDemand->status = 'reviewing';
  2303. $draftDemand->title = 'Test Reviewing Demand';
  2304. $draftDemand->notReview = array($this->app->user->account);
  2305. return array($activeDemand->id => $activeDemand, $draftDemand->id => $draftDemand);
  2306. }
  2307. /**
  2308. * 获取新手模式调研任务列表。
  2309. * Get research stage stats.
  2310. *
  2311. * @access public
  2312. * @return array
  2313. */
  2314. public function getResearchStageStats()
  2315. {
  2316. $stage = $this->getExecution();
  2317. $stage->id = 'sid_2';
  2318. $stage->parent = 'sid_1';
  2319. $stage->name = 'Test research stage';
  2320. $stage->path = ',1,2,';
  2321. $stage->project = 1;
  2322. $stage->model = '';
  2323. $stage->type = 'stage';
  2324. $stage->attribute = 'research';
  2325. $stage->canCreateTask = true;
  2326. $waitTask = $this->getTask();
  2327. $waitTask->id = 1;
  2328. $waitTask->name = 'Wait Task';
  2329. $waitTask->type = 'research';
  2330. $waitTask->project = 1;
  2331. $waitTask->execution = 2;
  2332. $waitTask->parent = 'sid_2';
  2333. $waitTask->rawParent = 0;
  2334. $waitTask->isParent = 1;
  2335. $doneTask = $this->getTask();
  2336. $doneTask->id = 2;
  2337. $doneTask->name = 'Done task';
  2338. $doneTask->status = 'done';
  2339. $doneTask->finishedBy = 'test';
  2340. $doneTask->type = 'research';
  2341. $doneTask->project = 1;
  2342. $doneTask->execution = 2;
  2343. $doneTask->parent = 'sid_2';
  2344. $doneTask->rawParent = 0;
  2345. $doneTask->isParent = 1;
  2346. return array($stage, $waitTask, $doneTask);
  2347. }
  2348. /**
  2349. * 获取新手模式市场。
  2350. * Get market.
  2351. *
  2352. * @access public
  2353. * @return object
  2354. */
  2355. public function getMarket()
  2356. {
  2357. $market = new stdClass();
  2358. $market->id = 1;
  2359. $market->name = 'Test Market';
  2360. $market->industry = '';
  2361. $market->scale = 0.00;
  2362. $market->maturity = '';
  2363. $market->speed = '';
  2364. $market->competition = '';
  2365. $market->strategy = '';
  2366. $market->ppm = '';
  2367. $market->desc = '';
  2368. $market->openedBy = $this->app->user->account;
  2369. $market->openedDate = helper::now();
  2370. $market->lastEditedBy = '';
  2371. $market->lastEditedDate = '';
  2372. $market->deleted = 0;
  2373. return $market;
  2374. }
  2375. /**
  2376. * 获取新手模式Charter立项。
  2377. * Get charter.
  2378. *
  2379. * @access public
  2380. * @return object
  2381. */
  2382. public function getCharter()
  2383. {
  2384. $charter = new stdClass();
  2385. $charter->id = 1;
  2386. $charter->name = 'Test charter';
  2387. $charter->level = 3;
  2388. $charter->category = 'IPD';
  2389. $charter->market = 'domestic';
  2390. $charter->check = 0;
  2391. $charter->appliedBy = $this->app->user->account;
  2392. $charter->appliedDate = helper::now();
  2393. $charter->budget = '';
  2394. $charter->budgetUnit = 'CNY';
  2395. $charter->product = ',1,';
  2396. $charter->roadmap = '';
  2397. $charter->spec = '';
  2398. $charter->status = 'wait';
  2399. $charter->createdBy = $this->app->user->account;
  2400. $charter->createdDate = helper::now();
  2401. $charter->charterFiles = '';
  2402. $charter->closedBy = '';
  2403. $charter->closedDate = '';
  2404. $charter->closedReason = '';
  2405. $charter->activatedBy = '';
  2406. $charter->activatedDate = '';
  2407. $charter->reviewedBy = '';
  2408. $charter->reviewedResult = '';
  2409. $charter->reviewedDate = '';
  2410. $charter->meetingDate = '';
  2411. $charter->meetingLocation = '';
  2412. $charter->meetingMinutes = '';
  2413. $charter->deleted = 0;
  2414. return $charter;
  2415. }
  2416. /**
  2417. * 获取新手模式Charter立项列表。
  2418. * Get charter list.
  2419. *
  2420. * @access public
  2421. * @return array
  2422. */
  2423. public function getCharters()
  2424. {
  2425. $charter = $this->getCharter();
  2426. return array($charter->id => $charter);
  2427. }
  2428. /**
  2429. * 获取新手模式代码库键值对。
  2430. * Get repo pairs.
  2431. *
  2432. * @access public
  2433. * @return array
  2434. */
  2435. public function getRepoPairs()
  2436. {
  2437. return array(1 => '[git] Test repo');
  2438. }
  2439. /**
  2440. * 获取新手模式代码库。
  2441. * Get repo.
  2442. *
  2443. * @access public
  2444. * @return object
  2445. */
  2446. public function getRepo()
  2447. {
  2448. $repo = new stdClass();
  2449. $repo->id = 1;
  2450. $repo->product = 1;
  2451. $repo->projects = '1';
  2452. $repo->name = 'Test repo';
  2453. $repo->path = '';
  2454. $repo->prefix = '';
  2455. $repo->encoding = 'utf-8';
  2456. $repo->SCM = 'Git';
  2457. $repo->client = '/usr/bin/git';
  2458. $repo->serviceHost = 0;
  2459. $repo->serviceProject = '';
  2460. $repo->commits = 1;
  2461. $repo->account = '';
  2462. $repo->password = '';
  2463. $repo->encrypt = 'base64';
  2464. $repo->synced = 0;
  2465. $repo->lastSync = '';
  2466. $repo->lastCommit = '';
  2467. $repo->desc = '';
  2468. $repo->extra = '';
  2469. $repo->preMerge = 0;
  2470. $repo->job = 0;
  2471. $repo->fileServerUrl = '';
  2472. $repo->fileServerAccount = '';
  2473. $repo->fileServerPassword = '';
  2474. $repo->deleted = 0;
  2475. $repo->codePath = '';
  2476. return $repo;
  2477. }
  2478. /**
  2479. * 获取新手模式提交记录。
  2480. * Get git commits.
  2481. *
  2482. * @access public
  2483. * @return array
  2484. */
  2485. public function getCommits()
  2486. {
  2487. $commit = new stdClass();
  2488. $commit->id = 1;
  2489. $commit->repo = 1;
  2490. $commit->revision = 'bedeaaf39ef7084b9a455b9d9dba71e2db357201';
  2491. $commit->commit = 1;
  2492. $commit->comment = 'Git comment.';
  2493. $commit->committer = $this->app->user->account;
  2494. $commit->time = helper::now();
  2495. $commit->originalComment = 'Git comment.';
  2496. return array($commit->revision => $commit);
  2497. }
  2498. }