Пример #1
0
function gen_datos($datos, $cero = false, $datos2 = false)
{
    $maxValue = max($datos);
    $dato_last = $datos[count($datos) - 1];
    if ($cero) {
        $datos = strtr(chart_data($datos), 'A', '_');
    } else {
        $datos = chart_data($datos);
    }
    if ($datos2) {
        $maxValue2 = max($datos2);
        if ($maxValue2 > $maxValue) {
            $maxValue = $maxValue2;
        }
        if ($cero) {
            $datos = $datos . ',' . strtr(chart_data($datos2), 'A', '_');
        } else {
            $datos = $datos . ',' . chart_data($datos2);
        }
    }
    return '&chxt=y,r&chxl=0:|_____|' . $maxValue . '|1:|__|' . $dato_last . '&chd=s:' . $datos;
}
Пример #2
0
<td colspan="4" class="amarillo"><form action="/accion.php?a=mercado&b=puja&ID=1" method="post">
<b><input type="text" name="puja" value="1" size="4" maxlength="7" style="text-align:right;" class="pols" /> ' . MONEDA . ' <input class="pujar" disabled="disabled" type="submit" value="Pujar" /> &nbsp; "La frase"</b></form></td>
</tr>';
    }
    $txt .= '</table>
<p>Propietario actual: <b style="font-size:22px;">' . crear_link($nick) . '</b></p>

</td><td width="50%" valign="top">




<table border="0" cellspacing="2" cellpadding="0" class="pol_table">

<tr>
<td colspan="4" align="center"><img src="http://chart.apis.google.com/chart?cht=lc&chs=360x100&chxt=y&chxl=0:|0|' . round($dgrafico_max_2 / 2) . '|' . $dgrafico_max_2 . '&chd=s:' . chart_data($dgrafico[2]) . '&chco=0066FF&chm=B,FFFFDD,0,0,0&chf=bg,s,ffffff01|c,s,ffffff01" width="360" height="100" /></td>
</tr>';
    $gan = 0;
    $ganador = '';
    $init = false;
    $result = mysql_query("SELECT user_ID, MAX(pols) AS los_pols, time,\r\n(SELECT nick FROM " . SQL_USERS . " WHERE ID = " . SQL . "pujas.user_ID LIMIT 1) AS nick\r\nFROM " . SQL . "pujas\r\nWHERE mercado_ID = 2\r\nGROUP BY user_ID\r\nORDER BY los_pols DESC\r\nLIMIT 10", $link);
    while ($row = mysql_fetch_array($result)) {
        $init = true;
        $gan++;
        if ($gan == 1) {
            $txt .= '
<tr>
<td colspan="4" class="amarillo"><form action="/accion.php?a=mercado&b=puja&ID=2" method="post">
<b><input type="text" name="puja" value="' . ($row['los_pols'] + 10) . '" size="4" maxlength="7" readonly="readonly" style="text-align:right;" class="pols" /> ' . MONEDA . ' <input type="submit" value="Pujar" class="pujar" disabled="disabled" /> &nbsp; "las palabras"</b></form></td>
</tr>';
        }
Пример #3
0
                    // AND ($num > 1)
                    if ($g_eh_datos) {
                        $g_parl_datos .= '|';
                    }
                    $g_parl_datos .= $partido;
                    $g_parl_x = '';
                    foreach ($elec as $fecha => $partido2) {
                        if (!$partido2[$partido]) {
                            $partido2[$partido] = -1;
                        }
                        $g_parl_x[] = $partido2[$partido];
                    }
                    if ($g_parl) {
                        $g_parl .= ',';
                    }
                    $g_parl .= chart_data($g_parl_x, $votos_max_pres);
                } else {
                    break;
                }
            }
        }
        if ($pol['config']['elecciones'] == 'parl') {
            $txt .= '<center><img src="http://chart.apis.google.com/chart?cht=p&chds=a&chd=t:' . $chart_dato . '&chs=362x220&chl=' . $chart_nom . '&chf=bg,s,ffffff01|c,s,ffffff01&chp=3.14" alt="Escrutinio Parlamentarias" />';
        } else {
            $txt .= '<center>';
            //<img src="http://chart.apis.google.com/chart?cht=p&chd=t:' . $chart_dato_escaños . ',' . $chart_dato . '&chs=362x220&chl=|' . $chart_nom . '&chco=FFFFDD,FF8000&chf=bg,s,FFFFDD,0" alt="Esca&ntilde;os Parlamentarias" />
        }
        $txt .= '<table border="0" class="pol_table">
