1
0
Fork 0

i18n standard entries

Dieser Commit ist enthalten in:
Oldperl 2011-12-17 16:52:15 +00:00
Ursprung 844bf08a42
Commit f2e50a8402

Datei anzeigen

@ -53,18 +53,28 @@ include_once plugin_dir_path(__FILE__).'includes/pChart/class/pData.class.php';
include_once plugin_dir_path(__FILE__).'includes/pChart/class/pDraw.class.php';
include_once plugin_dir_path(__FILE__).'includes/pChart/class/pImage.class.php';
/**
* chart for last 30 days
*
* @uses pChart
* @since 1.0.0
* @todo use own semR chart class
*
* @global wpdb $wpdb
* @return void
*/
function sem_drawLast30DaysGoo() {
global $wpdb;
//$sql = $wpdb->get_results("ALTER TABLE ".$wpdb->statzhist." ORDER BY date ASC");
$results = $wpdb->get_results("SELECT DAY(date) as days, visitors FROM ".$wpdb->statzhist." WHERE date >= NOW() - INTERVAL 31 DAY ORDER BY date ASC");
print "<div class='statz'>Besucher: Die letzten 30 Tage</div>";
print "<div class='statz'>".semr_i18n("Visitors: Last 30 days")."</div>";
print "<div align='left'>";
if (empty($results)) {
print "<small>... noch keine Eintr&auml;ge</small></div>";
return;
print "<small>... ".semr_i18n("no entries")."</small></div>";
return;
}
foreach ($results as $result) {
@ -107,19 +117,26 @@ function sem_drawLast30DaysGoo() {
print "<hr />";
}
### HISTORY Monatsgrafik GOOGLE-API
function sem_drawAllMonthGoo() {
/**
* chart of all month
*
* @global wpdb $wpdb
* @return void
*/
function sem_drawAllMonthGoo() {
global $wpdb;
$nummonths = $wpdb->get_var("SELECT MONTH(date) FROM ".$wpdb->statzhist);
$results = $wpdb->get_results("SELECT MONTH(date) as months, SUM(visitors) as visitors FROM ".$wpdb->statzhist." GROUP BY months ORDER BY date ASC");
print "<div class='statz'>Besucher: Die letzten ".$nummonths." Monate</div>";
print "<div align='left'>";
print "<div class='statz'>";
printf(semr_i18np("Visitors: Last %s month", "Visitors: Last %s month", $nummonths), $nummonths);
print "</div>";
print "<div align='left'>";
if (empty($results)) {
print "<small>... noch keine Eintr&auml;ge</small></div>";
print "<small>... ".semr_i18n("no entries")."</small></div>";
return;
}
@ -163,10 +180,12 @@ function sem_drawLast30DaysGoo() {
print "<hr />";
}
### HISTORY ALLE historischen Tage
/**
*
* @global wpdb $wpdb
* @return void
*/
function sem_drawAllDaysGoo() {
/* @var $wpdb wpdb */
global $wpdb;
$numdays = $wpdb->get_var("SELECT COUNT(date) FROM ".$wpdb->statzhist);
@ -175,12 +194,14 @@ function sem_drawAllDaysGoo() {
FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date ASC");
print "<div class='statz'>Besucher: ".$numdays." Tage zur&uuml;ck</div>";
print "<div class='statz'>";
printf(semr_i18np("Visitors: %s day back", "Visitors: %s days back", $numdays), $numdays);
print "</div>";
print "<div align='left'>";
if (empty($results)) {
print "<small>... noch keine Eintr&auml;ge</small></div>";
return;
print "<small>... ".semr_i18n("no entries")."</small></div>";
return;
}
foreach($results as $result) {
@ -230,18 +251,20 @@ function sem_drawAllDaysGoo() {
$results = $wpdb->get_results("SELECT referers, visitors, hits, substring(date,1,10) AS date
FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date DESC");
print "<div class='statz'>Die letzten ".$numdays." Tage</div>";
print "<div class='statz'>";
printf(semr_i18np("Last %s day", "Last %s days", $numdays), $numdays);
print "</div>";
if (empty($results)) {
print "<small>... noch keine Eintr&auml;ge</small>";
print "<small>... ".semr_i18n("no entries")."</small></div>";
return;
}
print "<table class='statzelement'>";
print "<thead>";
print "<tr>";
print "<th style='width:15%;text-align:center;'>Datum</th>";
print "<th style='width:10%;text-align:right;'>Besucher</th>";
print "<th style='width:10%;text-align:right;'>Hits</th>";
print "<th style='width:10%;text-align:right;'>Referer</th>";
print "<th style='width:15%;text-align:center;'>".semr_i18n("Date")."</th>";
print "<th style='width:10%;text-align:right;'>".semr_i18n("Visitors")."</th>";
print "<th style='width:10%;text-align:right;'>".semr_i18n("Hits")."</th>";
print "<th style='width:10%;text-align:right;'>".semr_i18n("Referrer")."</th>";
print "<th style='text-align:right;'>&nbsp;</th>";
print "</tr>";
print "</thead>";
@ -249,32 +272,32 @@ function sem_drawAllDaysGoo() {
$sum_visitors = 0;
$sum_hits = 0;
$sum_referers = 0;
foreach($results as $key=>$result) {
$date = mysql2date('d.m.Y',$result->date);
$visitors = $result->visitors;
$sum_visitors += $visitors;
$hits = $result->hits;
$sum_hits += $hits;
$referers = $result->referers;
$sum_referers += $referers;
print "<tr"; if(1&$key) print " class='alternate'"; print ">";
print "<td style='text-align:center;'>".$date."</td>";
print "<td style='text-align:right;'>".$visitors."</td>";
print "<td style='text-align:right;'>".$hits."</td>";
print "<td style='text-align:right;'>".$referers."</td>";
print "<td style='text-align:right;'>&nbsp;</td>";
print "</tr>";
}
foreach($results as $key=>$result) {
$date = mysql2date('d.m.Y',$result->date);
$visitors = $result->visitors;
$sum_visitors += $visitors;
$hits = $result->hits;
$sum_hits += $hits;
$referers = $result->referers;
$sum_referers += $referers;
print "<tr"; if(1&$key) print " class='alternate'"; print ">";
print "<td style='text-align:center;'>".$date."</td>";
print "<td style='text-align:right;'>".$visitors."</td>";
print "<td style='text-align:right;'>".$hits."</td>";
print "<td style='text-align:right;'>".$referers."</td>";
print "<td style='text-align:right;'>&nbsp;</td>";
print "</tr>";
}
print "<tr><td>&nbsp;</td></tr>";
print "<tr class='alternate'"; print ">";
print "<td style='text-align:center;'><b>Gesamt</b></td>";
print "<td style='text-align:center;'><b>".semr_i18n("Total")."</b></td>";
print "<td style='text-align:right;'><b>".$sum_visitors."</b></td>";
print "<td style='text-align:right;'><b>".$sum_hits."</b></td>";
print "<td style='text-align:right;'><b>".$sum_referers."</b></td>";
print "</tr>";
print "<tr>";
print "<td style='text-align:center;'><b>Durchschnitt</b></td>";
print "<td style='text-align:center;'><b>".semr_i18n("Average")."</b></td>";
print "<td style='text-align:right;'>".ceil($sum_visitors / $numdays)."</td>";
print "<td style='text-align:right;'>".ceil($sum_hits / $numdays)."</td>";
print "<td style='text-align:right;'>".ceil($sum_referers / $numdays)."</td>";
@ -289,7 +312,7 @@ function sem_drawAllDaysGoo() {
print "<div class='wrap'>";
print "<div id='icon-semmelstatzR' class='icon32'><br /></div>";
print "<h2>SemmelstatzR &rsaquo; Historie</h2>";
print "<h2>SemmelstatzR &gt; ".semr_i18n("History")."</h2>";
sem_drawLast30DaysGoo();
sem_drawAllMonthGoo();