products = $this->product->getProductPairsByProject($projectID);
if(empty($this->products)) $this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=projectrelease&projectID=' . $projectID));
/* 获取当前的产品。*/
/* Get current product. */
if(!$productID) $productID = key($this->products);
$product = $this->product->getByID($productID);
$this->view->products = $this->products;
$this->view->product = $product;
$this->view->branches = (isset($product->type) and $product->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID, 'active', $projectID);
$this->view->branch = $branch;
$this->view->project = $this->project->getByID($projectID);
}
/**
* 生成关联的需求的 html。
* Generate story html.
*
* @access protected
* @return void
*/
protected function generateStoryHtml(): string
{
$this->loadModel('story');
$html = "
{$this->lang->release->stories}
";
$fields = array('id' => $this->lang->story->id, 'title' => $this->lang->story->title);
/* 生成表头。*/
/* Generate thead.*/
$html .= '';
foreach($fields as $fieldLabel) $html .= "| $fieldLabel | \n";
$html .= '
';
$stories = $this->dbh->query($this->session->storyQueryCondition . " ORDER BY " . strtr($this->session->storyOrderBy, '_', ' '))->fetchAll();
foreach($stories as $story)
{
$story->title = "id") . "' target='_blank'>$story->title";
$html .= "\n";
foreach($fields as $fieldName => $fieldLabel) $html .= '| ' . zget($story, $fieldName, '') . " | \n";
$html .= "
\n";
}
$html .= '
';
return $html;
}
/**
* 生成 bug 的 html。
* Generate bug html.
*
* @param string $type linked|left
* @access protected
* @return string
*/
protected function generateBugHtml($type = 'linked'): string
{
$this->loadModel('bug');
$html = '' . ($type == 'linked' ? $this->lang->release->bugs : $this->lang->release->generatedBugs) . '
';
$fields = array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title);
$html .= '';
foreach($fields as $fieldLabel) $html .= "| $fieldLabel | \n";
$html .= '
';
$bugs = array();
$queryConditionName = $type == 'linked' ? 'linkedBugQueryCondition' : 'leftBugsQueryCondition';
if($this->session->$queryConditionName !== false) $bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->$queryConditionName)->beginIF($this->session->bugOrderBy !== false)->orderBy($this->session->bugOrderBy)->fi()->fetchAll('id');
foreach($bugs as $bug)
{
$bug->title = "id") . "' target='_blank'>$bug->title";
$html .= "\n";
foreach($fields as $fieldName => $fieldLabel) $html .= "| " . zget($bug, $fieldName, '') . " | \n";
$html .= "
\n";
}
$html .= '
';
return $html;
}
}