<tr>
<th align="left" colspan="2">' . (ASAMBLEA ? '' : NOM_PARTIDOS) . '</th>
<th colspan="2" align="left">Votos</th>
Пример #4
0
 function TheChart($Ctype, $Res, $chart_height, $Search = "", $axes_type, $chart_bg, $chart_type = null, $chart_pos = null)
 {
     global $wpdb;
     $mysqlversion = substr(mysql_get_server_info(), 0, 3);
     $ss = "";
     //#Mysql's 'FROM_UNIXTIME' returns the local server
     //#  datetime from an expected UTC unix timestamp, so
     //#  convert 'timestamp' to UTC and calculate in any
     //#  differences between the server TZ and Wordpress' time
     //#  offset to get an accurate Wordpress datetime value.
     $WPoffset = (int) (get_option("gmt_offset") * 60 * 60);
     $UTCoffset = $WPoffset + ((int) date('Z') - $WPoffset);
     //
     //#for US/Euro date display: USA Timezone=USA date format.
     if (in_array(date('T'), array("ADT", "AST", "AKDT", "AKST", "CDT", "CST", "EDT", "EST", "HADT", "HAST", "MDT", "MST", "PDT", "PST"))) {
         $USAdate = true;
     } else {
         $USAdate = false;
     }
     if (!isset($chart_pos)) {
         $chart_pos = "center";
     }
     $this->searchString = $Search;
     $this->Last = $Ctype;
     // Options by chart type
     switch ($Ctype) {
         case 0:
             $label = __("Last 6 Hours", "wassup");
             $strto = "6 hours";
             $Ctimeformat = "%H";
             $x_axes_label = "%H:00";
             break;
         case 1:
             $label = __("Last 24 Hours", "wassup");
             $strto = "24 hours";
             $Ctimeformat = "%H";
             $x_axes_label = "%H:00";
             break;
         case 7:
             $label = __("Last 7 Days", "wassup");
             $strto = "7 days";
             $Ctimeformat = "%d";
             if ($USAdate) {
                 $x_axes_label = "%a %b %d";
             } else {
                 $x_axes_label = "%a %d %b";
             }
             break;
         case 30:
             $label = __("Last Month", "wassup");
             $strto = "30 days";
             $Ctimeformat = "%d";
             if ($USAdate) {
                 $x_axes_label = " %b %d";
             } else {
                 $x_axes_label = "%d %b";
             }
             break;
         case 365:
             $label = __("Last Year", "wassup");
             $strto = "12 months";
             $Ctimeformat = "%m";
             $x_axes_label = "%b %Y";
             break;
     }
     // Add Search variable to WHERE clause
     if ($Search != "") {
         $ss = " AND (ip LIKE '%" . $this->searchString . "%' OR hostname LIKE '%" . $this->searchString . "%' OR urlrequested LIKE '%" . $this->searchString . "%' OR agent LIKE '%" . $this->searchString . "%' OR referrer LIKE '%" . $this->searchString . "%') ";
     }
     $hour_todate = $this->to_date;
     $hour_fromdate = strtotime("-" . $strto, $hour_todate);
     if ($hour_fromdate == "") {
         $hour_fromdate = strtotime("-24 hours", $hour_todate);
     }
     /* Debug
                     $q = "SELECT COUNT(DISTINCT wassup_id) as items, COUNT(wassup_id) as pages, DATE_FORMAT(FROM_UNIXTIME((timestamp-$UTCoffset)), '$x_axes_label') as thedate FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN $hour_fromdate AND $hour_todate ".$this->whereis." $ss GROUP BY DATE_FORMAT(FROM_UNIXTIME((timestamp-$UTCoffset)), '$Ctimeformat') ORDER BY timestamp";
     		echo $q;
     		*/
     //$aitems = $wpdb->get_results("SELECT COUNT(DISTINCT wassup_id) as items, COUNT(wassup_id) as pages, DATE_FORMAT(FROM_UNIXTIME((timestamp-$UTCoffset)), '$x_axes_label') as thedate FROM ".$this->tableName." WHERE wassup_id IS NOT NULL AND timestamp BETWEEN $hour_fromdate AND $hour_todate ".$this->whereis." $ss GROUP BY DATE_FORMAT(FROM_UNIXTIME((timestamp-$UTCoffset)), '$Ctimeformat') ORDER BY timestamp", ARRAY_A);
     $aitems = $wpdb->get_results("SELECT COUNT(DISTINCT wassup_id) as items, COUNT(wassup_id) as pages, DATE_FORMAT(FROM_UNIXTIME(CAST((timestamp-{$UTCoffset}) AS UNSIGNED)), '{$x_axes_label}') as thedate FROM " . $this->tableName . " WHERE timestamp BETWEEN {$hour_fromdate} AND {$hour_todate} " . $this->whereis . " {$ss} GROUP BY DATE_FORMAT(FROM_UNIXTIME(CAST((timestamp-{$UTCoffset}) AS UNSIGNED)), '{$Ctimeformat}') ORDER BY timestamp", ARRAY_A);
     // Extract arrays for Visits, Pages and X_Axis_Label
     if (count($aitems) > 0) {
         foreach ($aitems as $bhits) {
             $ahits[] = $bhits['items'];
             $apages[] = $bhits['pages'];
             $atime[] = $bhits['thedate'];
         }
         // Print the main chart in visitors details view
         echo "<div id='placeholder' align='{$chart_pos}'>\n\t\t\t<img src='http://chart.apis.google.com/chart?chf=" . $chart_bg . "&chtt=" . urlencode($label) . "&chls=4,1,0|2,6,2&chco=2683ae,FF6D06&chm=B,2683ae30,0,0,0&chg=10,20,2,5&cht=lc&chs=" . $Res . "x" . $chart_height . "&chd=" . chart_data($ahits, $apages, $atime, $Ctimeformat, "main", $axes_type, $chart_type) . "'>\n";
         //echo "UTCoffset=$UTCoffset\nmysqlversion=$mysqlversion\n"; //debug
         //print_r($atime);	//debug
         echo "</div>\n";
     }
 }
