17 require_once SQ_CORE_PACKAGE_PATH.
'/report/report_edit_fns.inc';
18 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
19 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
20 require_once SQ_PACKAGES_PATH.
'/funnelback/log_reports/funnelback_search_log_report/funnelback_log_iterator.inc';
49 $job_vars =& $job->_running_vars;
52 if (!isset($job_vars[
'report']) || is_null($job_vars[
'report'])) {
53 trigger_error(
'Warning Warning', E_USER_WARNING);
58 if (!isset($job_vars[
'mode'])) {
59 $job_vars[
'mode'] =
'cache';
63 $job_vars[
'mode'] = (string) $job_vars[
'mode'];
64 switch ($job_vars[
'mode']) {
66 $this->_maintainReport($job_vars);
70 $this->_generateReport($job_vars);
71 $job_vars[
'mode'] =
'cleanup';
74 $step_data[
'percent_done'] = 100;
75 $step_data[
'complete'] = TRUE;
79 $status = $this->_generateTotals($job_vars);
80 $job_vars[
'mode'] =
'report';
83 $step_data[
'percent_done'] = 70;
84 $step_data[
'complete'] = FALSE;
89 $status = $this->_generateCacheEntries($job_vars);
92 if ($status === TRUE) {
93 $step_data[
'percent_done'] = 40;
94 $step_data[
'complete'] = FALSE;
95 }
else if ($status === FALSE) {
96 $step_data[
'percent_done'] = 100;
97 $step_data[
'complete'] = TRUE;
117 private function _generateCacheEntries(&$job_vars)
120 if (isset($job_vars[
'logs'])) {
121 $meta[
'report'] = $job_vars[
'report'];
122 $logs = $job_vars[
'logs'];
130 if (!isset($job_vars[
'iterator'])) {
132 $job_vars[
'current_collection'] = key($logs);
133 $log_file = $logs[$job_vars[
'current_collection']];
138 $progress = $job_vars[
'iterator']->getCurrentProgress();
139 $total = array_get_index($progress,
'total', 0);
140 $current = array_get_index($progress,
'current', $total);
141 if ($current >= $total && isset($job_vars[
'current_collection'])) {
143 unset($job_vars[
'logs'][$job_vars[
'current_collection']]);
144 unset($job_vars[
'current_collection']);
145 if (!empty($job_vars[
'logs'])) {
146 reset($job_vars[
'logs']);
147 $job_vars[
'current_collection'] = key($job_vars[
'logs']);
148 $log_file = $job_vars[
'logs'][$job_vars[
'current_collection']];
152 $job_vars[
'mode'] =
'total';
158 $rollover_period = $job_vars[
'report']->attr(
'rollover_period');
159 $line = $job_vars[
'iterator']->getNextEntry();
160 if (isset($line[
'line']) && !empty($line[
'line'])) {
161 $period = $this->_getPeriod($line[
'line'][
'date'], $rollover_period);
162 $path = $job_vars[
'report']->data_path.
'/cache/'.$period;
164 $cache[
'ip'] = $line[
'line'][
'ip'];
165 $cache[
'date'] = $line[
'line'][
'date'];
166 $cache[
'query'] = $line[
'line'][
'query'];
167 $cache[
'full_matches'] = $line[
'line'][
'full_matches'];
168 $cache[
'partial_matches'] = $line[
'line'][
'partial_matches'];
169 $cache[
'collection'] = $job_vars[
'current_collection'];
170 $this->_generateCacheEntry($path, $cache);
188 private function _generateTotals(&$job_vars)
190 $cache_date_entries = glob($job_vars[
'report']->data_path.
'/cache/*');
191 foreach ($cache_date_entries as $cache_date_entry) {
192 $period = basename($cache_date_entry);
193 $path = $job_vars[
'report']->data_path.
'/total/'.$period;
194 if (!is_dir($path)) {
195 create_directory($path);
197 $collections = glob($cache_date_entry.
'/*');
198 $collection_totals = Array();
199 foreach ($collections as $collection_path) {
200 $collection_id = basename($collection_path);
201 $cache_entries = glob($collection_path.
'/*/*/*.cache');
202 foreach ($cache_entries as $cache_entry) {
203 $query = basename($cache_entry,
'.cache');
204 $data = @unserialize(file_to_string($cache_entry));
205 $report_data = $this->_processTotals($data);
206 $actual_query = array_get_index($report_data,
'query', 0);
207 $collection_totals = $this->_combineTotals($collection_totals, Array($actual_query => $report_data));
210 if ($actual_query ==
'' && $query ==
'blank') {
213 $hash = $this->_getQueryHash($query);
215 $file = $path.
'/'.$collection_id.
'/'.$hash.
'/'.$query.
'.results';
216 if (!is_dir(dirname($file))) {
217 create_directory(dirname($file));
219 string_to_file(serialize($report_data), $file);
223 string_to_file(serialize($collection_totals), $path.
'/'.$collection_id.
'/'.$collection_id.
'.results');
240 private function _generateReport(&$job_vars)
242 $total_entries = glob($job_vars[
'report']->data_path.
'/total/*');
243 $path = $job_vars[
'report']->data_path.
'/report/';
244 if (!is_dir($path)) {
245 create_directory($path);
247 foreach ($total_entries as $total_date_entry) {
248 $period = basename($total_date_entry);
249 $report_date = $this->_generateReportDate($period);
250 $report_content = $this->_generateReportContents($job_vars, $total_date_entry);
251 file_put_contents($path.
'report-'.date(
'd-m-Y', $report_date).
'.html', $report_content);
266 private function _generateCacheEntry($path, $cache)
272 if (empty($cache[
'query'])) {
277 $query = $cache[
'query'];
278 $hash = $this->_getQueryHash($this->_cleanQuery($query));
281 $path = $path.
'/'.$cache[
'collection'].
'/'.$hash;
282 if (!is_dir($path)) {
283 create_directory($path);
286 $filename = $this->_cleanQuery($query).
'.cache';
287 $file = $path.
'/'.$filename;
290 if (!is_writable(dirname($file))) {
295 if (file_exists($file)) {
296 $data = @unserialize(file_to_string($file));
305 file_put_contents($file, serialize($data));
322 private function _processTotals($data)
327 $report[
'queries'] = count($data);
329 foreach ($data as $line) {
331 if (is_null($query)) {
333 $query = array_get_index($line,
'query', NULL);
336 $check = array_get_index($line,
'query',
'');
337 if ($check != $query)
continue;
338 $report[
'query'] = $query;
340 $min = array_get_index($report,
'min_results', NULL);
341 $max = array_get_index($report,
'max_results', NULL);
342 $avg = array_get_index($report,
'avg_results', NULL);
343 $date = array_get_index($line,
'date', NULL);
344 $full_matches = array_get_index($line,
'full_matches', 0);
345 $partial_matches = array_get_index($line,
'partial_matches', 0);
346 $total_matches = $full_matches + $partial_matches;
347 if (!isset($report[
'total_results'])) {
348 $report[
'total_results'] = $total_matches;
350 $report[
'total_results'] += $total_matches;
355 $report[
'min_results'] = $total_matches;
357 $report[
'min_results'] = min($min, $total_matches);
360 $report[
'max_results'] = $total_matches;
362 $report[
'max_results'] = max($max, $total_matches);
364 $report[
'avg_results'] = ((!empty($total_matches)) ? ($report[
'total_results'] / $report[
'queries']) : 0);
383 private function _combineTotals($collection, $query)
386 if (!isset($collection[
'total_fail'])) $collection[
'total_fail'] = 0;
387 if (!isset($collection[
'total_pass'])) $collection[
'total_pass'] = 0;
388 if (!isset($collection[
'total_queries'])) $collection[
'total_queries'] = 0;
389 if (!isset($collection[
'total_results'])) $collection[
'total_results'] = 0;
391 foreach ($query as $query_term => $query_results) {
393 if (empty($query_term)) $query_term = 0;
394 if (!isset($collection[$query_term])) {
395 $collection[$query_term] = Array();
399 $collection[
'total_queries'] += $query_results[
'queries'];
400 if (isset($query_results[
'total_results'])) {
401 $collection[
'total_results'] += $query_results[
'total_results'];
402 if (is_null(array_get_index($collection[$query_term],
'total_queries', NULL))) {
403 $collection[$query_term][
'total_queries'] = $query_results[
'queries'];
405 $collection[$query_term][
'total_queries'] += $query_results[
'queries'];
407 if (is_null(array_get_index($collection[$query_term],
'total_results', NULL))) {
408 $collection[$query_term][
'total_results'] = $query_results[
'total_results'];
410 $collection[$query_term][
'total_results'] += $query_results[
'total_results'];
412 $collection[$query_term][
'total_avg_results'] = ((!empty($collection[$query_term][
'total_queries'])) ? ($collection[$query_term][
'total_results'] / $collection[$query_term][
'total_queries']) : 0);
413 if (is_null(array_get_index($collection[$query_term],
'total_min_results', NULL))) {
414 $collection[$query_term][
'total_min_results'] = $query_results[
'min_results'];
416 $collection[$query_term][
'total_min_results'] = min($collection[$query_term][
'total_min_results'], $query_results[
'min_results']);
418 if (is_null(array_get_index($collection[$query_term],
'total_max_results', NULL))) {
419 $collection[$query_term][
'total_max_results'] = $query_results[
'max_results'];
421 $collection[$query_term][
'total_max_results'] = max($collection[$query_term][
'total_max_results'], $query_results[
'max_results']);
423 if (empty($query_results[
'total_results'])) {
424 $collection[
'total_fail']++;
425 if (is_null(array_get_index($collection[$query_term],
'total_fail', NULL))) {
426 $collection[$query_term][
'total_fail'] = 1;
428 $collection[$query_term][
'total_fail']++;
431 $collection[
'total_pass']++;
432 if (is_null(array_get_index($collection[$query_term],
'total_pass', NULL))) {
433 $collection[$query_term][
'total_pass'] = 1;
435 $collection[$query_term][
'total_pass']++;
454 private function _generateReportDate($period)
456 $period_type = substr($period, 0, 1);
457 $period_date = substr($period, 1);
459 $period_type = (string) $period_type;
460 switch ($period_type) {
462 $year = substr($period_date, 0, 4);
463 $week = substr($period_date, 4);
466 $soy = strtotime(
'first monday january '.$year);
467 $soyw = date(
'W', $soy);
468 $days_diff = ($week - $soyw) * 7;
469 $sow = strtotime(
'+'.$days_diff.
' days', $soy);
470 return mktime(0, 0, 0, date(
'm', $sow), date(
'd', $sow), $year);
474 $year = substr($period_date, 0, 4);
475 $month = substr($period_date, 4);
476 return mktime(0, 0, 0, $month, 1, $year);
480 $year = substr($period_date, 0, 4);
481 $month = substr($period_date, 4, 2);
482 $day = substr($period_date, 6, 2);
483 return mktime(0, 0, 0, $month, $day, $year);
504 private function _generateReportContents(&$job_vars, $path)
508 $total_contents =
'';
509 $collection_data_paths = glob($path.
'/*');
510 foreach ($collection_data_paths as $collection_data_path) {
511 $collection_id = basename($collection_data_path);
514 $contents .= $this->_printCollectionHeader($collection_id);
517 $totals = glob($collection_data_path.
'/*/*/*.results');
520 $failed_query_totals = Array();
521 $success_query_totals = Array();
522 $fail_limit = Array();
523 $good_limit = Array();
524 $row_limit = $job_vars[
'report']->attr(
'row_count');
525 foreach ($totals as $total) {
528 $filename = basename($total,
'.results');
529 $query_totals = @unserialize(file_get_contents($total));
530 $query = array_get_index($query_totals,
'query', 0);
531 if (empty($query))
continue;
532 $query_results = array_get_index($query_totals,
'total_results', 0);
533 $query_queries = array_get_index($query_totals,
'queries', 0);
534 if (empty($query_results)) {
535 if (count($fail_limit) < $row_limit) {
537 $fail_limit[$query] = $query_queries;
538 $failed_query_totals[$query] = $query_totals;
542 $fail_threshold = end($fail_limit);
543 if ($query_queries > $fail_threshold) {
544 unset($failed_query_totals[key($fail_limit)]);
545 array_pop($fail_limit);
546 $fail_limit[$query] = $query_queries;
547 $failed_query_totals[$query] = $query_totals;
552 if (count($good_limit) < $row_limit) {
554 $good_limit[$query] = $query_queries;
555 $success_query_totals[$query] = $query_totals;
559 $good_threshold = end($good_limit);
560 if ($query_queries > $good_threshold) {
561 unset($success_query_totals[key($good_limit)]);
562 array_pop($good_limit);
563 $good_limit[$query] = $query_queries;
564 $success_query_totals[$query] = $query_totals;
572 foreach ($fail_limit as $query => $totals) {
573 $query_totals = $failed_query_totals[$query];
574 $line = $this->_formatLine($query_totals, FALSE);
578 $this->_combineOverallResults($query_totals, $overall);
582 foreach ($good_limit as $query => $totals) {
583 $query_totals = $success_query_totals[$query];
584 $line = $this->_formatLine($query_totals, TRUE);
588 $this->_combineOverallResults($query_totals, $overall);
590 $contents .= $this->_printQueryResults($good, $fail);
594 $total_contents .= $this->_printCollectionHeader(FALSE);
595 $total_good = Array();
596 $total_fail = Array();
597 $total_good_limit = Array();
598 $total_fail_limit = Array();
599 $row_limit = $job_vars[
'report']->attr(
'row_count');
600 foreach ($overall as $query => $query_data) {
601 if (!is_array($query_data)) {
603 }
else if ($query === 0) {
607 $query_data[
'query'] = $query;
608 $query_results = array_get_index($query_data,
'total_results', 0);
609 $query_queries = array_get_index($query_data,
'total_queries', 0);
610 if (empty($query_results)) {
611 if (count($total_fail_limit) < $row_limit) {
613 $total_fail_limit[$query] = $query_queries;
615 reset($total_fail_limit);
616 $threshold = end($total_fail_limit);
617 if ($query_queries > $threshold) {
618 array_pop($total_fail_limit);
619 $total_fail_limit[$query] = $query_queries;
622 arsort($total_fail_limit);
624 if (count($total_good_limit) < $row_limit) {
626 $total_good_limit[$query] = $query_queries;
628 reset($total_good_limit);
629 $threshold = end($total_good_limit);
630 if ($query_queries > $threshold) {
631 array_pop($total_good_limit);
632 $total_good_limit[$query] = $query_queries;
635 arsort($total_good_limit);
640 arsort($total_fail_limit);
641 foreach ($total_fail_limit as $query => $total) {
642 $query_data = $overall[$query];
643 $query_data[
'query'] = $query;
644 $line = $this->_formatLine($query_data, FALSE, TRUE);
646 $total_fail[] = $line;
650 arsort($total_good_limit);
651 foreach ($total_good_limit as $query => $total) {
652 $query_data = $overall[$query];
653 $query_data[
'query'] = $query;
654 $line = $this->_formatLine($query_data, TRUE, TRUE);
656 $total_good[] = $line;
659 $total_contents .= $this->_printQueryResults($total_good, $total_fail);
662 $contents = $contents.$total_contents;
678 private function _combineOverallResults($query_totals, &$overall)
680 $query = array_get_index($query_totals,
'query', NULL);
681 if (!is_null($query) && !empty($query)) {
682 if (!isset($overall[$query])) $overall[$query] = Array();
683 foreach ($query_totals as $key => $value) {
684 if ($key ==
'query')
continue;
687 if ($key ==
'avg_results') {
689 }
else if ($key ==
'min_results') {
690 $overall_total = array_get_index($overall[$query],
'total_min_results', 0);
691 $overall[$query][
'total_min_results'] = min($overall_total, $value);
692 }
else if ($key ==
'max_results') {
693 $overall_total = array_get_index($overall[$query],
'total_max_results', 0);
694 $overall[$query][
'total_max_results'] = max($overall_total, $value);
697 $overall_key = ((strpos($key,
'total_') === 0) ? $key :
'total_'.$key);
698 $overall_total = array_get_index($overall[$query], $overall_key, 0);
699 $overall[$query][$overall_key] = $overall_total + $value;
704 $total_results = array_get_index($query_totals,
'total_results', 0);
705 $overall_results = array_get_index($overall[$query],
'total_results', 0);
706 $total_queries = array_get_index($query_totals,
'queries', 0);
707 $overall_queries = array_get_index($overall[$query],
'total_queries', 0);
708 if (!empty($total_queries) && !empty($overall_queries)) {
709 $new_average = ($total_results + $overall_results) / ($total_queries + $overall_queries);
710 $overall[$query][
'total_avg_results'] = $new_average;
725 private function _printCollectionHeader($collection_id)
727 if ($collection_id === FALSE) {
729 $header =
'<br /><strong>Totals</strong>';
731 $fm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'funnelback_manager');
732 $name = $fm->getCollectionName($collection_id);
734 $header =
'<br /><strong>Collection "'.$collection_id.
'"</strong>';
736 $header =
'<br /><strong>Collection: '.$name.
'</strong>';
754 private function _formatLine($data, $type=TRUE, $total=FALSE)
756 $query = array_get_index($data,
'query', NULL);
757 if (is_null($query))
return '';
762 <td
class=
"sq-backend-table-cell"><?php echo $query; ?></td>
763 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'total_queries', 0); ?></td>
764 <?php
if ($type) { ?>
765 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'total_results', 0); ?></td>
766 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo round(array_get_index($data,
'total_avg_results', 0), 2); ?></td>
767 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'total_min_results', 0); ?></td>
768 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'total_max_results', 0); ?></td>
775 <td
class=
"sq-backend-table-cell"><?php echo $query; ?></td>
776 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'queries', 0); ?></td>
777 <?php
if ($type) { ?>
778 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'total_results', 0); ?></td>
779 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo round(array_get_index($data,
'avg_results', 0), 2); ?></td>
780 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'min_results', 0); ?></td>
781 <td
class=
"sq-backend-table-cell" style=
"width: 25px;"><?php echo array_get_index($data,
'max_results', 0); ?></td>
786 $line = ob_get_contents();
803 private function _printQueryResults($good, $fail)
808 <table
class=
"sq-backend-table">
810 <td
class=
"sq-backend-table-header" style=
"width: 200px"><?php echo translate(
'fnb_log_popular_queries'); ?></td>
811 <td
class=
"sq-backend-table-header"><?php echo translate(
'fnb_log_total_queries'); ?></td>
812 <td
class=
"sq-backend-table-header"><?php echo translate(
'fnb_log_total_results'); ?></td>
813 <td
class=
"sq-backend-table-header"><?php echo translate(
'fnb_log_avg_results'); ?></td>
814 <td
class=
"sq-backend-table-header"><?php echo translate(
'lowest'); ?></td>
815 <td
class=
"sq-backend-table-header"><?php echo translate(
'highest'); ?></td>
817 <?php echo (!empty($good) ? implode(
"\n", $good) :
'<td class="sq-backend-table-cell" colspan="6">'.translate(
'fnb_log_no_successful_queries').
'</td>'); ?>
820 <table
class=
"sq-backend-table">
822 <td
class=
"sq-backend-table-header" style=
"width: 200px"><?php echo translate(
'fnb_log_failed_queries'); ?></td>
823 <td
class=
"sq-backend-table-header"><?php echo translate(
'fnb_log_total_failed_queries'); ?></td>
825 <?php echo (!empty($fail) ? implode(
"\n", $fail) :
'<td class="sq-backend-table-cell" colspan="2">'.translate(
'fnb_log_no_failed_queries').
'</td>'); ?>
829 $line = ob_get_contents();
845 private function _cleanQuery($query)
847 $invalid = Array(
'#',
'&',
';',
'`',
'|',
'*',
'?',
'~',
'<',
'>',
'^',
'(',
')',
'[',
']',
'{',
'}',
'$');
848 $query = str_replace($invalid,
'', $query);
849 $query = str_replace(
' ',
'', $query);
850 $query = str_replace(
'"',
'', $query);
851 $query = str_replace(
"'",
'', $query);
852 $query = str_replace(
'.',
'_', $query);
853 $query = trim($query);
869 private function _getPeriod($date, $type)
871 $type = (string) $type;
874 $period =
'D'.date(
'Ymd', $date);
878 $period =
'M'.date(
'Ym', $date);
883 $period =
'W'.date(
'YW', $date);
900 private function _getQueryHash($query)
904 if (strlen($query) <= 4) {
906 $query = str_pad($query, 4,
'a');
910 $hash_bits = str_split(substr($query, 0, 4), 2);
911 foreach ($hash_bits as $bit) {
912 $bit = (string) $bit;
915 for ($i=0; $i<strlen($bit); $i++) {
916 $hash_part += ord($bit{$i});
918 $bit = (string) $hash_part;
919 }
while ($hash_part < 100);
920 $hash[] = (int) $hash_part;
923 if (!empty($hash) && count($hash) == 2) {
924 return implode(
'/', $hash);
940 private function _maintainReport(&$job_vars)
942 $data_path = $job_vars[
'report']->data_path;
944 $type = $job_vars[
'report']->attr(
'rollover_period');
945 $type = (string) $type;
946 $match = strtoupper(substr($type, 0, 1));
950 date(
'Ymd', strtotime(
'-2 days')),
951 date(
'Ymd', strtotime(
'-1 day')),
958 date(
'Ym', strtotime(
'-1 month')),
966 date(
'YW', strtotime(
'-1 week')),
973 $base_directories = Array(
'cache',
'total',
'report');
974 foreach ($base_directories as $dir) {
975 create_directory($data_path.
'/'.$dir);
979 $cache_files = glob($data_path.
'/cache/*');
980 foreach ($cache_files as $cache_dir) {
981 $cache_file = basename($cache_dir);
983 $cache_match = strtoupper(substr($cache_file, 0, 1));
984 if ($cache_match != $match) {
985 delete_directory($cache_dir);
989 $date_match = substr($cache_file, 1);
990 if (!in_array($date_match, $valid)) {
991 delete_directory($cache_dir);
996 $total_files = glob($data_path.
'/total/*');
997 foreach ($total_files as $total_dir) {
998 $total_file = basename($total_dir);
1000 $total_match = strtoupper(substr($total_file, 0, 1));
1001 if ($total_match != $match) {
1002 delete_directory($total_dir);
1006 $date_match = substr($total_file, 1);
1007 if (!in_array($date_match, $valid)) {
1008 delete_directory($total_dir);
1023 private function _getLatest(&$asset)
1026 $path = $asset->data_path.
'/report';
1027 $reports = glob($path.
'/report-*.html');
1028 foreach ($reports as $report) {
1029 $report_name = basename($report,
'.html');
1030 $report_date = strtotime(str_replace(
'report-',
'', str_replace(
'_',
'-', $report_name)));
1031 if ($latest === FALSE || $report_date > $latest) {
1032 $latest = $report_date;
1050 private function _getReport(&$asset, $date)
1052 $date = date(
'd-m-Y', $date);
1053 $report_path = $asset->data_path.
'/report/report-'.$date.
'.html';
1054 if (!file_exists($report_path)) {
1058 return $report_path;
1076 $latest = $this->_getLatest($asset);
1077 $all_reports_raw = glob($asset->data_path.
'/report/report-*.html');
1078 $all_reports = Array();
1079 foreach ($all_reports_raw as $report_path) {
1080 $report_name = basename($report_path);
1081 $report_date = strtotime(str_replace(
'.html',
'', str_replace(
'report-',
'', str_replace(
'_',
'-', $report_name))));
1082 if ($report_date !== FALSE) {
1083 if ($report_date == $latest) {
1084 $all_reports[$report_date] = translate(
'current');
1085 $all_reports[$report_date] = translate(
'fb_sch_log_report_report_item', date(
'd-m-Y', $report_date));
1087 $all_reports[$report_date] = translate(
'fb_sch_log_report_report_item', date(
'd-m-Y', $report_date));
1092 $selected = array_get_index($_POST, $prefix.
'_select_report',
'');
1094 if (!empty($all_reports)) {
1095 krsort($all_reports);
1096 combo_box($prefix.
'_select_report', $all_reports, FALSE, $selected);
1097 submit_button($prefix.
'submit_report', translate(
'select_report'));
1102 if (array_key_exists($selected, $all_reports)) {
1103 include_once($asset->data_path.
'/report/report-'.date(
'd-m-Y', $selected).
'.html');
1106 if ($latest !== FALSE) {
1107 $report_path = $this->_getReport($asset, $latest);
1108 if (is_file($report_path)) {
1109 include_once($report_path);
1116 if ($printed === FALSE) {
1117 echo translate(
'fb_sch_log_report_generate_at_next_rotation');
1135 $generated_user = $asset->attr(
'generated_user');
1136 if (empty($generated_user)) {
1137 echo translate(
'report_not_generated').
'<br />';
1140 echo
' <b>'.translate(
'report_generated').
'</b><br />';
1141 echo
' '.translate(
'date').
': '.$asset->attr(
'generated_date');
1143 echo
' '.translate(
'user').
': '.$asset->attr(
'generated_user');