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"); } } }
/** * 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 } }
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'); } } }
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'); } }
/** * 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); }
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; }
/** * @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; }
public function testReportConfigInConstructor() { $report = new Report('', '', '', ['size' => 10]); $this->assertEquals(['size' => 10], $report->getConfig()); $report = new Report('', '', '', []); $this->assertEquals([], $report->getConfig()); }
/** * 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'); }
/** * @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; }
/** * 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; }
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; }
/** * 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; } }
/** * 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); }
/** * 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 ); */ }
public function run() { try { // 共通設定取得 $base_dir = dirname(__FILE__) . '/../'; $config = new Config($base_dir); $debug = $config->get_param('debug'); // レポート用オブジェクト $report = new Report($config); // メンバー一覧のオブジェクト $member = new Member($config); // 担当者マスターの差分を取得する。 $member->get_diff(); $this->mail_body .= $member->print_diff(); // プロジェクト一覧のオブジェクト $project = new Project($config); // プロジェクトマスターの差分を取得する。 $project->get_diff(); $this->mail_body .= $project->print_diff(); // 担当プロジェクトのオブジェクト $relation = new Relation($config); // 担当プロジェクトの差分を取得する。 $relation->set_member($member); $relation->set_project($project); $relation->get_diff(); $this->mail_body .= $relation->print_diff(); // BackLogIDが入力されているにもかかわらず担当者名が未入力のデータを検出する。 $this->mail_body .= $relation->validate(); // 複数コンテンツ障害の配信先 // 全社向け $multi_alert = new MultiAlert($config); $multi_alert->set_mode('all'); $multi_alert->set_project($project); $multi_alert->set_member($member); $multi_alert->get_diff(); $this->mail_body .= $multi_alert->print_diff(); // コンテンツ事業部向け $multi_alert = new MultiAlert($config); $multi_alert->set_mode('contents'); $multi_alert->set_project($project); $multi_alert->set_member($member); $multi_alert->get_diff(); $this->mail_body .= $multi_alert->print_diff(); // レポート $report->out($this->mail_body); // 古いファイルを削除 Util::remove_old_file($config->get_param('data_dir'), $config->get_param('keep_file_days')); } catch (Exception $e) { $member->remove(); $project->remove(); $relation->remove(); $multi_alert->remove(); if ($debug) { print $e->getMessage() . PHP_EOL; } else { $report->out($e->getMessage()); } } }
public function report(Report $report) { $form = $report->toWebFormat(); $form['api_user'] = $this->api_user; $form['api_key'] = $this->api_key; $response = \Unirest::post($report->getUrl(), array(), $form); return $response->body; }
protected static function render_report($report_file, $request) { $report = new Report($report_file); $report->run(); $locals = array('report' => $report, 'request' => $request); $locals['content_for_layout'] = Template::render(VIEWS_TEMPLATE_DIRECTORY . DS . $report->view, $locals); return $report->layout ? Template::render(LAYOUTS_TEMPLATE_DIRECTORY . DS . $report->layout, $locals) : $locals['content_for_layout']; }
public function report(Report $report) { $form = $report->toWebFormat(); $form['api_user'] = $this->apiUser; $form['api_key'] = $this->apiKey; $response = $this->postRequest($report->getUrl(), $form); return $response->body; }
public function testFilesCanBeAddedToReport() { $file = $this->getMockBuilder('Helmich\\TypoScriptLint\\Linter\\Report\\File')->disableOriginalConstructor()->getMock(); $report = new Report(); $report->addFile($file); $this->assertCount(1, $report->getFiles()); $this->assertSame($file, $report->getFiles()[0]); }
public function createMultiple($gameModel, $gameInputs) { foreach ($gameInputs as $player) { $report = new Report(); $report->game = $gameModel->id; $report->player = $player; $report->save(); } }
public static function run(Report $report) { $commands = $report->getMongoCommand(); $db = Yii::app()->mongodb->getDbInstance(); foreach ($commands as $stage => $command) { $result = $db->command($command); } return $report->getResult(); }
public static function createReportToExportAdapter(Report $report, ReportDataProvider $dataProvider) { $dataProviderClassName = get_class($dataProvider); if ($dataProviderClassName == 'SummationDrillDownReportDataProvider') { $className = 'SummationDrillDownReportToExportAdapter'; } else { $className = $report->getType() . 'ReportToExportAdapter'; } return new $className($dataProvider, $report); }
public function renderReport($file, $data = null, $return = false) { $report = new Report(); $filePath = $this->getReportFile($file); $output = $report->load($filePath, $data); if (($layoutFile = $this->getLayoutFile($this->reportLayout)) !== false) { $output = $this->renderFile($layoutFile, array('content' => $output), true); } $output = $this->processOutput($output); $report->createPdf($output); }
public function getDistinctGroupReport($g1, $g2, array $years) { try { $values1 = $this->getValues($g1, $years); $values2 = $this->getValues($g2, $years); $values1 = $this->getListAsAnArrayObject($values1); $values2 = $this->getListAsAnArrayObject($values2); return $this->report->getDistinctGroupsReport($values1, $values2, $years, $this->grouper); } catch (LoginException $exception) { return $this->loginExceptionMessage($exception); } }
public function indexAction() { $this->render('index'); return; $report = new Report(); $report->id = 1; $report->populate(); //echo $report->toString(); foreach ($report->reportQueries as $query) { echo $query->execute()->toXml(); } exit; }
public function testStaticReport() { global $l_name, $l_surname, $l_gender; $report = new Report(); $report->addRecord(new Element('1', 'John', 'Doe', 'M')); $report->addRecord(new Element('2', 'Janne', 'Doe', 'F')); $report->addRecord(new Element('3', 'Julia', 'Doe', 'F')); $formater = new GenericFormater(); $formater->addField('name'); $formater->addField('surname'); $formater->addField('gender'); $output = $report->format($formater); $this->assertEquals($output, "$l_name\t$l_surname\t$l_gender\t\nJohn\tDoe\tM\t\nJanne\tDoe\tF\t\nJulia\tDoe\tF\t\n"); }
/** * Carica da database tutti i report per l'oggetto passato e li salva nell'oggetto. * @param Editable $object un oggetto di cui si possono caricare i report. * @return l'oggetto aggiornato */ function loadAll($object) { parent::load($object); $objectClass = get_class($object); $rs = $this->db->execute($s = Query::generateSelectStm(array($this->table), array(), array(new WhereConstraint($this->table->getColumn(REPORT_OBJECT_ID), Operator::EQUAL, $object->getID()), new WhereConstraint($this->table->getColumn(REPORT_OBJECT_CLASS), Operator::EQUAL, get_class($object))), array())); $reports = array(); while ($row = $this->db->fetch_result()) { $report = new Report(intval($row[DB::REPORT_USER]), $object, $row[DB::REPORT_TEXT]); $report->setID($row[REPORT_ID]); $reports[] = $report; } return $object->setReports($reports); }
/** * @param Report $report * @return MatrixReportStepsAndProgressBarForWizardView| * RowsAndColumnsReportStepsAndProgressBarForWizardView| * SummationReportStepsAndProgressBarForWizardView * @throws NotSupportedException */ public static function makeStepsAndProgressBarViewFromReport(Report $report) { $type = $report->getType(); if ($type == Report::TYPE_ROWS_AND_COLUMNS) { return new RowsAndColumnsReportStepsAndProgressBarForWizardView(); } elseif ($type == Report::TYPE_SUMMATION) { return new SummationReportStepsAndProgressBarForWizardView(); } elseif ($type == Report::TYPE_MATRIX) { return new MatrixReportStepsAndProgressBarForWizardView(); } else { throw new NotSupportedException(); } }
/** * @param Report $report * @param $pageSize * @return MatrixReportDataProvider|RowsAndColumnsReportDataProvider|SummationReportDataProvider * @throws NotSupportedException */ public static function makeByReport(Report $report, $pageSize) { $config = array('pagination' => array('pageSize' => $pageSize)); if ($report->getType() == Report::TYPE_ROWS_AND_COLUMNS) { $dataProvider = new RowsAndColumnsReportDataProvider($report, $config); } elseif ($report->getType() == Report::TYPE_SUMMATION) { $dataProvider = new SummationReportDataProvider($report, $config); } elseif ($report->getType() == Report::TYPE_MATRIX) { $dataProvider = new MatrixReportDataProvider($report); } else { throw new NotSupportedException(); } return $dataProvider; }