Пример #5
0
    // datos graficos
    $result = mysql_query("SELECT mapa_vende\r\nFROM stats WHERE pais = '" . PAIS . "' AND mapa_vende != 0 \r\nORDER BY time ASC LIMIT 500", $link);
    while ($row = mysql_fetch_array($result)) {
        $dgrafico[] = $row['mapa_vende'];
    }
    if ($dgrafico) {
        $dgrafico_max = max($dgrafico);
    } else {
        $dgrafico_max = 0;
    }
    $txt .= '
<h1 style="display:inline-block;">Info</h1>
<span><acronym title="Superficie ocupada" style="color:blue;"><b>' . round($sup_total * 100 / $superficie_total, 1) . '%</b> ocupado</acronym> 
<acronym title="Superficie en venta" style="color:red;"><b>' . round($venta_total * 100 / $superficie_total, 1) . '%</b> en venta </acronym>	
</span><br />
<img style="margin:0 0 4px 0;" src="http://chart.apis.google.com/chart?cht=lc&chs=450x110&chxt=y&chxl=0:|0|' . round($dgrafico_max / 2) . '|' . $dgrafico_max . '&chd=s:' . chart_data($dgrafico) . '&chco=0066FF&chm=B,FFFFDD,0,0,0&chf=bg,s,ffffff01|c,s,ffffff01" width="450" height="110" />
</td></tr>
<tr><td valign="top">
<h1>Terratenientes</h1>
<p class="gris">Con m&aacute;s propiedades</p><ol>';
    $n = 0;
    $result = mysql_query("SELECT SUM(superficie) AS superficie, COUNT(*) AS num,\r\n(SELECT nick FROM users WHERE ID = " . SQL . "mapa.user_ID LIMIT 1) AS nick,\r\n(SELECT cargo FROM users WHERE ID = " . SQL . "mapa.user_ID LIMIT 1) AS cargo\r\nFROM " . SQL . "mapa\r\nWHERE estado != 'e'\r\nGROUP BY user_ID\r\nORDER BY superficie DESC, num ASC\r\nLIMIT 15");
    while ($row = mysql_fetch_array($result)) {
        $n++;
        if ($n <= 3) {
            $first = true;
            $txt .= '<li><img width="16" height="16" src="' . IMG . 'cargos/' . $row['cargo'] . '.gif" /> <b>' . crear_link($row['nick']) . ' (' . $row['superficie'] . ')</b></li>';
        } else {
            $txt .= '<li><img width="16" height="16" src="' . IMG . 'cargos/' . $row['cargo'] . '.gif" /> ' . crear_link($row['nick']) . ' (' . $row['superficie'] . ')</li>';
        }
    }
Пример #6
0
            }
            spyview($from_date, $to_date, $rows, $wassup_options->wassup_default_spy_type);
            // ACTION: SUMMARY PIE CHART
        } elseif ($_GET['action'] == "piechart") {
            // Prepare Pie Chart
            $Tot = new MainItems();
            $Tot->tableName = $table_name;
            $Tot->from_date = $from_date;
            $Tot->to_date = $to_date;
            $items_pie[] = $Tot->calc_tot("count", $search, "AND spam>0", "DISTINCT");
            $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine!='' AND spam=0", "DISTINCT");
            $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%" . $this->WpUrl . "%' AND referrer!='' AND spam=0", "DISTINCT");
            $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%" . $this->WpUrl . "%' OR referrer='') AND spam=0", "DISTINCT");
            ?>
		<div style="text-align: center"><img src="http://chart.apis.google.com/chart?cht=p3&amp;chco=0000ff&amp;chs=600x300&amp;chl=Spam|Search%20Engine|Referrer|Direct&amp;chd=<?php 
            chart_data($items_pie, null, null, null, 'pie');
            ?>
" /></div>


	<?php 
            // ACTION: DISPLAY RAW RECORDS
        } elseif ($_GET['action'] == "displayraw") {
            $raw_table = $wpdb->get_results("SELECT ip, hostname, agent, referrer, search, searchpage, os, browser, language FROM {$table_name} WHERE wassup_id='" . urlencode(attribute_escape($_GET['wassup_id'])) . "' ORDER BY timestamp ASC LIMIT 1");
            ?>
		<div><h2><?php 
            _e("Raw data", "wassup");
            ?>
:</h2>
		<ul style="list-style-type:none;padding:20px 0 0 30px;">
		<?php