Ejemplo n.º 1
0
<?php

$REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'] = rex_get('term', 'string', '');
$REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount'] = rex_get('monthcount', 'int', 12);
a587_stats_saveSettings($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']);
if ($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'] == 'all') {
    $term = '';
} else {
    $term = substr($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'], 1);
}
$basedir = dirname(__FILE__);
require_once $basedir . '/phplot/phplot.php';
$stats = new RexSearchStats();
// fetch data
$bardata = array();
$cumulateddata = array();
$max = 1;
foreach ($stats->getTimestats($term, $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']) as $month) {
    $bardata[] = array(date('M', mktime(0, 0, 0, $month['m'], 1, 2010)) . "\n" . $month['count'], $month['count']);
    if ($month['count'] > $max) {
        $max = $month['count'];
    }
}
$title = $I18N->Msg('a587_stats_searchterm_timestats_title', empty($term) ? $I18N->Msg('a587_stats_searchterm_timestats_title0_all') : $I18N->Msg('a587_stats_searchterm_timestats_title0_single', $term), intval($_GET['monthcount']));
if (rex_lang_is_utf8()) {
    $title = utf8_decode($title);
}
// draw bars
$plot = new PHPlot(700, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
Ejemplo n.º 2
0
<?php

$basedir = dirname(__FILE__);
require_once $basedir . '/phplot/phplot.php';
$stats = new RexSearchStats();
// fetch data
$bardata = array();
$cumulateddata = array();
$statCounts = $stats->getCount();
$max = 1;
foreach ($statCounts as $statCount) {
    $bardata[] = array(date('M', mktime(0, 0, 0, $statCount['m'], 1, 2010)) . "\n" . $statCount['count'], $statCount['count']);
    if ($statCount['count'] > $max) {
        $max = $statCount['count'];
    }
}
$title = $I18N->Msg('a587_stats_general_timestats', 6);
if (rex_lang_is_utf8()) {
    $title = utf8_decode($title);
}
$plot = new PHPlot(350, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
$plot->SetMarginsPixels(NULL, NULL, 26, NULL);
# Make sure Y axis starts at 0:
$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
$len = strlen('' . $max);
$plot->SetYTickIncrement(max(1, ceil($max / pow(10, $len - 1)) * pow(10, $len - 2)));
# Main plot title:
$plot->SetTitle($title);
$plot->SetFont('title', 3);
Ejemplo n.º 3
0
<?php

$stats = new RexSearchStats();
$REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['maxtopSearchitems'] = rex_request('count', 'int', 10);
a587_stats_saveSettings($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']);
echo json_encode($stats->getTopSearchterms($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['maxtopSearchitems'], rex_request('only', 'int', 0)));
Ejemplo n.º 4
0
<?php

$basedir = dirname(__FILE__);
error_reporting(E_ALL);
require_once $basedir . '/phplot/phplot.php';
// fetch data
$stats = new RexSearchStats();
$missCount = $stats->getMissCount();
$successCount = $stats->getSuccessCount();
$title = $I18N->Msg('a587_stats_rate_success_failure', "\n", $missCount + $successCount);
if (rex_lang_is_utf8()) {
    $title = utf8_decode($title);
}
$lbl_success = $I18N->Msg('a587_stats_rate_success_failure_lblsuccess');
if (rex_lang_is_utf8()) {
    $lbl_success = utf8_decode($lbl_success);
}
$lbl_miss = $I18N->Msg('a587_stats_rate_success_failure_lblmiss');
if (rex_lang_is_utf8()) {
    $lbl_miss = utf8_decode($lbl_miss);
}
$data = array(array('', $successCount, $missCount, '', ''));
// draw image
$plot = new PHPlot(350, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
$plot->SetMarginsPixels(NULL, NULL, 40, NULL);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetDataColors(array('#2c8ce0', '#14568a'));