| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * The execution entry point of ZenTaoPMS.
- *
- * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
- * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
- * @author Chunsheng Wang <chunsheng@cnezsoft.com>
- * @package execution
- * @version 1
- * @link https://www.zentao.net
- */
- class executionStoriesEntry extends entry
- {
- /**
- * GET method.
- *
- * @param int $executionID
- * @access public
- * @return string
- */
- public function get($executionID)
- {
- if(empty($executionID)) $this->param('execution', 0);
- if(empty($executionID)) return $this->sendError(400, 'Need execution id.');
- $control = $this->loadController('execution', 'story');
- $control->story($executionID, $this->param('storyType', 'story'), $this->param('order', 'id_desc'), $this->param('status', 'all'), 0, 0, $this->param('limit', 20), $this->param('page', 1));
- $data = $this->getData();
- if(isset($data->status) and $data->status == 'success')
- {
- $stories = $data->data->stories;
- $pager = $data->data->pager;
- $result = array();
- $this->loadModel('product');
- foreach($stories as $story)
- {
- $product = $this->product->getById($story->product);
- $story->productStatus = $product->status;
- $result[] = $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList');
- }
- return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result));
- }
- if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
- return $this->sendError(400, 'error');
- }
- }
|