* Display chart datas of testtask.
This commit is contained in:
@@ -158,6 +158,8 @@ class testreport extends control
|
||||
$tasks = array($task->id => $task);
|
||||
$owner = $task->owner;
|
||||
|
||||
$this->setChartDatas($objectID);
|
||||
|
||||
$this->view->title = $task->name . $this->lang->testreport->create;
|
||||
$this->view->position[] = html::a(inlink('browse', "objectID=$productID&objectType=product&extra={$task->id}"), $task->name);
|
||||
$this->view->position[] = $this->lang->testreport->create;
|
||||
@@ -306,6 +308,8 @@ class testreport extends control
|
||||
$bugs = $this->testreport->getBugs4Test($builds, $report->product, $report->begin, $report->end);
|
||||
}
|
||||
$tasks = array($task->id => $task);
|
||||
|
||||
$this->setChartDatas($report->objectID);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -390,6 +394,8 @@ class testreport extends control
|
||||
$cases = $this->testreport->getTaskCases($tasks, $report->cases);
|
||||
$bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds);
|
||||
|
||||
if($report->objectType == 'testtask') $this->setChartDatas($report->objectID);
|
||||
|
||||
$this->view->title = $report->title;
|
||||
$this->view->browseLink = $browseLink;
|
||||
$this->view->position[] = $report->title;
|
||||
@@ -461,4 +467,29 @@ class testreport extends control
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set chart datas of cases.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setChartDatas($taskID)
|
||||
{
|
||||
$this->loadModel('report');
|
||||
$task = $this->loadModel('testtask')->getById($taskID);
|
||||
foreach($this->lang->testtask->report->charts as $chart => $title)
|
||||
{
|
||||
if(strpos($chart, 'testTask') === false) continue;
|
||||
|
||||
$chartFunc = 'getDataOf' . $chart;
|
||||
$chartData = $this->testtask->$chartFunc($taskID);
|
||||
$chartOption = $this->testtask->mergeChartOption($chart);
|
||||
if(!empty($chartType)) $chartOption->type = $chartType;
|
||||
|
||||
$this->view->charts[$chart] = $chartOption;
|
||||
$this->view->datas[$chart] = $this->report->computePercent($chartData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,50 @@
|
||||
<table class='table table-form'>
|
||||
<?php foreach($charts as $chartType => $chartOption):?>
|
||||
<tr>
|
||||
<td class='text-top'>
|
||||
<table class='table table-condensed table-report' id='bugSeverityGroups'>
|
||||
<?php if(empty($datas[$chartType])):?>
|
||||
<tr>
|
||||
<td class='none-data'>
|
||||
<h5><?php echo $lang->testtask->report->charts[$chartType];?></h5>
|
||||
<?php echo $lang->testreport->none;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php else:?>
|
||||
<tr class='text-top'>
|
||||
<td class='w-p70'>
|
||||
<div class='chart-wrapper text-center'>
|
||||
<h5><?php echo $lang->testtask->report->charts[$chartType];?></h5>
|
||||
<div class='chart-canvas'><canvas id='chart-<?php echo $chartType ?>' width='<?php echo $chartOption->width;?>' height='<?php echo $chartOption->height;?>' data-responsive='true'></canvas></div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class='table-wrapper' style='overflow:auto'>
|
||||
<table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='<?php echo $chartOption->type; ?>' data-target='#chart-<?php echo $chartType ?>' data-animation='false'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='chart-label' colspan='2'><?php echo $lang->report->item;?></th>
|
||||
<th class='w-50px'><?php echo $lang->report->value;?></th>
|
||||
<th class='w-50px'><?php echo $lang->report->percent;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach($datas[$chartType] as $key => $data):?>
|
||||
<tr class='text-center'>
|
||||
<td class='chart-color'><i class='chart-color-dot'></i></td>
|
||||
<td class='chart-label'><?php echo $data->name;?></td>
|
||||
<td class='chart-value'><?php echo $data->value;?></td>
|
||||
<td><?php echo ($data->percent * 100) . '%';?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php foreach($bugInfo as $infoKey => $infoValue):?>
|
||||
<tr>
|
||||
<td class='text-top'>
|
||||
|
||||
Reference in New Issue
Block a user