本文整理汇总了PHP中Stats::getAssocUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::getAssocUser方法的具体用法?PHP Stats::getAssocUser怎么用?PHP Stats::getAssocUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::getAssocUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StatsChart
/**
* Plot various stats charts
*
* @param string $plotType
* @param bool $hide_closed
* @return bool return false if no data is available
*/
public function StatsChart($plotType, $hide_closed)
{
// don't bother if user has no access
$prj_id = Auth::getCurrentProject();
if (Auth::getCurrentRole() <= User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
return false;
}
$colors = array();
switch ($plotType) {
case 'status':
$data = Stats::getAssocStatus($hide_closed);
$graph_title = ev_gettext('Issues by Status');
// use same colors as defined for statuses
foreach ($data as $sta_title => $trash) {
$sta_id = Status::getStatusID($sta_title);
$status_details = Status::getDetails($sta_id);
$colors[] = $status_details['sta_color'];
}
break;
case 'release':
$data = Stats::getAssocRelease($hide_closed);
$graph_title = ev_gettext('Issues by Release');
break;
case 'priority':
$data = Stats::getAssocPriority($hide_closed);
$graph_title = ev_gettext('Issues by Priority');
break;
case 'user':
$data = Stats::getAssocUser($hide_closed);
$graph_title = ev_gettext('Issues by Assignment');
break;
case 'category':
$data = Stats::getAssocCategory($hide_closed);
$graph_title = ev_gettext('Issues by Category');
break;
default:
return false;
}
// check the values coming from the database and if they are all empty, then
// output a pre-generated 'No Data Available' picture
if (!Stats::hasData($data)) {
return false;
}
$plot = $this->create(360, 200);
$plot->SetImageBorderType('plain');
$plot->SetTitle($graph_title);
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
if ($colors) {
$plot->SetDataColors($colors);
}
$legend = $dataValue = array();
foreach ($data as $label => $count) {
$legend[] = $label . ' (' . $count . ')';
$dataValue[] = array($label, $count);
}
$plot->SetDataValues($dataValue);
foreach ($legend as $label) {
$plot->SetLegend($label);
}
return $plot->DrawGraph();
}
示例2: elseif
$scale = 3;
}
if ($scale < 1) {
$scale = 1;
}
if ($HTTP_GET_VARS["plot"] == "status") {
$data = Stats::getAssocStatus();
$graph_title = "Issues by Status";
} elseif ($HTTP_GET_VARS["plot"] == "release") {
$data = Stats::getAssocRelease();
$graph_title = "Issues by Release";
} elseif ($HTTP_GET_VARS["plot"] == "priority") {
$data = Stats::getAssocPriority();
$graph_title = "Issues by Priority";
} elseif ($HTTP_GET_VARS["plot"] == "user") {
$data = Stats::getAssocUser();
$graph_title = "Issues by Assignment";
} elseif ($HTTP_GET_VARS["plot"] == "category") {
$data = Stats::getAssocCategory();
$graph_title = "Issues by Category";
}
$labels = array_keys($data);
$data = array_values($data);
// check the values coming from the database and if they are all empty, then
// output a pre-generated 'No Data Available' picture
if (!Stats::hasData($data)) {
readfile(APP_PATH . "images/no_data.gif");
exit;
}
// A new graph
$graph = new PieGraph(360 * $scale, 200 * $scale, "auto");