/**
  *   根据项目来取其中定义的分类
  * @param int $projectId
  * @param string $format
  */
 public function fetchAllByProjectId($projectId, $format = 'json')
 {
     $model = $this->loadModel('project');
     $project = $model->getById($projectId);
     //TODO 支持按项目代号查找
     if (!$project) {
         $this->responseNotExixted();
     }
     global $app;
     $types = $app->loadLang('bug')->bug->typeList;
     $issue_categories = array();
     foreach ($types as $key => $name) {
         $issue_categories[] = array('id' => BugType::getIdByInterId($key), 'project' => array('id' => $projectId, 'name' => $project->name), 'name' => $name);
     }
     echo json_encode(array('issue_categories' => $issue_categories, 'total_count' => 2));
 }
Beispiel #2
0
 /**
  * 返回指定问题的详细数据
  * @param int|string $id
  * @param string $format
  */
 public function fetch($id, $format = 'json')
 {
     $model = $this->loadModel('bug');
     $issue = $model->getById($id);
     if (!$issue) {
         $this->responseNotExixted();
     }
     $user_model = $this->loadModel('user');
     $proj_model = $this->loadModel('project');
     $type_id = BugType::getIdByInterId($issue->type);
     $opened_user = $user_model->getById($issue->openedBy);
     $assgined_user = $user_model->getById($issue->assignedTo);
     $project = $proj_model->getById($issue->project);
     $_issue = array('id' => (int) $issue->id, 'project' => array('id' => (int) $issue->project, 'name' => $project->name), 'subject' => $issue->title, 'tracker' => array('id' => 1, 'name' => 'Bug'), 'category' => array('id' => $type_id, 'name' => BugType::findLabelById($type_id)), 'priority' => array('id' => (int) $issue->pri, 'name' => $issue->pri), 'author' => array('id' => $opened_user->id, 'name' => $issue->openedBy), 'assigned_to' => array('id' => $assgined_user->id, 'name' => $issue->assignedTo), 'description' => '', 'start_date' => date('Y-m-d', strtotime($issue->assignedDate)), 'due_date' => date('Y-m-d', strtotime($issue->assignedDate) + 1000000), 'done_ratio' => 0, 'created_on' => date('Y-m-d\\TH:i:s\\Z', strtotime($issue->openedDate)), 'updated_on' => date('Y-m-d\\TH:i:s\\Z', strtotime($issue->lastEditedDate)), 'attachments' => array(), 'journals' => array(), 'watchers' => array());
     $this->response(array('issue' => $_issue));
 }