本文整理汇总了PHP中Report类的典型用法代码示例。如果您正苦于以下问题:PHP Report类的具体用法?PHP Report怎么用?PHP Report使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Report类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleReport
public function handleReport($request)
{
if (!empty($request['id'])) {
$report = new Report();
$report->Load("id = ?", array($request['id']));
if ($report->id . "" == $request['id']) {
if ($report->type == 'Query') {
$where = $this->buildQueryOmmit(json_decode($report->paramOrder, true), $request);
$query = str_replace("_where_", $where[0], $report->query);
return $this->executeReport($report, $query, $where[1]);
} else {
if ($report->type == 'Class') {
$className = $report->query;
include MODULE_PATH . '/reportClasses/ReportBuilder.php';
include MODULE_PATH . '/reportClasses/' . $className . ".php";
$cls = new $className();
$data = $cls->getData($report, $request);
return $this->generateReport($report, $data);
}
}
} else {
return array("ERROR", "Report id not found");
}
}
}
示例2: display
/**
* Displays the dashlet
*
* @return string html to display dashlet
*/
function display()
{
require_once "modules/Reports/Report.php";
// ini_set('display_errors', 'false');
$chartReport = new SavedReport();
$chartExists = $chartReport->retrieve($this->report_id, false);
if (!is_null($chartExists)) {
$this->title = $chartReport->name;
$reporter = new Report($chartReport->content);
$reporter->is_saved_report = true;
$reporter->saved_report_id = $chartReport->id;
$reporter->get_total_header_row();
$reporter->run_chart_queries();
require_once "modules/Reports/templates/templates_chart.php";
ob_start();
template_chart($reporter, true, true, $this->id);
$str = ob_get_contents();
ob_end_clean();
$xmlFile = get_cache_file_name($reporter);
$html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />";
// return parent::display for title and such
$ss = new Sugar_Smarty();
$ss->assign('chartName', $this->id);
$ss->assign('chartXMLFile', $xmlFile);
$script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
$json = getJSONobj();
return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />";
// return parent::display for title and such
}
}
示例3: index
public function index()
{
if (!$this->wg->User->isAllowed('customreports')) {
$this->displayRestrictionError();
return false;
// skip rendering
}
$this->response->addAsset('extensions/wikia/CustomReports/css/CustomReports.scss');
$code = $this->getVal('report', null);
$days = $this->getVal('days', null);
$this->charts = '';
$this->report = $code;
$this->days = $days;
$this->action = $this->getTitle()->escapeLocalUrl();
if (!is_null($code)) {
$report = new Report($code, $days);
$data = $report->get_data();
foreach ($data as $key => $data_xml) {
$this->charts .= (string) $this->app->sendRequest('CustomReportsSpecial', 'getChart', array('data_xml' => $data_xml, 'num_chart' => $key));
}
if (empty($this->charts)) {
$this->charts = $this->wf->Msg('report-no-data');
}
}
}
示例4: action_run
protected function action_run()
{
$stmt = $this->db->query('select * from query
where query_id = :query_id', array('query_id' => $_POST['query_id']));
if ($row = $stmt->fetch()) {
if (stripos($row['query'], 'file ') === 0) {
$this->transfer(substr($row['query'], 5), array('dest' => $_POST['dest']));
} else {
$stmt2 = $this->db->query($row['query']);
$r = new Report();
if ($_POST['dest'] == 'screen') {
$r->html($row['title'], $stmt2);
} else {
if ($_POST['dest'] == 'pdf') {
$r->pdf($row['title'], $stmt2);
} else {
if ($_POST['dest'] == 'csv') {
$r->csv($stmt2);
}
}
}
}
} else {
$this->message('Query not found');
}
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$imageurl = '';
if (Request::get('image') != '') {
$imageurl = "/images/report/accident_" . time() . ".jpg";
$base = Request::get('image');
$binary = base64_decode($base);
$ifp = fopen($imageurl, "wb");
fwrite($ifp, $binary);
fclose($ifp);
$imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
}
$accident = Accident::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:i A', time()), 'date' => date('M j', time()), 'details' => Request::get('details'), 'image_url' => $imageurl));
$report = new Report();
$report->traffic_jam_id = $accident->id;
$report->user = Request::get('user');
$report->latitude = Request::get('lat');
$report->longitude = Request::get('lng');
$report->time = date('g:i A', time());
$report->date = date('M j', time());
$report->description = "There has been an accident. " . Request::get('details');
$report->image_url = $imageurl;
$report->type = 'Accident';
$report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
$report->save();
//RestApi::sendNotification()
return Response::json(array('error' => false), 200);
}
示例6: generateAdmin
function generateAdmin()
{
require_once CORE_DIR . "/admin/report.php";
$getReport = new Report();
$boardTitle = SHOWTITLETXT > 0 ? "<div class='boardTitle'>" . $this->info['page']['title'] . "</div><div class='boardSubtitle'>" . S_HEADSUB . "</div><hr>" : '';
$bannerImg .= SHOWTITLEIMG ? '<img class="bannerImg" src="' . TITLEIMG . '" onclick="this.src=this.src;" alt="' . TITLE . '" /><br>' : '';
/* begin page content */
$dat = "<!DOCTYPE html><head>\n <meta name='description' content='" . S_DESCR . "'/></meta>\n <meta http-equiv='content-type' content='text/html;charset=utf-8' /></meta>\n <meta name='viewport' content='width=device-width, initial-scale=1'></meta>\n <meta http-equiv='cache-control' content='max-age=0' />\n <meta http-equiv='cache-control' content='no-cache' />\n <meta http-equiv='expires' content='0' />\n <meta http-equiv='expires' content='Tue, 01 Jan 1980 1:00:00 GMT' />\n <meta http-equiv='pragma' content='no-cache' />\n <link rel='shortcut icon' href='" . CSS_PATH . "imgs/favicon.ico'>\n <title>" . $this->info['page']['title'] . "</title>";
//$dat .= "<link class='togglesheet' rel='stylesheet' type='text/css' href='" . CSS_PATH . "/panel.css' title='Admin Panel' />";
if (NSFW) {
$dat .= "<link class='togglesheet' rel='stylesheet' type='text/css' href='" . CSS_PATH . CSS1 . "' title='Yotsuba' />\n <link rel='stylesheet' type='text/css' href='" . CSS_PATH . "/stylesheets/mobile.css' title='mobile' />\n <link class='togglesheet' rel='alternate stylesheet' type='text/css' media='screen' href='" . CSS_PATH . CSS2 . "' title='Yotsuba B' />";
} else {
$dat .= "<link class='togglesheet' rel='stylesheet' type='text/css' media='screen' href='" . CSS_PATH . CSS2 . "' title='Yotsuba B' />\n <link rel='stylesheet' type='text/css' href='" . CSS_PATH . "/stylesheets/mobile.css' title='mobile' />\n <link class='togglesheet' rel='alternate stylesheet' type='text/css' href='" . CSS_PATH . CSS1 . "' title='Yotsuba' />";
}
//<link class='togglesheet' rel='alternate stylesheet' type='text/css' media='screen' href='" . CSS_PATH . CSS4 . "' title='Burichan'/> RIP Burichan 1862-2015
$dat .= "<link class='togglesheet' rel='alternate stylesheet' type='text/css' media='screen' href='" . CSS_PATH . CSS3 . "' title='Tomorrow' />";
$dat .= "<script src='" . JS_PATH . "/extension.min.js' type='text/javascript'></script>\n <script src='" . JS_PATH . "/main.js' type='text/javascript'></script>";
$dat .= '</head><div class="beforePostform" />' . $titlebar . '
<span class="boardList desktop">' . (file_exists(BOARDLIST) ? file_get_contents(BOARDLIST) : '') . '</div>
<div class="linkBar">[<a href="' . HOME . '" target="_top">' . S_HOME . '</a>][<a href="' . PHP_ASELF_ABS . '">' . S_ADMIN . '</a>]
</span><div class="boardBanner">' . $bannerImg . $boardTitle . '</div>';
$dat .= "<div class='panelOps' style='text-align:left;' />[<a href=\"" . PHP_SELF2 . "\">" . S_RETURNS . "</a>]";
$dat .= "[<a href=\"" . PHP_SELF . "\">" . S_LOGUPD . "</a>]";
if (valid('moderator')) {
$dat .= "[<a href='" . PHP_ASELF_ABS . "?mode=rebuild' >Пересобрать</a>]";
$dat .= "[<a href='" . PHP_ASELF_ABS . "?mode=rebuildall' >Пересобрать все треды</a>]";
$dat .= "[<a href='" . PHP_ASELF_ABS . "?mode=reports' >" . $getReport->reportGetAllBoard() . "</a>]";
}
if (valid('admin')) {
$dat .= "[<a href='" . PHP_ASELF_ABS . "?mode=staff' >Управление пользователями</a>]";
}
$dat .= "[<a href='" . PHP_ASELF . "?mode=logout'>" . S_LOGOUT . "</a>]";
return $dat;
}
示例7: __invoke
/**
* @param $params
* @return Report
*/
public function __invoke($params)
{
$deliveryMonitoringService = $this->getServiceLocator()->get(DeliveryMonitoringService::CONFIG_ID);
$deliveryClass = new \core_kernel_classes_Class('http://www.tao.lu/Ontologies/TAODelivery.rdf#AssembledDelivery');
$deliveries = $deliveryClass->getInstances(true);
$deliveryExecutionService = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$this->report = new Report(Report::TYPE_INFO, 'Updating of delivery monitoring cache...');
foreach ($deliveries as $delivery) {
if ($delivery->exists()) {
$deliveryExecutions = $deliveryExecutionService->getExecutionsByDelivery($delivery);
foreach ($deliveryExecutions as $deliveryExecution) {
$data = $deliveryMonitoringService->getData($deliveryExecution, true);
if ($deliveryMonitoringService->save($data)) {
$this->report->add(new Report(Report::TYPE_SUCCESS, "Delivery execution {$deliveryExecution->getUri()} successfully updated."));
} else {
$errors = $data->getErrors();
$errorsStr = " " . PHP_EOL;
array_walk($errors, function ($val, $key) use(&$errorsStr) {
$errorsStr .= " {$key} - {$val}" . PHP_EOL;
});
$this->report->add(new Report(Report::TYPE_ERROR, "Delivery execution {$deliveryExecution->getUri()} was not updated. {$errorsStr}"));
}
}
}
}
return $this->report;
}
示例8: testReportConfigInConstructor
public function testReportConfigInConstructor()
{
$report = new Report('', '', '', ['size' => 10]);
$this->assertEquals(['size' => 10], $report->getConfig());
$report = new Report('', '', '', []);
$this->assertEquals([], $report->getConfig());
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$imageurl = '';
if (Request::get('image') != '') {
$imageurl = "public/images/report/trafficjam_" . time() . ".jpg";
$base = Request::get('image');
$binary = base64_decode($base);
$ifp = fopen($imageurl, "wb");
fwrite($ifp, $binary);
fclose($ifp);
$imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
}
$roadblock = RoadBlock::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:iA', time()), 'date' => date('M j', time()), 'status' => Request::get('status'), 'reason' => Request::get('reason'), 'image_url' => $imageurl));
$report = new Report();
$report->user = Request::get('user');
$report->latitude = Request::get('lat');
$report->longitude = Request::get('lng');
$report->time = date('g:i A', time());
$report->date = date('M j', time());
$report->description = "The road is blocked at " . RestApi::getaddress(Request::get('lat'), Request::get('lng')) . " due to " . Request::get('reason');
$report->image_url = $imageurl;
$report->type = 'Road Block';
$report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
$report->save();
return RestApi::sendNotification('RB', Request::get('lat'), Request::get('lng'), RestApi::getaddress(Request::get('lat'), Request::get('lng')), '12');
}
示例10: makeReportBySavedCalendar
/**
* @param $savedCalendar
* @return Report
*/
public static function makeReportBySavedCalendar(SavedCalendar $savedCalendar)
{
$report = new Report();
if ($savedCalendar->id > 0) {
$report->setId((int) $savedCalendar->id);
}
$report->setDescription($savedCalendar->description);
if ($savedCalendar->moduleClassName != null) {
$report->setModuleClassName($savedCalendar->moduleClassName);
}
if ($savedCalendar->name != null) {
$report->setName($savedCalendar->name);
}
$report->setOwner($savedCalendar->owner);
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedCalendar);
$report->setExplicitReadWriteModelPermissions($explicitReadWriteModelPermissions);
if ($savedCalendar->serializedData != null) {
$unserializedData = unserialize($savedCalendar->serializedData);
if (isset($unserializedData['filtersStructure'])) {
$report->setFiltersStructure($unserializedData['filtersStructure']);
}
CalendarUtil::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_FILTERS], $report, 'Filter');
}
return $report;
}
示例11: getReport
/**
* Return the Report instance from filters list and data type.
*
* @param mixed $filters array of IFilter used to filter data before adding to Report
* @param mixed $type data type the report refers to (user, mailshare, group). The equivalent class must be defined to access data (e.g. class User for $type='user').
* @access public
* @return void
*/
public static function getReport($filters, $type='user') {
if (($type!='mailshare') && ($type!='group')) {
$type = 'user';
}
$report = new Report;
$obm_q = new DB_OBM;
$query_builder = 'build_'.$type.'_query';
$entity_builder = 'build_'.$type.'_entity';
// query database to get entity data
$query = ReportFactory::$query_builder($obm_q);
display_debug_msg($query, $cdg_sql, 'getReport()');
$obm_q->query($query);
while ($obm_q->next_record()) {
// build object from any result row
$record = ReportFactory::$entity_builder($obm_q);
// filter the results with filters list
$included = true;
foreach($filters as $filter) {
$included &= $filter->filter($record);
}
if ($included) $report->addRecord($record);
}
return $report;
}
示例12: perform
function perform()
{
// set display requirements
$result = array('renderer' => 'template_renderer.inc', 'pageTitle' => SITE_NAME . ' : Add Date Criteria', 'content' => 'content/reportFormDate.php');
// don't lose the db!
$db = $_REQUEST['db'];
// where are we?
$userFinder = new UserFinder($db);
$user = $userFinder->findById($_SESSION['userId']);
$library = $user['library_short_name'];
$libraryID = $user['library_id'];
$result['library_id'] = $libraryID;
$result['library'] = $library;
$result['user'] = $user;
$report_id = grwd('report_id');
$result['report_id'] = $report_id;
// get all the info on the reports
$reportFinder = new ReportFinder($db);
$reportCount = $reportFinder->getReportCount();
$result['reportCount'] = $reportCount;
// get the information for the chosen report by requiring Reports.php and all the reports
$report_class_handle = new Report();
$report_class_get = $report_class_handle->get();
// declare the report class by using it's ID
$report_info = new $report_id();
$result['reportList'] = $report_info->info();
$libraryFinder = new LibraryFinder($db);
$result['libraryList'] = $libraryFinder->getAllLibraries();
$locationFinder = new LocationFinder($db);
$result['locationList'] = $locationFinder->getAllLocations();
return $result;
}
示例13: getSavedReportChartById
/**
* Retrieves a saved report and chart data, given a report ID in the args
*
* @param $api ServiceBase The API class of the request
* @param $args array The arguments array passed in from the API
* @return array
*/
public function getSavedReportChartById($api, $args)
{
require_once "include/SugarCharts/ChartDisplay.php";
$chartReport = $this->getSavedReportById($args['reportId']);
if (isset($args['filter_id']) && $args['filter_id'] !== 'all_records') {
$chartReport->content = $this->updateFilterDef($chartReport->content, $args['filter_id']);
}
if (!empty($chartReport)) {
if (!$chartReport->ACLAccess('view')) {
throw new SugarApiExceptionNotAuthorized('No access to view this report');
}
$returnData = array();
$this->title = $chartReport->name;
require_once "modules/Reports/Report.php";
$reporter = new Report($chartReport->content);
$reporter->saved_report_id = $chartReport->id;
if ($reporter && !$reporter->has_summary_columns()) {
return '';
}
// build report data since it isn't a SugarBean
$reportData = array();
$reportData['name'] = $reporter->name;
$reportData['id'] = $reporter->saved_report_id;
$reportData['summary_columns'] = $reporter->report_def['summary_columns'];
$reportData['group_defs'] = $reporter->report_def['group_defs'];
// add reportData to returnData
$returnData['reportData'] = $reportData;
$chartDisplay = new ChartDisplay();
$chartDisplay->setReporter($reporter);
$chart = $chartDisplay->getSugarChart();
$json = json_decode($chart->buildJson($chart->generateXML()));
$returnData['chartData'] = $json;
return $returnData;
}
}
示例14: testRouterReportCreate
/**
* lrs/{id}/reporting/create
*
* This test case create new reporting and run report
*
* It is ensure reporting work correctly.
* */
public function testRouterReportCreate()
{
for ($i = 0; $i < 7; $i++) {
$vs = $this->defaultStatment();
$this->statements[] = $this->createStatement($vs, $this->lrs);
}
$data = array('description' => \app\locker\helpers\Helpers::getRandomValue(), 'name' => '', 'lrs' => $this->lrs->_id, 'query' => array('statement.actor.mbox' => array("mailto:duy.nguyen@go1.com.au"), 'statement.verb.id' => array("http://adlnet.gov/expapi/verbs/experienced")));
//lrs input validation
$rules['name'] = 'required|alpha_spaces';
$rules['description'] = 'alpha_spaces';
$validator = Validator::make($data, $rules);
$this->assertTrue($validator->fails());
$data['name'] = 'reportabcd';
$data['description'] = 'reportabcd description';
$validator = Validator::make($data, $rules);
$this->assertTrue($validator->passes());
// create report.
$report = new Report();
$report->lrs = $data['lrs'];
$report->query = $data['query'];
$report->name = $data['name'];
$report->description = $data['description'];
$save = $report->save();
$this->assertTrue($save);
// Ensure report show in reporting page.
$crawler = $this->client->request('GET', "/lrs/{$this->lrs->_id}/reporting");
$this->assertGreaterThan(0, $crawler->filter('html:contains("reportabcd")')->count());
$this->assertGreaterThan(0, $crawler->filter('html:contains("reportabcd description")')->count());
$crawler = $this->client->request('GET', "/lrs/{$this->lrs->_id}/reporting/show/{$report->_id}");
$this->assertGreaterThan(0, $crawler->filter('html:contains("Number of statements")')->count());
$this->assertGreaterThan(0, $crawler->filter('html:contains("7")')->count());
// Delete report by router.
$crawler = $this->client->request('DELETE', "/lrs/{$this->lrs->_id}/reporting/delete/{$report->_id}");
$this->assertEquals(Report::find($report->_id), NULL);
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$imageurl = '';
if (Request::get('image') != '') {
$imageurl = "/images/report/trafficjam_" . time() . ".jpg";
$base = Request::get('image');
$binary = base64_decode($base);
$ifp = fopen($imageurl, "wb");
fwrite($ifp, $binary);
fclose($ifp);
$imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
}
$trafficJam = TrafficJam::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'clear_by' => RestApi::clearBy(Request::get('status')), 'time' => date('g:iA', time()), 'date' => date('M j', time()), 'status' => Request::get('status'), 'reason' => Request::get('reason'), 'image_url' => $imageurl));
$report = new Report();
$report->traffic_jam_id = $trafficJam->id;
$report->user = Request::get('user');
$report->latitude = Request::get('lat');
$report->longitude = Request::get('lng');
$report->time = date('g:i A', time());
$report->date = date('M j', time());
$report->clear_by = RestApi::clearBy(Request::get('status'));
$report->description = "There is a " . Request::get('status') . " traffic jam at " . RestApi::getaddress(Request::get('lat'), Request::get('lng')) . " due to " . Request::get('reason');
$report->image_url = $imageurl;
$report->type = 'Traffic Jam';
$report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
$report->save();
$values = array(Request::get('lat'), Request::get('lng'), '12');
return RestApi::sendNotification('TJ', $values);
/*return Response::json(array(
'error' => false),
200
);
*/
}