本文整理汇总了PHP中Report::getWorkloadByTimePeriod方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getWorkloadByTimePeriod方法的具体用法?PHP Report::getWorkloadByTimePeriod怎么用?PHP Report::getWorkloadByTimePeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::getWorkloadByTimePeriod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WorkloadTimePeriodGraph
/**
* Generates the workload by time period graph.
*
* @param string $type
*/
public function WorkloadTimePeriodGraph($type)
{
$usr_id = Auth::getUserID();
// get timezone of current user
$user_prefs = Prefs::get($usr_id);
if ($type == 'email') {
$data = Report::getEmailWorkloadByTimePeriod($user_prefs['timezone'], true);
$graph_title = ev_gettext('Email by Time Period');
$event_type = ev_gettext('emails');
} else {
$data = Report::getWorkloadByTimePeriod($user_prefs['timezone'], true);
$graph_title = ev_gettext('Workload by Time Period');
$event_type = ev_gettext('actions');
}
// TRANSLATORS: %s = Timezone name
$xtitle = ev_gettext('Hours (%s)', Date_Helper::getTimezoneShortNameByUser($usr_id));
// rebuild data for phplot format
$plotData = array();
$legends = array();
$i = 1;
foreach ($data as $performer => $values) {
foreach ($values as $hour => $value) {
$plotData[(int) $hour][0] = $hour;
$plotData[(int) $hour][$i] = $value;
}
$legends[$i] = ucfirst($performer) . ' ' . $event_type;
$i++;
}
$plot = $this->create(900, 350);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($plotData);
$plot->SetTitle($graph_title);
$plot->SetLegend($legends);
$plot->SetYTitle($event_type);
$plot->SetXTitle($xtitle);
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYDataLabelPos('plotin');
$plot->SetYLabelType('printf', '%.0f%%');
$plot->group_frac_width = 1;
$plot->DrawGraph();
}
示例2: dirname
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: Bryan Alsdorf <bryan@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/workload_time_period.tpl.html');
Auth::checkAuthentication(APP_COOKIE);
$usr_id = Auth::getUserID();
if (!Access::canAccessReports(Auth::getUserID())) {
echo 'Invalid role';
exit;
}
$prj_id = Auth::getCurrentProject();
// get timezone of current user
$user_prefs = Prefs::get($usr_id);
if (@$_GET['type'] == 'email') {
$data = Report::getEmailWorkloadByTimePeriod(@$user_prefs['timezone']);
} else {
$data = Report::getWorkloadByTimePeriod(@$user_prefs['timezone']);
}
$tpl->assign(array('data' => $data, 'type' => @$_GET['type'], 'user_tz' => Date_Helper::getTimezoneShortNameByUser($usr_id)));
$tpl->displayTemplate();
示例3: array
$usr_id = Auth::getUserID();
if (Auth::getCurrentRole() <= User::getRoleID("Customer")) {
echo "Invalid role";
exit;
}
/**
* Generates the workload by time period graph.
*/
// get timezone of current user
$user_prefs = Prefs::get($usr_id);
if (@$HTTP_GET_VARS["type"] == "email") {
$data = Report::getEmailWorkloadByTimePeriod(@$user_prefs["timezone"], true);
$graph_title = "Email by Time Period";
$event_type = "emails";
} else {
$data = Report::getWorkloadByTimePeriod(@$user_prefs["timezone"], true);
$graph_title = "Workload by Time Period";
$event_type = "actions";
}
$plots = array();
foreach ($data as $performer => $values) {
ksort($values);
ksort($data[$performer]);
// Create a bar pot
$bplot = new BarPlot(array_values($values));
if ($performer == "customer") {
$color = "#99ccff";
} else {
$color = "#ffcc00";
}
$bplot->SetFillColor($color);