* Visual improvements (from Babel Project) added to Pandora (logon screen and user views for agents).
* setup.php: New background editor in setup (from Babel Project) added to Pandora. * New background images. * Replaced again jpgraph with a -running- version. * pandora.css: Updated, fixed and added some styles ( * language_en.php: Added a few tokens. Sorry Raul, it's necessary. * functions.php: Added a new function to list files in a directory (taken from Babel Project). * fgraph.php: Added a new progressbar function (taken from Babel Project). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@68 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
|
@ -34,17 +34,26 @@ $query1="SELECT * FROM tsesion WHERE (TO_DAYS(fecha) > TO_DAYS(NOW()) -7) AND ID
|
|||
|
||||
$result=mysql_query($query1);
|
||||
$contador = 5; // Max items
|
||||
$color = 1;
|
||||
while (($row=mysql_fetch_array($result)) and ($contador > 0))
|
||||
{
|
||||
$usuario=$row["ID_usuario"];
|
||||
echo '<tr><td class="datos"><b class="f9">'.$usuario."</b>";
|
||||
echo '<td class="datosf9">';
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$usuario=$row["ID_usuario"];
|
||||
echo '<tr><td class="'.$tdcolor.'"><b class="'.$tdcolor.'f9">'.$usuario."</b>";
|
||||
echo '<td class="'.$tdcolor.'f9">';
|
||||
echo $row["accion"];
|
||||
echo '<td class="datosf9">';
|
||||
echo '<td class="'.$tdcolor.'f9">';
|
||||
echo $row["fecha"];
|
||||
echo '<td class="datosf9">';
|
||||
echo '<td class="'.$tdcolor.'f9">';
|
||||
echo $row["IP_origen"];
|
||||
echo '<td class="datosf9">';
|
||||
echo '<td class="'.$tdcolor.'f9">';
|
||||
echo $row["descripcion"];
|
||||
echo '</tr>';
|
||||
$contador--;
|
||||
|
|
|
@ -21,6 +21,7 @@ if (comprueba_login() == 0)
|
|||
$config_step_compact=$_POST["step_compact"];
|
||||
$config_graph_order=$_POST["graph_order"];
|
||||
$config_truetype=$_POST["truetype"];
|
||||
$config_bgimage=$_POST["bgimage"];
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$block_size."' WHERE TOKEN='block_size'");
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$language_code."' WHERE TOKEN='language_code'");
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$days_purge."' WHERE TOKEN='days_purge'");
|
||||
|
@ -29,12 +30,13 @@ if (comprueba_login() == 0)
|
|||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config_step_compact."' WHERE TOKEN='step_compact'");
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config_truetype."' WHERE TOKEN='truetype'");
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config_graph_order."' WHERE TOKEN='graph_order'");
|
||||
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config_bgimage."' WHERE token='bgimage'");
|
||||
}
|
||||
echo "<h2>".$lang_label["setup_screen"]."</h2>";
|
||||
echo "<h3>".$lang_label["general_config"]."<a href='help/".substr($language_code,0,2)."/chap7.php#7' target='_help'><img src='images/help.gif' border='0' class='help'></a></h3>";
|
||||
echo "<form name='setup' method='POST' action='index.php?sec=godmode/setup/setup&update=1'>";
|
||||
echo '<table width="500" cellpadding="3" cellspacing="3">';
|
||||
echo '<tr><td class="lb" rowspan="8" width="5"></td><td class="datos">'.$lang_label["language_code"];
|
||||
echo '<tr><td class="lb" rowspan="9" width="5"></td><td class="datos">'.$lang_label["language_code"];
|
||||
echo '<td class="datos"><select name="language_code" onChange="javascript:this.form.submit();">';
|
||||
|
||||
$sql="SELECT * FROM tlanguage";
|
||||
|
@ -87,6 +89,22 @@ if (comprueba_login() == 0)
|
|||
echo '<option value="0">'.$lang_label["disabled"].'</option>';
|
||||
echo '<option value="1">'.$lang_label["active"].'</option>';
|
||||
}
|
||||
|
||||
echo '<tr><td class="datos">'.$lang_label["background_image"];
|
||||
echo '<td class="datos">';
|
||||
echo '<select name="bgimage">';
|
||||
if ($config_bgimage!=""){
|
||||
echo '<option>'.$config_bgimage;
|
||||
}
|
||||
|
||||
$ficheros = list_files('images/backgrounds/', "background",1, 0);
|
||||
$a=0;
|
||||
while ($ficheros[$a]){
|
||||
echo "<option>".$ficheros[$a];
|
||||
$a++;
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
echo "<tr><td colspan='3'><div class='noraya'></div></td></tr>";
|
||||
echo "<tr><td colspan='3' align='right'>";
|
||||
echo '<input type="submit" class="sub" value="'.$lang_label["update"].'">';
|
||||
|
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 25 KiB |
|
@ -340,6 +340,42 @@ function no_permission () {
|
|||
exit;
|
||||
}
|
||||
|
||||
function list_files($directory, $stringSearch, $searchHandler, $outputHandler) {
|
||||
$errorHandler = false;
|
||||
$result = array();
|
||||
if (! $directoryHandler = @opendir ($directory)) {
|
||||
echo ("<pre>\nerror: directory \"$directory\" doesn't exist!\n</pre>\n");
|
||||
return $errorHandler = true;
|
||||
}
|
||||
if ($searchHandler == 0) {
|
||||
while (false !== ($fileName = @readdir ($directoryHandler))) {
|
||||
@array_push ($result, $fileName);
|
||||
}
|
||||
}
|
||||
if ($searchHandler == 1) {
|
||||
while(false !== ($fileName = @readdir ($directoryHandler))) {
|
||||
if(@substr_count ($fileName, $stringSearch) > 0) {
|
||||
@array_push ($result, $fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($errorHandler == true) && (@count ($result) === 0)) {
|
||||
echo ("<pre>\nerror: no filetype \"$fileExtension\" found!\n</pre>\n");
|
||||
}
|
||||
else {
|
||||
sort ($result);
|
||||
if ($outputHandler == 0) {
|
||||
return $result;
|
||||
}
|
||||
if ($outputHandler == 1) {
|
||||
echo ("<pre>\n");
|
||||
print_r ($result);
|
||||
echo ("</pre>\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pagination ($count, $url, $offset ) {
|
||||
require ("config.php");
|
||||
require ("include/languages/language_".$language_code.".php");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnológicas S.L, info@artica.es
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<EFBFBD>icas S.L, info@artica.es
|
||||
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
@ -642,12 +642,15 @@ $lang_label["truetype"]="Truetype fonts";
|
|||
$lang_label["right_left"]="Right to Left";
|
||||
$lang_label["left_right"]="Left to Right";
|
||||
|
||||
// 29 May 06 (New in Beta2)
|
||||
// 29 May 06 (New for Beta2)
|
||||
|
||||
$lang_label["cannot_read_snmp"]="Cannot read from SNMP source";
|
||||
$lang_label["ok_read_snmp"]="SNMP source has been scanned";
|
||||
$lang_label["cancel"]="Cancel";
|
||||
$lang_label["network_module_refresh_exec"]="Network module refresh executed";
|
||||
$lang_label["next_contact"]="Next agent contact";
|
||||
$lang_label["out_of_limits"]="Out of limits";
|
||||
$lang_label["background_image"]="Background image";
|
||||
|
||||
global $lang_label;
|
||||
global $help_label;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
Pandora - The Free Source Monitoring System
|
||||
This code is protected by GPL license.
|
||||
Este código esta protegido por la licencia GPL.
|
||||
Este c<EFBFBD>igo esta protegido por la licencia GPL.
|
||||
Sancho Lerena <slerena@gmail.com>, 2003-2006
|
||||
Raúl Mateos <raulofpandora@gmail.com>, 2004-2006
|
||||
Ral Mateos <raulofpandora@gmail.com>, 2004-2006
|
||||
*/
|
||||
|
||||
@import url(op.css);
|
||||
|
@ -11,7 +11,6 @@ Ra
|
|||
@import url(link.css);
|
||||
@import url(tip.css);
|
||||
@import url(calendar.css);
|
||||
body {background:url(../../images/fondo_serpent.jpg);}
|
||||
* {font-family: Verdana, sans-serif, Arial, Helvetica; font-size: 11px;}
|
||||
select, textarea, input {font-size: 12px;}
|
||||
textarea {border: 1px solid Silver; -moz-border-radius: 3%; padding: 5px;}
|
||||
|
@ -54,13 +53,14 @@ input.sub {font-weight: bold; border-bottom-color: #708090; border-right-color:
|
|||
th, td.lb {color: #ffffff; background-color: #778866;}
|
||||
td.lb {height: 16px; padding-left: 3px; font-weight: bold;}
|
||||
td.datos, td.datost, td.datosb, td.datos_id, td.datosf9, td.datosf9i, td.datos_jus, td.w30d, td.w40d, td.w90d, td.w135d, td.w180d, td.w230d {background-color: #f5f5f5;}
|
||||
td.datos2 {background-color: #c5c5d5;}
|
||||
td.datos2, td.datos2t, td.datos2b, td.datos2_id, td.datos2f9, td.datos2f9i, td.datos2_jus {background-color: #fafbfc;}
|
||||
td.datos3 {background-color: #e6e9cd;} #d7ebce
|
||||
td.datos_id {color: #1a313a;}
|
||||
td.datos_jus {text-align: justify;}
|
||||
.bg , .bgt {background-color: #4a6629;}
|
||||
.bg {position:relative; height: 20px; width: 100%;}
|
||||
.f10, .w155f10, #ip {font-size: 10px; text-align: center;}
|
||||
.f9, .f9i, .f9b, td.f9, td.f9i, td.datosf9, td.datosf9i, .f9l20, .f9l30 {font-size: 9px;}
|
||||
.f9, .f9i, .f9b, td.f9, td.f9i, td.datosf9, td.datos2f9, td.datosf9i, td.datos2f9i .f9l20, .f9l30 {font-size: 9px;}
|
||||
.f9i {font-style: italic;}
|
||||
.f9l20 {padding-left: 20px;}
|
||||
.f9l30, .f9130t {padding-left: 30px;}
|
||||
|
@ -74,7 +74,7 @@ td.datos_jus {text-align: justify;}
|
|||
.green {color: #5a8629;}
|
||||
.greenb {color: #00aa00;}
|
||||
.grey {color: #808080; font-weight: bold;}
|
||||
.redb, .greenb, td.datos_id, .f9b {font-weight: bold;}
|
||||
.redb, .greenb, td.datos_id, td.datos2_id, f9b {font-weight: bold;}
|
||||
.raya {border-top: 1px solid #778866; width: 100%;}
|
||||
.raya, .noraya {margin-bottom: -10px;}
|
||||
.p10 {padding-top: 1px; padding-bottom: 0px;}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnológicas S.L, info@artica.es
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<EFBFBD>icas S.L, info@artica.es
|
||||
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
@ -54,7 +54,8 @@ if (isset ($_GET["refr"])){
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
// Show custom background
|
||||
echo "<body background='images/backgrounds/$config_bgimage'>";
|
||||
$REMOTE_ADDR = getenv("REMOTE_ADDR");
|
||||
global $REMOTE_ADDR;
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ if (comprueba_login() == 0) {
|
|||
echo "<th>".$lang_label["alerts"]."</th>";
|
||||
echo "<th>".$lang_label["last_contact"]."</th>";
|
||||
// For every agent deficed in the agent table
|
||||
$color = 1;
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($row["disabled"] == 0) {
|
||||
$intervalo = $row["intervalo"]; // Interval in seconds
|
||||
|
@ -142,9 +143,17 @@ if (comprueba_login() == 0) {
|
|||
$agent_down = 1;
|
||||
else
|
||||
$agent_down = 0;
|
||||
|
||||
// Color change for each line (1.2 beta2)
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
$id_grupo=dame_id_grupo($id_agente);
|
||||
if (give_acl($id_user, $id_grupo, "AW")==1){
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."'><img src='images/setup.gif' border=0 width=15></a>";
|
||||
|
@ -152,45 +161,57 @@ if (comprueba_login() == 0) {
|
|||
echo " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'><b>".$nombre_agente."</b></a>";
|
||||
if ( $agent_type == 0) {
|
||||
// Show SO icon :)
|
||||
echo "<td class='datos' align='center'><img border=0 src='images/".dame_so_icon($id_os)."' height=18 alt='".dame_so_name($id_os)."'>";
|
||||
echo "<td class='$tdcolor' align='center'><img border=0 src='images/".dame_so_icon($id_os)."' height=18 alt='".dame_so_name($id_os)."'>";
|
||||
} elseif ($agent_type == 1) {
|
||||
// Show network icon (for pandora 1.2)
|
||||
echo "<td class='datos' align='center'><img border=0 src='images/network.gif' height=18 alt='Network Agent'>";
|
||||
echo "<td class='$tdcolor' align='center'><img border=0 src='images/network.gif' height=18 alt='Network Agent'>";
|
||||
}
|
||||
echo "<td class='datos'>".$intervalo;
|
||||
echo '<td class="datos"><img src="images/g_'.$iconindex_g[$id_grupo].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )';
|
||||
echo "<td class='datos'> ".$numero_modulos." <b>/</b> ".$numero_monitor;
|
||||
echo "<td class='$tdcolor'>".$intervalo;
|
||||
echo '<td class="'.$tdcolor.'"><img src="images/g_'.$iconindex_g[$id_grupo].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )';
|
||||
echo "<td class='$tdcolor'> ".$numero_modulos." <b>/</b> ".$numero_monitor;
|
||||
if ($monitor_bad <> 0)
|
||||
echo " <b>/</b> <font class='red'>".$monitor_bad."</font>";
|
||||
if ($agent_down == 1)
|
||||
echo "<td class='datos' align='center'><img src='images/b_down.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_down.gif'>";
|
||||
else
|
||||
if ($numero_monitor <> 0)
|
||||
if ($estado_general <> 0)
|
||||
if ($estado_cambio == 0)
|
||||
echo "<td class='datos' align='center'><img src='images/b_red.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_red.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/b_yellow.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_yellow.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/b_green.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_green.gif'>";
|
||||
elseif ($numero_modulos <> 0)
|
||||
echo "<td class='datos' align='center'><img src='images/b_white.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_white.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/b_blue.gif'>";
|
||||
echo "<td class='$tdcolor' align='center'><img src='images/b_blue.gif'>";
|
||||
// checks if an alert was fired recently
|
||||
echo "<td class='datos' align='center'>";
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if (check_alert_fired($id_agente) == 1)
|
||||
echo "<img src='images/dot_red.gif'>";
|
||||
else
|
||||
echo "<img src='images/dot_green.gif'>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($agent_down == 1) // if agent down, red and bold
|
||||
echo "<b><font class='red'>";
|
||||
if ( $ultimo_contacto == "0000-00-00 00:00:00")
|
||||
echo $lang_label["never"];
|
||||
else
|
||||
echo $ultimo_contacto;
|
||||
else {
|
||||
$ultima = strtotime($ultimo_contacto);
|
||||
$ahora = strtotime("now");
|
||||
$diferencia = $ahora - $ultima;
|
||||
if ($intervalo > 0){
|
||||
$percentil = round($diferencia/(($intervalo*2) / 100));
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
echo "<a div class='info'><img src='reporting/fgraph.php?tipo=progress&percent=".$percentil."&height=15&width=80' border=0>";
|
||||
echo "<span>$ultimo_contacto</span></div>";
|
||||
// echo $ultimo_contacto;
|
||||
}
|
||||
|
||||
} // writing agent data
|
||||
} // Disabled agent
|
||||
}
|
||||
|
|
|
@ -18,20 +18,28 @@ if (comprueba_login() == 0) {
|
|||
echo "<h3>".$lang_label["alert_listing"]."<a href='help/".substr($language_code,0,2)."/chap3.php#3324' target='_help'><img src='images/help.gif' border='0' class='help'></a></h3>";
|
||||
echo "<table cellpadding='3' cellspacing='3' width=750 border=0>";
|
||||
echo "<tr><th>".$lang_label["type"]."<th>".$lang_label["name"]."</th><th>".$lang_label["description"]."</th><th>".$lang_label["min_max"]."</th><th>".$lang_label["time_threshold"]."</th><th>".$lang_label["last_fired"]."</th><th>".$lang_label["times_fired"]."</th><th>".$lang_label["status"]."</th>";
|
||||
|
||||
$color=0;
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>".dame_nombre_alerta($data["id_alerta"]);
|
||||
echo "<td class='datos'>".$data["nombre"];
|
||||
echo "<td class='datos'>".$data["descripcion"];
|
||||
echo "<td class='datos'>".$data["dis_max"]."/".$data["dis_min"];
|
||||
echo "<td class='datos'>".$data["time_threshold"];
|
||||
echo "<td class='f9'>".$data["last_fired"];
|
||||
echo "<td class='datos'>".$data["times_fired"];
|
||||
echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"]);
|
||||
echo "<td class='".$tdcolor."'>".$data["nombre"];
|
||||
echo "<td class='".$tdcolor."'>".$data["descripcion"];
|
||||
echo "<td class='".$tdcolor."'>".$data["dis_max"]."/".$data["dis_min"];
|
||||
echo "<td class='".$tdcolor."'>".$data["time_threshold"];
|
||||
echo "<td class='".$tdcolor."f9'>".$data["last_fired"];
|
||||
echo "<td class='".$tdcolor."'>".$data["times_fired"];
|
||||
if ($data["times_fired"] <> 0)
|
||||
echo "<td class='datos' align='center'><img src='images/dot_red.gif'>";
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_red.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/dot_green.gif'>";
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_green.gif'>";
|
||||
}
|
||||
echo '<tr><td colspan="9"><div class="raya"></div></td></tr></table>';
|
||||
}
|
||||
|
@ -98,6 +106,7 @@ if (comprueba_login() == 0) {
|
|||
echo "<br>";
|
||||
echo "<table cellpadding='3' cellspacing='3'>";
|
||||
echo "<tr><th>ID</th><th>".$lang_label["type"]."</th><th>".$lang_label["description"]."</th><th>".$lang_label["last_fired"]."</th><th>".$lang_label["times_fired"]."</th><th>".$lang_label["status"]."</th>";
|
||||
$color=1;
|
||||
while ($row=mysql_fetch_array($result)){ //while there are agents
|
||||
if ($row["disabled"] == 0) {
|
||||
$id_agente = $row['id_agente'];
|
||||
|
@ -106,15 +115,23 @@ if (comprueba_login() == 0) {
|
|||
$result_gen=mysql_query($query_gen);
|
||||
if (mysql_num_rows ($result_gen)) {
|
||||
while ($data=mysql_fetch_array($result_gen)){
|
||||
echo "<tr><td class='datos'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'><b>".$nombre_agente."</b>";
|
||||
echo "<td class='datos'>".dame_nombre_alerta($data["id_alerta"]);
|
||||
echo "<td class='datos'>".$data["descripcion"];
|
||||
echo "<td class='datos'>".$data["last_fired"];
|
||||
echo "<td class='datos'>".$data["times_fired"];
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr><td class='".$tdcolor."'><a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'><b>".$nombre_agente."</b>";
|
||||
echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"]);
|
||||
echo "<td class='".$tdcolor."'>".$data["descripcion"];
|
||||
echo "<td class='".$tdcolor."'>".$data["last_fired"];
|
||||
echo "<td class='".$tdcolor."'>".$data["times_fired"];
|
||||
if ($data["times_fired"] <> 0)
|
||||
echo "<td class='datos' align='center'><img src='images/dot_red.gif'>";
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_red.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/dot_green.gif'>";
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_green.gif'>";
|
||||
}
|
||||
} //end result
|
||||
} //end disabled=0
|
||||
|
|
|
@ -58,31 +58,29 @@ if (comprueba_login() == 0) {
|
|||
echo " <a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente."'><img src='images/setup.gif' border=0 width=19 class='top' ></a>";
|
||||
// Data base access graph
|
||||
|
||||
echo "<td class='datost' rowspan=4><b>".$lang_label["agent_access_rate"]."</b><br><br>
|
||||
<img src='reporting/fgraph.php?id=".$id_agente."&tipo=agentaccess&periodo=1440' border=0>";
|
||||
echo "<td rowspan=4><b>".$lang_label["agent_access_rate"]."</b><br><br>
|
||||
<img border=1 src='reporting/fgraph.php?id=".$id_agente."&tipo=agentaccess&periodo=1440' border=0>";
|
||||
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["ip_address"].'</b> <td class="datos">'.salida_limpia($direccion_agente);
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["ip_address"].'</b> <td class="datos2">'.salida_limpia($direccion_agente);
|
||||
if ($agent_type == 0) {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["os"].'</b> <td class="datos"><img border=0 src="images/'.dame_so_icon($id_os).'"> - '.dame_so_name($id_os);
|
||||
} elseif ($agent_type == 1) {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["agent_type"].'</b> <td class="datos"><img border=0 src="images/network.gif"';
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["agent_type"].'</b> <td class="datos2"><img border=0 src="images/network.gif"';
|
||||
}
|
||||
if ($os_version != "") echo ' v'.salida_limpia($os_version);
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["interval"].'</b> <td class="datos">'.$intervalo;
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["interval"].'</b> <td class="datos2">'.$intervalo;
|
||||
echo '<tr><td class="datos"><b>'.salida_limpia($lang_label["description"]).'</b> <td class="datos">'.$comentarios;
|
||||
|
||||
echo "<td datost' rowspan=6><b>".$lang_label["agent_module_shareout"]."</b><br><br>";
|
||||
echo "<img src='reporting/fgraph.php?id=".$id_agente."&tipo=agentmodules' border=0>";
|
||||
echo "<td rowspan=6><b>".$lang_label["agent_module_shareout"]."</b><br><br>";
|
||||
echo "<img border=1 src='reporting/fgraph.php?id=".$id_agente."&tipo=agentmodules' border=0>";
|
||||
|
||||
echo '<tr><td class="datos"><b>'.salida_limpia($lang_label["group"]).'</b> <td class="datos"> <img src="images/g_'.$iconindex_g[$row["id_grupo"]].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )';
|
||||
echo '<tr><td class="datos2"><b>'.salida_limpia($lang_label["group"]).'</b> <td class="datos2"> <img src="images/g_'.$iconindex_g[$row["id_grupo"]].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )';
|
||||
if ($agent_type == 0) {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b> <td class="datos">'.salida_limpia($agent_version);
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["total_packets"].'</b> <td class="datos">';
|
||||
|
||||
// Total packets
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["total_packets"].'</b> <td class="datos2">';
|
||||
$total_paketes= 0;
|
||||
$id_agente = dame_agente_id($nombre_agente);
|
||||
$sql_2='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
|
||||
|
@ -93,17 +91,32 @@ if (comprueba_login() == 0) {
|
|||
$row3=mysql_fetch_array($result_3);
|
||||
$total_paketes = $total_paketes + $row3[0];
|
||||
}
|
||||
|
||||
echo $total_paketes;
|
||||
|
||||
// Last contact
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["last_contact"]." / ".$lang_label["remote"].'</b> <td class="datosf9">';
|
||||
echo $ultima_act." / ".$ultima_act_remota;
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["default_server"].'</b> <td class="datos">';
|
||||
if ($server == ""){ // default server
|
||||
echo $lang_label["server_asigned"];
|
||||
|
||||
// Asigned/active server
|
||||
echo '<tr><td class="datos2"><b>'.$lang_label["server_asigned"].'</b> <td class="datos2">';
|
||||
if ($server == ""){
|
||||
echo "N/A";
|
||||
} else {
|
||||
echo give_server_name($server);
|
||||
}
|
||||
|
||||
// Next contact
|
||||
|
||||
$ultima = strtotime($ultima_act);
|
||||
$ahora = strtotime("now");
|
||||
$diferencia = $ahora - $ultima;
|
||||
if ($intervalo > 0){
|
||||
$percentil = round($diferencia/(($intervalo*2) / 100));
|
||||
} else {
|
||||
echo "N/A";
|
||||
}
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["next_contact"].'</b> <td class="datos2">';
|
||||
echo "<img src='reporting/fgraph.php?tipo=progress&percent=".$percentil."&height=20&width=200'>";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
}
|
||||
|
|
|
@ -17,66 +17,71 @@ if (comprueba_login() == 0) {
|
|||
// Get all module from agent
|
||||
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente;
|
||||
$result_t=mysql_query($sql_t);
|
||||
|
||||
if (mysql_num_rows ($result_t)) {
|
||||
|
||||
echo "<h3>".$lang_label["monitor_listing"]."<a href='help/".substr($language_code,0,2)."/chap3.php#3323' target='_help'><img src='images/help.gif' border='0' class='help'></a></h3>";
|
||||
echo "<table width='750' cellpadding=3 cellspacing=3>";
|
||||
echo "<tr><th>".$lang_label["type"]."<th>".$lang_label["module_name"]."<th>".$lang_label["description"]."<th>".$lang_label["status"]."<th>".$lang_label["interval"]."<th>".$lang_label["last_contact"];
|
||||
while ($row_t=mysql_fetch_array($result_t)){
|
||||
|
||||
# For evey module in the status table
|
||||
$est_modulo = $row_t["nombre"];
|
||||
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
|
||||
$est_description = $row_t["descripcion"];
|
||||
$est_timestamp = $row_t["timestamp"];
|
||||
$est_estado = $row_t["estado"];
|
||||
$est_datos = $row_t["datos"];
|
||||
$est_cambio = $row_t["cambio"];
|
||||
$est_interval = $row_t["module_interval"];
|
||||
|
||||
if (($est_interval != $intervalo) && ($est_interval > 0)) {
|
||||
$temp_interval = $est_interval;
|
||||
} else {
|
||||
$temp_interval = $intervalo;
|
||||
}
|
||||
|
||||
if ($est_estado <>100){ # si no es un modulo de tipo datos
|
||||
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
|
||||
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$seconds = strtotime($ahora) - strtotime($row_t["timestamp"]);
|
||||
if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
|
||||
$agent_down = 1;
|
||||
else
|
||||
$agent_down = 0;
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>".$est_tipo;
|
||||
echo "<td class='datos'>".$est_modulo;
|
||||
echo "<td class='f9'>".substr($est_description,0,32);
|
||||
// echo "<td class='datos'>".$row3["datos"];
|
||||
if ($agent_down == 1)
|
||||
echo "<td class='datos' align='center'><img src='images/b_down.gif'>";
|
||||
else
|
||||
if ($est_estado == 1)
|
||||
if ($est_cambio ==1)
|
||||
echo "<td class='datos' align='center'><img src='images/b_yellow.gif'>";
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/b_red.gif'>";
|
||||
$color=0;
|
||||
while ($row_t=mysql_fetch_array($result_t)){
|
||||
# For evey module in the status table
|
||||
$est_modulo = $row_t["nombre"];
|
||||
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
|
||||
$est_description = $row_t["descripcion"];
|
||||
$est_timestamp = $row_t["timestamp"];
|
||||
$est_estado = $row_t["estado"];
|
||||
$est_datos = $row_t["datos"];
|
||||
$est_cambio = $row_t["cambio"];
|
||||
$est_interval = $row_t["module_interval"];
|
||||
|
||||
if (($est_interval != $intervalo) && ($est_interval > 0)) {
|
||||
$temp_interval = $est_interval;
|
||||
} else {
|
||||
$temp_interval = $intervalo;
|
||||
}
|
||||
if ($est_estado <>100){ # si no es un modulo de tipo datos
|
||||
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
$seconds = strtotime($ahora) - strtotime($row_t["timestamp"]);
|
||||
if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
|
||||
$agent_down = 1;
|
||||
else
|
||||
echo "<td class='datos' align='center'><img src='images/b_green.gif'>";
|
||||
echo "<td class='datos'>";
|
||||
echo $temp_interval;
|
||||
echo "<td class='f9'>";
|
||||
if ($agent_down == 1) // Si el agente esta down, lo mostramos en negrita y en rojo
|
||||
echo "<b><font color='red'>";
|
||||
|
||||
echo $row_t["timestamp"];
|
||||
$agent_down = 0;
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='".$tdcolor."'>".$est_tipo;
|
||||
echo "<td class='".$tdcolor."'>".$est_modulo;
|
||||
echo "<td class='".$tdcolor."f9'>".substr($est_description,0,32);
|
||||
// echo "<td class='datos'>".$row3["datos"];
|
||||
if ($agent_down == 1)
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/b_down.gif'>";
|
||||
else
|
||||
if ($est_estado == 1)
|
||||
if ($est_cambio ==1)
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/b_yellow.gif'>";
|
||||
else
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/b_red.gif'>";
|
||||
else
|
||||
echo "<td class='".$tdcolor."' align='center'><img src='images/b_green.gif'>";
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
echo $temp_interval;
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($agent_down == 1) // Si el agente esta down, lo mostramos en negrita y en rojo
|
||||
echo "<b><font color='red'>";
|
||||
|
||||
echo $row_t["timestamp"];
|
||||
}
|
||||
}
|
||||
echo '<tr><td colspan="7"><div class="raya"></div></td></tr></table>';
|
||||
}
|
||||
echo '<tr><td colspan="7"><div class="raya"></div></td></tr></table>';
|
||||
}
|
||||
else echo "- <font class='red'>".$lang_label["no_monitors"]."</font>";
|
||||
else
|
||||
echo "- <font class='red'>".$lang_label["no_monitors"]."</font>";
|
||||
}
|
||||
?>
|
|
@ -2,7 +2,7 @@
|
|||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnológicas S.L, info@artica.es
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<EFBFBD>icas S.L, info@artica.es
|
||||
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
@ -78,18 +78,28 @@ if (comprueba_login() == 0) {
|
|||
echo "<table width='750' cellpadding='3' cellspacing='3'><th>X<th>".$lang_label["module_name"];
|
||||
echo "<th>".$lang_label["type"]."<th>".$lang_label["int"]."<th>".$lang_label["description"]."<th>".$lang_label["data"]."<th>".$lang_label["graph"]."<th>".$lang_label["raw_data"]."<th>".$lang_label["timestamp"];
|
||||
$texto='';
|
||||
$color = 1;
|
||||
while ($row3=mysql_fetch_array($result3)){
|
||||
// Calculate table line color
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
// Render module group names (fixed code)
|
||||
$nombre_grupomodulo = dame_nombre_grupomodulo ($row3["id_module_group"]);
|
||||
if ($nombre_grupomodulo != ""){
|
||||
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
|
||||
$label_group = -1;
|
||||
$last_label = $nombre_grupomodulo;
|
||||
echo "<tr><td class='datos2' align='center' colspan=9><b>".$nombre_grupomodulo."</b>";
|
||||
echo "<tr><td class='datos3' align='center' colspan=9><b>".$nombre_grupomodulo."</b>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<tr><td class='datos'>";
|
||||
// Begin to render data ...
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
// Render network exec module button, only when
|
||||
// Agent Write for this module and group, is given
|
||||
// Is a network module
|
||||
|
@ -110,22 +120,22 @@ if (comprueba_login() == 0) {
|
|||
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
|
||||
$label_group = -1;
|
||||
$last_label = $nombre_grupomodulo;
|
||||
$texto = $texto. "<td class='datos2' align='center' colspan=7><b>".$nombre_grupomodulo."</b>";
|
||||
$texto = $texto. "<td class='$tdcolor' align='center' colspan=7><b>".$nombre_grupomodulo."</b>";
|
||||
}
|
||||
}
|
||||
|
||||
$nombre_tipo_modulo = dame_nombre_tipo_modulo($row3["id_tipo_modulo"]);
|
||||
echo "<td class='datos_id'>";
|
||||
echo "<td class='".$tdcolor."_id'>";
|
||||
echo salida_limpia(substr($row3["nombre"],0,15));
|
||||
echo "<td class='datos'>";
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
echo "<img src='images/".$iconindex[$row3["id_tipo_modulo"]]."' border=0>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
if ($row3["module_interval"] != 0)
|
||||
echo $row3["module_interval"];
|
||||
else
|
||||
echo $intervalo_agente;
|
||||
//echo $nombre_tipo_modulo;
|
||||
echo "<td class='f9'>";
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
echo salida_limpia(substr($row3["descripcion"],0,32));
|
||||
if (strlen($row3["descripcion"]) > 32){
|
||||
echo "...";
|
||||
|
@ -133,12 +143,12 @@ if (comprueba_login() == 0) {
|
|||
// For types not string type (3 data_string, 9 tcp_string, 14 snmp_string)
|
||||
if (($row3["id_tipo_modulo"] != 3) AND ($row3["id_tipo_modulo"]!=10) AND ($row3["id_tipo_modulo"]!=17)){
|
||||
|
||||
echo "<td class=datos>";
|
||||
echo "<td class=".$tdcolor.">";
|
||||
echo substr($row3["datos"],0,5);
|
||||
$handle = "stat".$nombre_tipo_modulo."_".$nombre_agente;
|
||||
$url = 'reporting/procesos.php?agente='.$nombre_agente;
|
||||
$win_handle=dechex(crc32($nombre_agente.$row3["nombre"]));
|
||||
echo "<td class=datos width='78'>";
|
||||
echo "<td class=".$tdcolor." width='78'>";
|
||||
|
||||
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?tipo=mes&id=".$row3["id_agente_modulo"]."\", \"mes_".$win_handle."\")'><img border=0 src='images/grafica_m.gif'></a> ";
|
||||
|
||||
|
@ -152,15 +162,15 @@ if (comprueba_login() == 0) {
|
|||
echo '<a href="javascript:'.$link.'"><img border=0 src="images/grafica_h.gif"</a>';
|
||||
}
|
||||
else { # Writing string data in different way :)
|
||||
echo "<td class='datosf9' colspan='2'>";
|
||||
echo "<td class='".$tdcolor."f9' colspan='2'>";
|
||||
echo salida_limpia(substr($row3["datos"],0,42));
|
||||
}
|
||||
|
||||
echo "<td class=datos width=70>";
|
||||
echo "<td class=".$tdcolor." width=70>";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=mes&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_m.gif'> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=semana&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_w.gif'> ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=dia&id=".$row3["id_agente_modulo"]."'><img border=0 src='images/data_d.gif'>";
|
||||
echo "<td class='datosf9'>".$row3["timestamp"];
|
||||
echo "<td class='".$tdcolor."f9'>".$row3["timestamp"];
|
||||
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ INSERT INTO `tconfig` VALUES (8,'db_scheme_version','1.1');
|
|||
INSERT INTO `tconfig` VALUES (9,'db_scheme_build','PD60126');
|
||||
INSERT INTO `tconfig` VALUES (10,'graph_order','1');
|
||||
INSERT INTO `tconfig` VALUES (11,'truetype','0');
|
||||
|
||||
INSERT INTO `tconfig` VALUES (12,'bgimage','background2.jpg');
|
||||
--
|
||||
-- Dumping data for table `tconfig_os`
|
||||
--
|
||||
|
|
|
@ -1209,20 +1209,45 @@ function grafico_db_agentes_purge($id_agente) {
|
|||
$graph->Stroke();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// progress_bar ( value, min, max, graph_width, graph_height)
|
||||
// Show a progress bar
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function prueba() {
|
||||
function drawRating($rating) {
|
||||
$width = $_GET['width'];
|
||||
$height = $_GET['height'];
|
||||
function drawWarning($width,$height) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$language_code.".php");
|
||||
if ($width == 0) {
|
||||
$width = 102;
|
||||
$width = 50;
|
||||
}
|
||||
if ($height == 0) {
|
||||
$height = 10;
|
||||
$height = 30;
|
||||
}
|
||||
|
||||
|
||||
$image = imagecreate($width,$height);
|
||||
//colors
|
||||
$back = ImageColorAllocate($image,255,255,255);
|
||||
$border = ImageColorAllocate($image,0,0,0);
|
||||
$red = ImageColorAllocate($image,255,60,75);
|
||||
$fill = ImageColorAllocate($image,44,81,150);
|
||||
|
||||
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
|
||||
ImageRectangle($image,0,0,$width-1,$height-1,$border);
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $lang_label["no_data"]);
|
||||
imagePNG($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
|
||||
function progress_bar($progress,$width,$height) {
|
||||
// Copied from the PHP manual:
|
||||
// http://us3.php.net/manual/en/function.imagefilledrectangle.php
|
||||
// With some adds from sdonie at lgc dot com
|
||||
// Get from official documentation PHP.net website. Thanks guys :-)
|
||||
// Code ripped from Babel Project :-)
|
||||
function drawRating($rating,$width,$height) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$language_code.".php");
|
||||
if ($width == 0) {
|
||||
$width = 150;
|
||||
}
|
||||
if ($height == 0) {
|
||||
$height = 20;
|
||||
}
|
||||
|
||||
//$rating = $_GET['rating'];
|
||||
|
@ -1234,53 +1259,28 @@ function prueba() {
|
|||
$border = ImageColorAllocate($image,0,0,0);
|
||||
$red = ImageColorAllocate($image,255,60,75);
|
||||
$fill = ImageColorAllocate($image,44,81,150);
|
||||
|
||||
|
||||
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
|
||||
if ($rating > 100)
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$red);
|
||||
else
|
||||
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
|
||||
ImageRectangle($image,0,0,$width-1,$height-1,$border);
|
||||
if ($rating > 50)
|
||||
if ($rating > 100)
|
||||
ImageTTFText($image, 8, 0, ($width/3)-($width/10), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]);
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%");
|
||||
else
|
||||
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%");
|
||||
imagePNG($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
|
||||
Header("Content-type: image/png");
|
||||
drawRating(120);
|
||||
}
|
||||
Header("Content-type: image/png");
|
||||
drawRating($progress,$width,$height);
|
||||
}
|
||||
|
||||
function progress_bar($valor, $min, $max, $longitud_barra, $anchura_barra){
|
||||
$uno = $max / $longitud_barra; // define el valor de un 1%
|
||||
$actual = $valor / $uno;
|
||||
$pic=imagecreate($longitud_barra,$anchura_barra);
|
||||
$col3=imagecolorallocate($pic,0,0,0);
|
||||
$col1=imagecolorallocate($pic,200,200,200);
|
||||
$col2=imagecolorallocate($pic,0,0,255);
|
||||
$col4=imagecolorallocate($pic,255,255,255);
|
||||
imagefilledrectangle($pic,1,1,$longitud_barra,$anchura_barra,$col3);
|
||||
imagefilledrectangle($pic,1,1,$actual-1,$anchura_barra-2,$col2);
|
||||
imagefilledrectangle($pic,$actual,1,$longitud_barra-2,$anchura_barra-2,$col1);
|
||||
imagepng($pic,"graficos/temp/barraprogreso_".$valor.".png");
|
||||
echo '<img src="graficos/temp/barraprogreso_'.$valor.'.png" border=0>';
|
||||
imagedestroy($pic);
|
||||
}
|
||||
|
||||
function progress_bar_per($valor, $min, $max, $longitud_barra, $anchura_barra){
|
||||
$uno = $max / $longitud_barra; // define el valor de un 1%
|
||||
$actual = $valor / $uno;
|
||||
$porc = (int)($valor/($max/100));
|
||||
$pic=imagecreate($longitud_barra,$anchura_barra);
|
||||
$col3=imagecolorallocate($pic,0,0,0);
|
||||
$col1=imagecolorallocate($pic,200,200,200);
|
||||
$col2=imagecolorallocate($pic,0,0,255);
|
||||
$col4=imagecolorallocate($pic,255,255,255);
|
||||
|
||||
imagefilledrectangle($pic,1,1,$longitud_barra,$anchura_barra,$col3);
|
||||
imagefilledrectangle($pic,1,1,$actual-1,$anchura_barra-2,$col2);
|
||||
imagefilledrectangle($pic,$actual,1,$longitud_barra-2,$anchura_barra-2,$col1);
|
||||
//array ImageTTFText ( int im, int size, int angle, int x, int y, int col, string fontfile, string text)
|
||||
ImageTTFText($pic, 9, 0, ($longitud_barra/2)-10, 9+(($anchura_barra-12)/2), $col3, "/usr/share/fonts/truetype/commercial/arial.ttf", $porc."%");
|
||||
imagepng($pic,"graficos/temp/barraprogresop_".$valor.".png");
|
||||
echo '<img src="graficos/temp/barraprogresop_'.$valor.'.png" border=0>';
|
||||
imagedestroy($pic);
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************
|
||||
// MAIN Code
|
||||
|
@ -1328,5 +1328,11 @@ if (isset($_GET["tipo"])){
|
|||
graphic_agentaccess($_GET["id"], $_GET["periodo"]);
|
||||
elseif ($_GET["tipo"] == "agentmodules")
|
||||
graphic_agentmodules($_GET["id"]);
|
||||
elseif ( $_GET["tipo"] =="progress"){
|
||||
$percent= $_GET["percent"];
|
||||
$width= $_GET["width"];
|
||||
$height= $_GET["height"];
|
||||
progress_bar($percent,$width,$height);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,105 +1,105 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_BEVELS.INC
|
||||
// Description: Base64 encoded images for round bevels
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_bevels.inc 20 2005-05-30 20:34:41Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Bevels extends ImgData {
|
||||
protected $name = 'Round Bevels';
|
||||
protected $an = array(MARK_IMG_BEVEL => 'imgdata');
|
||||
|
||||
protected $colors = array('green','purple','orange','red','yellow');
|
||||
protected $index = array('green'=>1,'purple'=>4,'orange'=>2,'red'=>0,'yellow'=>3);
|
||||
protected $maxidx = 4 ;
|
||||
|
||||
protected $imgdata ;
|
||||
|
||||
function ImgData_Bevels() {
|
||||
//==========================================================
|
||||
// File: bullets_balls_red_013.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 337 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/f3+LFwcmNxMuxm62DmqKth1VpZmIWg6fv'.
|
||||
'HCa7K0BwMEytCjFnIyUlEBg9vhQvAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNhk+pYJVAAAAl0lEQVR4nE2Q2xLDIAgFHUWBKJf//9'.
|
||||
'oekmbafVDZARRbK/pYTKP9WNcNv64zzUdd9BjmrgnsVXRNSzO3'.
|
||||
'CJ5ahdhy0XKQkxld1kxb45j7dp0x2lBNOyVgQpMaoadX7Hs7zr'.
|
||||
'P1yKj47DKBnKaBKiSAkNss7O6PkMx6kIgYXISQJpcZCqdY6KR+'.
|
||||
'J1PkS5Xob/h7MNz8x6D3fz5DKQjpkZOBYAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_green_013.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 344 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/e3+K3vriUub/Dm18j4xc3ob10k0ItqQlU'.
|
||||
'e5JBmwpxY1ENaKBgUh0iHgwsSre9AAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNTfJXtxZAAAAnklEQVR4nE2QWY4EMQhDUVhSIRC4/2'.
|
||||
'kbaqLp9p+f2AxAayAzDfiK9znPORuvH0x8Ss9z6I9sHp6tcxE9'.
|
||||
'nLmWmebmt5F5p2AR0+C9AWpLBjXRaZsCAT3SqklVp0YkAWaGtd'.
|
||||
'c5Z41/STYpPzW7BjyiRrwkVmQto/Cw9tNEMvsgcekyCyFPboIu'.
|
||||
'IsuXiKffYB4NK4r/h6d4g9HPPwCR7i8+GscIiiaonUAAAAAASU'.
|
||||
'VORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_oy_035.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 341 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/f3+K5tbqNwcjnkjXjbxR2i5anfEoNkbis'.
|
||||
'PBxpU0sZbZejKgdqIRIlERIwYtkYAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNgK0wEu5AAAAm0lEQVR4nE3QVxIEIQgEUErAgTHA/U'.
|
||||
'+7zbipf9RXgoGo0liMmX6RdSPLPtZM9F4LuuSIaZtZWffiU6Iz'.
|
||||
'Y8SOMF0NogBj30ioGRGLZgiPvce1TbIRz6oBQEbOFGK0rIoxrn'.
|
||||
'5hDomMA1cfGRCaRVhjS3gkzheM+4HtnlkXcvdZhWG4qZawewe6'.
|
||||
'9Jnz/TKLB/ML6HUepn//QczazuwFO/0Ivpolhi4AAAAASUVORK'.
|
||||
'5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_oy_036.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 340 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/e3+LO3hfYzz65ubiNwci6uQ12ipadgVGa'.
|
||||
'fwsNkbhnVkcaZ5dwSA8lFg7CEepmAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElN'.
|
||||
'RQfTAxcCBySi1nevAAAAjElEQVR4nFXPWw7EIAgFUNMoCMhj/6'.
|
||||
'staKczc/2RkwjS2glQ+w3YytgXCXCZpRo8gJdGxZadJws13CUP'.
|
||||
'4SZI4MYiUxypeiGGw1XShVBTNN9kLXP2GRrZPFvKgd7z/sqGGV'.
|
||||
'7C7r7r3l09alYN3iA8Yn+ImdVrNoEeSRqJPAaHfhZzLYwXstdZ'.
|
||||
'rP3n2bvdAI4INwtihiwAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_pp_019.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 334 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////+/v7i4eO/w8eHxcvKroNVormtfkjrMN2BeXQrepPc'.
|
||||
'Esy4IL+OFaR7F25LHF8mFRh5XXtUAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNgkjEpIxAAAAlElEQVR4nE2QAQ7FIAhDDTAVndL7n3'.
|
||||
'ZV/7JfEwMvFIWUlkTMVNInbVv5ZeJqG7Smh2QTBwJBpsdizAZP'.
|
||||
'5NyW0awhK8kYodnZxS6ECvPRp2sI+y7PBv1mN02KH7h77QCJ8D'.
|
||||
'4VvY5NUgEmCwj6ZMzHtJRgRSXwC1gfcqJJH0GBnSnK1kUQ72DY'.
|
||||
'CPBv+MCS/e0jib77eQAJxwiEWm7hFwAAAABJRU5ErkJggg==' ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_BEVELS.INC
|
||||
// Description: Base64 encoded images for round bevels
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_bevels.inc 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Bevels extends ImgData {
|
||||
var $name = 'Round Bevels';
|
||||
var $an = array(MARK_IMG_BEVEL => 'imgdata');
|
||||
|
||||
var $colors = array('green','purple','orange','red','yellow');
|
||||
var $index = array('green'=>1,'purple'=>4,'orange'=>2,'red'=>0,'yellow'=>3);
|
||||
var $maxidx = 4 ;
|
||||
|
||||
var $imgdata ;
|
||||
|
||||
function ImgData_Bevels() {
|
||||
//==========================================================
|
||||
// File: bullets_balls_red_013.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 337 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/f3+LFwcmNxMuxm62DmqKth1VpZmIWg6fv'.
|
||||
'HCa7K0BwMEytCjFnIyUlEBg9vhQvAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNhk+pYJVAAAAl0lEQVR4nE2Q2xLDIAgFHUWBKJf//9'.
|
||||
'oekmbafVDZARRbK/pYTKP9WNcNv64zzUdd9BjmrgnsVXRNSzO3'.
|
||||
'CJ5ahdhy0XKQkxld1kxb45j7dp0x2lBNOyVgQpMaoadX7Hs7zr'.
|
||||
'P1yKj47DKBnKaBKiSAkNss7O6PkMx6kIgYXISQJpcZCqdY6KR+'.
|
||||
'J1PkS5Xob/h7MNz8x6D3fz5DKQjpkZOBYAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_green_013.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 344 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/e3+K3vriUub/Dm18j4xc3ob10k0ItqQlU'.
|
||||
'e5JBmwpxY1ENaKBgUh0iHgwsSre9AAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNTfJXtxZAAAAnklEQVR4nE2QWY4EMQhDUVhSIRC4/2'.
|
||||
'kbaqLp9p+f2AxAayAzDfiK9znPORuvH0x8Ss9z6I9sHp6tcxE9'.
|
||||
'nLmWmebmt5F5p2AR0+C9AWpLBjXRaZsCAT3SqklVp0YkAWaGtd'.
|
||||
'c5Z41/STYpPzW7BjyiRrwkVmQto/Cw9tNEMvsgcekyCyFPboIu'.
|
||||
'IsuXiKffYB4NK4r/h6d4g9HPPwCR7i8+GscIiiaonUAAAAAASU'.
|
||||
'VORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_oy_035.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 341 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/f3+K5tbqNwcjnkjXjbxR2i5anfEoNkbis'.
|
||||
'PBxpU0sZbZejKgdqIRIlERIwYtkYAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNgK0wEu5AAAAm0lEQVR4nE3QVxIEIQgEUErAgTHA/U'.
|
||||
'+7zbipf9RXgoGo0liMmX6RdSPLPtZM9F4LuuSIaZtZWffiU6Iz'.
|
||||
'Y8SOMF0NogBj30ioGRGLZgiPvce1TbIRz6oBQEbOFGK0rIoxrn'.
|
||||
'5hDomMA1cfGRCaRVhjS3gkzheM+4HtnlkXcvdZhWG4qZawewe6'.
|
||||
'9Jnz/TKLB/ML6HUepn//QczazuwFO/0Ivpolhi4AAAAASUVORK'.
|
||||
'5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_oy_036.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 340 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////////27t/e3+LO3hfYzz65ubiNwci6uQ12ipadgVGa'.
|
||||
'fwsNkbhnVkcaZ5dwSA8lFg7CEepmAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElN'.
|
||||
'RQfTAxcCBySi1nevAAAAjElEQVR4nFXPWw7EIAgFUNMoCMhj/6'.
|
||||
'staKczc/2RkwjS2glQ+w3YytgXCXCZpRo8gJdGxZadJws13CUP'.
|
||||
'4SZI4MYiUxypeiGGw1XShVBTNN9kLXP2GRrZPFvKgd7z/sqGGV'.
|
||||
'7C7r7r3l09alYN3iA8Yn+ImdVrNoEeSRqJPAaHfhZzLYwXstdZ'.
|
||||
'rP3n2bvdAI4INwtihiwAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bullets_balls_pp_019.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 334 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAM1'.
|
||||
'BMVEX////+/v7i4eO/w8eHxcvKroNVormtfkjrMN2BeXQrepPc'.
|
||||
'Esy4IL+OFaR7F25LHF8mFRh5XXtUAAAAAXRSTlMAQObYZgAAAA'.
|
||||
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
|
||||
'RQfTAxcBNgkjEpIxAAAAlElEQVR4nE2QAQ7FIAhDDTAVndL7n3'.
|
||||
'ZV/7JfEwMvFIWUlkTMVNInbVv5ZeJqG7Smh2QTBwJBpsdizAZP'.
|
||||
'5NyW0awhK8kYodnZxS6ECvPRp2sI+y7PBv1mN02KH7h77QCJ8D'.
|
||||
'4VvY5NUgEmCwj6ZMzHtJRgRSXwC1gfcqJJH0GBnSnK1kUQ72DY'.
|
||||
'CPBv+MCS/e0jib77eQAJxwiEWm7hFwAAAABJRU5ErkJggg==' ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,178 +1,178 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_DIAMONDS.INC
|
||||
// Description: Base64 encoded images for diamonds
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_diamonds.inc 20 2005-05-30 20:34:41Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Diamonds extends ImgData {
|
||||
protected $name = 'Diamonds';
|
||||
protected $an = array(MARK_IMG_DIAMOND =>'imgdata');
|
||||
protected $colors = array('lightblue','darkblue','gray',
|
||||
'blue','pink','purple','red','yellow');
|
||||
protected $index = array('lightblue' =>7,'darkblue'=>2,'gray'=>6,
|
||||
'blue'=>4,'pink'=>1,'purple'=>5,'red'=>0,'yellow'=>3);
|
||||
|
||||
protected $maxidx = 7 ;
|
||||
protected $imgdata ;
|
||||
|
||||
function ImgData_Diamonds() {
|
||||
//==========================================================
|
||||
// File: diam_red.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 668 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/F'.
|
||||
'BMVEX///////+cAAD/AADOAABjAABrAADWGBjOCAj/CAj/GBj/'.
|
||||
'EBCcCAiMOTl7KSl7ISFzGBilGBjOEBBrCAjv5+eMQkK1QkKtMT'.
|
||||
'GtKSnWKSn/KSlzEBCcEBDexsb/tbXOe3ucWlqcUlKUSkr/e3vn'.
|
||||
'a2u9UlL/a2uEMTHeUlLeSkqtOTn/UlL/SkrWOTn/QkL/OTmlIS'.
|
||||
'H/MTH/ISH39/f/9/f35+fezs7/5+fvzs7WtbXOra3nvb3/zs7G'.
|
||||
'nJzvtbXGlJTepaW9jIy1hITWlJS1e3uta2ulY2P/lJTnhITne3'.
|
||||
'vGY2O9Wlr/c3PeY2O1Skr/Y2P/WlreQkLWISGlEBCglEUaAAAA'.
|
||||
'AXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAA'.
|
||||
'sSAdLdfvwAAAAHdElNRQfTAwsWEw5WI4qnAAABGUlEQVR4nHXQ'.
|
||||
'1XLDMBAFUKUCM1NiO8zcpIxpp8z0//9SWY7b2LHv6EU6s1qtAN'.
|
||||
'iMBAojLPkigpJvogKC4pxDuQipjanlICXof1RQDkYEF21mKIfg'.
|
||||
'/GGKtjAmOKt9oSyuCU7OhyiDCQnjowGfRnooCJIkiWJvv8NxnG'.
|
||||
'nyNAwFcekvZpPP3mu7Vrp8fOq8DYbTyjdnAvBj7Jbd7nP95urs'.
|
||||
'+MC2D6unF+Cu0VJULQBAlsOQuueN3Hrp2nGUvqppemBZ0aU7Se'.
|
||||
'SXvYZFMKaLJn7MH3btJmZEMEmGSOreqy0SI/4ffo3uiUOYEACy'.
|
||||
'OFopmNWlP5uZd9uPWmUoxvK9ilO9NtBo6mS7KkZD0fOJYqgGBU'.
|
||||
'S/T7OKCAA9tfsFOicXcbxt29cAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_pink.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 262 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgID/M5n/Zpn/zMz/mZn1xELhAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEi3tX8qUAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_blue.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 662 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA+V'.
|
||||
'BMVEX///+AgIAAAJwAAP8AAM4AAGMAAGsQEP8YGHMQEHMYGP8Q'.
|
||||
'EKUICJwICM5KSpQxMYQpKXsYGNYQEM4ICGsICP97e85aWpw5OY'.
|
||||
'xSUv85ObVCQt4xMa0pKa0hIaUpKf+9vd6EhLVra+dzc/9SUr1r'.
|
||||
'a/9aWt5SUt5CQrVaWv9KSv8hIXs5Of8xMf8pKdYhIdYYGKUhIf'.
|
||||
'/Ozs739//v7/fn5+/v7//n5/fW1ufOzufOzu/W1v+trc69veel'.
|
||||
'pc6trd6UlMa9vf+MjL21tfe1tf+UlNZzc61ra6Wlpf+EhOeMjP'.
|
||||
'9ra8ZSUpyEhP9CQoxKSrVCQv85Od4xMdYQENZnJhlWAAAAAXRS'.
|
||||
'TlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAd'.
|
||||
'LdfvwAAAAHdElNRQfTAwsWEx3Snct5AAABFklEQVR4nHXR5XbD'.
|
||||
'IBgGYM6AuHsaqbvOfeuknev9X8xISbplSd5/8JyXwwcA/I0AKm'.
|
||||
'PFchVBdvKNKggKQx2VIoRwMZihMiQE49YUlWBCcPL0hYq4ITh+'.
|
||||
'qKECUoLDZWqoQNA766F/mJHlHXblPJJNiyURhM5eU9cNw5BlmS'.
|
||||
'IrLOLxhzfotF7vwO2j3ez2ap/TmW4AIM7DoN9+tu+vLk6Pdg9O'.
|
||||
'6ufXjfXLm6pxPACSJIpRFAa+/26DhuK6qjbiON40k0N3skjOvm'.
|
||||
'NijBmchF5mi+1jhQqDmWyIzPp1hUlrv8On5l+6mMm1tigFNyrt'.
|
||||
'5R97g+FKKyGKkTNKesXPJTZXOFIrUoKiypcTQVHjK4g8H2dWEQ'.
|
||||
'B8bvUDLSQXSr41rmEAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_yellow.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 262 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgIBmMwCZZgD/zADMmQD/QLMZAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEwcv/zIDAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_lightblue.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 671 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/1'.
|
||||
'BMVEX///+AgIAAnP8A//8Azv8AY/8Aa/8I//8Y1v8Izv8Y//8Q'.
|
||||
'//8InP8Qzv8Ypf85jP8he/8Yc/8Ia/8pe/8p//8p1v9Ctf8xrf'.
|
||||
'8prf8QnP8Qc/9CjP+1//97//9r//9S//9K//9C//85//8x//8h'.
|
||||
'//9r5/9K3v9S3v851v97zv9Svf85rf8hpf/G3v9SnP9anP9KlP'.
|
||||
'8xhP/n7//v7+f3///n///O//+U//9z//9j//9a//975/9C3v8h'.
|
||||
'1v+E5/+17/9j3v/O7//n9/+95/+l3v9jxv+U1v8Qpf9avf9Ktf'.
|
||||
'+Uxv+11v97tf9rrf+cxv+Mvf9jpf+tzv+Etf/O3v/39/8Akkxr'.
|
||||
'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx'.
|
||||
'IAAAsSAdLdfvwAAAAHdElNRQfTAwsWEiHk6Ya/AAABGUlEQVR4'.
|
||||
'nHXQ13KDMBAF0J2o0E01GHDvJa7p3em95/+/JQJMYjDc0Yt0Zr'.
|
||||
'VaAaxHgtxwbSGPkGQpOIeQ2ORxJiJmNWYZyAhZR0WcgQGhViU0'.
|
||||
'nEGoedDHGxgRapRPcRpXhOr7XZzCmLjaXk9IIjvkOEmSRLG62+'.
|
||||
'F5XlEElhA5sW21GvXj6mGlDBfnJ51lr9svnvEKwH1hu2QPbwd3'.
|
||||
'N9eXVzuL7/Hn29frdKaamgcgy67L3HFG9gDefV+dm5qme4YRXL'.
|
||||
'oVR374mRqUELZYosf84XAxISFRQuMh4rrH8YxGSP6HX6H97NNQ'.
|
||||
'KEAaR08qCeuSnx2a8zIPWqUowtKHSRK91rAw0elmVYQFVc8mhq'.
|
||||
'7p5RD7Ps3IIwA9sfsFxFUX6eZ4Zh4AAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_purple.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 657 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/F'.
|
||||
'BMVEX///////8xAP/OAP+cAP9jAP9rAP+cCP85CP/OEP9SKf/O'.
|
||||
'CP9CEP9zGP9rCP+lGP/WOf/WIf9KIf9jOf+MQv+EMf97If9zEP'.
|
||||
'+1Sv+lIf/ne//eUv/na//n5//Oxv/Wzv+chP9zUv97Wv9rQv9a'.
|
||||
'Mf9KGP/v5/+te/97Kf+9Y/+tOf+tKf+lEP/vtf/WMf/WKf/v7+'.
|
||||
'f39/+tnP+9rf9rSv9jQv9CGP+ljP+EY//Gtf+tlP+Ma/9zSv/e'.
|
||||
'zv+UUv+9lP+cWv+lY/+cUv+MOf+EKf+UQv/Opf/OhP/Ga/+1Qv'.
|
||||
'/Oe/+9Uv/ntf/eWv/eSv/WGP/3zv/vlP/WEP//9/+pL4oHAAAA'.
|
||||
'AXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAA'.
|
||||
'sSAdLdfvwAAAAHdElNRQfTAwsWEjX+M1LCAAABDklEQVR4nHXQ'.
|
||||
'1bLDIBAGYFqIEW+ksbr7cXd3ff93OUCamdOE/Mxw882yywLwPz'.
|
||||
'+gNKotlRFUVnNUQlCxTMRFCKEdE+MgpJaEiIOU4DKaoSIygtb3'.
|
||||
'FBUQrm3xjPK4JvXjK0A5hFniYSBtIilQVYUm+X0KTVNiYah+2q'.
|
||||
'ulFb8nUbSovD2+TCavwXQWmnMA6ro+di+uR5cPzfPhVqPV3N1p'.
|
||||
'n3b3+rimAWAYhP3xnXd7P6oc9vadPsa1wYEs00dFQRAFehlX21'.
|
||||
'25Sg9NOgwF5jeNTjVL9om0TjDc1lmeCKZ17nFPzhPtSRt6J06R'.
|
||||
'WKUoeG3MoXRa/wjLHGLodwZcotPqjsYngnWslRBZH91hWTbpD2'.
|
||||
'EdF1ECWW1SAAAAAElFTkSuQmCC' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_gray.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 262 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX//////wAzMzNmZmbMzMyZmZlq4Qo5AAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWExZFTxLxAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_blgr.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 262 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgIBmzP9m///M//+Z//8hMmBVAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEwCxm6egAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_DIAMONDS.INC
|
||||
// Description: Base64 encoded images for diamonds
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_diamonds.inc 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Diamonds extends ImgData {
|
||||
var $name = 'Diamonds';
|
||||
var $an = array(MARK_IMG_DIAMOND =>'imgdata');
|
||||
var $colors = array('lightblue','darkblue','gray',
|
||||
'blue','pink','purple','red','yellow');
|
||||
var $index = array('lightblue' =>7,'darkblue'=>2,'gray'=>6,
|
||||
'blue'=>4,'pink'=>1,'purple'=>5,'red'=>0,'yellow'=>3);
|
||||
|
||||
var $maxidx = 7 ;
|
||||
var $imgdata ;
|
||||
|
||||
function ImgData_Diamonds() {
|
||||
//==========================================================
|
||||
// File: diam_red.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 668 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/F'.
|
||||
'BMVEX///////+cAAD/AADOAABjAABrAADWGBjOCAj/CAj/GBj/'.
|
||||
'EBCcCAiMOTl7KSl7ISFzGBilGBjOEBBrCAjv5+eMQkK1QkKtMT'.
|
||||
'GtKSnWKSn/KSlzEBCcEBDexsb/tbXOe3ucWlqcUlKUSkr/e3vn'.
|
||||
'a2u9UlL/a2uEMTHeUlLeSkqtOTn/UlL/SkrWOTn/QkL/OTmlIS'.
|
||||
'H/MTH/ISH39/f/9/f35+fezs7/5+fvzs7WtbXOra3nvb3/zs7G'.
|
||||
'nJzvtbXGlJTepaW9jIy1hITWlJS1e3uta2ulY2P/lJTnhITne3'.
|
||||
'vGY2O9Wlr/c3PeY2O1Skr/Y2P/WlreQkLWISGlEBCglEUaAAAA'.
|
||||
'AXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAA'.
|
||||
'sSAdLdfvwAAAAHdElNRQfTAwsWEw5WI4qnAAABGUlEQVR4nHXQ'.
|
||||
'1XLDMBAFUKUCM1NiO8zcpIxpp8z0//9SWY7b2LHv6EU6s1qtAN'.
|
||||
'iMBAojLPkigpJvogKC4pxDuQipjanlICXof1RQDkYEF21mKIfg'.
|
||||
'/GGKtjAmOKt9oSyuCU7OhyiDCQnjowGfRnooCJIkiWJvv8NxnG'.
|
||||
'nyNAwFcekvZpPP3mu7Vrp8fOq8DYbTyjdnAvBj7Jbd7nP95urs'.
|
||||
'+MC2D6unF+Cu0VJULQBAlsOQuueN3Hrp2nGUvqppemBZ0aU7Se'.
|
||||
'SXvYZFMKaLJn7MH3btJmZEMEmGSOreqy0SI/4ffo3uiUOYEACy'.
|
||||
'OFopmNWlP5uZd9uPWmUoxvK9ilO9NtBo6mS7KkZD0fOJYqgGBU'.
|
||||
'S/T7OKCAA9tfsFOicXcbxt29cAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_pink.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 262 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgID/M5n/Zpn/zMz/mZn1xELhAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEi3tX8qUAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_blue.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 662 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA+V'.
|
||||
'BMVEX///+AgIAAAJwAAP8AAM4AAGMAAGsQEP8YGHMQEHMYGP8Q'.
|
||||
'EKUICJwICM5KSpQxMYQpKXsYGNYQEM4ICGsICP97e85aWpw5OY'.
|
||||
'xSUv85ObVCQt4xMa0pKa0hIaUpKf+9vd6EhLVra+dzc/9SUr1r'.
|
||||
'a/9aWt5SUt5CQrVaWv9KSv8hIXs5Of8xMf8pKdYhIdYYGKUhIf'.
|
||||
'/Ozs739//v7/fn5+/v7//n5/fW1ufOzufOzu/W1v+trc69veel'.
|
||||
'pc6trd6UlMa9vf+MjL21tfe1tf+UlNZzc61ra6Wlpf+EhOeMjP'.
|
||||
'9ra8ZSUpyEhP9CQoxKSrVCQv85Od4xMdYQENZnJhlWAAAAAXRS'.
|
||||
'TlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAd'.
|
||||
'LdfvwAAAAHdElNRQfTAwsWEx3Snct5AAABFklEQVR4nHXR5XbD'.
|
||||
'IBgGYM6AuHsaqbvOfeuknev9X8xISbplSd5/8JyXwwcA/I0AKm'.
|
||||
'PFchVBdvKNKggKQx2VIoRwMZihMiQE49YUlWBCcPL0hYq4ITh+'.
|
||||
'qKECUoLDZWqoQNA766F/mJHlHXblPJJNiyURhM5eU9cNw5BlmS'.
|
||||
'IrLOLxhzfotF7vwO2j3ez2ap/TmW4AIM7DoN9+tu+vLk6Pdg9O'.
|
||||
'6ufXjfXLm6pxPACSJIpRFAa+/26DhuK6qjbiON40k0N3skjOvm'.
|
||||
'NijBmchF5mi+1jhQqDmWyIzPp1hUlrv8On5l+6mMm1tigFNyrt'.
|
||||
'5R97g+FKKyGKkTNKesXPJTZXOFIrUoKiypcTQVHjK4g8H2dWEQ'.
|
||||
'B8bvUDLSQXSr41rmEAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_yellow.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 262 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgIBmMwCZZgD/zADMmQD/QLMZAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEwcv/zIDAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_lightblue.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 671 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/1'.
|
||||
'BMVEX///+AgIAAnP8A//8Azv8AY/8Aa/8I//8Y1v8Izv8Y//8Q'.
|
||||
'//8InP8Qzv8Ypf85jP8he/8Yc/8Ia/8pe/8p//8p1v9Ctf8xrf'.
|
||||
'8prf8QnP8Qc/9CjP+1//97//9r//9S//9K//9C//85//8x//8h'.
|
||||
'//9r5/9K3v9S3v851v97zv9Svf85rf8hpf/G3v9SnP9anP9KlP'.
|
||||
'8xhP/n7//v7+f3///n///O//+U//9z//9j//9a//975/9C3v8h'.
|
||||
'1v+E5/+17/9j3v/O7//n9/+95/+l3v9jxv+U1v8Qpf9avf9Ktf'.
|
||||
'+Uxv+11v97tf9rrf+cxv+Mvf9jpf+tzv+Etf/O3v/39/8Akkxr'.
|
||||
'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx'.
|
||||
'IAAAsSAdLdfvwAAAAHdElNRQfTAwsWEiHk6Ya/AAABGUlEQVR4'.
|
||||
'nHXQ13KDMBAF0J2o0E01GHDvJa7p3em95/+/JQJMYjDc0Yt0Zr'.
|
||||
'VaAaxHgtxwbSGPkGQpOIeQ2ORxJiJmNWYZyAhZR0WcgQGhViU0'.
|
||||
'nEGoedDHGxgRapRPcRpXhOr7XZzCmLjaXk9IIjvkOEmSRLG62+'.
|
||||
'F5XlEElhA5sW21GvXj6mGlDBfnJ51lr9svnvEKwH1hu2QPbwd3'.
|
||||
'N9eXVzuL7/Hn29frdKaamgcgy67L3HFG9gDefV+dm5qme4YRXL'.
|
||||
'oVR374mRqUELZYosf84XAxISFRQuMh4rrH8YxGSP6HX6H97NNQ'.
|
||||
'KEAaR08qCeuSnx2a8zIPWqUowtKHSRK91rAw0elmVYQFVc8mhq'.
|
||||
'7p5RD7Ps3IIwA9sfsFxFUX6eZ4Zh4AAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_purple.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 657 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAAA/F'.
|
||||
'BMVEX///////8xAP/OAP+cAP9jAP9rAP+cCP85CP/OEP9SKf/O'.
|
||||
'CP9CEP9zGP9rCP+lGP/WOf/WIf9KIf9jOf+MQv+EMf97If9zEP'.
|
||||
'+1Sv+lIf/ne//eUv/na//n5//Oxv/Wzv+chP9zUv97Wv9rQv9a'.
|
||||
'Mf9KGP/v5/+te/97Kf+9Y/+tOf+tKf+lEP/vtf/WMf/WKf/v7+'.
|
||||
'f39/+tnP+9rf9rSv9jQv9CGP+ljP+EY//Gtf+tlP+Ma/9zSv/e'.
|
||||
'zv+UUv+9lP+cWv+lY/+cUv+MOf+EKf+UQv/Opf/OhP/Ga/+1Qv'.
|
||||
'/Oe/+9Uv/ntf/eWv/eSv/WGP/3zv/vlP/WEP//9/+pL4oHAAAA'.
|
||||
'AXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAA'.
|
||||
'sSAdLdfvwAAAAHdElNRQfTAwsWEjX+M1LCAAABDklEQVR4nHXQ'.
|
||||
'1bLDIBAGYFqIEW+ksbr7cXd3ff93OUCamdOE/Mxw882yywLwPz'.
|
||||
'+gNKotlRFUVnNUQlCxTMRFCKEdE+MgpJaEiIOU4DKaoSIygtb3'.
|
||||
'FBUQrm3xjPK4JvXjK0A5hFniYSBtIilQVYUm+X0KTVNiYah+2q'.
|
||||
'ulFb8nUbSovD2+TCavwXQWmnMA6ro+di+uR5cPzfPhVqPV3N1p'.
|
||||
'n3b3+rimAWAYhP3xnXd7P6oc9vadPsa1wYEs00dFQRAFehlX21'.
|
||||
'25Sg9NOgwF5jeNTjVL9om0TjDc1lmeCKZ17nFPzhPtSRt6J06R'.
|
||||
'WKUoeG3MoXRa/wjLHGLodwZcotPqjsYngnWslRBZH91hWTbpD2'.
|
||||
'EdF1ECWW1SAAAAAElFTkSuQmCC' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_gray.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 262 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX//////wAzMzNmZmbMzMyZmZlq4Qo5AAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWExZFTxLxAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: diam_blgr.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 262 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABsAAAAbBAMAAAB/+ulmAAAAEl'.
|
||||
'BMVEX///+AgIBmzP9m///M//+Z//8hMmBVAAAAAXRSTlMAQObY'.
|
||||
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
|
||||
'AHdElNRQfTAwsWEwCxm6egAAAAbUlEQVR4nFXJwQ3AMAhDUdRm'.
|
||||
'kKojuCswABf2X6UEEiC+WF+PyDfoGEuvwXogq3Rk1Y6W0tBSG8'.
|
||||
'6Uwpla6CmJnpoYKRsjjb/Y63vo9kIkLcZCCsbGYGwMRqIzEp1R'.
|
||||
'OBmFk9HQGA2N0ZEIz5HX+h/jailYpfz4dAAAAABJRU5ErkJggg'.
|
||||
'==' ;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,151 +1,151 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_SQUARES.INC
|
||||
// Description: Base64 encoded images for squares
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_squares.inc 20 2005-05-30 20:34:41Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Squares extends ImgData {
|
||||
protected $name = 'Squares';
|
||||
protected $an = array(MARK_IMG_SQUARE =>'imgdata');
|
||||
|
||||
protected $colors = array('bluegreen','blue','green',
|
||||
'lightblue','orange','purple','red','yellow');
|
||||
protected $index = array('bluegreen' =>2,'blue'=>5,'green'=>6,
|
||||
'lightblue'=>0,'orange'=>7,'purple'=>4,'red'=>3,'yellow'=>1);
|
||||
protected $maxidx = 7 ;
|
||||
protected $imgdata ;
|
||||
|
||||
function ImgData_Squares () {
|
||||
//==========================================================
|
||||
//sq_lblue.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 362 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAABm'.
|
||||
'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA'.
|
||||
'B3RJTUUH0wMLFgojiPx/ygAAAPdJREFUeNpj/P377+kzHx89/c'.
|
||||
'VAHNBQ5VBX52HavPWWjg6nnDQbkXoUFTnnL7zD9PPXrz17HxCj'.
|
||||
'E6Jn6fL7H7/+ZWJgYCBGJ7IeBgYGJogofp1oehDa8OjE1IOiDa'.
|
||||
'tOrHoYGBhY0NwD0enirMDAwMDFxYRVD7ptyDrNTAU0NXix6sGu'.
|
||||
'jYGBgZOT9e/f/0xMjFyczFgVsGAKCfBza2kKzpl3hIuT1c9Xb/'.
|
||||
'PW58/foKchJqx6tmy98vbjj8cvPm/afMnXW1JShA2fNmQ9EBFc'.
|
||||
'Opnw6MGjkwm/Hlw6mQjqwaqTiRg9mDoZv//4M2/+UYJ64EBWgj'.
|
||||
'cm2hwA8l24oNDl+DMAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_yellow.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 338 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAWl'.
|
||||
'BMVEX////+/+H+/9/9/9v8/8P8/8H8/7v8/7n6/4P5/335/3n5'.
|
||||
'/3X4/1f4/1P3/031/w30/wn0/wPt+ADp9ADm8ADk7gDc5gDa5A'.
|
||||
'DL1ADFzgCwuACqsgClrABzeAC9M0MzAAAAAWJLR0QAiAUdSAAA'.
|
||||
'AAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEDlOgDj'.
|
||||
'EAAAB+SURBVHjaVcpbCsQgDEDRGERGKopjDa2a/W9zfLWj9/Nw'.
|
||||
'Ac21ZRBOtZlRN9ApzSYFaDUj79KIorRDbJNO9bN/GUSh2ZRJFJ'.
|
||||
'S18iorURBiyksO8buT0zkfYaUqzI91ckfhWhoGXTLzsDjI68Sz'.
|
||||
'pGMjrzPzauA/iXk1AtykmvgBC8UcWUdc9HkAAAAASUVORK5CYI'.
|
||||
'I=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_blgr.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 347 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAZl'.
|
||||
'BMVEX////0+vv0+vrz+fry+frv+Png7e/d7e/a6+zY6+250tSz'.
|
||||
'0tSyztCtztGM0NWIz9SDzdNfsLVcrrRZrbJOp61MpqtIr7dHn6'.
|
||||
'RErrZArLQ6q7M2g4kygYcsp68npa4ctr8QZ20JnqepKsl4AAAA'.
|
||||
'AWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU'.
|
||||
'1FB9MDCxYEByp8tpUAAAB7SURBVHjaVcjRFoIgDADQWZpWJpjY'.
|
||||
'MsnG//9kzIFn3McLzfArDA3MndFjrhvgfDHFBEB9pt0CVzwrY3'.
|
||||
'n2yicjhY4vTSp0nbXtN+hCV53SHDWe61dZY+/9463r2XuifHAM'.
|
||||
'0SoH+6xEcovUlCfefeFSIwfTTQ3fB+pi4lV/bTIgvmaA7a0AAA'.
|
||||
'AASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_red.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 324 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAXV'.
|
||||
'BMVEX////++Pn99/j99ff99fb98/X98/T98PL55uj43+P24+bw'.
|
||||
'kKPvjaHviJ3teJHpxMnoL2Pjs73WW3rWNljVWXnUVnbUK1DTJk'.
|
||||
'3SUHPOBz/KQmmxPVmuOFasNFOeIkWVka/fAAAAAWJLR0QAiAUd'.
|
||||
'SAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEHd'.
|
||||
'ceT+8AAABtSURBVHjaVchbAkMwEAXQq6i3VrQiQfa/zDYTw8z5'.
|
||||
'PCjGt9JVWFt1XWPh1fWNdfDy+tq6WPfRUPENNKnSnXNWPB4uv2'.
|
||||
'b54nSZ8jHrMtOxvWZZZtpD4KP6xLkO9/AhzhaCOMhJh68cOjzV'.
|
||||
'/K/4Ac2cG+nBcaRuAAAAAElFTkSuQmCC' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_pink.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 445 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAApV'.
|
||||
'BMVEX////6+Pz69/v49Pr38/r17/jr4+/l3Onj2efh1ua/L+i+'.
|
||||
'q8m+Lue9Lua8qsS8LuW8LeS7pca5LOG4LN+2Y9O2YNW1ZdO1Kt'.
|
||||
'y0atC0aNGzb82zbc6zKtuzKdqycsuwa8qtJtOISZ2GRpuFN6GE'.
|
||||
'NqCDQpmCMZ+BPpd/LJ1/K519S5B9Jpx9Jpt9JZt6RY11BJZ1BJ'.
|
||||
'V0BJV0BJRzBJNvNoRtIoJUEmdZ/XbrAAAAAWJLR0QAiAUdSAAA'.
|
||||
'AAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYDF3iKMD'.
|
||||
'YAAACeSURBVHjaVczbEoIgGARgCiMtrexoWpaa2FHUgvd/tH4Y'.
|
||||
'BnEvv9ldhNPradPnnGBUTtPDzMRPSIF46SaBoR25dYjz3I20Lb'.
|
||||
'ek6BgQz73Il7KKpSgCO0pTHU0886J1sCe0ZYbALjGhjFnEM2es'.
|
||||
'VhZVI4d+B1QtfnV47ywCEaKeP/p7JdLejSYt0j6NIiOq1wJZIs'.
|
||||
'QTDA0ELHwhPBCwyR/Cni9cOmzJtwAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_blue.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 283 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAQl'.
|
||||
'BMVEX////4+fz39/z19vvy8vru7/ni4+7g4fHW1ue8vteXmt6B'.
|
||||
'hdhiZ7FQVaZETcxCSJo1Oq4zNoMjKakhJHcKFaMEC2jRVYdWAA'.
|
||||
'AAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0'.
|
||||
'SU1FB9MDCxYDN0PkEP4AAABfSURBVHjaVchHAoAgDATAVcCCIF'.
|
||||
'j4/1elJEjmOFDHKVgDv4iz640gLs+LMF6ZUv/VqcXXplU7Gqpy'.
|
||||
'PFzBT5qml9NzlOX259riWHlS4kOffviHD8PQYZx2EFMPRkw+9Q'.
|
||||
'FSnRPeWEDzKAAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_green.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 325 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAXV'.
|
||||
'BMVEX////2+vX1+vX1+fT0+fPz+PPx9/Dv9u7u9e3h7uHe697a'.
|
||||
'6dnO2s3I1sa10LOvza2ay5aEwYBWlE9TqE5Tkk1RkEpMrUJMg0'.
|
||||
'hKiUNGpEFBojw8oTcsbScaYBMWlwmMT0NtAAAAAWJLR0QAiAUd'.
|
||||
'SAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEFd'.
|
||||
'nFx90AAABuSURBVHjaVc9HAoAgDADB2HuJWLDx/2cKBITscW4L'.
|
||||
'5byzMIWtZobNDZIZtrcCGZsRQ8GwvRSRNxIiMuysODKG3alikl'.
|
||||
'ueOPlpKTLBaRmOZxQxaXlfb5ZWI9om4WntrXiDSJzp7SBkwMQa'.
|
||||
'FEy0VR/NAB2kNuj7rgAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_orange.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 321 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAUV'.
|
||||
'BMVEX/////8+n/8uf/8OP/59H/5Mv/zqH/zJ3/ypv/yJf/vYH/'.
|
||||
'u33/uXn/n0n/nUX/m0H/lzn/ljf/lDP/kS3/kCv/iR//hxv/fg'.
|
||||
'n/fAX/eQDYZgDW6ia5AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAL'.
|
||||
'EgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEJIgbx+cAAAB2SURBVH'.
|
||||
'jaVczRCoQwDETRbLAWLZSGUA35/w/dVI0283i4DODew3YESmWW'.
|
||||
'kg5gWkoQAe6TleUQI/66Sy7i56+kLk7cht2N0+hcnJgQu0SqiC'.
|
||||
'1SzSIbzWSi6gavqJ63wSduRi2f+kwyD5rEukwCdZ1kGAMGMfv9'.
|
||||
'AbWuGMOr5COSAAAAAElFTkSuQmCC' ;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_SQUARES.INC
|
||||
// Description: Base64 encoded images for squares
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_squares.inc 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class ImgData_Squares extends ImgData {
|
||||
var $name = 'Squares';
|
||||
var $an = array(MARK_IMG_SQUARE =>'imgdata');
|
||||
|
||||
var $colors = array('bluegreen','blue','green',
|
||||
'lightblue','orange','purple','red','yellow');
|
||||
var $index = array('bluegreen' =>2,'blue'=>5,'green'=>6,
|
||||
'lightblue'=>0,'orange'=>7,'purple'=>4,'red'=>3,'yellow'=>1);
|
||||
var $maxidx = 7 ;
|
||||
var $imgdata ;
|
||||
|
||||
function ImgData_Squares () {
|
||||
//==========================================================
|
||||
//sq_lblue.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 362 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAIAAADZrBkAAAAABm'.
|
||||
'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA'.
|
||||
'B3RJTUUH0wMLFgojiPx/ygAAAPdJREFUeNpj/P377+kzHx89/c'.
|
||||
'VAHNBQ5VBX52HavPWWjg6nnDQbkXoUFTnnL7zD9PPXrz17HxCj'.
|
||||
'E6Jn6fL7H7/+ZWJgYCBGJ7IeBgYGJogofp1oehDa8OjE1IOiDa'.
|
||||
'tOrHoYGBhY0NwD0enirMDAwMDFxYRVD7ptyDrNTAU0NXix6sGu'.
|
||||
'jYGBgZOT9e/f/0xMjFyczFgVsGAKCfBza2kKzpl3hIuT1c9Xb/'.
|
||||
'PW58/foKchJqx6tmy98vbjj8cvPm/afMnXW1JShA2fNmQ9EBFc'.
|
||||
'Opnw6MGjkwm/Hlw6mQjqwaqTiRg9mDoZv//4M2/+UYJ64EBWgj'.
|
||||
'cm2hwA8l24oNDl+DMAAAAASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_yellow.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 338 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAWl'.
|
||||
'BMVEX////+/+H+/9/9/9v8/8P8/8H8/7v8/7n6/4P5/335/3n5'.
|
||||
'/3X4/1f4/1P3/031/w30/wn0/wPt+ADp9ADm8ADk7gDc5gDa5A'.
|
||||
'DL1ADFzgCwuACqsgClrABzeAC9M0MzAAAAAWJLR0QAiAUdSAAA'.
|
||||
'AAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEDlOgDj'.
|
||||
'EAAAB+SURBVHjaVcpbCsQgDEDRGERGKopjDa2a/W9zfLWj9/Nw'.
|
||||
'Ac21ZRBOtZlRN9ApzSYFaDUj79KIorRDbJNO9bN/GUSh2ZRJFJ'.
|
||||
'S18iorURBiyksO8buT0zkfYaUqzI91ckfhWhoGXTLzsDjI68Sz'.
|
||||
'pGMjrzPzauA/iXk1AtykmvgBC8UcWUdc9HkAAAAASUVORK5CYI'.
|
||||
'I=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_blgr.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 347 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAZl'.
|
||||
'BMVEX////0+vv0+vrz+fry+frv+Png7e/d7e/a6+zY6+250tSz'.
|
||||
'0tSyztCtztGM0NWIz9SDzdNfsLVcrrRZrbJOp61MpqtIr7dHn6'.
|
||||
'RErrZArLQ6q7M2g4kygYcsp68npa4ctr8QZ20JnqepKsl4AAAA'.
|
||||
'AWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU'.
|
||||
'1FB9MDCxYEByp8tpUAAAB7SURBVHjaVcjRFoIgDADQWZpWJpjY'.
|
||||
'MsnG//9kzIFn3McLzfArDA3MndFjrhvgfDHFBEB9pt0CVzwrY3'.
|
||||
'n2yicjhY4vTSp0nbXtN+hCV53SHDWe61dZY+/9463r2XuifHAM'.
|
||||
'0SoH+6xEcovUlCfefeFSIwfTTQ3fB+pi4lV/bTIgvmaA7a0AAA'.
|
||||
'AASUVORK5CYII=' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_red.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 324 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAXV'.
|
||||
'BMVEX////++Pn99/j99ff99fb98/X98/T98PL55uj43+P24+bw'.
|
||||
'kKPvjaHviJ3teJHpxMnoL2Pjs73WW3rWNljVWXnUVnbUK1DTJk'.
|
||||
'3SUHPOBz/KQmmxPVmuOFasNFOeIkWVka/fAAAAAWJLR0QAiAUd'.
|
||||
'SAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEHd'.
|
||||
'ceT+8AAABtSURBVHjaVchbAkMwEAXQq6i3VrQiQfa/zDYTw8z5'.
|
||||
'PCjGt9JVWFt1XWPh1fWNdfDy+tq6WPfRUPENNKnSnXNWPB4uv2'.
|
||||
'b54nSZ8jHrMtOxvWZZZtpD4KP6xLkO9/AhzhaCOMhJh68cOjzV'.
|
||||
'/K/4Ac2cG+nBcaRuAAAAAElFTkSuQmCC' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_pink.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 445 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAApV'.
|
||||
'BMVEX////6+Pz69/v49Pr38/r17/jr4+/l3Onj2efh1ua/L+i+'.
|
||||
'q8m+Lue9Lua8qsS8LuW8LeS7pca5LOG4LN+2Y9O2YNW1ZdO1Kt'.
|
||||
'y0atC0aNGzb82zbc6zKtuzKdqycsuwa8qtJtOISZ2GRpuFN6GE'.
|
||||
'NqCDQpmCMZ+BPpd/LJ1/K519S5B9Jpx9Jpt9JZt6RY11BJZ1BJ'.
|
||||
'V0BJV0BJRzBJNvNoRtIoJUEmdZ/XbrAAAAAWJLR0QAiAUdSAAA'.
|
||||
'AAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYDF3iKMD'.
|
||||
'YAAACeSURBVHjaVczbEoIgGARgCiMtrexoWpaa2FHUgvd/tH4Y'.
|
||||
'BnEvv9ldhNPradPnnGBUTtPDzMRPSIF46SaBoR25dYjz3I20Lb'.
|
||||
'ek6BgQz73Il7KKpSgCO0pTHU0886J1sCe0ZYbALjGhjFnEM2es'.
|
||||
'VhZVI4d+B1QtfnV47ywCEaKeP/p7JdLejSYt0j6NIiOq1wJZIs'.
|
||||
'QTDA0ELHwhPBCwyR/Cni9cOmzJtwAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_blue.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 283 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAQl'.
|
||||
'BMVEX////4+fz39/z19vvy8vru7/ni4+7g4fHW1ue8vteXmt6B'.
|
||||
'hdhiZ7FQVaZETcxCSJo1Oq4zNoMjKakhJHcKFaMEC2jRVYdWAA'.
|
||||
'AAAWJLR0QAiAUdSAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0'.
|
||||
'SU1FB9MDCxYDN0PkEP4AAABfSURBVHjaVchHAoAgDATAVcCCIF'.
|
||||
'j4/1elJEjmOFDHKVgDv4iz640gLs+LMF6ZUv/VqcXXplU7Gqpy'.
|
||||
'PFzBT5qml9NzlOX259riWHlS4kOffviHD8PQYZx2EFMPRkw+9Q'.
|
||||
'FSnRPeWEDzKAAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_green.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 325 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAXV'.
|
||||
'BMVEX////2+vX1+vX1+fT0+fPz+PPx9/Dv9u7u9e3h7uHe697a'.
|
||||
'6dnO2s3I1sa10LOvza2ay5aEwYBWlE9TqE5Tkk1RkEpMrUJMg0'.
|
||||
'hKiUNGpEFBojw8oTcsbScaYBMWlwmMT0NtAAAAAWJLR0QAiAUd'.
|
||||
'SAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEFd'.
|
||||
'nFx90AAABuSURBVHjaVc9HAoAgDADB2HuJWLDx/2cKBITscW4L'.
|
||||
'5byzMIWtZobNDZIZtrcCGZsRQ8GwvRSRNxIiMuysODKG3alikl'.
|
||||
'ueOPlpKTLBaRmOZxQxaXlfb5ZWI9om4WntrXiDSJzp7SBkwMQa'.
|
||||
'FEy0VR/NAB2kNuj7rgAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
//sq_orange.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 321 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAUV'.
|
||||
'BMVEX/////8+n/8uf/8OP/59H/5Mv/zqH/zJ3/ypv/yJf/vYH/'.
|
||||
'u33/uXn/n0n/nUX/m0H/lzn/ljf/lDP/kS3/kCv/iR//hxv/fg'.
|
||||
'n/fAX/eQDYZgDW6ia5AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAL'.
|
||||
'EgAACxIB0t1+/AAAAAd0SU1FB9MDCxYEJIgbx+cAAAB2SURBVH'.
|
||||
'jaVczRCoQwDETRbLAWLZSGUA35/w/dVI0283i4DODew3YESmWW'.
|
||||
'kg5gWkoQAe6TleUQI/66Sy7i56+kLk7cht2N0+hcnJgQu0SqiC'.
|
||||
'1SzSIbzWSi6gavqJ63wSduRi2f+kwyD5rEukwCdZ1kGAMGMfv9'.
|
||||
'AbWuGMOr5COSAAAAAElFTkSuQmCC' ;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,145 +1,145 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_STARS.INC
|
||||
// Description: Base64 encoded images for stars
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_stars.inc 20 2005-05-30 20:34:41Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
|
||||
class ImgData_Stars extends ImgData {
|
||||
protected $name = 'Stars';
|
||||
protected $an = array(MARK_IMG_STAR => 'imgdata');
|
||||
|
||||
protected $colors = array('bluegreen','lightblue','purple','blue','green','pink','red','yellow');
|
||||
protected $index = array('bluegreen'=>3,'lightblue'=>4,'purple'=>1,
|
||||
'blue'=>5,'green'=>0,'pink'=>7,'red'=>2,'yellow'=>6);
|
||||
protected $maxidx = 7 ;
|
||||
protected $imgdata ;
|
||||
|
||||
function ImgData_Stars() {
|
||||
//==========================================================
|
||||
// File: bstar_green_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 329 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAAUV'.
|
||||
'BMVEX///////+/v7+83rqcyY2Q/4R7/15y/1tp/05p/0lg/zdX'.
|
||||
'/zdX/zVV/zdO/zFJ9TFJvDFD4yg+8Bw+3iU68hwurhYotxYosx'.
|
||||
'YokBoTfwANgQFUp7DWAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF'.
|
||||
'HUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJj'.
|
||||
'CRyxgTAAAAcUlEQVR4nH3MSw6AIAwEUBL/IKBWwXL/g0pLojUS'.
|
||||
'ZzGLl8ko9Zumhr5iy66/GH0dp49llNPB5sTotDY5PVuLG6tnM9'.
|
||||
'CVKSIe1joSgPsAKSuANNaENFQvTAGzmheSkUpMBWeJZwqBT8wo'.
|
||||
'hmysD4bnnPsC/x8ItUdGPfAAAAAASUVORK5CYII=' ;
|
||||
//==========================================================
|
||||
// File: bstar_blred.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 325 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79uRJ6jWPOSUtKrb+ejWO+gWPaGTruJTr6rZvF2'.
|
||||
'RqC2ocqdVuCeV+egV/GsnLuIXL66rMSpcOyATbipY/OdWOp+VK'.
|
||||
'aTU9WhV+yJKBoLAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJwynv1'.
|
||||
'XVAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_red_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 325 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+eRFHzWG3SUmHnb37vWGr2WHG7Tlm+TljxZneg'.
|
||||
'Rk3KoaXgVmXnV2nxV227nJ++XGzErK3scIS4TVzzY3fqWG2mVF'.
|
||||
'zVU2PsV2rJFw9VAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJzCI0C'.
|
||||
'lSAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blgr_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 325 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79Ehp5Yx/NSq9Jvw+dYwu9YzfZOmbtOmb5myPFG'.
|
||||
'gqChvcpWteBXvedXxvGcsbtcpb6su8RwzOxNmrhjyvNYwupUjK'.
|
||||
'ZTr9VXwOyJhmWNAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJTC65k'.
|
||||
'vQAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blgr_002.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 325 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79EnpxY8/FS0dJv5+dY7+9Y9vBOubtOur5m8fFG'.
|
||||
'nKChycpW3uBX5+ZX8e2curtcvrqswsRw7OdNuLZj8/BY6udUpK'.
|
||||
'ZT1dRX7OtNkrW5AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJgXHeN'.
|
||||
'wwAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blue_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 325 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79EY55Yi/NSetJvledYiO9YkPZOb7tObr5mkvFG'.
|
||||
'X6ChrcpWgOBXhedXi/Gcpbtcf76sssRwnOxNcbhjk/NYiepUbK'.
|
||||
'ZTfdVXh+ynNEzzAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJhStyP'.
|
||||
'zCAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_oy_007.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 325 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+ejUTz11jSvVLn02/v1lj21li7q06+r07x2mag'.
|
||||
'lUbKxKHgy1bnz1fx1Ve7t5y+qlzEwqzs03C4pE3z2WPqz1imml'.
|
||||
'TVv1Ps01dGRjeyAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJjsGGc'.
|
||||
'GbAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_lred.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 325 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+eRJPzWN3SUr7nb9TvWNj2WOS7Tqi+TqnxZtyg'.
|
||||
'Ro/KocPgVsjnV9LxV927nLa+XLTErL7scN24TarzY9/qWNemVJ'.
|
||||
'jVU8LsV9VCwcc9AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJxi9ZY'.
|
||||
'GoAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: IMGDATA_STARS.INC
|
||||
// Description: Base64 encoded images for stars
|
||||
// Created: 2003-03-20
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: imgdata_stars.inc 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
|
||||
class ImgData_Stars extends ImgData {
|
||||
var $name = 'Stars';
|
||||
var $an = array(MARK_IMG_STAR => 'imgdata');
|
||||
|
||||
var $colors = array('bluegreen','lightblue','purple','blue','green','pink','red','yellow');
|
||||
var $index = array('bluegreen'=>3,'lightblue'=>4,'purple'=>1,
|
||||
'blue'=>5,'green'=>0,'pink'=>7,'red'=>2,'yellow'=>6);
|
||||
var $maxidx = 7 ;
|
||||
var $imgdata ;
|
||||
|
||||
function ImgData_Stars() {
|
||||
//==========================================================
|
||||
// File: bstar_green_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[0][0]= 329 ;
|
||||
$this->imgdata[0][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAAUV'.
|
||||
'BMVEX///////+/v7+83rqcyY2Q/4R7/15y/1tp/05p/0lg/zdX'.
|
||||
'/zdX/zVV/zdO/zFJ9TFJvDFD4yg+8Bw+3iU68hwurhYotxYosx'.
|
||||
'YokBoTfwANgQFUp7DWAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF'.
|
||||
'HUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJj'.
|
||||
'CRyxgTAAAAcUlEQVR4nH3MSw6AIAwEUBL/IKBWwXL/g0pLojUS'.
|
||||
'ZzGLl8ko9Zumhr5iy66/GH0dp49llNPB5sTotDY5PVuLG6tnM9'.
|
||||
'CVKSIe1joSgPsAKSuANNaENFQvTAGzmheSkUpMBWeJZwqBT8wo'.
|
||||
'hmysD4bnnPsC/x8ItUdGPfAAAAAASUVORK5CYII=' ;
|
||||
//==========================================================
|
||||
// File: bstar_blred.png
|
||||
//==========================================================
|
||||
$this->imgdata[1][0]= 325 ;
|
||||
$this->imgdata[1][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79uRJ6jWPOSUtKrb+ejWO+gWPaGTruJTr6rZvF2'.
|
||||
'RqC2ocqdVuCeV+egV/GsnLuIXL66rMSpcOyATbipY/OdWOp+VK'.
|
||||
'aTU9WhV+yJKBoLAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJwynv1'.
|
||||
'XVAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_red_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[2][0]= 325 ;
|
||||
$this->imgdata[2][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+eRFHzWG3SUmHnb37vWGr2WHG7Tlm+TljxZneg'.
|
||||
'Rk3KoaXgVmXnV2nxV227nJ++XGzErK3scIS4TVzzY3fqWG2mVF'.
|
||||
'zVU2PsV2rJFw9VAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJzCI0C'.
|
||||
'lSAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blgr_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[3][0]= 325 ;
|
||||
$this->imgdata[3][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79Ehp5Yx/NSq9Jvw+dYwu9YzfZOmbtOmb5myPFG'.
|
||||
'gqChvcpWteBXvedXxvGcsbtcpb6su8RwzOxNmrhjyvNYwupUjK'.
|
||||
'ZTr9VXwOyJhmWNAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJTC65k'.
|
||||
'vQAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blgr_002.png
|
||||
//==========================================================
|
||||
$this->imgdata[4][0]= 325 ;
|
||||
$this->imgdata[4][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79EnpxY8/FS0dJv5+dY7+9Y9vBOubtOur5m8fFG'.
|
||||
'nKChycpW3uBX5+ZX8e2curtcvrqswsRw7OdNuLZj8/BY6udUpK'.
|
||||
'ZT1dRX7OtNkrW5AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJgXHeN'.
|
||||
'wwAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_blue_001.png
|
||||
//==========================================================
|
||||
$this->imgdata[5][0]= 325 ;
|
||||
$this->imgdata[5][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v79EY55Yi/NSetJvledYiO9YkPZOb7tObr5mkvFG'.
|
||||
'X6ChrcpWgOBXhedXi/Gcpbtcf76sssRwnOxNcbhjk/NYiepUbK'.
|
||||
'ZTfdVXh+ynNEzzAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJhStyP'.
|
||||
'zCAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_oy_007.png
|
||||
//==========================================================
|
||||
$this->imgdata[6][0]= 325 ;
|
||||
$this->imgdata[6][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+ejUTz11jSvVLn02/v1lj21li7q06+r07x2mag'.
|
||||
'lUbKxKHgy1bnz1fx1Ve7t5y+qlzEwqzs03C4pE3z2WPqz1imml'.
|
||||
'TVv1Ps01dGRjeyAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJjsGGc'.
|
||||
'GbAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
|
||||
//==========================================================
|
||||
// File: bstar_lred.png
|
||||
//==========================================================
|
||||
$this->imgdata[7][0]= 325 ;
|
||||
$this->imgdata[7][1]=
|
||||
'iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAMAAABsDg4iAAAATl'.
|
||||
'BMVEX///+/v7+eRJPzWN3SUr7nb9TvWNj2WOS7Tqi+TqnxZtyg'.
|
||||
'Ro/KocPgVsjnV9LxV927nLa+XLTErL7scN24TarzY9/qWNemVJ'.
|
||||
'jVU8LsV9VCwcc9AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
|
||||
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAxYTJxi9ZY'.
|
||||
'GoAAAAcElEQVR4nH3MyQ6AIAwEUFIqiwju2///qLQmWiJxDnN4'.
|
||||
'mYxSv5lqGCs2nvaLLtZx/VhGOW1MjnPJWp0zsw2wsUY2jd09BY'.
|
||||
'DFmESC+BwA5UCUxhqAhqrA4CGrLpCMVGK4sZe4B+/5RLdiyMb6'.
|
||||
'on/PuS9CdQNC7yBXEQAAAABJRU5ErkJggg==' ;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,206 +1,205 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_ANTISPAM.PHP
|
||||
// Description: Genarate anti-spam challenge
|
||||
// Created: 2004-10-07
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_antispam-digits.php 629 2006-05-26 00:05:28Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class HandDigits {
|
||||
public $digits = array();
|
||||
public $iHeight=30, $iWidth=30;
|
||||
|
||||
function HandDigits() {
|
||||
//==========================================================
|
||||
// d6-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['6'][0]= 645 ;
|
||||
$this->digits['6'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAEBAAMBAAAAAAAAAAAAAAAABgMEBwX/xAAvEAABAwMC'.
|
||||
'BAQEBwAAAAAAAAABAgMEAAURBiESIjFRBxMUQRUWMmFTYnGRkrHC/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFhEBAQEAAAAA'.
|
||||
'AAAAAAAAAAAAAAER/9oADAMBAAIRAxEAPwDslwiR3oDku8ONttsAvDiVyMcO/ET7ke5/aoOz6k1Vr5htNjW7a7M1yO3NTQU9JUDu'.
|
||||
'GgrlSn8xyf6p4gXaHJvNps9/mKZtSkGdMjRwpfqAFBLLACRlZUrJONsI2717No1lbZ10kx7XGnRpKWQ/6GVGMfzEJ5VFIVtsOH6e'.
|
||||
'wyKVhYsia0y22pLThSkJK1uniVgdThOM0ol+StIUhpopIyCFq3H8aUVCwnG3PGe4Rp6fLXJtMdyM0ojcIWvIz3HFnAPfrWTXb6GN'.
|
||||
'WaLXDwZjVz8pKEfhuIUFg/bAz9sVJ61nt61mxJFslLtq7e5yPqiBT4UDklKw4MDpt+u+9bFiu9riXNu83R+fcr6tohuQ5HQhmK37'.
|
||||
'paaC8DruScmg6X8KkjZEhbaB9KEyFYSOw26Uqd+e7Qerl5z74DY/1SomP//Z' ;
|
||||
|
||||
//==========================================================
|
||||
// d2-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['2'][0]= 606 ;
|
||||
$this->digits['2'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEQMBIgACEQEDEQH/xAAYAAEBAQEBAAAAAAAAAAAAAAAFAAQHAv/EACsQAAEDBAEC'.
|
||||
'BAYDAAAAAAAAAAIBAwQABQYRIRIxQVFhcQcTFSJSU5GU0f/EABcBAAMBAAAAAAAAAAAAAAAAAAECAwT/xAAZEQACAwEAAAAAAAAA'.
|
||||
'AAAAAAAAARESUUH/2gAMAwEAAhEDEQA/AOqXm/Q8dxmOL4PPSnCSNFixx6nXnkXgRT3Te17JWbGsveueSyLZdbPItNxOKLzTLjou'.
|
||||
'gYCSoSoY8ISKSbFeUrzkdlnTL1YshskiErkQnFEZaF8kkdBBVdjyi6RNL5+9F486eS/ECVkcBtDt1vZcho5viS8ZCp9C9tAIAm/F'.
|
||||
'VoPRU+HRtJ5JVRP1kP0PfwP+1VKrHBMliXG4Nw8VgE4xGkuqk2S1wTUNEVdIvgpL9iL6KtNxY7WOwo9tt0RCitj0sR2uCbFPPzH1'.
|
||||
'7+6rRuSRcljMBMsUy2tky045KOawZk5xtEFBJEROO3hx61kh2rPCIX3MhsyC4QmfTbC6lH8dq5212qwkiG5H6Y/9R2qm+ofxqqsL'.
|
||||
'DLZ6f//Z' ;
|
||||
|
||||
//==========================================================
|
||||
// d9-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['9'][0]= 680 ;
|
||||
$this->digits['9'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwP/xAArEAABAwMD'.
|
||||
'AgYBBQAAAAAAAAABAgMEBQYRABIhE1EUIjEzQUIHMlJhcdH/xAAWAQEBAQAAAAAAAAAAAAAAAAACAQD/xAAYEQEAAwEAAAAAAAAA'.
|
||||
'AAAAAAAAAREhQf/aAAwDAQACEQMRAD8AkK7brF6X7XpMeGoKhFMLEeT4ZUheEhanF4OcZ2pTgDykk92bZpdCsi7aezLjxkIPUZiV'.
|
||||
'RSCy8hah7EkZ27yM7V+iscal5bE22Lon1qNDmSKROd8Sl+Ix1lMOlIS4HGgQpbStoUCnlJz8HmsXtW3Lst2rmBAelLMRRekOwnYz'.
|
||||
'Edls9QKKnOVLyk7UgcbzzrdBthqEJJwZbAI4x1U/7o1TaFa9lG36aXaZTy54VrcXUgrzsGdx+T30aNydweqVw1GS87T6Lb86Q4ha'.
|
||||
'my/IAYjZBx+snKk99oOQMf1AViE65SY348hzFy6hPKnqtKz7DC1lbqyPrvJKUJ7H+M6Wrt3InP7o1brFNp4bCDGhxGAsqz69VSiQ'.
|
||||
'ORwBxrrQ7itm1ac7Hp0WoGTIc3PSn0pccdcP2WorycfA1RaRHjxosZqOyhtDTSAhCf2gDAGjVHTd9sKSCumynFEZK1tIJUe58/ro'.
|
||||
'1V1//9k=' ;
|
||||
|
||||
//==========================================================
|
||||
// d5-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['5'][0]= 632 ;
|
||||
$this->digits['5'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgIFBwT/xAAoEAABAwME'.
|
||||
'AQQCAwAAAAAAAAABAgMEBQYRABIhIkEUMVFhBxNCgaH/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAv/EABcRAQEBAQAAAAAAAAAAAAAA'.
|
||||
'AAABEUH/2gAMAwEAAhEDEQA/ANGvW4YVOeiRX5b4mv5Sin05IdlupPKdo/j2SO3+6TbPNQvOsTVz33KRT4csR3YUF7Dsh5OSFvug'.
|
||||
'kqG4FPBxnjxpvvi4KZb1pTpU+QwxUi2Y7ZIAefUk5ATxnB9/gbtL/wCH1UpuhPUlZlMVaQ0mS8zJjqZOPfc2TwpIUonI9tw40R1r'.
|
||||
'WNGq/wBdJR1XT3lqHBUnGCfkfWjRWs1ve249erQqQYjOtN1FqPUpCXQ4WIzQSsJwT0UpRwQPG0nzqyuNHobjsl9kBuWqoOoXtT1/'.
|
||||
'WppZcA8lKRj64HxqU+3KpAr6plElRVKef3S4E0K9O8pLXVzKcqSsJAB9wSAca6bSoNXeuA1+5pEV+SGFNU1iKVFqI0Vdx2AJUeoz'.
|
||||
'8DGlTDwG3CAf3q/pI0ah6MDhLz6U+EpXwPoaNMU//9k=' ;
|
||||
|
||||
//==========================================================
|
||||
// d1-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['1'][0]= 646 ;
|
||||
$this->digits['1'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEwMBIgACEQEDEQH/xAAZAAADAAMAAAAAAAAAAAAAAAAABQYCBAf/xAApEAACAQMD'.
|
||||
'AwQBBQAAAAAAAAABAgMEBREABiESMUEHEyJRkSNCYXGB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFxEBAQEBAAAAAAAAAAAA'.
|
||||
'AAAAAAEREv/aAAwDAQACEQMRAD8A6jdd4WLbstILnc4Uq0VoWpkJknb6IjXLHJUePOlez923fcW4r1SxWlqC2UbdKirQif3Xw3yA'.
|
||||
'OFAGT09/kO3OmV3a20MFRf6lIYPcpy7yRRAzgxjIy2M8YwcdiBzpX6d22VNvUlTXsFkuwkrKqNSfnK7F8OTzwrAY+l5zoxKskudN'.
|
||||
'EgQPUT9PBkWF3DH+1GPxo1mLnRoAqF2VRgGOFmX/AAgY/GjRUP6hVMFv2FuFqUvUGrpDFJMBnpdyF5bsAQew7Hxzp6LZNT0yQ1DI'.
|
||||
'wp0QCFBhD0jCsfLZHxbx5xxpTuvb1+v9PV7Ztk9roLPLCjmSSN3mX5ZwqjCgZX7PfWxDQb2in96pv9qq46aTE0bW4x9ceAWAYPwS'.
|
||||
'PsYzoixgmheBGjIVcYCnjp/jHjHbRpe1JLn9OnopE/a0ykvjwDx47aNMXqP/2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d8-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['8'][0]= 694 ;
|
||||
$this->digits['8'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AFQMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABgcEBf/EACsQAAEDAwMD'.
|
||||
'AwMFAAAAAAAAAAECAwQFBhEAEiEUMVEHE0EVYYEiIzJCsf/EABYBAQEBAAAAAAAAAAAAAAAAAAIAAf/EABcRAQEBAQAAAAAAAAAA'.
|
||||
'AAAAAAABERL/2gAMAwEAAhEDEQA/AKL6gVVUa0i1T5QjvTprUJMlxW4R9zgQXe/AH+kaWrntqlWjaq7gpcmotXAw82ht9yY4tch8'.
|
||||
'uAFC0k7VBXPGMY51ruiaue+bThIj+7NbWqS+7HDxajFf6AlB/k44o8ZOABk4xkL0X0tZiojKrlRuGRJjugqldSlKGf6t7BuUQe3J'.
|
||||
'44xxxrA1a4KVJipLidri8uLHgqOcfjOPxo0o2hdDvS1CmV2Yl6fS5ioipIQR1CAlKkLKR2UUqAI8g6NRSwuuyHab6s1ufLI/Zai7'.
|
||||
'UBJOxhTS0+6B32pWSFH4CidOdWU0ukLiN1BLr0zG5Sdm3GRvcPhIT858DvjXNrVsSLnm/VIdTXS6tTnFsxZTSN3jchaTwps+O/z9'.
|
||||
'tcBVq3hIX0tYqlIiQHdy5CqRHKHXEjAOMgBKjnvyRk4xrQa7OiGt1K5biYZL8SoVEpjOqkFsONtJCNwASeCQrn7aNUKnQYtLp7EC'.
|
||||
'EylmLHQltptPZKQOBo1FzH//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d4-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['4'][0]= 643 ;
|
||||
$this->digits['4'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABAYHAv/EAC0QAAIBAwQA'.
|
||||
'BAMJAAAAAAAAAAECAwQFEQAGEiETFDFBUmGBByIjUVNxobHR/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAIB/8QAGBEBAAMBAAAAAAAA'.
|
||||
'AAAAAAAAAAERIVH/2gAMAwEAAhEDEQA/ANjM00Nxmt1xiWW31CZp5uJwoAAaOQ/n7qfcZHqO5my3q5XX7R6ijiqnNut9u4NyJ4yv'.
|
||||
'JJyjYr8Xhrn5g599J7x3ulBNU7Zo7dXXXcLQ8kURYi4epYtkALjOePv1nUvbLvV7P3BZm3DR3eh88Kp7pVzBZI6iUhGWRRGWwE44'.
|
||||
'HX3V+uiL1uHgt+vL/H+aNJQ3CSeCOaFqSaJ1DJKs/TqRkMOvQjvRorHE4pRDLNWLGlRHGUeYIORXs9e5B7OP31E0fmdyb/t0DJ4Q'.
|
||||
'27bfx3YZzPUIoAAz7IpOD6cuxq0uNumqLfVNDOqXBoZEjnZcqhIPXH4c46+WkdoWOltu3IDDLLLVVR83UVcuPEmmcZZ2/rHoAANG'.
|
||||
'GI7KIY1ijoLeEQBVCwIoAHpgY6Hy0aZe7mJ2jeHLKcEhusj6aNKgzr//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d7-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['7'][0]= 658 ;
|
||||
$this->digits['7'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgEFBwT/xAAuEAABAwIE'.
|
||||
'BAQGAwAAAAAAAAABAgMEBREABiExEhMiQSMyUXEHFBclVJFhk9L/xAAXAQADAQAAAAAAAAAAAAAAAAAAAQID/8QAGREBAQEAAwAA'.
|
||||
'AAAAAAAAAAAAAAEREiFR/9oADAMBAAIRAxEAPwDXq9mCjZeQ05VZ5ZST4bfEpa3VdglCbqUe+g9MZ5Uq7V8415WXoMSdQ6etgSps'.
|
||||
'19wpkCMDZKUpv0FZvbi1NzpYasMDLDUbMVXrtQdbeeU23xLWkj5RlLYK0J7anW9gbAjCzkOtsVSUJUdtc6dVZK51UeaFm4LKbhpC'.
|
||||
'l7EhIFkDW974GbRI2XorUVls1OTdKAOqUpR0Hc3198GITQ6k+hLwrEpoODiDenRfW23bBicg78JXxPpD0mgVOW5PAivNNpahsPW5'.
|
||||
'8xxQaSVkboQnhsnYm5OHqDGp1IpsalMKjMsMIC3+XZKbJFth62/QOEfMOZqZXp9JcKZTcGmTky3meSi7xQklI81vMR+sXIz/AEgp'.
|
||||
'Q0qPNu6ea8Q2jqtbp8+2w9h/OKORc/cpHjt1dDSHOtLZ4ekHW23bBjj+o9H/AB539aP94MG0+L//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d3-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['3'][0]= 662 ;
|
||||
$this->digits['3'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwL/xAArEAABBAED'.
|
||||
'AwMDBQEAAAAAAAABAgMEBREABhIhMUEiMmETFZEHFkJDUdH/xAAWAQEBAQAAAAAAAAAAAAAAAAABAAL/xAAYEQEBAQEBAAAAAAAA'.
|
||||
'AAAAAAAAEQExQf/aAAwDAQACEQMRAD8A0vclruBdk3VVLLUNssGRJsZSCtqOjlgJAHvcOD6c4HnOdIbcttw1W5P29cFEhuawqTXS'.
|
||||
'VsJjnCMBxKkJJx7goAde+ceJfdNxU0UNlyymyXHi6kxWUNl1S3EnkAEIHX2nv86qtTuZr9Q9+1VhRsOoYpYcgSVyAE/TdewkJxnK'.
|
||||
'sBCjkdPGpnOtFMd3PqsXgfOAgD8Y0aX+11H9rDDjn8lr9yj5J+dGqsqxaw6Cc9cQZU4Sp7zTJsIrKlcUEKwhSin1JABI45GUjqOu'.
|
||||
'lbOvjbc3Ts9ynjGCy445UuFLYRzbWgrT6fhSCQSMDke+pew2zYVly/d7YchNqkMJZnQpgV9J8IzwWFJyUrAJHYgjvpLbu37G5nR7'.
|
||||
'vck5C3YRKYEOEVJZj8kjKypXqWvirjk9h+dB9i4faa89TDZUfKlIyT8k+To10a6KTkpcJ/0vL/7o0TS//9k=' ;
|
||||
}
|
||||
}
|
||||
|
||||
class AntiSpam {
|
||||
|
||||
var $iNumber='';
|
||||
|
||||
function AntiSpam($aNumber='') {
|
||||
$this->iNumber = $aNumber;
|
||||
}
|
||||
|
||||
function Rand($aLen) {
|
||||
$d='';
|
||||
for($i=0; $i < $aLen; ++$i) {
|
||||
$d .= rand(1,9);
|
||||
}
|
||||
$this->iNumber = $d;
|
||||
return $d;
|
||||
}
|
||||
|
||||
function Stroke() {
|
||||
|
||||
$n=strlen($this->iNumber);
|
||||
for($i=0; $i < $n; ++$i ) {
|
||||
if( !is_numeric($this->iNumber[$i]) || $this->iNumber[$i]==0 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$dd = new HandDigits();
|
||||
$n = strlen($this->iNumber);
|
||||
$img = @imagecreatetruecolor($n*$dd->iWidth, $dd->iHeight);
|
||||
if( $img < 1 ) {
|
||||
return false;
|
||||
}
|
||||
$start=0;
|
||||
for($i=0; $i < $n; ++$i ) {
|
||||
$size = $dd->digits[$this->iNumber[$i]][0];
|
||||
$dimg = imagecreatefromstring(base64_decode($dd->digits[$this->iNumber[$i]][1]));
|
||||
imagecopy($img,$dimg,$start,0,0,0,imagesx($dimg), $dd->iHeight);
|
||||
$start += imagesx($dimg);
|
||||
}
|
||||
$resimg = @imagecreatetruecolor($start+4, $dd->iHeight+4);
|
||||
if( $resimg < 1 ) {
|
||||
return false;
|
||||
}
|
||||
imagecopy($resimg,$img,2,2,0,0,$start, $dd->iHeight);
|
||||
header("Content-type: image/jpeg");
|
||||
imagejpeg($resimg);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_ANTISPAM.PHP
|
||||
// Description: Genarate anti-spam challenge
|
||||
// Created: 2004-10-07
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_antispam-digits.php 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
class HandDigits {
|
||||
var $digits_thumb30x30 = array();
|
||||
var $iHeight=30, $iWidth=30;
|
||||
function HandDigits() {
|
||||
//==========================================================
|
||||
// d6-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['6'][0]= 645 ;
|
||||
$this->digits['6'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAEBAAMBAAAAAAAAAAAAAAAABgMEBwX/xAAvEAABAwMC'.
|
||||
'BAQEBwAAAAAAAAABAgMEAAURBiESIjFRBxMUQRUWMmFTYnGRkrHC/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFhEBAQEAAAAA'.
|
||||
'AAAAAAAAAAAAAAER/9oADAMBAAIRAxEAPwDslwiR3oDku8ONttsAvDiVyMcO/ET7ke5/aoOz6k1Vr5htNjW7a7M1yO3NTQU9JUDu'.
|
||||
'GgrlSn8xyf6p4gXaHJvNps9/mKZtSkGdMjRwpfqAFBLLACRlZUrJONsI2717No1lbZ10kx7XGnRpKWQ/6GVGMfzEJ5VFIVtsOH6e'.
|
||||
'wyKVhYsia0y22pLThSkJK1uniVgdThOM0ol+StIUhpopIyCFq3H8aUVCwnG3PGe4Rp6fLXJtMdyM0ojcIWvIz3HFnAPfrWTXb6GN'.
|
||||
'WaLXDwZjVz8pKEfhuIUFg/bAz9sVJ61nt61mxJFslLtq7e5yPqiBT4UDklKw4MDpt+u+9bFiu9riXNu83R+fcr6tohuQ5HQhmK37'.
|
||||
'paaC8DruScmg6X8KkjZEhbaB9KEyFYSOw26Uqd+e7Qerl5z74DY/1SomP//Z' ;
|
||||
|
||||
//==========================================================
|
||||
// d2-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['2'][0]= 606 ;
|
||||
$this->digits['2'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEQMBIgACEQEDEQH/xAAYAAEBAQEBAAAAAAAAAAAAAAAFAAQHAv/EACsQAAEDBAEC'.
|
||||
'BAYDAAAAAAAAAAIBAwQABQYRIRIxQVFhcQcTFSJSU5GU0f/EABcBAAMBAAAAAAAAAAAAAAAAAAECAwT/xAAZEQACAwEAAAAAAAAA'.
|
||||
'AAAAAAAAARESUUH/2gAMAwEAAhEDEQA/AOqXm/Q8dxmOL4PPSnCSNFixx6nXnkXgRT3Te17JWbGsveueSyLZdbPItNxOKLzTLjou'.
|
||||
'gYCSoSoY8ISKSbFeUrzkdlnTL1YshskiErkQnFEZaF8kkdBBVdjyi6RNL5+9F486eS/ECVkcBtDt1vZcho5viS8ZCp9C9tAIAm/F'.
|
||||
'VoPRU+HRtJ5JVRP1kP0PfwP+1VKrHBMliXG4Nw8VgE4xGkuqk2S1wTUNEVdIvgpL9iL6KtNxY7WOwo9tt0RCitj0sR2uCbFPPzH1'.
|
||||
'7+6rRuSRcljMBMsUy2tky045KOawZk5xtEFBJEROO3hx61kh2rPCIX3MhsyC4QmfTbC6lH8dq5212qwkiG5H6Y/9R2qm+ofxqqsL'.
|
||||
'DLZ6f//Z' ;
|
||||
|
||||
//==========================================================
|
||||
// d9-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['9'][0]= 680 ;
|
||||
$this->digits['9'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwP/xAArEAABAwMD'.
|
||||
'AgYBBQAAAAAAAAABAgMEBQYRABIhE1EUIjEzQUIHMlJhcdH/xAAWAQEBAQAAAAAAAAAAAAAAAAACAQD/xAAYEQEAAwEAAAAAAAAA'.
|
||||
'AAAAAAAAAREhQf/aAAwDAQACEQMRAD8AkK7brF6X7XpMeGoKhFMLEeT4ZUheEhanF4OcZ2pTgDykk92bZpdCsi7aezLjxkIPUZiV'.
|
||||
'RSCy8hah7EkZ27yM7V+iscal5bE22Lon1qNDmSKROd8Sl+Ix1lMOlIS4HGgQpbStoUCnlJz8HmsXtW3Lst2rmBAelLMRRekOwnYz'.
|
||||
'Edls9QKKnOVLyk7UgcbzzrdBthqEJJwZbAI4x1U/7o1TaFa9lG36aXaZTy54VrcXUgrzsGdx+T30aNydweqVw1GS87T6Lb86Q4ha'.
|
||||
'my/IAYjZBx+snKk99oOQMf1AViE65SY348hzFy6hPKnqtKz7DC1lbqyPrvJKUJ7H+M6Wrt3InP7o1brFNp4bCDGhxGAsqz69VSiQ'.
|
||||
'ORwBxrrQ7itm1ac7Hp0WoGTIc3PSn0pccdcP2WorycfA1RaRHjxosZqOyhtDTSAhCf2gDAGjVHTd9sKSCumynFEZK1tIJUe58/ro'.
|
||||
'1V1//9k=' ;
|
||||
|
||||
//==========================================================
|
||||
// d5-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['5'][0]= 632 ;
|
||||
$this->digits['5'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgIFBwT/xAAoEAABAwME'.
|
||||
'AQQCAwAAAAAAAAABAgMEBQYRABIhIkEUMVFhBxNCgaH/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAv/EABcRAQEBAQAAAAAAAAAAAAAA'.
|
||||
'AAABEUH/2gAMAwEAAhEDEQA/ANGvW4YVOeiRX5b4mv5Sin05IdlupPKdo/j2SO3+6TbPNQvOsTVz33KRT4csR3YUF7Dsh5OSFvug'.
|
||||
'kqG4FPBxnjxpvvi4KZb1pTpU+QwxUi2Y7ZIAefUk5ATxnB9/gbtL/wCH1UpuhPUlZlMVaQ0mS8zJjqZOPfc2TwpIUonI9tw40R1r'.
|
||||
'WNGq/wBdJR1XT3lqHBUnGCfkfWjRWs1ve249erQqQYjOtN1FqPUpCXQ4WIzQSsJwT0UpRwQPG0nzqyuNHobjsl9kBuWqoOoXtT1/'.
|
||||
'WppZcA8lKRj64HxqU+3KpAr6plElRVKef3S4E0K9O8pLXVzKcqSsJAB9wSAca6bSoNXeuA1+5pEV+SGFNU1iKVFqI0Vdx2AJUeoz'.
|
||||
'8DGlTDwG3CAf3q/pI0ah6MDhLz6U+EpXwPoaNMU//9k=' ;
|
||||
|
||||
//==========================================================
|
||||
// d1-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['1'][0]= 646 ;
|
||||
$this->digits['1'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEwMBIgACEQEDEQH/xAAZAAADAAMAAAAAAAAAAAAAAAAABQYCBAf/xAApEAACAQMD'.
|
||||
'AwQBBQAAAAAAAAABAgMEBREABiESMUEHEyJRkSNCYXGB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFxEBAQEBAAAAAAAAAAAA'.
|
||||
'AAAAAAEREv/aAAwDAQACEQMRAD8A6jdd4WLbstILnc4Uq0VoWpkJknb6IjXLHJUePOlez923fcW4r1SxWlqC2UbdKirQif3Xw3yA'.
|
||||
'OFAGT09/kO3OmV3a20MFRf6lIYPcpy7yRRAzgxjIy2M8YwcdiBzpX6d22VNvUlTXsFkuwkrKqNSfnK7F8OTzwrAY+l5zoxKskudN'.
|
||||
'EgQPUT9PBkWF3DH+1GPxo1mLnRoAqF2VRgGOFmX/AAgY/GjRUP6hVMFv2FuFqUvUGrpDFJMBnpdyF5bsAQew7Hxzp6LZNT0yQ1DI'.
|
||||
'wp0QCFBhD0jCsfLZHxbx5xxpTuvb1+v9PV7Ztk9roLPLCjmSSN3mX5ZwqjCgZX7PfWxDQb2in96pv9qq46aTE0bW4x9ceAWAYPwS'.
|
||||
'PsYzoixgmheBGjIVcYCnjp/jHjHbRpe1JLn9OnopE/a0ykvjwDx47aNMXqP/2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d8-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['8'][0]= 694 ;
|
||||
$this->digits['8'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AFQMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABgcEBf/EACsQAAEDAwMD'.
|
||||
'AwMFAAAAAAAAAAECAwQFBhEAEiEUMVEHE0EVYYEiIzJCsf/EABYBAQEBAAAAAAAAAAAAAAAAAAIAAf/EABcRAQEBAQAAAAAAAAAA'.
|
||||
'AAAAAAABERL/2gAMAwEAAhEDEQA/AKL6gVVUa0i1T5QjvTprUJMlxW4R9zgQXe/AH+kaWrntqlWjaq7gpcmotXAw82ht9yY4tch8'.
|
||||
'uAFC0k7VBXPGMY51ruiaue+bThIj+7NbWqS+7HDxajFf6AlB/k44o8ZOABk4xkL0X0tZiojKrlRuGRJjugqldSlKGf6t7BuUQe3J'.
|
||||
'44xxxrA1a4KVJipLidri8uLHgqOcfjOPxo0o2hdDvS1CmV2Yl6fS5ioipIQR1CAlKkLKR2UUqAI8g6NRSwuuyHab6s1ufLI/Zai7'.
|
||||
'UBJOxhTS0+6B32pWSFH4CidOdWU0ukLiN1BLr0zG5Sdm3GRvcPhIT858DvjXNrVsSLnm/VIdTXS6tTnFsxZTSN3jchaTwps+O/z9'.
|
||||
'tcBVq3hIX0tYqlIiQHdy5CqRHKHXEjAOMgBKjnvyRk4xrQa7OiGt1K5biYZL8SoVEpjOqkFsONtJCNwASeCQrn7aNUKnQYtLp7EC'.
|
||||
'EylmLHQltptPZKQOBo1FzH//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d4-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['4'][0]= 643 ;
|
||||
$this->digits['4'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAYAAADAQEAAAAAAAAAAAAAAAAABAYHAv/EAC0QAAIBAwQA'.
|
||||
'BAMJAAAAAAAAAAECAwQFEQAGEiETFDFBUmGBByIjUVNxobHR/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAIB/8QAGBEBAAMBAAAAAAAA'.
|
||||
'AAAAAAAAAAERIVH/2gAMAwEAAhEDEQA/ANjM00Nxmt1xiWW31CZp5uJwoAAaOQ/n7qfcZHqO5my3q5XX7R6ijiqnNut9u4NyJ4yv'.
|
||||
'JJyjYr8Xhrn5g599J7x3ulBNU7Zo7dXXXcLQ8kURYi4epYtkALjOePv1nUvbLvV7P3BZm3DR3eh88Kp7pVzBZI6iUhGWRRGWwE44'.
|
||||
'HX3V+uiL1uHgt+vL/H+aNJQ3CSeCOaFqSaJ1DJKs/TqRkMOvQjvRorHE4pRDLNWLGlRHGUeYIORXs9e5B7OP31E0fmdyb/t0DJ4Q'.
|
||||
'27bfx3YZzPUIoAAz7IpOD6cuxq0uNumqLfVNDOqXBoZEjnZcqhIPXH4c46+WkdoWOltu3IDDLLLVVR83UVcuPEmmcZZ2/rHoAANG'.
|
||||
'GI7KIY1ijoLeEQBVCwIoAHpgY6Hy0aZe7mJ2jeHLKcEhusj6aNKgzr//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d7-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['7'][0]= 658 ;
|
||||
$this->digits['7'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABgEFBwT/xAAuEAABAwIE'.
|
||||
'BAQGAwAAAAAAAAABAgMEBREABiExEhMiQSMyUXEHFBclVJFhk9L/xAAXAQADAQAAAAAAAAAAAAAAAAAAAQID/8QAGREBAQEAAwAA'.
|
||||
'AAAAAAAAAAAAAAEREiFR/9oADAMBAAIRAxEAPwDXq9mCjZeQ05VZ5ZST4bfEpa3VdglCbqUe+g9MZ5Uq7V8415WXoMSdQ6etgSps'.
|
||||
'19wpkCMDZKUpv0FZvbi1NzpYasMDLDUbMVXrtQdbeeU23xLWkj5RlLYK0J7anW9gbAjCzkOtsVSUJUdtc6dVZK51UeaFm4LKbhpC'.
|
||||
'l7EhIFkDW974GbRI2XorUVls1OTdKAOqUpR0Hc3198GITQ6k+hLwrEpoODiDenRfW23bBicg78JXxPpD0mgVOW5PAivNNpahsPW5'.
|
||||
'8xxQaSVkboQnhsnYm5OHqDGp1IpsalMKjMsMIC3+XZKbJFth62/QOEfMOZqZXp9JcKZTcGmTky3meSi7xQklI81vMR+sXIz/AEgp'.
|
||||
'Q0qPNu6ea8Q2jqtbp8+2w9h/OKORc/cpHjt1dDSHOtLZ4ekHW23bBjj+o9H/AB539aP94MG0+L//2Q==' ;
|
||||
|
||||
//==========================================================
|
||||
// d3-small.jpg
|
||||
//==========================================================
|
||||
$this->digits['3'][0]= 662 ;
|
||||
$this->digits['3'][1]=
|
||||
'/9j/4AAQSkZJRgABAQEASgBKAAD//gAJSnBHcmFwaP/bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicg'.
|
||||
'IiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
|
||||
'MjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAB4AEgMBIgACEQEDEQH/xAAZAAACAwEAAAAAAAAAAAAAAAAABAUGBwL/xAArEAABBAED'.
|
||||
'AwMDBQEAAAAAAAABAgMEBREABhIhMUEiMmETFZEHFkJDUdH/xAAWAQEBAQAAAAAAAAAAAAAAAAABAAL/xAAYEQEBAQEBAAAAAAAA'.
|
||||
'AAAAAAAAEQExQf/aAAwDAQACEQMRAD8A0vclruBdk3VVLLUNssGRJsZSCtqOjlgJAHvcOD6c4HnOdIbcttw1W5P29cFEhuawqTXS'.
|
||||
'VsJjnCMBxKkJJx7goAde+ceJfdNxU0UNlyymyXHi6kxWUNl1S3EnkAEIHX2nv86qtTuZr9Q9+1VhRsOoYpYcgSVyAE/TdewkJxnK'.
|
||||
'sBCjkdPGpnOtFMd3PqsXgfOAgD8Y0aX+11H9rDDjn8lr9yj5J+dGqsqxaw6Cc9cQZU4Sp7zTJsIrKlcUEKwhSin1JABI45GUjqOu'.
|
||||
'lbOvjbc3Ts9ynjGCy445UuFLYRzbWgrT6fhSCQSMDke+pew2zYVly/d7YchNqkMJZnQpgV9J8IzwWFJyUrAJHYgjvpLbu37G5nR7'.
|
||||
'vck5C3YRKYEOEVJZj8kjKypXqWvirjk9h+dB9i4faa89TDZUfKlIyT8k+To10a6KTkpcJ/0vL/7o0TS//9k=' ;
|
||||
}
|
||||
}
|
||||
|
||||
class AntiSpam {
|
||||
|
||||
var $iNumber='';
|
||||
|
||||
function AntiSpam($aNumber='') {
|
||||
$this->iNumber = $aNumber;
|
||||
}
|
||||
|
||||
function Rand($aLen) {
|
||||
$d='';
|
||||
for($i=0; $i < $aLen; ++$i) {
|
||||
$d .= rand(1,9);
|
||||
}
|
||||
$this->iNumber = $d;
|
||||
return $d;
|
||||
}
|
||||
|
||||
function Stroke() {
|
||||
|
||||
$n=strlen($this->iNumber);
|
||||
for($i=0; $i < $n; ++$i ) {
|
||||
if( !is_numeric($this->iNumber[$i]) || $this->iNumber[$i]==0 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$dd = new HandDigits();
|
||||
$n = strlen($this->iNumber);
|
||||
$img = @imagecreatetruecolor($n*$dd->iWidth, $dd->iHeight);
|
||||
if( $img < 1 ) {
|
||||
return false;
|
||||
}
|
||||
$start=0;
|
||||
for($i=0; $i < $n; ++$i ) {
|
||||
$size = $dd->digits[$this->iNumber[$i]][0];
|
||||
$dimg = imagecreatefromstring(base64_decode($dd->digits[$this->iNumber[$i]][1]));
|
||||
imagecopy($img,$dimg,$start,0,0,0,imagesx($dimg), $dd->iHeight);
|
||||
$start += imagesx($dimg);
|
||||
}
|
||||
$resimg = @imagecreatetruecolor($start+4, $dd->iHeight+4);
|
||||
if( $resimg < 1 ) {
|
||||
return false;
|
||||
}
|
||||
imagecopy($resimg,$img,2,2,0,0,$start, $dd->iHeight);
|
||||
header("Content-type: image/jpeg");
|
||||
imagejpeg($resimg);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,96 +1,72 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_CANVAS.PHP
|
||||
// Description: Canvas drawing extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_canvas.php 626 2006-05-08 19:06:19Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS CanvasGraph
|
||||
// Description: Creates a simple canvas graph which
|
||||
// might be used together with the basic Image drawing
|
||||
// primitives. Useful to auickoly produce some arbitrary
|
||||
// graphic which benefits from all the functionality in the
|
||||
// graph liek caching for example.
|
||||
//===================================================
|
||||
class CanvasGraph extends Graph {
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function CanvasGraph($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
|
||||
$this->Graph($aWidth,$aHeight,$aCachedName,$timeout,$inline);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
function InitFrame() {
|
||||
$this->StrokePlotArea();
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke($aStrokeFileName="") {
|
||||
if( $this->texts != null ) {
|
||||
for($i=0; $i < count($this->texts); ++$i) {
|
||||
$this->texts[$i]->Stroke($this->img);
|
||||
}
|
||||
}
|
||||
if( $this->iTables !== null ) {
|
||||
for($i=0; $i < count($this->iTables); ++$i) {
|
||||
$this->iTables[$i]->Stroke($this->img);
|
||||
}
|
||||
}
|
||||
$this->StrokeTitles();
|
||||
|
||||
// If the filename is the predefined value = '_csim_special_'
|
||||
// we assume that the call to stroke only needs to do enough
|
||||
// to correctly generate the CSIM maps.
|
||||
// We use this variable to skip things we don't strictly need
|
||||
// to do to generate the image map to improve performance
|
||||
// a best we can. Therefor you will see a lot of tests !$_csim in the
|
||||
// code below.
|
||||
$_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
|
||||
|
||||
// We need to know if we have stroked the plot in the
|
||||
// GetCSIMareas. Otherwise the CSIM hasn't been generated
|
||||
// and in the case of GetCSIM called before stroke to generate
|
||||
// CSIM without storing an image to disk GetCSIM must call Stroke.
|
||||
$this->iHasStroked = true;
|
||||
|
||||
if( !$_csim ) {
|
||||
|
||||
// Should we do any final image transformation
|
||||
if( $this->iImgTrans ) {
|
||||
if( !class_exists('ImgTrans') ) {
|
||||
require_once('jpgraph_imgtrans.php');
|
||||
}
|
||||
|
||||
$tform = new ImgTrans($this->img->img);
|
||||
$this->img->img = $tform->Skew3D($this->iImgTransHorizon,$this->iImgTransSkewDist,
|
||||
$this->iImgTransDirection,$this->iImgTransHighQ,
|
||||
$this->iImgTransMinSize,$this->iImgTransFillColor,
|
||||
$this->iImgTransBorder);
|
||||
}
|
||||
|
||||
|
||||
// If the filename is given as the special _IMG_HANDLER
|
||||
// then the image handler is returned and the image is NOT
|
||||
// streamed back
|
||||
if( $aStrokeFileName == _IMG_HANDLER ) {
|
||||
return $this->img->img;
|
||||
}
|
||||
else {
|
||||
// Finally stream the generated picture
|
||||
$this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,$aStrokeFileName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
|
||||
/* EOF */
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_CANVAS.PHP
|
||||
// Description: Canvas drawing extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_canvas.php 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS CanvasGraph
|
||||
// Description: Creates a simple canvas graph which
|
||||
// might be used together with the basic Image drawing
|
||||
// primitives. Useful to auickoly produce some arbitrary
|
||||
// graphic which benefits from all the functionality in the
|
||||
// graph liek caching for example.
|
||||
//===================================================
|
||||
class CanvasGraph extends Graph {
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function CanvasGraph($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
|
||||
$this->Graph($aWidth,$aHeight,$aCachedName,$timeout,$inline);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
function InitFrame() {
|
||||
$this->StrokePlotArea();
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke($aStrokeFileName="") {
|
||||
if( $this->texts != null ) {
|
||||
for($i=0; $i<count($this->texts); ++$i) {
|
||||
$this->texts[$i]->Stroke($this->img);
|
||||
}
|
||||
}
|
||||
$this->StrokeTitles();
|
||||
|
||||
// Should we do any final image transformation
|
||||
if( $this->iImgTrans ) {
|
||||
if( !class_exists('ImgTrans') ) {
|
||||
require_once('jpgraph_imgtrans.php');
|
||||
}
|
||||
|
||||
$tform = new ImgTrans($this->img->img);
|
||||
$this->img->img = $tform->Skew3D($this->iImgTransHorizon,$this->iImgTransSkewDist,
|
||||
$this->iImgTransDirection,$this->iImgTransHighQ,
|
||||
$this->iImgTransMinSize,$this->iImgTransFillColor,
|
||||
$this->iImgTransBorder);
|
||||
}
|
||||
|
||||
|
||||
// If the filename is given as the special _IMG_HANDLER
|
||||
// then the image handler is returned and the image is NOT
|
||||
// streamed back
|
||||
if( $aStrokeFileName == _IMG_HANDLER ) {
|
||||
return $this->img->img;
|
||||
}
|
||||
else {
|
||||
// Finally stream the generated picture
|
||||
$this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,$aStrokeFileName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
/* EOF */
|
||||
?>
|
|
@ -1,495 +1,491 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_DATE.PHP
|
||||
// Description: Classes to handle Date scaling
|
||||
// Created: 2005-05-02
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_date.php 573 2006-03-04 10:41:59Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
DEFINE('HOURADJ_1',0+30);
|
||||
DEFINE('HOURADJ_2',1+30);
|
||||
DEFINE('HOURADJ_3',2+30);
|
||||
DEFINE('HOURADJ_4',3+30);
|
||||
DEFINE('HOURADJ_6',4+30);
|
||||
DEFINE('HOURADJ_12',5+30);
|
||||
|
||||
DEFINE('MINADJ_1',0+20);
|
||||
DEFINE('MINADJ_5',1+20);
|
||||
DEFINE('MINADJ_10',2+20);
|
||||
DEFINE('MINADJ_15',3+20);
|
||||
DEFINE('MINADJ_30',4+20);
|
||||
|
||||
DEFINE('SECADJ_1',0);
|
||||
DEFINE('SECADJ_5',1);
|
||||
DEFINE('SECADJ_10',2);
|
||||
DEFINE('SECADJ_15',3);
|
||||
DEFINE('SECADJ_30',4);
|
||||
|
||||
|
||||
DEFINE('YEARADJ_1',0+30);
|
||||
DEFINE('YEARADJ_2',1+30);
|
||||
DEFINE('YEARADJ_5',2+30);
|
||||
|
||||
DEFINE('MONTHADJ_1',0+20);
|
||||
DEFINE('MONTHADJ_6',1+20);
|
||||
|
||||
DEFINE('DAYADJ_1',0);
|
||||
DEFINE('DAYADJ_WEEK',1);
|
||||
DEFINE('DAYADJ_7',1);
|
||||
|
||||
DEFINE('SECPERYEAR',31536000);
|
||||
DEFINE('SECPERDAY',86400);
|
||||
DEFINE('SECPERHOUR',3600);
|
||||
DEFINE('SECPERMIN',60);
|
||||
|
||||
|
||||
class DateScale extends LinearScale {
|
||||
private $date_format = '';
|
||||
private $iStartAlign = false, $iEndAlign = false;
|
||||
private $iStartTimeAlign = false, $iEndTimeAlign = false;
|
||||
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function DateScale($aMin=0,$aMax=0,$aType='x') {
|
||||
assert($aType=="x");
|
||||
assert($aMin<=$aMax);
|
||||
|
||||
$this->type=$aType;
|
||||
$this->scale=array($aMin,$aMax);
|
||||
$this->world_size=$aMax-$aMin;
|
||||
$this->ticks = new LinearTicks();
|
||||
$this->intscale=true;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Utility Function AdjDate()
|
||||
// Description: Will round a given time stamp to an even year, month or day
|
||||
// argument.
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
function AdjDate($aTime,$aRound=0,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h=0;$i=0;$s=0;
|
||||
if( $aYearType !== false ) {
|
||||
$yearAdj = array(0=>1, 1=>2, 2=>5);
|
||||
if( $aRound == 0 ) {
|
||||
$y = floor($y/$yearAdj[$aYearType])*$yearAdj[$aYearType];
|
||||
}
|
||||
else {
|
||||
++$y;
|
||||
$y = ceil($y/$yearAdj[$aYearType])*$yearAdj[$aYearType];
|
||||
}
|
||||
$m=1;$d=1;
|
||||
}
|
||||
elseif( $aMonthType !== false ) {
|
||||
$monthAdj = array(0=>1, 1=>6);
|
||||
if( $aRound == 0 ) {
|
||||
$m = floor($m/$monthAdj[$aMonthType])*$monthAdj[$aMonthType];
|
||||
$d=1;
|
||||
}
|
||||
else {
|
||||
++$m;
|
||||
$m = ceil($m/$monthAdj[$aMonthType])*$monthAdj[$aMonthType];
|
||||
$d=1;
|
||||
}
|
||||
}
|
||||
elseif( $aDayType !== false ) {
|
||||
if( $aDayType == 0 ) {
|
||||
if( $aRound == 1 ) {
|
||||
//++$d;
|
||||
$h=23;$i=59;$s=59;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Adjust to an even week boundary.
|
||||
$w = (int)date('w',$aTime); // Day of week 0=Sun, 6=Sat
|
||||
if( true ) { // Adjust to start on Mon
|
||||
if( $w==0 ) $w=6;
|
||||
else --$w;
|
||||
}
|
||||
if( $aRound == 0 ) {
|
||||
$d -= $w;
|
||||
}
|
||||
else {
|
||||
$d += (7-$w);
|
||||
$h=23;$i=59;$s=59;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mktime($h,$i,$s,$m,$d,$y);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjDate that will round a timestamp to an even date rounding
|
||||
// it downwards.
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjStartDate($aTime,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
return $this->AdjDate($aTime,0,$aYearType,$aMonthType,$aDayType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjDate that will round a timestamp to an even date rounding
|
||||
// it upwards
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjEndDate($aTime,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
return $this->AdjDate($aTime,1,$aYearType,$aMonthType,$aDayType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Utility Function AdjTime()
|
||||
// Description: Will round a given time stamp to an even time according to
|
||||
// argument.
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
function AdjTime($aTime,$aRound=0,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = (int)date('i',$aTime); $s = (int)date('s',$aTime);
|
||||
if( $aHourType !== false ) {
|
||||
$aHourType %= 6;
|
||||
$hourAdj = array(0=>1, 1=>2, 2=>3, 3=>4, 4=>6, 5=>12);
|
||||
if( $aRound == 0 )
|
||||
$h = floor($h/$hourAdj[$aHourType])*$hourAdj[$aHourType];
|
||||
else {
|
||||
if( ($h % $hourAdj[$aHourType]==0) && ($i > 0 || $s > 0) ) {
|
||||
$h++;
|
||||
}
|
||||
$h = ceil($h/$hourAdj[$aHourType])*$hourAdj[$aHourType];
|
||||
if( $h >= 24 ) {
|
||||
$aTime += 86400;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h -= 24;
|
||||
}
|
||||
}
|
||||
$i=0;$s=0;
|
||||
}
|
||||
elseif( $aMinType !== false ) {
|
||||
$aMinType %= 5;
|
||||
$minAdj = array(0=>1, 1=>5, 2=>10, 3=>15, 4=>30);
|
||||
if( $aRound == 0 ) {
|
||||
$i = floor($i/$minAdj[$aMinType])*$minAdj[$aMinType];
|
||||
}
|
||||
else {
|
||||
if( ($i % $minAdj[$aMinType]==0) && $s > 0 ) {
|
||||
$i++;
|
||||
}
|
||||
$i = ceil($i/$minAdj[$aMinType])*$minAdj[$aMinType];
|
||||
if( $i >= 60) {
|
||||
$aTime += 3600;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = 0;
|
||||
}
|
||||
}
|
||||
$s=0;
|
||||
}
|
||||
elseif( $aSecType !== false ) {
|
||||
$aSecType %= 5;
|
||||
$secAdj = array(0=>1, 1=>5, 2=>10, 3=>15, 4=>30);
|
||||
if( $aRound == 0 ) {
|
||||
$s = floor($s/$secAdj[$aSecType])*$secAdj[$aSecType];
|
||||
}
|
||||
else {
|
||||
$s = ceil($s/$secAdj[$aSecType]*1.0)*$secAdj[$aSecType];
|
||||
if( $s >= 60) {
|
||||
$s=0;
|
||||
$aTime += 60;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = (int)date('i',$aTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mktime($h,$i,$s,$m,$d,$y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjTime that will round a timestamp to an even time rounding
|
||||
// it downwards.
|
||||
// Example: AdjStartTime(mktime(18,27,13,2,22,2005),false,2) => 18:20
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjStartTime($aTime,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
return $this->AdjTime($aTime,0,$aHourType,$aMinType,$aSecType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjTime that will round a timestamp to an even time rounding
|
||||
// it upwards
|
||||
// Example: AdjEndTime(mktime(18,27,13,2,22,2005),false,2) => 18:30
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjEndTime($aTime,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
return $this->AdjTime($aTime,1,$aHourType,$aMinType,$aSecType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// DateAutoScale
|
||||
// Autoscale a date axis given start and end time
|
||||
// Returns an array ($start,$end,$major,$minor,$format)
|
||||
//------------------------------------------------------------------------------------------
|
||||
function DoDateAutoScale($aStartTime,$aEndTime,$aDensity=0,$aAdjust=true) {
|
||||
// Format of array
|
||||
// array ( Decision point, array( array( Major-scale-step-array ),
|
||||
// array( Minor-scale-step-array ),
|
||||
// array( 0=date-adjust, 1=time-adjust, adjustment-alignment) )
|
||||
//
|
||||
$scalePoints =
|
||||
array(
|
||||
/* Intervall larger than 10 years */
|
||||
SECPERYEAR*10,array(array(SECPERYEAR*5,SECPERYEAR*2),
|
||||
array(SECPERYEAR),
|
||||
array(0,YEARADJ_1, 0,YEARADJ_1) ),
|
||||
|
||||
/* Intervall larger than 2 years */
|
||||
SECPERYEAR*2,array(array(SECPERYEAR),array(SECPERYEAR),
|
||||
array(0,YEARADJ_1) ),
|
||||
|
||||
/* Intervall larger than 90 days (approx 3 month) */
|
||||
SECPERDAY*90,array(array(SECPERDAY*30,SECPERDAY*14,SECPERDAY*7,SECPERDAY),
|
||||
array(SECPERDAY*5,SECPERDAY*7,SECPERDAY,SECPERDAY),
|
||||
array(0,MONTHADJ_1, 0,DAYADJ_WEEK, 0,DAYADJ_1, 0,DAYADJ_1)),
|
||||
|
||||
/* Intervall larger than 30 days (approx 1 month) */
|
||||
SECPERDAY*30,array(array(SECPERDAY*14,SECPERDAY*7,SECPERDAY*2, SECPERDAY),
|
||||
array(SECPERDAY,SECPERDAY.SECPERDAY,SECPERDAY),
|
||||
array(0,DAYADJ_WEEK, 0,DAYADJ_1, 0,DAYADJ_1, 0,DAYADJ_1)),
|
||||
|
||||
/* Intervall larger than 7 days */
|
||||
SECPERDAY*7,array(array(SECPERDAY,SECPERHOUR*12,SECPERHOUR*6,SECPERHOUR*2),
|
||||
array(SECPERHOUR*6,SECPERHOUR*3,SECPERHOUR,SECPERHOUR),
|
||||
array(0,DAYADJ_1, 1,HOURADJ_12, 1,HOURADJ_6, 1,HOURADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 day */
|
||||
SECPERDAY,array(array(SECPERDAY,SECPERHOUR*12,SECPERHOUR*6,SECPERHOUR*2,SECPERHOUR),
|
||||
array(SECPERHOUR*6,SECPERHOUR*2,SECPERHOUR,SECPERHOUR,SECPERHOUR),
|
||||
array(1,HOURADJ_12, 1,HOURADJ_6, 1,HOURADJ_1, 1,HOURADJ_1)),
|
||||
|
||||
/* Intervall larger than 12 hours */
|
||||
SECPERHOUR*12,array(array(SECPERHOUR*2,SECPERHOUR,SECPERMIN*30,900,600),
|
||||
array(1800,1800,900,300,300),
|
||||
array(1,HOURADJ_1, 1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 2 hours */
|
||||
SECPERHOUR*2,array(array(SECPERHOUR,SECPERMIN*30,900,600,300),
|
||||
array(1800,900,300,120,60),
|
||||
array(1,HOURADJ_1, 1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 1 hours */
|
||||
SECPERHOUR,array(array(SECPERMIN*30,900,600,300),array(900,300,120,60),
|
||||
array(1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 30 min */
|
||||
SECPERMIN*30,array(array(SECPERMIN*15,SECPERMIN*10,SECPERMIN*5,SECPERMIN),
|
||||
array(300,300,60,10),
|
||||
array(1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5, 1,MINADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 min */
|
||||
SECPERMIN,array(array(SECPERMIN,15,10,5),
|
||||
array(15,5,2,1),
|
||||
array(1,MINADJ_1, 1,SECADJ_15, 1,SECADJ_10, 1,SECADJ_5)),
|
||||
|
||||
/* Intervall larger than 10 sec */
|
||||
10,array(array(5,2),
|
||||
array(1,1),
|
||||
array(1,SECADJ_5, 1,SECADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 sec */
|
||||
1,array(array(1),
|
||||
array(1),
|
||||
array(1,SECADJ_1)),
|
||||
);
|
||||
|
||||
$ns = count($scalePoints);
|
||||
// Establish major and minor scale units for the date scale
|
||||
$diff = $aEndTime - $aStartTime;
|
||||
if( $diff < 1 ) return false;
|
||||
$done=false;
|
||||
$i=0;
|
||||
while( ! $done ) {
|
||||
if( $diff > $scalePoints[2*$i] ) {
|
||||
// Get major and minor scale for this intervall
|
||||
$scaleSteps = $scalePoints[2*$i+1];
|
||||
$major = $scaleSteps[0][min($aDensity,count($scaleSteps[0])-1)];
|
||||
// Try to find out which minor step looks best
|
||||
$minor = $scaleSteps[1][min($aDensity,count($scaleSteps[1])-1)];
|
||||
if( $aAdjust ) {
|
||||
// Find out how we should align the start and end timestamps
|
||||
$idx = 2*min($aDensity,floor(count($scaleSteps[2])/2)-1);
|
||||
if( $scaleSteps[2][$idx] === 0 ) {
|
||||
// Use date adjustment
|
||||
$adj = $scaleSteps[2][$idx+1];
|
||||
if( $adj >= 30 ) {
|
||||
$start = $this->AdjStartDate($aStartTime,$adj-30);
|
||||
$end = $this->AdjEndDate($aEndTime,$adj-30);
|
||||
}
|
||||
elseif( $adj >= 20 ) {
|
||||
$start = $this->AdjStartDate($aStartTime,false,$adj-20);
|
||||
$end = $this->AdjEndDate($aEndTime,false,$adj-20);
|
||||
}
|
||||
else {
|
||||
$start = $this->AdjStartDate($aStartTime,false,false,$adj);
|
||||
$end = $this->AdjEndDate($aEndTime,false,false,$adj);
|
||||
// We add 1 second for date adjustment to make sure we end on 00:00 the following day
|
||||
// This makes the final major tick be srawn when we step day-by-day instead of ending
|
||||
// on xx:59:59 which would not draw the final major tick
|
||||
$end++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use time adjustment
|
||||
$adj = $scaleSteps[2][$idx+1];
|
||||
if( $adj >= 30 ) {
|
||||
$start = $this->AdjStartTime($aStartTime,$adj-30);
|
||||
$end = $this->AdjEndTime($aEndTime,$adj-30);
|
||||
}
|
||||
elseif( $adj >= 20 ) {
|
||||
$start = $this->AdjStartTime($aStartTime,false,$adj-20);
|
||||
$end = $this->AdjEndTime($aEndTime,false,$adj-20);
|
||||
}
|
||||
else {
|
||||
$start = $this->AdjStartTime($aStartTime,false,false,$adj);
|
||||
$end = $this->AdjEndTime($aEndTime,false,false,$adj);
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the overall date span is larger than 1 day ten we show date
|
||||
$format = '';
|
||||
if( ($end-$start) > SECPERDAY ) {
|
||||
$format = 'Y-m-d ';
|
||||
}
|
||||
// If the major step is less than 1 day we need to whow hours + min
|
||||
if( $major < SECPERDAY ) {
|
||||
$format .= 'H:i';
|
||||
}
|
||||
// If the major step is less than 1 min we need to show sec
|
||||
if( $major < 60 ) {
|
||||
$format .= ':s';
|
||||
}
|
||||
$done=true;
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
return array($start,$end,$major,$minor,$format);
|
||||
}
|
||||
|
||||
// Overrides the automatic determined date format. Must be a valid date() format string
|
||||
function SetDateFormat($aFormat) {
|
||||
$this->date_format = $aFormat;
|
||||
$this->ticks->SetLabelDateFormat($this->date_format);
|
||||
}
|
||||
|
||||
function SetDateAlign($aStartAlign,$aEndAlign=false) {
|
||||
if( $aEndAlign === false ) {
|
||||
$aEndAlign=$aStartAlign;
|
||||
}
|
||||
$this->iStartAlign = $aStartAlign;
|
||||
$this->iEndAlign = $aEndAlign;
|
||||
}
|
||||
|
||||
function SetTimeAlign($aStartAlign,$aEndAlign=false) {
|
||||
if( $aEndAlign === false ) {
|
||||
$aEndAlign=$aStartAlign;
|
||||
}
|
||||
$this->iStartTimeAlign = $aStartAlign;
|
||||
$this->iEndTimeAlign = $aEndAlign;
|
||||
}
|
||||
|
||||
|
||||
function AutoScale($img,$aStartTime,$aEndTime,$aNumSteps,$_adummy=false) {
|
||||
// We need to have one dummy argument to make the signature of AutoScale()
|
||||
// identical to LinearScale::AutoScale
|
||||
if( $aStartTime == $aEndTime ) {
|
||||
// Special case when we only have one data point.
|
||||
// Create a small artifical intervall to do the autoscaling
|
||||
$aStartTime -= 10;
|
||||
$aEndTime += 10;
|
||||
}
|
||||
$done=false;
|
||||
$i=0;
|
||||
while( ! $done && $i < 5) {
|
||||
list($adjstart,$adjend,$maj,$min,$format) = $this->DoDateAutoScale($aStartTime,$aEndTime,$i);
|
||||
$n = floor(($adjend-$adjstart)/$maj);
|
||||
if( $n * 1.7 > $aNumSteps ) {
|
||||
$done=true;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
/*
|
||||
if( 0 ) { // DEBUG
|
||||
echo " Start =".date("Y-m-d H:i:s",$aStartTime)."<br>";
|
||||
echo " End =".date("Y-m-d H:i:s",$aEndTime)."<br>";
|
||||
echo "Adj Start =".date("Y-m-d H:i:s",$adjstart)."<br>";
|
||||
echo "Adj End =".date("Y-m-d H:i:s",$adjend)."<p>";
|
||||
echo "Major = $maj s, ".floor($maj/60)."min, ".floor($maj/3600)."h, ".floor($maj/86400)."day<br>";
|
||||
echo "Min = $min s, ".floor($min/60)."min, ".floor($min/3600)."h, ".floor($min/86400)."day<br>";
|
||||
echo "Format=$format<p>";
|
||||
}
|
||||
*/
|
||||
|
||||
if( $this->iStartTimeAlign !== false && $this->iStartAlign !== false ) {
|
||||
JpGraphError::RaiseL(3001);
|
||||
//('It is only possible to use either SetDateAlign() or SetTimeAlign() but not both');
|
||||
}
|
||||
|
||||
if( $this->iStartTimeAlign !== false ) {
|
||||
if( $this->iStartTimeAlign >= 30 ) {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,$this->iStartTimeAlign-30);
|
||||
}
|
||||
elseif( $this->iStartTimeAlign >= 20 ) {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,false,$this->iStartTimeAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,false,false,$this->iStartTimeAlign);
|
||||
}
|
||||
}
|
||||
if( $this->iEndTimeAlign !== false ) {
|
||||
if( $this->iEndTimeAlign >= 30 ) {
|
||||
$adjend = $this->AdjEndTime($aEndTime,$this->iEndTimeAlign-30);
|
||||
}
|
||||
elseif( $this->iEndTimeAlign >= 20 ) {
|
||||
$adjend = $this->AdjEndTime($aEndTime,false,$this->iEndTimeAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjend = $this->AdjEndTime($aEndTime,false,false,$this->iEndTimeAlign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( $this->iStartAlign !== false ) {
|
||||
if( $this->iStartAlign >= 30 ) {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,$this->iStartAlign-30);
|
||||
}
|
||||
elseif( $this->iStartAlign >= 20 ) {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,false,$this->iStartAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,false,false,$this->iStartAlign);
|
||||
}
|
||||
}
|
||||
if( $this->iEndAlign !== false ) {
|
||||
if( $this->iEndAlign >= 30 ) {
|
||||
$adjend = $this->AdjEndDate($aEndTime,$this->iEndAlign-30);
|
||||
}
|
||||
elseif( $this->iEndAlign >= 20 ) {
|
||||
$adjend = $this->AdjEndDate($aEndTime,false,$this->iEndAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjend = $this->AdjEndDate($aEndTime,false,false,$this->iEndAlign);
|
||||
}
|
||||
}
|
||||
$this->Update($img,$adjstart,$adjend);
|
||||
if( ! $this->ticks->IsSpecified() )
|
||||
$this->ticks->Set($maj,$min);
|
||||
if( $this->date_format == '' )
|
||||
$this->ticks->SetLabelDateFormat($format);
|
||||
else
|
||||
$this->ticks->SetLabelDateFormat($this->date_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_DATE.PHP
|
||||
// Description: Classes to handle Date scaling
|
||||
// Created: 2005-05-02
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_date.php 220 2005-10-15 16:53:53Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
DEFINE('HOURADJ_1',0+30);
|
||||
DEFINE('HOURADJ_2',1+30);
|
||||
DEFINE('HOURADJ_3',2+30);
|
||||
DEFINE('HOURADJ_4',3+30);
|
||||
DEFINE('HOURADJ_6',4+30);
|
||||
DEFINE('HOURADJ_12',5+30);
|
||||
|
||||
DEFINE('MINADJ_1',0+20);
|
||||
DEFINE('MINADJ_5',1+20);
|
||||
DEFINE('MINADJ_10',2+20);
|
||||
DEFINE('MINADJ_15',3+20);
|
||||
DEFINE('MINADJ_30',4+20);
|
||||
|
||||
DEFINE('SECADJ_1',0);
|
||||
DEFINE('SECADJ_5',1);
|
||||
DEFINE('SECADJ_10',2);
|
||||
DEFINE('SECADJ_15',3);
|
||||
DEFINE('SECADJ_30',4);
|
||||
|
||||
|
||||
DEFINE('YEARADJ_1',0+30);
|
||||
DEFINE('YEARADJ_2',1+30);
|
||||
DEFINE('YEARADJ_5',2+30);
|
||||
|
||||
DEFINE('MONTHADJ_1',0+20);
|
||||
DEFINE('MONTHADJ_6',1+20);
|
||||
|
||||
DEFINE('DAYADJ_1',0);
|
||||
DEFINE('DAYADJ_WEEK',1);
|
||||
DEFINE('DAYADJ_7',1);
|
||||
|
||||
DEFINE('SECPERYEAR',31536000);
|
||||
DEFINE('SECPERDAY',86400);
|
||||
DEFINE('SECPERHOUR',3600);
|
||||
DEFINE('SECPERMIN',60);
|
||||
|
||||
|
||||
class DateScale extends LinearScale {
|
||||
var $date_format = '';
|
||||
var $iStartAlign = false, $iEndAlign = false;
|
||||
var $iStartTimeAlign = false, $iEndTimeAlign = false;
|
||||
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function DateScale($aMin=0,$aMax=0,$aType='x') {
|
||||
assert($aType=="x");
|
||||
assert($aMin<=$aMax);
|
||||
|
||||
$this->type=$aType;
|
||||
$this->scale=array($aMin,$aMax);
|
||||
$this->world_size=$aMax-$aMin;
|
||||
$this->ticks = new LinearTicks();
|
||||
$this->intscale=true;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Utility Function AdjDate()
|
||||
// Description: Will round a given time stamp to an even year, month or day
|
||||
// argument.
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
function AdjDate($aTime,$aRound=0,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h=0;$i=0;$s=0;
|
||||
if( $aYearType !== false ) {
|
||||
$yearAdj = array(0=>1, 1=>2, 2=>5);
|
||||
if( $aRound == 0 ) {
|
||||
$y = floor($y/$yearAdj[$aYearType])*$yearAdj[$aYearType];
|
||||
}
|
||||
else {
|
||||
++$y;
|
||||
$y = ceil($y/$yearAdj[$aYearType])*$yearAdj[$aYearType];
|
||||
}
|
||||
$m=1;$d=1;
|
||||
}
|
||||
elseif( $aMonthType !== false ) {
|
||||
$monthAdj = array(0=>1, 1=>6);
|
||||
if( $aRound == 0 ) {
|
||||
$m = floor($m/$monthAdj[$aMonthType])*$monthAdj[$aMonthType];
|
||||
$d=1;
|
||||
}
|
||||
else {
|
||||
++$m;
|
||||
$m = ceil($m/$monthAdj[$aMonthType])*$monthAdj[$aMonthType];
|
||||
$d=1;
|
||||
}
|
||||
}
|
||||
elseif( $aDayType !== false ) {
|
||||
if( $aDayType == 0 ) {
|
||||
if( $aRound == 1 ) {
|
||||
//++$d;
|
||||
$h=23;$i=59;$s=59;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Adjust to an even week boundary.
|
||||
$w = (int)date('w',$aTime); // Day of week 0=Sun, 6=Sat
|
||||
if( true ) { // Adjust to start on Mon
|
||||
if( $w==0 ) $w=6;
|
||||
else --$w;
|
||||
}
|
||||
if( $aRound == 0 ) {
|
||||
$d -= $w;
|
||||
}
|
||||
else {
|
||||
$d += (7-$w);
|
||||
$h=23;$i=59;$s=59;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mktime($h,$i,$s,$m,$d,$y);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjDate that will round a timestamp to an even date rounding
|
||||
// it downwards.
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjStartDate($aTime,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
return $this->AdjDate($aTime,0,$aYearType,$aMonthType,$aDayType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjDate that will round a timestamp to an even date rounding
|
||||
// it upwards
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjEndDate($aTime,$aYearType=false,$aMonthType=false,$aDayType=false) {
|
||||
return $this->AdjDate($aTime,1,$aYearType,$aMonthType,$aDayType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Utility Function AdjTime()
|
||||
// Description: Will round a given time stamp to an even time according to
|
||||
// argument.
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
function AdjTime($aTime,$aRound=0,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = (int)date('i',$aTime); $s = (int)date('s',$aTime);
|
||||
if( $aHourType !== false ) {
|
||||
$aHourType %= 6;
|
||||
$hourAdj = array(0=>1, 1=>2, 2=>3, 3=>4, 4=>6, 5=>12);
|
||||
if( $aRound == 0 )
|
||||
$h = floor($h/$hourAdj[$aHourType])*$hourAdj[$aHourType];
|
||||
else {
|
||||
if( ($h % $hourAdj[$aHourType]==0) && ($i > 0 || $s > 0) ) {
|
||||
$h++;
|
||||
}
|
||||
$h = ceil($h/$hourAdj[$aHourType])*$hourAdj[$aHourType];
|
||||
if( $h >= 24 ) {
|
||||
$aTime += 86400;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h -= 24;
|
||||
}
|
||||
}
|
||||
$i=0;$s=0;
|
||||
}
|
||||
elseif( $aMinType !== false ) {
|
||||
$aMinType %= 5;
|
||||
$minAdj = array(0=>1, 1=>5, 2=>10, 3=>15, 4=>30);
|
||||
if( $aRound == 0 ) {
|
||||
$i = floor($i/$minAdj[$aMinType])*$minAdj[$aMinType];
|
||||
}
|
||||
else {
|
||||
if( ($i % $minAdj[$aMinType]==0) && $s > 0 ) {
|
||||
$i++;
|
||||
}
|
||||
$i = ceil($i/$minAdj[$aMinType])*$minAdj[$aMinType];
|
||||
if( $i >= 60) {
|
||||
$aTime += 3600;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = 0;
|
||||
}
|
||||
}
|
||||
$s=0;
|
||||
}
|
||||
elseif( $aSecType !== false ) {
|
||||
$aSecType %= 5;
|
||||
$secAdj = array(0=>1, 1=>5, 2=>10, 3=>15, 4=>30);
|
||||
if( $aRound == 0 ) {
|
||||
$s = floor($s/$secAdj[$aSecType])*$secAdj[$aSecType];
|
||||
}
|
||||
else {
|
||||
$s = ceil($s/$secAdj[$aSecType]*1.0)*$secAdj[$aSecType];
|
||||
if( $s >= 60) {
|
||||
$s=0;
|
||||
$aTime += 60;
|
||||
$y = (int)date('Y',$aTime); $m = (int)date('m',$aTime); $d = (int)date('d',$aTime);
|
||||
$h = (int)date('H',$aTime); $i = (int)date('i',$aTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mktime($h,$i,$s,$m,$d,$y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjTime that will round a timestamp to an even time rounding
|
||||
// it downwards.
|
||||
// Example: AdjStartTime(mktime(18,27,13,2,22,2005),false,2) => 18:20
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjStartTime($aTime,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
return $this->AdjTime($aTime,0,$aHourType,$aMinType,$aSecType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// Wrapper for AdjTime that will round a timestamp to an even time rounding
|
||||
// it upwards
|
||||
// Example: AdjEndTime(mktime(18,27,13,2,22,2005),false,2) => 18:30
|
||||
//------------------------------------------------------------------------------------------
|
||||
function AdjEndTime($aTime,$aHourType=false,$aMinType=false,$aSecType=false) {
|
||||
return $this->AdjTime($aTime,1,$aHourType,$aMinType,$aSecType);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// DateAutoScale
|
||||
// Autoscale a date axis given start and end time
|
||||
// Returns an array ($start,$end,$major,$minor,$format)
|
||||
//------------------------------------------------------------------------------------------
|
||||
function DoDateAutoScale($aStartTime,$aEndTime,$aDensity=0,$aAdjust=true) {
|
||||
// Format of array
|
||||
// array ( Decision point, array( array( Major-scale-step-array ),
|
||||
// array( Minor-scale-step-array ),
|
||||
// array( 0=date-adjust, 1=time-adjust, adjustment-alignment) )
|
||||
//
|
||||
$scalePoints =
|
||||
array(
|
||||
/* Intervall larger than 10 years */
|
||||
SECPERYEAR*10,array(array(SECPERYEAR*5,SECPERYEAR*2),
|
||||
array(SECPERYEAR),
|
||||
array(0,YEARADJ_1, 0,YEARADJ_1) ),
|
||||
|
||||
/* Intervall larger than 2 years */
|
||||
SECPERYEAR*2,array(array(SECPERYEAR),array(SECPERYEAR),
|
||||
array(0,YEARADJ_1) ),
|
||||
|
||||
/* Intervall larger than 90 days (approx 3 month) */
|
||||
SECPERDAY*90,array(array(SECPERDAY*30,SECPERDAY*14,SECPERDAY*7,SECPERDAY),
|
||||
array(SECPERDAY*5,SECPERDAY*7,SECPERDAY,SECPERDAY),
|
||||
array(0,MONTHADJ_1, 0,DAYADJ_WEEK, 0,DAYADJ_1, 0,DAYADJ_1)),
|
||||
|
||||
/* Intervall larger than 30 days (approx 1 month) */
|
||||
SECPERDAY*30,array(array(SECPERDAY*14,SECPERDAY*7,SECPERDAY*2, SECPERDAY),
|
||||
array(SECPERDAY,SECPERDAY.SECPERDAY,SECPERDAY),
|
||||
array(0,DAYADJ_WEEK, 0,DAYADJ_1, 0,DAYADJ_1, 0,DAYADJ_1)),
|
||||
|
||||
/* Intervall larger than 7 days */
|
||||
SECPERDAY*7,array(array(SECPERDAY,SECPERHOUR*12,SECPERHOUR*6,SECPERHOUR*2),
|
||||
array(SECPERHOUR*6,SECPERHOUR*3,SECPERHOUR,SECPERHOUR),
|
||||
array(0,DAYADJ_1, 1,HOURADJ_12, 1,HOURADJ_6, 1,HOURADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 day */
|
||||
SECPERDAY,array(array(SECPERDAY,SECPERHOUR*12,SECPERHOUR*6,SECPERHOUR*2,SECPERHOUR),
|
||||
array(SECPERHOUR*6,SECPERHOUR*2,SECPERHOUR,SECPERHOUR,SECPERHOUR),
|
||||
array(1,HOURADJ_12, 1,HOURADJ_6, 1,HOURADJ_1, 1,HOURADJ_1)),
|
||||
|
||||
/* Intervall larger than 12 hours */
|
||||
SECPERHOUR*12,array(array(SECPERHOUR*2,SECPERHOUR,SECPERMIN*30,900,600),
|
||||
array(1800,1800,900,300,300),
|
||||
array(1,HOURADJ_1, 1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 2 hours */
|
||||
SECPERHOUR*2,array(array(SECPERHOUR,SECPERMIN*30,900,600,300),
|
||||
array(1800,900,300,120,60),
|
||||
array(1,HOURADJ_1, 1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 1 hours */
|
||||
SECPERHOUR,array(array(SECPERMIN*30,900,600,300),array(900,300,120,60),
|
||||
array(1,MINADJ_30, 1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5) ),
|
||||
|
||||
/* Intervall larger than 30 min */
|
||||
SECPERMIN*30,array(array(SECPERMIN*15,SECPERMIN*10,SECPERMIN*5,SECPERMIN),
|
||||
array(300,300,60,10),
|
||||
array(1,MINADJ_15, 1,MINADJ_10, 1,MINADJ_5, 1,MINADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 min */
|
||||
SECPERMIN,array(array(SECPERMIN,15,10,5),
|
||||
array(15,5,2,1),
|
||||
array(1,MINADJ_1, 1,SECADJ_15, 1,SECADJ_10, 1,SECADJ_5)),
|
||||
|
||||
/* Intervall larger than 10 sec */
|
||||
10,array(array(5,2),
|
||||
array(1,1),
|
||||
array(1,SECADJ_5, 1,SECADJ_1)),
|
||||
|
||||
/* Intervall larger than 1 sec */
|
||||
1,array(array(1),
|
||||
array(1),
|
||||
array(1,SECADJ_1)),
|
||||
);
|
||||
|
||||
$ns = count($scalePoints);
|
||||
// Establish major and minor scale units for the date scale
|
||||
$diff = $aEndTime - $aStartTime;
|
||||
if( $diff < 1 ) return false;
|
||||
$done=false;
|
||||
$i=0;
|
||||
while( ! $done ) {
|
||||
if( $diff > $scalePoints[2*$i] ) {
|
||||
// Get major and minor scale for this intervall
|
||||
$scaleSteps = $scalePoints[2*$i+1];
|
||||
$major = $scaleSteps[0][min($aDensity,count($scaleSteps[0])-1)];
|
||||
// Try to find out which minor step looks best
|
||||
$minor = $scaleSteps[1][min($aDensity,count($scaleSteps[1])-1)];
|
||||
if( $aAdjust ) {
|
||||
// Find out how we should align the start and end timestamps
|
||||
$idx = 2*min($aDensity,floor(count($scaleSteps[2])/2)-1);
|
||||
if( $scaleSteps[2][$idx] === 0 ) {
|
||||
// Use date adjustment
|
||||
$adj = $scaleSteps[2][$idx+1];
|
||||
if( $adj >= 30 ) {
|
||||
$start = $this->AdjStartDate($aStartTime,$adj-30);
|
||||
$end = $this->AdjEndDate($aEndTime,$adj-30);
|
||||
}
|
||||
elseif( $adj >= 20 ) {
|
||||
$start = $this->AdjStartDate($aStartTime,false,$adj-20);
|
||||
$end = $this->AdjEndDate($aEndTime,false,$adj-20);
|
||||
}
|
||||
else {
|
||||
$start = $this->AdjStartDate($aStartTime,false,false,$adj);
|
||||
$end = $this->AdjEndDate($aEndTime,false,false,$adj);
|
||||
// We add 1 second for date adjustment to make sure we end on 00:00 the following day
|
||||
// This makes the final major tick be srawn when we step day-by-day instead of ending
|
||||
// on xx:59:59 which would not draw the final major tick
|
||||
$end++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use time adjustment
|
||||
$adj = $scaleSteps[2][$idx+1];
|
||||
if( $adj >= 30 ) {
|
||||
$start = $this->AdjStartTime($aStartTime,$adj-30);
|
||||
$end = $this->AdjEndTime($aEndTime,$adj-30);
|
||||
}
|
||||
elseif( $adj >= 20 ) {
|
||||
$start = $this->AdjStartTime($aStartTime,false,$adj-20);
|
||||
$end = $this->AdjEndTime($aEndTime,false,$adj-20);
|
||||
}
|
||||
else {
|
||||
$start = $this->AdjStartTime($aStartTime,false,false,$adj);
|
||||
$end = $this->AdjEndTime($aEndTime,false,false,$adj);
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the overall date span is larger than 1 day ten we show date
|
||||
$format = '';
|
||||
if( ($end-$start) > SECPERDAY ) {
|
||||
$format = 'Y-m-d ';
|
||||
}
|
||||
// If the major step is less than 1 day we need to whow hours + min
|
||||
if( $major < SECPERDAY ) {
|
||||
$format .= 'H:i';
|
||||
}
|
||||
// If the major step is less than 1 min we need to show sec
|
||||
if( $major < 60 ) {
|
||||
$format .= ':s';
|
||||
}
|
||||
$done=true;
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
return array($start,$end,$major,$minor,$format);
|
||||
}
|
||||
|
||||
// Overrides the automatic determined date format. Must be a valid date() format string
|
||||
function SetDateFormat($aFormat) {
|
||||
$this->date_format = $aFormat;
|
||||
}
|
||||
|
||||
function SetDateAlign($aStartAlign,$aEndAlign=false) {
|
||||
if( $aEndAlign === false ) {
|
||||
$aEndAlign=$aStartAlign;
|
||||
}
|
||||
$this->iStartAlign = $aStartAlign;
|
||||
$this->iEndAlign = $aEndAlign;
|
||||
}
|
||||
|
||||
function SetTimeAlign($aStartAlign,$aEndAlign=false) {
|
||||
if( $aEndAlign === false ) {
|
||||
$aEndAlign=$aStartAlign;
|
||||
}
|
||||
$this->iStartTimeAlign = $aStartAlign;
|
||||
$this->iEndTimeAlign = $aEndAlign;
|
||||
}
|
||||
|
||||
|
||||
function AutoScale(&$img,$aStartTime,$aEndTime,$aNumSteps) {
|
||||
if( $aStartTime == $aEndTime ) {
|
||||
// Special case when we only have one data point.
|
||||
// Create a small artifical intervall to do the autoscaling
|
||||
$aStartTime -= 10;
|
||||
$aEndTime += 10;
|
||||
}
|
||||
$done=false;
|
||||
$i=0;
|
||||
while( ! $done && $i < 5) {
|
||||
list($adjstart,$adjend,$maj,$min,$format) = $this->DoDateAutoScale($aStartTime,$aEndTime,$i);
|
||||
$n = floor(($adjend-$adjstart)/$maj);
|
||||
if( $n * 1.7 > $aNumSteps ) {
|
||||
$done=true;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
/*
|
||||
if( 0 ) { // DEBUG
|
||||
echo " Start =".date("Y-m-d H:i:s",$aStartTime)."<br>";
|
||||
echo " End =".date("Y-m-d H:i:s",$aEndTime)."<br>";
|
||||
echo "Adj Start =".date("Y-m-d H:i:s",$adjstart)."<br>";
|
||||
echo "Adj End =".date("Y-m-d H:i:s",$adjend)."<p>";
|
||||
echo "Major = $maj s, ".floor($maj/60)."min, ".floor($maj/3600)."h, ".floor($maj/86400)."day<br>";
|
||||
echo "Min = $min s, ".floor($min/60)."min, ".floor($min/3600)."h, ".floor($min/86400)."day<br>";
|
||||
echo "Format=$format<p>";
|
||||
}
|
||||
*/
|
||||
|
||||
if( $this->iStartTimeAlign !== false && $this->iStartAlign !== false ) {
|
||||
JpGraphError::Raise('It is only possible to use either SetDateAlign() or SetTimeAlign() but not both');
|
||||
}
|
||||
|
||||
if( $this->iStartTimeAlign !== false ) {
|
||||
if( $this->iStartTimeAlign >= 30 ) {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,$this->iStartTimeAlign-30);
|
||||
}
|
||||
elseif( $this->iStartTimeAlign >= 20 ) {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,false,$this->iStartTimeAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjstart = $this->AdjStartTime($aStartTime,false,false,$this->iStartTimeAlign);
|
||||
}
|
||||
}
|
||||
if( $this->iEndTimeAlign !== false ) {
|
||||
if( $this->iEndTimeAlign >= 30 ) {
|
||||
$adjend = $this->AdjEndTime($aEndTime,$this->iEndTimeAlign-30);
|
||||
}
|
||||
elseif( $this->iEndTimeAlign >= 20 ) {
|
||||
$adjend = $this->AdjEndTime($aEndTime,false,$this->iEndTimeAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjend = $this->AdjEndTime($aEndTime,false,false,$this->iEndTimeAlign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( $this->iStartAlign !== false ) {
|
||||
if( $this->iStartAlign >= 30 ) {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,$this->iStartAlign-30);
|
||||
}
|
||||
elseif( $this->iStartAlign >= 20 ) {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,false,$this->iStartAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjstart = $this->AdjStartDate($aStartTime,false,false,$this->iStartAlign);
|
||||
}
|
||||
}
|
||||
if( $this->iEndAlign !== false ) {
|
||||
if( $this->iEndAlign >= 30 ) {
|
||||
$adjend = $this->AdjEndDate($aEndTime,$this->iEndAlign-30);
|
||||
}
|
||||
elseif( $this->iEndAlign >= 20 ) {
|
||||
$adjend = $this->AdjEndDate($aEndTime,false,$this->iEndAlign-20);
|
||||
}
|
||||
else {
|
||||
$adjend = $this->AdjEndDate($aEndTime,false,false,$this->iEndAlign);
|
||||
}
|
||||
}
|
||||
$this->Update($img,$adjstart,$adjend);
|
||||
if( ! $this->ticks->IsSpecified() )
|
||||
$this->ticks->Set($maj,$min);
|
||||
if( $this->date_format == '' )
|
||||
$this->ticks->SetLabelDateFormat($format);
|
||||
else
|
||||
$this->ticks->SetLabelDateFormat($this->date_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,157 +1,156 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_ERROR.PHP
|
||||
// Description: Error plot extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_error.php 462 2006-02-04 12:07:05Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS ErrorPlot
|
||||
// Description: Error plot with min/max value for
|
||||
// each datapoint
|
||||
//===================================================
|
||||
class ErrorPlot extends Plot {
|
||||
private $errwidth=2;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ErrorPlot($datay,$datax=false) {
|
||||
$this->Plot($datay,$datax);
|
||||
$this->numpoints /= 2;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
// Gets called before any axis are stroked
|
||||
function PreStrokeAdjust($graph) {
|
||||
if( $this->center ) {
|
||||
$a=0.5; $b=0.5;
|
||||
++$this->numpoints;
|
||||
} else {
|
||||
$a=0; $b=0;
|
||||
}
|
||||
$graph->xaxis->scale->ticks->SetXLabelOffset($a);
|
||||
$graph->SetTextScaleOff($b);
|
||||
//$graph->xaxis->scale->ticks->SupressMinorTickMarks();
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
$numpoints=count($this->coords[0])/2;
|
||||
$img->SetColor($this->color);
|
||||
$img->SetLineWeight($this->weight);
|
||||
|
||||
if( isset($this->coords[1]) ) {
|
||||
if( count($this->coords[1])!=$numpoints )
|
||||
JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints);
|
||||
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||
else
|
||||
$exist_x = true;
|
||||
}
|
||||
else
|
||||
$exist_x = false;
|
||||
|
||||
for( $i=0; $i<$numpoints; ++$i) {
|
||||
if( $exist_x )
|
||||
$x=$this->coords[1][$i];
|
||||
else
|
||||
$x=$i;
|
||||
|
||||
if( !is_numeric($x) ||
|
||||
!is_numeric($this->coords[0][$i*2]) || !is_numeric($this->coords[0][$i*2+1]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$xt = $xscale->Translate($x);
|
||||
$yt1 = $yscale->Translate($this->coords[0][$i*2]);
|
||||
$yt2 = $yscale->Translate($this->coords[0][$i*2+1]);
|
||||
$img->Line($xt,$yt1,$xt,$yt2);
|
||||
$img->Line($xt-$this->errwidth,$yt1,$xt+$this->errwidth,$yt1);
|
||||
$img->Line($xt-$this->errwidth,$yt2,$xt+$this->errwidth,$yt2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS ErrorLinePlot
|
||||
// Description: Combine a line and error plot
|
||||
// THIS IS A DEPRECATED PLOT TYPE JUST KEPT FOR
|
||||
// BACKWARD COMPATIBILITY
|
||||
//===================================================
|
||||
class ErrorLinePlot extends ErrorPlot {
|
||||
public $line=null;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ErrorLinePlot($datay,$datax=false) {
|
||||
$this->ErrorPlot($datay,$datax);
|
||||
// Calculate line coordinates as the average of the error limits
|
||||
$n = count($datay);
|
||||
for($i=0; $i < $n; $i+=2 ) {
|
||||
$ly[]=($datay[$i]+$datay[$i+1])/2;
|
||||
}
|
||||
$this->line=new LinePlot($ly,$datax);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function Legend($graph) {
|
||||
if( $this->legend != "" )
|
||||
$graph->legend->Add($this->legend,$this->color);
|
||||
$this->line->Legend($graph);
|
||||
}
|
||||
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
parent::Stroke($img,$xscale,$yscale);
|
||||
$this->line->Stroke($img,$xscale,$yscale);
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS LineErrorPlot
|
||||
// Description: Combine a line and error plot
|
||||
//===================================================
|
||||
class LineErrorPlot extends ErrorPlot {
|
||||
public $line=null;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
// Data is (val, errdeltamin, errdeltamax)
|
||||
function LineErrorPlot($datay,$datax=false) {
|
||||
$ly=array(); $ey=array();
|
||||
$n = count($datay);
|
||||
if( $n % 3 != 0 ) {
|
||||
JpGraphError::RaiseL(4002);
|
||||
//('Error in input data to LineErrorPlot. Number of data points must be a multiple of 3');
|
||||
}
|
||||
for($i=0; $i < $n; $i+=3 ) {
|
||||
$ly[]=$datay[$i];
|
||||
$ey[]=$datay[$i]+$datay[$i+1];
|
||||
$ey[]=$datay[$i]+$datay[$i+2];
|
||||
}
|
||||
$this->ErrorPlot($ey,$datax);
|
||||
$this->line=new LinePlot($ly,$datax);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function Legend($graph) {
|
||||
if( $this->legend != "" )
|
||||
$graph->legend->Add($this->legend,$this->color);
|
||||
$this->line->Legend($graph);
|
||||
}
|
||||
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
parent::Stroke($img,$xscale,$yscale);
|
||||
$this->line->Stroke($img,$xscale,$yscale);
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
/* EOF */
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_ERROR.PHP
|
||||
// Description: Error plot extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_error.php 88 2005-08-07 17:18:51Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS ErrorPlot
|
||||
// Description: Error plot with min/max value for
|
||||
// each datapoint
|
||||
//===================================================
|
||||
class ErrorPlot extends Plot {
|
||||
var $errwidth=2;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ErrorPlot(&$datay,$datax=false) {
|
||||
$this->Plot($datay,$datax);
|
||||
$this->numpoints /= 2;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
// Gets called before any axis are stroked
|
||||
function PreStrokeAdjust(&$graph) {
|
||||
if( $this->center ) {
|
||||
$a=0.5; $b=0.5;
|
||||
++$this->numpoints;
|
||||
} else {
|
||||
$a=0; $b=0;
|
||||
}
|
||||
$graph->xaxis->scale->ticks->SetXLabelOffset($a);
|
||||
$graph->SetTextScaleOff($b);
|
||||
//$graph->xaxis->scale->ticks->SupressMinorTickMarks();
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke(&$img,&$xscale,&$yscale) {
|
||||
$numpoints=count($this->coords[0])/2;
|
||||
$img->SetColor($this->color);
|
||||
$img->SetLineWeight($this->weight);
|
||||
|
||||
if( isset($this->coords[1]) ) {
|
||||
if( count($this->coords[1])!=$numpoints )
|
||||
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||
else
|
||||
$exist_x = true;
|
||||
}
|
||||
else
|
||||
$exist_x = false;
|
||||
|
||||
for( $i=0; $i<$numpoints; ++$i) {
|
||||
if( $exist_x )
|
||||
$x=$this->coords[1][$i];
|
||||
else
|
||||
$x=$i;
|
||||
|
||||
if( !is_numeric($x) ||
|
||||
!is_numeric($this->coords[0][$i*2]) || !is_numeric($this->coords[0][$i*2+1]) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$xt = $xscale->Translate($x);
|
||||
$yt1 = $yscale->Translate($this->coords[0][$i*2]);
|
||||
$yt2 = $yscale->Translate($this->coords[0][$i*2+1]);
|
||||
$img->Line($xt,$yt1,$xt,$yt2);
|
||||
$img->Line($xt-$this->errwidth,$yt1,$xt+$this->errwidth,$yt1);
|
||||
$img->Line($xt-$this->errwidth,$yt2,$xt+$this->errwidth,$yt2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS ErrorLinePlot
|
||||
// Description: Combine a line and error plot
|
||||
// THIS IS A DEPRECATED PLOT TYPE JUST KEPT FOR
|
||||
// BACKWARD COMPATIBILITY
|
||||
//===================================================
|
||||
class ErrorLinePlot extends ErrorPlot {
|
||||
var $line=null;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ErrorLinePlot(&$datay,$datax=false) {
|
||||
$this->ErrorPlot($datay,$datax);
|
||||
// Calculate line coordinates as the average of the error limits
|
||||
$n = count($datay);
|
||||
for($i=0; $i < $n; $i+=2 ) {
|
||||
$ly[]=($datay[$i]+$datay[$i+1])/2;
|
||||
}
|
||||
$this->line=new LinePlot($ly,$datax);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function Legend(&$graph) {
|
||||
if( $this->legend != "" )
|
||||
$graph->legend->Add($this->legend,$this->color);
|
||||
$this->line->Legend($graph);
|
||||
}
|
||||
|
||||
function Stroke(&$img,&$xscale,&$yscale) {
|
||||
parent::Stroke($img,$xscale,$yscale);
|
||||
$this->line->Stroke($img,$xscale,$yscale);
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS LineErrorPlot
|
||||
// Description: Combine a line and error plot
|
||||
//===================================================
|
||||
class LineErrorPlot extends ErrorPlot {
|
||||
var $line=null;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
// Data is (val, errdeltamin, errdeltamax)
|
||||
function LineErrorPlot(&$datay,$datax=false) {
|
||||
$ly=array(); $ey=array();
|
||||
$n = count($datay);
|
||||
if( $n % 3 != 0 ) {
|
||||
JpGraphError::Raise('Error in input data to LineErrorPlot.'.
|
||||
'Number of data points must be a multiple of 3');
|
||||
}
|
||||
for($i=0; $i < $n; $i+=3 ) {
|
||||
$ly[]=$datay[$i];
|
||||
$ey[]=$datay[$i]+$datay[$i+1];
|
||||
$ey[]=$datay[$i]+$datay[$i+2];
|
||||
}
|
||||
$this->ErrorPlot($ey,$datax);
|
||||
$this->line=new LinePlot($ly,$datax);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function Legend(&$graph) {
|
||||
if( $this->legend != "" )
|
||||
$graph->legend->Add($this->legend,$this->color);
|
||||
$this->line->Legend($graph);
|
||||
}
|
||||
|
||||
function Stroke(&$img,&$xscale,&$yscale) {
|
||||
parent::Stroke($img,$xscale,$yscale);
|
||||
$this->line->Stroke($img,$xscale,$yscale);
|
||||
}
|
||||
} // Class
|
||||
|
||||
|
||||
/* EOF */
|
||||
?>
|
|
@ -1,374 +1,370 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_FLAGS.PHP
|
||||
// Description: Class Jpfile. Handles plotmarks
|
||||
// Created: 2003-06-28
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_flags.php 472 2006-02-04 12:13:48Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Defines for the different basic sizes of flags
|
||||
//------------------------------------------------------------
|
||||
DEFINE('FLAGSIZE1',1);
|
||||
DEFINE('FLAGSIZE2',2);
|
||||
DEFINE('FLAGSIZE3',3);
|
||||
DEFINE('FLAGSIZE4',4);
|
||||
|
||||
class FlagImages {
|
||||
|
||||
private $iCountryNameMap = array(
|
||||
'Afghanistan' => 'afgh',
|
||||
'Republic of Angola' => 'agla',
|
||||
'Republic of Albania' => 'alba',
|
||||
'Alderney' => 'alde',
|
||||
'Democratic and Popular Republic of Algeria' => 'alge',
|
||||
'Territory of American Samoa' => 'amsa',
|
||||
'Principality of Andorra' => 'andr',
|
||||
'British Overseas Territory of Anguilla' => 'angu',
|
||||
'Antarctica' => 'anta',
|
||||
'Argentine Republic' => 'arge',
|
||||
'League of Arab States' => 'arle',
|
||||
'Republic of Armenia' => 'arme',
|
||||
'Aruba' => 'arub',
|
||||
'Commonwealth of Australia' => 'astl',
|
||||
'Republic of Austria' => 'aust',
|
||||
'Azerbaijani Republic' => 'azer',
|
||||
'British Antarctic Territory' => 'bant',
|
||||
'Kingdom of Belgium' => 'belg',
|
||||
'British Overseas Territory of Bermuda' => 'berm',
|
||||
'Commonwealth of the Bahamas' => 'bhms',
|
||||
'Kingdom of Bahrain' => 'bhrn',
|
||||
'Republic of Belarus' => 'blru',
|
||||
'Republic of Bolivia' => 'blva',
|
||||
'Belize' => 'blze',
|
||||
'Republic of Benin' => 'bnin',
|
||||
'Republic of Botswana' => 'bots',
|
||||
'Federative Republic of Brazil' => 'braz',
|
||||
'Barbados' => 'brbd',
|
||||
'British Indian Ocean Territory' => 'brin',
|
||||
'Brunei Darussalam' => 'brun',
|
||||
'Republic of Burkina' => 'bufa',
|
||||
'Republic of Bulgaria' => 'bulg',
|
||||
'Republic of Burundi' => 'buru',
|
||||
'Overseas Territory of the British Virgin Islands' => 'bvis',
|
||||
'Central African Republic' => 'cafr',
|
||||
'Kingdom of Cambodia' => 'camb',
|
||||
'Republic of Cameroon' => 'came',
|
||||
'Dominion of Canada' => 'cana',
|
||||
'Caribbean Community' => 'cari',
|
||||
'Republic of Cape Verde' => 'cave',
|
||||
'Republic of Chad' => 'chad',
|
||||
'Republic of Chile' => 'chil',
|
||||
'Peoples Republic of China' => 'chin',
|
||||
'Territory of Christmas Island' => 'chms',
|
||||
'Commonwealth of Independent States' => 'cins',
|
||||
'Cook Islands' => 'ckis',
|
||||
'Republic of Colombia' => 'clmb',
|
||||
'Territory of Cocos Islands' => 'cois',
|
||||
'Commonwealth' => 'comn',
|
||||
'Union of the Comoros' => 'como',
|
||||
'Republic of the Congo' => 'cong',
|
||||
'Republic of Costa Rica' => 'corc',
|
||||
'Republic of Croatia' => 'croa',
|
||||
'Republic of Cuba' => 'cuba',
|
||||
'British Overseas Territory of the Cayman Islands' => 'cyis',
|
||||
'Republic of Cyprus' => 'cypr',
|
||||
'The Czech Republic' => 'czec',
|
||||
'Kingdom of Denmark' => 'denm',
|
||||
'Republic of Djibouti' => 'djib',
|
||||
'Commonwealth of Dominica' => 'domn',
|
||||
'Dominican Republic' => 'dore',
|
||||
'Republic of Ecuador' => 'ecua',
|
||||
'Arab Republic of Egypt' => 'egyp',
|
||||
'Republic of El Salvador' => 'elsa',
|
||||
'England' => 'engl',
|
||||
'Republic of Equatorial Guinea' => 'eqgu',
|
||||
'State of Eritrea' => 'erit',
|
||||
'Republic of Estonia' => 'estn',
|
||||
'Ethiopia' => 'ethp',
|
||||
'European Union' => 'euun',
|
||||
'British Overseas Territory of the Falkland Islands' => 'fais',
|
||||
'International Federation of Vexillological Associations' => 'fiav',
|
||||
'Republic of Fiji' => 'fiji',
|
||||
'Republic of Finland' => 'finl',
|
||||
'Territory of French Polynesia' => 'fpol',
|
||||
'French Republic' => 'fran',
|
||||
'Overseas Department of French Guiana' => 'frgu',
|
||||
'Gabonese Republic' => 'gabn',
|
||||
'Republic of the Gambia' => 'gamb',
|
||||
'Republic of Georgia' => 'geor',
|
||||
'Federal Republic of Germany' => 'germ',
|
||||
'Republic of Ghana' => 'ghan',
|
||||
'Gibraltar' => 'gibr',
|
||||
'Hellenic Republic' => 'grec',
|
||||
'State of Grenada' => 'gren',
|
||||
'Overseas Department of Guadeloupe' => 'guad',
|
||||
'Territory of Guam' => 'guam',
|
||||
'Republic of Guatemala' => 'guat',
|
||||
'The Bailiwick of Guernsey' => 'guer',
|
||||
'Republic of Guinea' => 'guin',
|
||||
'Republic of Haiti' => 'hait',
|
||||
'Hong Kong Special Administrative Region' => 'hokn',
|
||||
'Republic of Honduras' => 'hond',
|
||||
'Republic of Hungary' => 'hung',
|
||||
'Republic of Iceland' => 'icel',
|
||||
'International Committee of the Red Cross' => 'icrc',
|
||||
'Republic of India' => 'inda',
|
||||
'Republic of Indonesia' => 'indn',
|
||||
'Republic of Iraq' => 'iraq',
|
||||
'Republic of Ireland' => 'irel',
|
||||
'Organization of the Islamic Conference' => 'isco',
|
||||
'Isle of Man' => 'isma',
|
||||
'State of Israel' => 'isra',
|
||||
'Italian Republic' => 'ital',
|
||||
'Jamaica' => 'jama',
|
||||
'Japan' => 'japa',
|
||||
'The Bailiwick of Jersey' => 'jers',
|
||||
'Hashemite Kingdom of Jordan' => 'jord',
|
||||
'Republic of Kazakhstan' => 'kazk',
|
||||
'Republic of Kenya' => 'keny',
|
||||
'Republic of Kiribati' => 'kirb',
|
||||
'State of Kuwait' => 'kuwa',
|
||||
'Kyrgyz Republic' => 'kyrg',
|
||||
'Republic of Latvia' => 'latv',
|
||||
'Lebanese Republic' => 'leba',
|
||||
'Kingdom of Lesotho' => 'lest',
|
||||
'Republic of Liberia' => 'libe',
|
||||
'Principality of Liechtenstein' => 'liec',
|
||||
'Republic of Lithuania' => 'lith',
|
||||
'Grand Duchy of Luxembourg' => 'luxe',
|
||||
'Macao Special Administrative Region' => 'maca',
|
||||
'Republic of Macedonia' => 'mace',
|
||||
'Republic of Madagascar' => 'mada',
|
||||
'Republic of the Marshall Islands' => 'mais',
|
||||
'Republic of Mali' => 'mali',
|
||||
'Federation of Malaysia' => 'mals',
|
||||
'Republic of Malta' => 'malt',
|
||||
'Republic of Malawi' => 'malw',
|
||||
'Overseas Department of Martinique' => 'mart',
|
||||
'Islamic Republic of Mauritania' => 'maur',
|
||||
'Territorial Collectivity of Mayotte' => 'mayt',
|
||||
'United Mexican States' => 'mexc',
|
||||
'Federated States of Micronesia' => 'micr',
|
||||
'Midway Islands' => 'miis',
|
||||
'Republic of Moldova' => 'mold',
|
||||
'Principality of Monaco' => 'mona',
|
||||
'Republic of Mongolia' => 'mong',
|
||||
'British Overseas Territory of Montserrat' => 'mont',
|
||||
'Kingdom of Morocco' => 'morc',
|
||||
'Republic of Mozambique' => 'moza',
|
||||
'Republic of Mauritius' => 'mrts',
|
||||
'Union of Myanmar' => 'myan',
|
||||
'Republic of Namibia' => 'namb',
|
||||
'North Atlantic Treaty Organization' => 'nato',
|
||||
'Republic of Nauru' => 'naur',
|
||||
'Turkish Republic of Northern Cyprus' => 'ncyp',
|
||||
'Netherlands Antilles' => 'nean',
|
||||
'Kingdom of Nepal' => 'nepa',
|
||||
'Kingdom of the Netherlands' => 'neth',
|
||||
'Territory of Norfolk Island' => 'nfis',
|
||||
'Federal Republic of Nigeria' => 'ngra',
|
||||
'Republic of Nicaragua' => 'nica',
|
||||
'Republic of Niger' => 'nigr',
|
||||
'Niue' => 'niue',
|
||||
'Commonwealth of the Northern Mariana Islands' => 'nmar',
|
||||
'Province of Northern Ireland' => 'noir',
|
||||
'Nordic Council' => 'nord',
|
||||
'Kingdom of Norway' => 'norw',
|
||||
'Territory of New Caledonia and Dependencies' => 'nwca',
|
||||
'New Zealand' => 'nwze',
|
||||
'Organization of American States' => 'oast',
|
||||
'Organization of African Unity' => 'oaun',
|
||||
'International Olympic Committee' => 'olym',
|
||||
'Sultanate of Oman' => 'oman',
|
||||
'Islamic Republic of Pakistan' => 'paks',
|
||||
'Republic of Palau' => 'pala',
|
||||
'Independent State of Papua New Guinea' => 'pang',
|
||||
'Republic of Paraguay' => 'para',
|
||||
'Republic of Peru' => 'peru',
|
||||
'Republic of the Philippines' => 'phil',
|
||||
'British Overseas Territory of the Pitcairn Islands' => 'piis',
|
||||
'Republic of Poland' => 'pola',
|
||||
'Republic of Portugal' => 'port',
|
||||
'Commonwealth of Puerto Rico' => 'purc',
|
||||
'State of Qatar' => 'qata',
|
||||
'Russian Federation' => 'russ',
|
||||
'Republic of Rwanda' => 'rwan',
|
||||
'Kingdom of Saudi Arabia' => 'saar',
|
||||
'Republic of San Marino' => 'sama',
|
||||
'Nordic Sami Conference' => 'sami',
|
||||
'Sark' => 'sark',
|
||||
'Scotland' => 'scot',
|
||||
'Principality of Seborga' => 'sebo',
|
||||
'Republic of Sierra Leone' => 'sile',
|
||||
'Republic of Singapore' => 'sing',
|
||||
'Republic of Korea' => 'skor',
|
||||
'Republic of Slovenia' => 'slva',
|
||||
'Somali Republic' => 'smla',
|
||||
'Republic of Somaliland' => 'smld',
|
||||
'Republic of South Africa' => 'soaf',
|
||||
'Solomon Islands' => 'sois',
|
||||
'Kingdom of Spain' => 'span',
|
||||
'Secretariat of the Pacific Community' => 'spco',
|
||||
'Democratic Socialist Republic of Sri Lanka' => 'srla',
|
||||
'Saint Lucia' => 'stlu',
|
||||
'Republic of the Sudan' => 'suda',
|
||||
'Republic of Suriname' => 'surn',
|
||||
'Slovak Republic' => 'svka',
|
||||
'Kingdom of Sweden' => 'swdn',
|
||||
'Swiss Confederation' => 'swit',
|
||||
'Syrian Arab Republic' => 'syra',
|
||||
'Kingdom of Swaziland' => 'szld',
|
||||
'Republic of China' => 'taiw',
|
||||
'Taiwan' => 'taiw',
|
||||
'Republic of Tajikistan' => 'tajk',
|
||||
'United Republic of Tanzania' => 'tanz',
|
||||
'Kingdom of Thailand' => 'thal',
|
||||
'Autonomous Region of Tibet' => 'tibe',
|
||||
'Turkmenistan' => 'tkst',
|
||||
'Togolese Republic' => 'togo',
|
||||
'Tokelau' => 'toke',
|
||||
'Kingdom of Tonga' => 'tong',
|
||||
'Tristan da Cunha' => 'trdc',
|
||||
'Tromelin' => 'tris',
|
||||
'Republic of Tunisia' => 'tuns',
|
||||
'Republic of Turkey' => 'turk',
|
||||
'Tuvalu' => 'tuva',
|
||||
'United Arab Emirates' => 'uaem',
|
||||
'Republic of Uganda' => 'ugan',
|
||||
'Ukraine' => 'ukrn',
|
||||
'United Kingdom of Great Britain' => 'unkg',
|
||||
'United Nations' => 'unna',
|
||||
'United States of America' => 'unst',
|
||||
'Oriental Republic of Uruguay' => 'urgy',
|
||||
'Virgin Islands of the United States' => 'usvs',
|
||||
'Republic of Uzbekistan' => 'uzbk',
|
||||
'State of the Vatican City' => 'vacy',
|
||||
'Republic of Vanuatu' => 'vant',
|
||||
'Bolivarian Republic of Venezuela' => 'venz',
|
||||
'Republic of Yemen' => 'yemn',
|
||||
'Democratic Republic of Congo' => 'zare',
|
||||
'Republic of Zimbabwe' => 'zbwe' ) ;
|
||||
|
||||
|
||||
private $iFlagCount = -1;
|
||||
private $iFlagSetMap = array(
|
||||
FLAGSIZE1 => 'flags_thumb35x35',
|
||||
FLAGSIZE2 => 'flags_thumb60x60',
|
||||
FLAGSIZE3 => 'flags_thumb100x100',
|
||||
FLAGSIZE4 => 'flags'
|
||||
);
|
||||
|
||||
private $iFlagData ;
|
||||
private $iOrdIdx=array();
|
||||
|
||||
function FlagImages($aSize=FLAGSIZE1) {
|
||||
switch($aSize) {
|
||||
case FLAGSIZE1 :
|
||||
case FLAGSIZE2 :
|
||||
case FLAGSIZE3 :
|
||||
case FLAGSIZE4 :
|
||||
$file = dirname(__FILE__).'/'.$this->iFlagSetMap[$aSize].'.dat';
|
||||
$fp = fopen($file,'rb');
|
||||
$rawdata = fread($fp,filesize($file));
|
||||
$this->iFlagData = unserialize($rawdata);
|
||||
break;
|
||||
default:
|
||||
JpGraphError::RaiseL(5001,$aSize);
|
||||
//('Unknown flag size. ('.$aSize.')');
|
||||
}
|
||||
$this->iFlagCount = count($this->iCountryNameMap);
|
||||
}
|
||||
|
||||
function GetNum() {
|
||||
return $this->iFlagCount;
|
||||
}
|
||||
|
||||
function GetImgByName($aName,&$outFullName) {
|
||||
$idx = $this->GetIdxByName($aName,$outFullName);
|
||||
return $this->GetImgByIdx($idx);
|
||||
}
|
||||
|
||||
function GetImgByIdx($aIdx) {
|
||||
if( array_key_exists($aIdx,$this->iFlagData) ) {
|
||||
$d = $this->iFlagData[$aIdx][1];
|
||||
return Image::CreateFromString($d);
|
||||
}
|
||||
else {
|
||||
JpGraphError::RaiseL(5002,$aIdx);
|
||||
//("Flag index \" $aIdx\" does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
function GetIdxByOrdinal($aOrd,&$outFullName) {
|
||||
$aOrd--;
|
||||
$n = count($this->iOrdIdx);
|
||||
if( $n == 0 ) {
|
||||
reset($this->iCountryNameMap);
|
||||
$this->iOrdIdx=array();
|
||||
$i=0;
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
$this->iOrdIdx[$i++] = array($val,$key);
|
||||
}
|
||||
$tmp=$this->iOrdIdx[$aOrd];
|
||||
$outFullName = $tmp[1];
|
||||
return $tmp[0];
|
||||
|
||||
}
|
||||
elseif( $aOrd >= 0 && $aOrd < $n ) {
|
||||
$tmp=$this->iOrdIdx[$aOrd];
|
||||
$outFullName = $tmp[1];
|
||||
return $tmp[0];
|
||||
}
|
||||
else {
|
||||
JpGraphError::RaiseL(5003,$aOrd);
|
||||
//('Invalid ordinal number specified for flag index.');
|
||||
}
|
||||
}
|
||||
|
||||
function GetIdxByName($aName,&$outFullName) {
|
||||
|
||||
if( is_integer($aName) ) {
|
||||
$idx = $this->GetIdxByOrdinal($aName,$outFullName);
|
||||
return $idx;
|
||||
}
|
||||
|
||||
$found=false;
|
||||
$aName = strtolower($aName);
|
||||
$nlen = strlen($aName);
|
||||
reset($this->iCountryNameMap);
|
||||
// Start by trying to match exact index name
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
if( $nlen == strlen($val) && $val == $aName ) {
|
||||
$found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !$found ) {
|
||||
reset($this->iCountryNameMap);
|
||||
// If the exact index doesn't work try a (partial) full name
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
if( strpos(strtolower($key), $aName) !== false ) {
|
||||
$found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $found ) {
|
||||
$outFullName = $key;
|
||||
return $val;
|
||||
}
|
||||
else {
|
||||
JpGraphError::RaiseL(5004,$aName);
|
||||
//("The (partial) country name \"$aName\" does not have a cooresponding flag image. The flag may still exist but under another name, e.g. insted of \"usa\" try \"united states\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_FLAGS.PHP
|
||||
// Description: Class Jpfile. Handles plotmarks
|
||||
// Created: 2003-06-28
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_flags.php 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Defines for the different basic sizes of flags
|
||||
//------------------------------------------------------------
|
||||
DEFINE('FLAGSIZE1',1);
|
||||
DEFINE('FLAGSIZE2',2);
|
||||
DEFINE('FLAGSIZE3',3);
|
||||
DEFINE('FLAGSIZE4',4);
|
||||
|
||||
class FlagImages {
|
||||
|
||||
var $iCountryNameMap = array(
|
||||
'Afghanistan' => 'afgh',
|
||||
'Republic of Angola' => 'agla',
|
||||
'Republic of Albania' => 'alba',
|
||||
'Alderney' => 'alde',
|
||||
'Democratic and Popular Republic of Algeria' => 'alge',
|
||||
'Territory of American Samoa' => 'amsa',
|
||||
'Principality of Andorra' => 'andr',
|
||||
'British Overseas Territory of Anguilla' => 'angu',
|
||||
'Antarctica' => 'anta',
|
||||
'Argentine Republic' => 'arge',
|
||||
'League of Arab States' => 'arle',
|
||||
'Republic of Armenia' => 'arme',
|
||||
'Aruba' => 'arub',
|
||||
'Commonwealth of Australia' => 'astl',
|
||||
'Republic of Austria' => 'aust',
|
||||
'Azerbaijani Republic' => 'azer',
|
||||
'British Antarctic Territory' => 'bant',
|
||||
'Kingdom of Belgium' => 'belg',
|
||||
'British Overseas Territory of Bermuda' => 'berm',
|
||||
'Commonwealth of the Bahamas' => 'bhms',
|
||||
'Kingdom of Bahrain' => 'bhrn',
|
||||
'Republic of Belarus' => 'blru',
|
||||
'Republic of Bolivia' => 'blva',
|
||||
'Belize' => 'blze',
|
||||
'Republic of Benin' => 'bnin',
|
||||
'Republic of Botswana' => 'bots',
|
||||
'Federative Republic of Brazil' => 'braz',
|
||||
'Barbados' => 'brbd',
|
||||
'British Indian Ocean Territory' => 'brin',
|
||||
'Brunei Darussalam' => 'brun',
|
||||
'Republic of Burkina' => 'bufa',
|
||||
'Republic of Bulgaria' => 'bulg',
|
||||
'Republic of Burundi' => 'buru',
|
||||
'Overseas Territory of the British Virgin Islands' => 'bvis',
|
||||
'Central African Republic' => 'cafr',
|
||||
'Kingdom of Cambodia' => 'camb',
|
||||
'Republic of Cameroon' => 'came',
|
||||
'Dominion of Canada' => 'cana',
|
||||
'Caribbean Community' => 'cari',
|
||||
'Republic of Cape Verde' => 'cave',
|
||||
'Republic of Chad' => 'chad',
|
||||
'Republic of Chile' => 'chil',
|
||||
'Peoples Republic of China' => 'chin',
|
||||
'Territory of Christmas Island' => 'chms',
|
||||
'Commonwealth of Independent States' => 'cins',
|
||||
'Cook Islands' => 'ckis',
|
||||
'Republic of Colombia' => 'clmb',
|
||||
'Territory of Cocos Islands' => 'cois',
|
||||
'Commonwealth' => 'comn',
|
||||
'Union of the Comoros' => 'como',
|
||||
'Republic of the Congo' => 'cong',
|
||||
'Republic of Costa Rica' => 'corc',
|
||||
'Republic of Croatia' => 'croa',
|
||||
'Republic of Cuba' => 'cuba',
|
||||
'British Overseas Territory of the Cayman Islands' => 'cyis',
|
||||
'Republic of Cyprus' => 'cypr',
|
||||
'The Czech Republic' => 'czec',
|
||||
'Kingdom of Denmark' => 'denm',
|
||||
'Republic of Djibouti' => 'djib',
|
||||
'Commonwealth of Dominica' => 'domn',
|
||||
'Dominican Republic' => 'dore',
|
||||
'Republic of Ecuador' => 'ecua',
|
||||
'Arab Republic of Egypt' => 'egyp',
|
||||
'Republic of El Salvador' => 'elsa',
|
||||
'England' => 'engl',
|
||||
'Republic of Equatorial Guinea' => 'eqgu',
|
||||
'State of Eritrea' => 'erit',
|
||||
'Republic of Estonia' => 'estn',
|
||||
'Ethiopia' => 'ethp',
|
||||
'European Union' => 'euun',
|
||||
'British Overseas Territory of the Falkland Islands' => 'fais',
|
||||
'International Federation of Vexillological Associations' => 'fiav',
|
||||
'Republic of Fiji' => 'fiji',
|
||||
'Republic of Finland' => 'finl',
|
||||
'Territory of French Polynesia' => 'fpol',
|
||||
'French Republic' => 'fran',
|
||||
'Overseas Department of French Guiana' => 'frgu',
|
||||
'Gabonese Republic' => 'gabn',
|
||||
'Republic of the Gambia' => 'gamb',
|
||||
'Republic of Georgia' => 'geor',
|
||||
'Federal Republic of Germany' => 'germ',
|
||||
'Republic of Ghana' => 'ghan',
|
||||
'Gibraltar' => 'gibr',
|
||||
'Hellenic Republic' => 'grec',
|
||||
'State of Grenada' => 'gren',
|
||||
'Overseas Department of Guadeloupe' => 'guad',
|
||||
'Territory of Guam' => 'guam',
|
||||
'Republic of Guatemala' => 'guat',
|
||||
'The Bailiwick of Guernsey' => 'guer',
|
||||
'Republic of Guinea' => 'guin',
|
||||
'Republic of Haiti' => 'hait',
|
||||
'Hong Kong Special Administrative Region' => 'hokn',
|
||||
'Republic of Honduras' => 'hond',
|
||||
'Republic of Hungary' => 'hung',
|
||||
'Republic of Iceland' => 'icel',
|
||||
'International Committee of the Red Cross' => 'icrc',
|
||||
'Republic of India' => 'inda',
|
||||
'Republic of Indonesia' => 'indn',
|
||||
'Republic of Iraq' => 'iraq',
|
||||
'Republic of Ireland' => 'irel',
|
||||
'Organization of the Islamic Conference' => 'isco',
|
||||
'Isle of Man' => 'isma',
|
||||
'State of Israel' => 'isra',
|
||||
'Italian Republic' => 'ital',
|
||||
'Jamaica' => 'jama',
|
||||
'Japan' => 'japa',
|
||||
'The Bailiwick of Jersey' => 'jers',
|
||||
'Hashemite Kingdom of Jordan' => 'jord',
|
||||
'Republic of Kazakhstan' => 'kazk',
|
||||
'Republic of Kenya' => 'keny',
|
||||
'Republic of Kiribati' => 'kirb',
|
||||
'State of Kuwait' => 'kuwa',
|
||||
'Kyrgyz Republic' => 'kyrg',
|
||||
'Republic of Latvia' => 'latv',
|
||||
'Lebanese Republic' => 'leba',
|
||||
'Kingdom of Lesotho' => 'lest',
|
||||
'Republic of Liberia' => 'libe',
|
||||
'Principality of Liechtenstein' => 'liec',
|
||||
'Republic of Lithuania' => 'lith',
|
||||
'Grand Duchy of Luxembourg' => 'luxe',
|
||||
'Macao Special Administrative Region' => 'maca',
|
||||
'Republic of Macedonia' => 'mace',
|
||||
'Republic of Madagascar' => 'mada',
|
||||
'Republic of the Marshall Islands' => 'mais',
|
||||
'Republic of Mali' => 'mali',
|
||||
'Federation of Malaysia' => 'mals',
|
||||
'Republic of Malta' => 'malt',
|
||||
'Republic of Malawi' => 'malw',
|
||||
'Overseas Department of Martinique' => 'mart',
|
||||
'Islamic Republic of Mauritania' => 'maur',
|
||||
'Territorial Collectivity of Mayotte' => 'mayt',
|
||||
'United Mexican States' => 'mexc',
|
||||
'Federated States of Micronesia' => 'micr',
|
||||
'Midway Islands' => 'miis',
|
||||
'Republic of Moldova' => 'mold',
|
||||
'Principality of Monaco' => 'mona',
|
||||
'Republic of Mongolia' => 'mong',
|
||||
'British Overseas Territory of Montserrat' => 'mont',
|
||||
'Kingdom of Morocco' => 'morc',
|
||||
'Republic of Mozambique' => 'moza',
|
||||
'Republic of Mauritius' => 'mrts',
|
||||
'Union of Myanmar' => 'myan',
|
||||
'Republic of Namibia' => 'namb',
|
||||
'North Atlantic Treaty Organization' => 'nato',
|
||||
'Republic of Nauru' => 'naur',
|
||||
'Turkish Republic of Northern Cyprus' => 'ncyp',
|
||||
'Netherlands Antilles' => 'nean',
|
||||
'Kingdom of Nepal' => 'nepa',
|
||||
'Kingdom of the Netherlands' => 'neth',
|
||||
'Territory of Norfolk Island' => 'nfis',
|
||||
'Federal Republic of Nigeria' => 'ngra',
|
||||
'Republic of Nicaragua' => 'nica',
|
||||
'Republic of Niger' => 'nigr',
|
||||
'Niue' => 'niue',
|
||||
'Commonwealth of the Northern Mariana Islands' => 'nmar',
|
||||
'Province of Northern Ireland' => 'noir',
|
||||
'Nordic Council' => 'nord',
|
||||
'Kingdom of Norway' => 'norw',
|
||||
'Territory of New Caledonia and Dependencies' => 'nwca',
|
||||
'New Zealand' => 'nwze',
|
||||
'Organization of American States' => 'oast',
|
||||
'Organization of African Unity' => 'oaun',
|
||||
'International Olympic Committee' => 'olym',
|
||||
'Sultanate of Oman' => 'oman',
|
||||
'Islamic Republic of Pakistan' => 'paks',
|
||||
'Republic of Palau' => 'pala',
|
||||
'Independent State of Papua New Guinea' => 'pang',
|
||||
'Republic of Paraguay' => 'para',
|
||||
'Republic of the Philippines' => 'phil',
|
||||
'British Overseas Territory of the Pitcairn Islands' => 'piis',
|
||||
'Republic of Poland' => 'pola',
|
||||
'Republic of Portugal' => 'port',
|
||||
'Commonwealth of Puerto Rico' => 'purc',
|
||||
'State of Qatar' => 'qata',
|
||||
'Russian Federation' => 'russ',
|
||||
'Republic of Rwanda' => 'rwan',
|
||||
'Kingdom of Saudi Arabia' => 'saar',
|
||||
'Republic of San Marino' => 'sama',
|
||||
'Nordic Sami Conference' => 'sami',
|
||||
'Sark' => 'sark',
|
||||
'Scotland' => 'scot',
|
||||
'Principality of Seborga' => 'sebo',
|
||||
'Republic of Sierra Leone' => 'sile',
|
||||
'Republic of Singapore' => 'sing',
|
||||
'Republic of Korea' => 'skor',
|
||||
'Republic of Slovenia' => 'slva',
|
||||
'Somali Republic' => 'smla',
|
||||
'Republic of Somaliland' => 'smld',
|
||||
'Republic of South Africa' => 'soaf',
|
||||
'Solomon Islands' => 'sois',
|
||||
'Kingdom of Spain' => 'span',
|
||||
'Secretariat of the Pacific Community' => 'spco',
|
||||
'Democratic Socialist Republic of Sri Lanka' => 'srla',
|
||||
'Saint Lucia' => 'stlu',
|
||||
'Republic of the Sudan' => 'suda',
|
||||
'Republic of Suriname' => 'surn',
|
||||
'Slovak Republic' => 'svka',
|
||||
'Kingdom of Sweden' => 'swdn',
|
||||
'Swiss Confederation' => 'swit',
|
||||
'Syrian Arab Republic' => 'syra',
|
||||
'Kingdom of Swaziland' => 'szld',
|
||||
'Republic of China' => 'taiw',
|
||||
'Taiwan' => 'taiw',
|
||||
'Republic of Tajikistan' => 'tajk',
|
||||
'United Republic of Tanzania' => 'tanz',
|
||||
'Kingdom of Thailand' => 'thal',
|
||||
'Autonomous Region of Tibet' => 'tibe',
|
||||
'Turkmenistan' => 'tkst',
|
||||
'Togolese Republic' => 'togo',
|
||||
'Tokelau' => 'toke',
|
||||
'Kingdom of Tonga' => 'tong',
|
||||
'Tristan da Cunha' => 'trdc',
|
||||
'Tromelin' => 'tris',
|
||||
'Republic of Tunisia' => 'tuns',
|
||||
'Republic of Turkey' => 'turk',
|
||||
'Tuvalu' => 'tuva',
|
||||
'United Arab Emirates' => 'uaem',
|
||||
'Republic of Uganda' => 'ugan',
|
||||
'Ukraine' => 'ukrn',
|
||||
'United Kingdom of Great Britain' => 'unkg',
|
||||
'United Nations' => 'unna',
|
||||
'United States of America' => 'unst',
|
||||
'Oriental Republic of Uruguay' => 'urgy',
|
||||
'Virgin Islands of the United States' => 'usvs',
|
||||
'Republic of Uzbekistan' => 'uzbk',
|
||||
'State of the Vatican City' => 'vacy',
|
||||
'Republic of Vanuatu' => 'vant',
|
||||
'Bolivarian Republic of Venezuela' => 'venz',
|
||||
'Republic of Yemen' => 'yemn',
|
||||
'Democratic Republic of Congo' => 'zare',
|
||||
'Republic of Zimbabwe' => 'zbwe' ) ;
|
||||
|
||||
|
||||
var $iFlagCount = -1;
|
||||
var $iFlagSetMap = array(
|
||||
FLAGSIZE1 => 'flags_thumb35x35',
|
||||
FLAGSIZE2 => 'flags_thumb60x60',
|
||||
FLAGSIZE3 => 'flags_thumb100x100',
|
||||
FLAGSIZE4 => 'flags'
|
||||
);
|
||||
|
||||
var $iFlagData ;
|
||||
var $iOrdIdx=array();
|
||||
|
||||
function FlagImages($aSize=FLAGSIZE1) {
|
||||
switch($aSize) {
|
||||
case FLAGSIZE1 :
|
||||
case FLAGSIZE2 :
|
||||
case FLAGSIZE3 :
|
||||
case FLAGSIZE4 :
|
||||
$file = dirname(__FILE__).'/'.$this->iFlagSetMap[$aSize].'.dat';
|
||||
$fp = fopen($file,'rb');
|
||||
$rawdata = fread($fp,filesize($file));
|
||||
$this->iFlagData = unserialize($rawdata);
|
||||
break;
|
||||
default:
|
||||
JpGraphError::Raise('Unknown flag size. ('.$aSize.')');
|
||||
die();
|
||||
}
|
||||
$this->iFlagCount = count($this->iCountryNameMap);
|
||||
}
|
||||
|
||||
function GetNum() {
|
||||
return $this->iFlagCount;
|
||||
}
|
||||
|
||||
function GetImgByName($aName,&$outFullName) {
|
||||
$idx = $this->GetIdxByName($aName,$outFullName);
|
||||
return $this->GetImgByIdx($idx);
|
||||
}
|
||||
|
||||
function GetImgByIdx($aIdx) {
|
||||
if( array_key_exists($aIdx,$this->iFlagData) ) {
|
||||
$d = $this->iFlagData[$aIdx][1];
|
||||
return Image::CreateFromString($d);
|
||||
}
|
||||
else {
|
||||
JpGraphError::Raise("Flag index \" $aIdx\" does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
function GetIdxByOrdinal($aOrd,&$outFullName) {
|
||||
$aOrd--;
|
||||
$n = count($this->iOrdIdx);
|
||||
if( $n == 0 ) {
|
||||
reset($this->iCountryNameMap);
|
||||
$this->iOrdIdx=array();
|
||||
$i=0;
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
$this->iOrdIdx[$i++] = array($val,$key);
|
||||
}
|
||||
$tmp=$this->iOrdIdx[$aOrd];
|
||||
$outFullName = $tmp[1];
|
||||
return $tmp[0];
|
||||
|
||||
}
|
||||
elseif( $aOrd >= 0 && $aOrd < $n ) {
|
||||
$tmp=$this->iOrdIdx[$aOrd];
|
||||
$outFullName = $tmp[1];
|
||||
return $tmp[0];
|
||||
}
|
||||
else {
|
||||
JpGraphError::Raise('Invalid ordinal number specified for flag index.');
|
||||
}
|
||||
}
|
||||
|
||||
function GetIdxByName($aName,&$outFullName) {
|
||||
|
||||
if( is_integer($aName) ) {
|
||||
$idx = $this->GetIdxByOrdinal($aName,$outFullName);
|
||||
return $idx;
|
||||
}
|
||||
|
||||
$found=false;
|
||||
$aName = strtolower($aName);
|
||||
$nlen = strlen($aName);
|
||||
reset($this->iCountryNameMap);
|
||||
// Start by trying to match exact index name
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
if( $nlen == strlen($val) && $val == $aName ) {
|
||||
$found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !$found ) {
|
||||
reset($this->iCountryNameMap);
|
||||
// If the exact index doesn't work try a (partial) full name
|
||||
while( list($key,$val) = each($this->iCountryNameMap) ) {
|
||||
if( strpos(strtolower($key), $aName) !== false ) {
|
||||
$found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $found ) {
|
||||
$outFullName = $key;
|
||||
return $val;
|
||||
}
|
||||
else {
|
||||
JpGraphError::Raise("The (partial) country name \"$aName\" does not have a cooresponding flag image. The flag may still exist but under another name, e.g. insted of \"usa\" try \"united states\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
|
@ -1,424 +1,376 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_GRADIENT.PHP
|
||||
// Description: Create a color gradient
|
||||
// Created: 2003-02-01
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_gradient.php 630 2006-05-26 00:09:30Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
// Styles for gradient color fill
|
||||
DEFINE("GRAD_VER",1);
|
||||
DEFINE("GRAD_VERT",1);
|
||||
DEFINE("GRAD_HOR",2);
|
||||
DEFINE("GRAD_MIDHOR",3);
|
||||
DEFINE("GRAD_MIDVER",4);
|
||||
DEFINE("GRAD_CENTER",5);
|
||||
DEFINE("GRAD_WIDE_MIDVER",6);
|
||||
DEFINE("GRAD_WIDE_MIDHOR",7);
|
||||
DEFINE("GRAD_LEFT_REFLECTION",8);
|
||||
DEFINE("GRAD_RIGHT_REFLECTION",9);
|
||||
DEFINE("GRAD_RAISED_PANEL",10);
|
||||
DEFINE("GRAD_DIAGONAL",11);
|
||||
|
||||
//===================================================
|
||||
// CLASS Gradient
|
||||
// Description: Handles gradient fills. This is to be
|
||||
// considered a "friend" class of Class Image.
|
||||
//===================================================
|
||||
class Gradient {
|
||||
private $img=null, $numcolors=100;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function Gradient(&$img) {
|
||||
$this->img = $img;
|
||||
}
|
||||
|
||||
|
||||
function SetNumColors($aNum) {
|
||||
$this->numcolors=$aNum;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
// Produce a gradient filled rectangle with a smooth transition between
|
||||
// two colors.
|
||||
// ($xl,$yt) Top left corner
|
||||
// ($xr,$yb) Bottom right
|
||||
// $from_color Starting color in gradient
|
||||
// $to_color End color in the gradient
|
||||
// $style Which way is the gradient oriented?
|
||||
function FilledRectangle($xl,$yt,$xr,$yb,$from_color,$to_color,$style=1) {
|
||||
switch( $style ) {
|
||||
case GRAD_VER:
|
||||
$steps = round(abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for( $i=0, $x=$xl; $i < $steps; ++$i ) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yt,$x,$yb);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_HOR:
|
||||
$steps = round(abs($yb-$yt));
|
||||
$delta = $yb>=$yt ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($i=0,$y=$yt; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_MIDHOR:
|
||||
$steps = round(abs($yb-$yt)/2);
|
||||
$delta = $yb >= $yt ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($y=$yt, $i=0; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
--$i;
|
||||
if( abs($yb-$yt) % 2 == 1 ) --$steps;
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
break;
|
||||
|
||||
case GRAD_MIDVER:
|
||||
$steps = round(abs($xr-$xl)/2);
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($x=$xl, $i=0; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
--$i;
|
||||
if( abs($xr-$xl) % 2 == 1 ) --$steps;
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
break;
|
||||
|
||||
case GRAD_WIDE_MIDVER:
|
||||
$diff = round(abs($xr-$xl));
|
||||
$steps = floor(abs($diff)/3);
|
||||
$firststep = $diff - 2*$steps ;
|
||||
$delta = $xr >= $xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$firststep,$colors,$this->numcolors);
|
||||
for($x=$xl, $i=0; $i < $firststep; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
--$i;
|
||||
$this->img->current_color = $colors[$i];
|
||||
for($j=0; $j< $steps; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_WIDE_MIDHOR:
|
||||
$diff = round(abs($yb-$yt));
|
||||
$steps = floor(abs($diff)/3);
|
||||
$firststep = $diff - 2*$steps ;
|
||||
$delta = $yb >= $yt? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$firststep,$colors,$this->numcolors);
|
||||
for($y=$yt, $i=0; $i < $firststep; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
--$i;
|
||||
$this->img->current_color = $colors[$i];
|
||||
for($j=0; $j < $steps; ++$j) {
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_LEFT_REFLECTION:
|
||||
$steps1 = round(0.3*abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$adj = 1.4;
|
||||
$m = ($adj-1.0)*(255-min(255,min($from_color[0],min($from_color[1],$from_color[2]))));
|
||||
$from_color2 = array(min(255,$from_color[0]+$m),
|
||||
min(255,$from_color[1]+$m), min(255,$from_color[2]+$m));
|
||||
|
||||
$this->GetColArray($from_color2,$to_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps2 = max(1,round(0.08*abs($xr-$xl)));
|
||||
$this->img->SetColor($to_color);
|
||||
for($j=0; $j< $steps2; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps = abs($xr-$xl)-$steps1-$steps2;
|
||||
$this->GetColArray($to_color,$from_color,$steps,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_RIGHT_REFLECTION:
|
||||
$steps1 = round(0.7*abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
|
||||
$this->GetColArray($from_color,$to_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps2 = max(1,round(0.08*abs($xr-$xl)));
|
||||
$this->img->SetColor($to_color);
|
||||
for($j=0; $j< $steps2; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$adj = 1.4;
|
||||
$m = ($adj-1.0)*(255-min(255,min($from_color[0],min($from_color[1],$from_color[2]))));
|
||||
$from_color = array(min(255,$from_color[0]+$m),
|
||||
min(255,$from_color[1]+$m), min(255,$from_color[2]+$m));
|
||||
|
||||
$steps = abs($xr-$xl)-$steps1-$steps2;
|
||||
$this->GetColArray($to_color,$from_color,$steps,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_CENTER:
|
||||
$steps = ceil(min(($yb-$yt)+1,($xr-$xl)+1)/2);
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
$dx = ($xr-$xl)/2;
|
||||
$dy = ($yb-$yt)/2;
|
||||
$x=$xl;$y=$yt;$x2=$xr;$y2=$yb;
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $x < $xl+$dx && $y < $yt+$dy && $i < $n; ++$x, ++$y, --$x2, --$y2, ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Rectangle($x,$y,$x2,$y2);
|
||||
}
|
||||
$this->img->Line($x,$y,$x2,$y2);
|
||||
break;
|
||||
|
||||
case GRAD_RAISED_PANEL:
|
||||
// right to left
|
||||
$steps1 = $xr-$xl;
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($to_color,$from_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
// left to right
|
||||
$xr -= 3;
|
||||
$xl += 3;
|
||||
$yb -= 3;
|
||||
$yt += 3;
|
||||
$steps2 = $xr-$xl;
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
for($x=$xl, $j=$steps2; $j >= 0; --$j) {
|
||||
$this->img->current_color = $colors[$j];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_DIAGONAL:
|
||||
// use the longer dimension to determine the required number of steps.
|
||||
// first loop draws from one corner to the mid-diagonal and the second
|
||||
// loop draws from the mid-diagonal to the opposing corner.
|
||||
if($xr-$xl > $yb - $yt) {
|
||||
// width is greater than height -> use x-dimension for steps
|
||||
$steps = $xr-$xl;
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps*2,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
|
||||
for($x=$xl, $i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$y = $yt+($i/$steps)*($yb-$yt)*$delta;
|
||||
$this->img->Line($x,$yt,$xl,$y);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
for($x=$xl, $i = 0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$steps+$i];
|
||||
$y = $yt+($i/$steps)*($yb-$yt)*$delta;
|
||||
$this->img->Line($x,$yb,$xr,$y);
|
||||
$x += $delta;
|
||||
}
|
||||
} else {
|
||||
// height is greater than width -> use y-dimension for steps
|
||||
$steps = $yb-$yt;
|
||||
$delta = $yb>=$yt ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps*2,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
|
||||
for($y=$yt, $i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$x = $xl+($i/$steps)*($xr-$xl)*$delta;
|
||||
$this->img->Line($x,$yt,$xl,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
|
||||
for($y=$yt, $i = 0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$steps+$i];
|
||||
$x = $xl+($i/$steps)*($xr-$xl)*$delta;
|
||||
$this->img->Line($x,$yb,$xr,$y);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
JpGraphError::RaiseL(7001,$style);
|
||||
//("Unknown gradient style (=$style).");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill a special case of a polygon with a flat bottom
|
||||
// with a gradient. Can be used for filled line plots.
|
||||
// Please note that this is NOT a generic gradient polygon fill
|
||||
// routine. It assumes that the bottom is flat (like a drawing
|
||||
// of a mountain)
|
||||
function FilledFlatPolygon($pts,$from_color,$to_color) {
|
||||
if( count($pts) == 0 ) return;
|
||||
|
||||
$maxy=$pts[1];
|
||||
$miny=$pts[1];
|
||||
$n = count($pts) ;
|
||||
for( $i=0, $idx=0; $i < $n; $i += 2) {
|
||||
$x = round($pts[$i]);
|
||||
$y = round($pts[$i+1]);
|
||||
$miny = min($miny,$y);
|
||||
$maxy = max($maxy,$y);
|
||||
}
|
||||
|
||||
$colors = array();
|
||||
$this->GetColArray($from_color,$to_color,abs($maxy-$miny)+1,$colors,$this->numcolors);
|
||||
for($i=$miny, $idx=0; $i <= $maxy; ++$i ) {
|
||||
$colmap[$i] = $colors[$idx++];
|
||||
}
|
||||
|
||||
$n = count($pts)/2 ;
|
||||
$idx = 0 ;
|
||||
while( $idx < $n-1 ) {
|
||||
$p1 = array(round($pts[$idx*2]),round($pts[$idx*2+1]));
|
||||
$p2 = array(round($pts[++$idx*2]),round($pts[$idx*2+1]));
|
||||
|
||||
// Find the largest rectangle we can fill
|
||||
$y = max($p1[1],$p2[1]) ;
|
||||
for($yy=$maxy; $yy > $y; --$yy) {
|
||||
$this->img->current_color = $colmap[$yy];
|
||||
$this->img->Line($p1[0],$yy,$p2[0]-1,$yy);
|
||||
}
|
||||
|
||||
if( $p1[1] == $p2[1] ) continue;
|
||||
|
||||
// Fill the rest using lines (slow...)
|
||||
$slope = ($p2[0]-$p1[0])/($p1[1]-$p2[1]);
|
||||
$x1 = $p1[0];
|
||||
$x2 = $p2[0]; //-1;
|
||||
$start = $y;
|
||||
if( $p1[1] > $p2[1] ) {
|
||||
while( $y >= $p2[1] ) {
|
||||
$x1=$slope*($start-$y)+$p1[0];
|
||||
$this->img->current_color = $colmap[$y];
|
||||
$this->img->Line($x1,$y,$x2,$y);
|
||||
--$y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while( $y >= $p1[1] ) {
|
||||
$x2=$p2[0]+$slope*($start-$y);
|
||||
$this->img->current_color = $colmap[$y];
|
||||
$this->img->Line($x1,$y,$x2,$y);
|
||||
--$y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PRIVATE METHODS
|
||||
// Add to the image color map the necessary colors to do the transition
|
||||
// between the two colors using $numcolors intermediate colors
|
||||
function GetColArray($from_color,$to_color,$arr_size,&$colors,$numcols=100) {
|
||||
if( $arr_size==0 ) return;
|
||||
// If color is given as text get it's corresponding r,g,b values
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$to_color = $this->img->rgb->Color($to_color);
|
||||
|
||||
$rdelta=($to_color[0]-$from_color[0])/$numcols;
|
||||
$gdelta=($to_color[1]-$from_color[1])/$numcols;
|
||||
$bdelta=($to_color[2]-$from_color[2])/$numcols;
|
||||
$colorsperstep = $numcols/$arr_size;
|
||||
$prevcolnum = -1;
|
||||
$from_alpha = $from_color[3];
|
||||
$to_alpha = $to_color[3];
|
||||
$adelta = ( $to_alpha - $from_alpha ) / $numcols ;
|
||||
for ($i=0; $i < $arr_size; ++$i) {
|
||||
$colnum = floor($colorsperstep*$i);
|
||||
if ( $colnum == $prevcolnum )
|
||||
$colors[$i] = $colidx;
|
||||
else {
|
||||
$r = floor($from_color[0] + $colnum*$rdelta);
|
||||
$g = floor($from_color[1] + $colnum*$gdelta);
|
||||
$b = floor($from_color[2] + $colnum*$bdelta);
|
||||
$alpha = $from_alpha + $colnum*$adelta;
|
||||
$colidx = $this->img->rgb->Allocate(sprintf("#%02x%02x%02x",$r,$g,$b),$alpha);
|
||||
$colors[$i] = $colidx;
|
||||
}
|
||||
$prevcolnum = $colnum;
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_GRADIENT.PHP
|
||||
// Description: Create a color gradient
|
||||
// Created: 2003-02-01
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_gradient.php 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
// Styles for gradient color fill
|
||||
DEFINE("GRAD_VER",1);
|
||||
DEFINE("GRAD_VERT",1);
|
||||
DEFINE("GRAD_HOR",2);
|
||||
DEFINE("GRAD_MIDHOR",3);
|
||||
DEFINE("GRAD_MIDVER",4);
|
||||
DEFINE("GRAD_CENTER",5);
|
||||
DEFINE("GRAD_WIDE_MIDVER",6);
|
||||
DEFINE("GRAD_WIDE_MIDHOR",7);
|
||||
DEFINE("GRAD_LEFT_REFLECTION",8);
|
||||
DEFINE("GRAD_RIGHT_REFLECTION",9);
|
||||
DEFINE("GRAD_RAISED_PANEL",10);
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS Gradient
|
||||
// Description: Handles gradient fills. This is to be
|
||||
// considered a "friend" class of Class Image.
|
||||
//===================================================
|
||||
class Gradient {
|
||||
var $img=null;
|
||||
var $numcolors=100;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function Gradient(&$img) {
|
||||
$this->img = $img;
|
||||
}
|
||||
|
||||
|
||||
function SetNumColors($aNum) {
|
||||
$this->numcolors=$aNum;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
// Produce a gradient filled rectangle with a smooth transition between
|
||||
// two colors.
|
||||
// ($xl,$yt) Top left corner
|
||||
// ($xr,$yb) Bottom right
|
||||
// $from_color Starting color in gradient
|
||||
// $to_color End color in the gradient
|
||||
// $style Which way is the gradient oriented?
|
||||
function FilledRectangle($xl,$yt,$xr,$yb,$from_color,$to_color,$style=1) {
|
||||
switch( $style ) {
|
||||
case GRAD_VER:
|
||||
$steps = round(abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for( $i=0, $x=$xl; $i < $steps; ++$i ) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yt,$x,$yb);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_HOR:
|
||||
$steps = round(abs($yb-$yt));
|
||||
$delta = $yb>=$yt ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($i=0,$y=$yt; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_MIDHOR:
|
||||
$steps = round(abs($yb-$yt)/2);
|
||||
$delta = $yb >= $yt ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($y=$yt, $i=0; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
--$i;
|
||||
if( abs($yb-$yt) % 2 == 1 ) --$steps;
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
break;
|
||||
|
||||
case GRAD_MIDVER:
|
||||
$steps = round(abs($xr-$xl)/2);
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
for($x=$xl, $i=0; $i < $steps; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
--$i;
|
||||
if( abs($xr-$xl) % 2 == 1 ) --$steps;
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
break;
|
||||
|
||||
case GRAD_WIDE_MIDVER:
|
||||
$diff = round(abs($xr-$xl));
|
||||
$steps = floor(abs($diff)/3);
|
||||
$firststep = $diff - 2*$steps ;
|
||||
$delta = $xr >= $xl ? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$firststep,$colors,$this->numcolors);
|
||||
for($x=$xl, $i=0; $i < $firststep; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
--$i;
|
||||
$this->img->current_color = $colors[$i];
|
||||
for($j=0; $j< $steps; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_WIDE_MIDHOR:
|
||||
$diff = round(abs($yb-$yt));
|
||||
$steps = floor(abs($diff)/3);
|
||||
$firststep = $diff - 2*$steps ;
|
||||
$delta = $yb >= $yt? 1 : -1;
|
||||
$this->GetColArray($from_color,$to_color,$firststep,$colors,$this->numcolors);
|
||||
for($y=$yt, $i=0; $i < $firststep; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
--$i;
|
||||
$this->img->current_color = $colors[$i];
|
||||
for($j=0; $j < $steps; ++$j) {
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
for($j=0; $j < $steps; ++$j, --$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($xl,$y,$xr,$y);
|
||||
$y += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_LEFT_REFLECTION:
|
||||
$steps1 = round(0.3*abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$adj = 1.4;
|
||||
$m = ($adj-1.0)*(255-min(255,min($from_color[0],min($from_color[1],$from_color[2]))));
|
||||
$from_color2 = array(min(255,$from_color[0]+$m),
|
||||
min(255,$from_color[1]+$m), min(255,$from_color[2]+$m));
|
||||
|
||||
$this->GetColArray($from_color2,$to_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps2 = max(1,round(0.08*abs($xr-$xl)));
|
||||
$this->img->SetColor($to_color);
|
||||
for($j=0; $j< $steps2; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps = abs($xr-$xl)-$steps1-$steps2;
|
||||
$this->GetColArray($to_color,$from_color,$steps,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_RIGHT_REFLECTION:
|
||||
$steps1 = round(0.7*abs($xr-$xl));
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
|
||||
$this->GetColArray($from_color,$to_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
$steps2 = max(1,round(0.08*abs($xr-$xl)));
|
||||
$this->img->SetColor($to_color);
|
||||
for($j=0; $j< $steps2; ++$j) {
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$adj = 1.4;
|
||||
$m = ($adj-1.0)*(255-min(255,min($from_color[0],min($from_color[1],$from_color[2]))));
|
||||
$from_color = array(min(255,$from_color[0]+$m),
|
||||
min(255,$from_color[1]+$m), min(255,$from_color[2]+$m));
|
||||
|
||||
$steps = abs($xr-$xl)-$steps1-$steps2;
|
||||
$this->GetColArray($to_color,$from_color,$steps,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($i=0; $i < $steps && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAD_CENTER:
|
||||
$steps = ceil(min(($yb-$yt)+1,($xr-$xl)+1)/2);
|
||||
$this->GetColArray($from_color,$to_color,$steps,$colors,$this->numcolors);
|
||||
$dx = ($xr-$xl)/2;
|
||||
$dy = ($yb-$yt)/2;
|
||||
$x=$xl;$y=$yt;$x2=$xr;$y2=$yb;
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $x < $xl+$dx && $y < $yt+$dy && $i < $n; ++$x, ++$y, --$x2, --$y2, ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Rectangle($x,$y,$x2,$y2);
|
||||
}
|
||||
$this->img->Line($x,$y,$x2,$y2);
|
||||
break;
|
||||
|
||||
case GRAD_RAISED_PANEL:
|
||||
// right to left
|
||||
$steps1 = $xr-$xl;
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
$this->GetColArray($to_color,$from_color,$steps1,$colors,$this->numcolors);
|
||||
$n = count($colors);
|
||||
for($x=$xl, $i=0; $i < $steps1 && $i < $n; ++$i) {
|
||||
$this->img->current_color = $colors[$i];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
|
||||
// left to right
|
||||
$xr -= 3;
|
||||
$xl += 3;
|
||||
$yb -= 3;
|
||||
$yt += 3;
|
||||
$steps2 = $xr-$xl;
|
||||
$delta = $xr>=$xl ? 1 : -1;
|
||||
for($x=$xl, $j=$steps2; $j >= 0; --$j) {
|
||||
$this->img->current_color = $colors[$j];
|
||||
$this->img->Line($x,$yb,$x,$yt);
|
||||
$x += $delta;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
JpGraphError::Raise("Unknown gradient style (=$style).");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill a special case of a polygon with a flat bottom
|
||||
// with a gradient. Can be used for filled line plots.
|
||||
// Please note that this is NOT a generic gradient polygon fill
|
||||
// routine. It assumes that the bottom is flat (like a drawing
|
||||
// of a mountain)
|
||||
function FilledFlatPolygon($pts,$from_color,$to_color) {
|
||||
if( count($pts) == 0 ) return;
|
||||
|
||||
$maxy=$pts[1];
|
||||
$miny=$pts[1];
|
||||
$n = count($pts) ;
|
||||
for( $i=0, $idx=0; $i < $n; $i += 2) {
|
||||
$x = round($pts[$i]);
|
||||
$y = round($pts[$i+1]);
|
||||
$miny = min($miny,$y);
|
||||
$maxy = max($maxy,$y);
|
||||
}
|
||||
|
||||
$colors = array();
|
||||
$this->GetColArray($from_color,$to_color,abs($maxy-$miny)+1,$colors,$this->numcolors);
|
||||
for($i=$miny, $idx=0; $i <= $maxy; ++$i ) {
|
||||
$colmap[$i] = $colors[$idx++];
|
||||
}
|
||||
|
||||
$n = count($pts)/2 ;
|
||||
$idx = 0 ;
|
||||
while( $idx < $n-1 ) {
|
||||
$p1 = array(round($pts[$idx*2]),round($pts[$idx*2+1]));
|
||||
$p2 = array(round($pts[++$idx*2]),round($pts[$idx*2+1]));
|
||||
|
||||
// Find the largest rectangle we can fill
|
||||
$y = max($p1[1],$p2[1]) ;
|
||||
for($yy=$maxy; $yy > $y; --$yy) {
|
||||
$this->img->current_color = $colmap[$yy];
|
||||
$this->img->Line($p1[0],$yy,$p2[0]-1,$yy);
|
||||
}
|
||||
|
||||
if( $p1[1] == $p2[1] ) continue;
|
||||
|
||||
// Fill the rest using lines (slow...)
|
||||
$slope = ($p2[0]-$p1[0])/($p1[1]-$p2[1]);
|
||||
$x1 = $p1[0];
|
||||
$x2 = $p2[0]; //-1;
|
||||
$start = $y;
|
||||
if( $p1[1] > $p2[1] ) {
|
||||
while( $y >= $p2[1] ) {
|
||||
$x1=$slope*($start-$y)+$p1[0];
|
||||
$this->img->current_color = $colmap[$y];
|
||||
$this->img->Line($x1,$y,$x2,$y);
|
||||
--$y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while( $y >= $p1[1] ) {
|
||||
$x2=$p2[0]+$slope*($start-$y);
|
||||
$this->img->current_color = $colmap[$y];
|
||||
$this->img->Line($x1,$y,$x2,$y);
|
||||
--$y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PRIVATE METHODS
|
||||
// Add to the image color map the necessary colors to do the transition
|
||||
// between the two colors using $numcolors intermediate colors
|
||||
function GetColArray($from_color,$to_color,$arr_size,&$colors,$numcols=100) {
|
||||
if( $arr_size==0 ) return;
|
||||
// If color is given as text get it's corresponding r,g,b values
|
||||
$from_color = $this->img->rgb->Color($from_color);
|
||||
$to_color = $this->img->rgb->Color($to_color);
|
||||
|
||||
$rdelta=($to_color[0]-$from_color[0])/$numcols;
|
||||
$gdelta=($to_color[1]-$from_color[1])/$numcols;
|
||||
$bdelta=($to_color[2]-$from_color[2])/$numcols;
|
||||
$colorsperstep = $numcols/$arr_size;
|
||||
$prevcolnum = -1;
|
||||
$from_alpha = $from_color[3];
|
||||
$to_alpha = $to_color[3];
|
||||
$adelta = ( $to_alpha - $from_alpha ) / $numcols ;
|
||||
for ($i=0; $i < $arr_size; ++$i) {
|
||||
$colnum = floor($colorsperstep*$i);
|
||||
if ( $colnum == $prevcolnum )
|
||||
$colors[$i] = $colidx;
|
||||
else {
|
||||
$r = floor($from_color[0] + $colnum*$rdelta);
|
||||
$g = floor($from_color[1] + $colnum*$gdelta);
|
||||
$b = floor($from_color[2] + $colnum*$bdelta);
|
||||
$alpha = $from_alpha + $colnum*$adelta;
|
||||
$colidx = $this->img->rgb->Allocate(sprintf("#%02x%02x%02x",$r,$g,$b),$alpha);
|
||||
$colors[$i] = $colidx;
|
||||
}
|
||||
$prevcolnum = $colnum;
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,191 +1,180 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_ICONPLOT.PHP
|
||||
// Description: PHP4 Graph Plotting library. Extension module.
|
||||
// Created: 2004-02-18
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_iconplot.php 575 2006-03-04 11:04:59Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS IconPlot
|
||||
// Description: Make it possible to add a (small) image
|
||||
// to the graph
|
||||
//===================================================
|
||||
class IconPlot {
|
||||
public $iX=0,$iY=0,$iScale=1.0,$iMix=100;
|
||||
private $iHorAnchor='left',$iVertAnchor='top';
|
||||
private $iFile='';
|
||||
private $iAnchors = array('left','right','top','bottom','center');
|
||||
private $iCountryFlag='',$iCountryStdSize=3;
|
||||
private $iScalePosY=null,$iScalePosX=null;
|
||||
private $iImgString='';
|
||||
|
||||
|
||||
function IconPlot($aFile="",$aX=0,$aY=0,$aScale=1.0,$aMix=100) {
|
||||
$this->iFile = $aFile;
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
$this->iScale= $aScale;
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::RaiseL(8001); //('Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix ;
|
||||
}
|
||||
|
||||
function SetCountryFlag($aFlag,$aX=0,$aY=0,$aScale=1.0,$aMix=100,$aStdSize=3) {
|
||||
$this->iCountryFlag = $aFlag;
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
$this->iScale= $aScale;
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::RaiseL(8001);//'Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix;
|
||||
$this->iCountryStdSize = $aStdSize;
|
||||
}
|
||||
|
||||
function SetPos($aX,$aY) {
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
}
|
||||
|
||||
function CreateFromString($aStr) {
|
||||
$this->iImgString = $aStr;
|
||||
}
|
||||
|
||||
function SetScalePos($aX,$aY) {
|
||||
$this->iScalePosX = $aX;
|
||||
$this->iScalePosY = $aY;
|
||||
}
|
||||
|
||||
function SetScale($aScale) {
|
||||
$this->iScale = $aScale;
|
||||
}
|
||||
|
||||
function SetMix($aMix) {
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::RaiseL(8001);//('Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix ;
|
||||
}
|
||||
|
||||
function SetAnchor($aXAnchor='left',$aYAnchor='center') {
|
||||
if( !in_array($aXAnchor,$this->iAnchors) ||
|
||||
!in_array($aYAnchor,$this->iAnchors) ) {
|
||||
JpGraphError::RaiseL(8002);//("Anchor position for icons must be one of 'top', 'bottom', 'left', 'right' or 'center'");
|
||||
}
|
||||
$this->iHorAnchor=$aXAnchor;
|
||||
$this->iVertAnchor=$aYAnchor;
|
||||
}
|
||||
|
||||
function PreStrokeAdjust($aGraph) {
|
||||
// Nothing to do ...
|
||||
}
|
||||
|
||||
function DoLegend($aGraph) {
|
||||
// Nothing to do ...
|
||||
}
|
||||
|
||||
function Max() {
|
||||
return array(false,false);
|
||||
}
|
||||
|
||||
|
||||
// The next four function are framework function tht gets called
|
||||
// from Gantt and is not menaiungfull in the context of Icons but
|
||||
// they must be implemented to avoid errors.
|
||||
function GetMaxDate() { return false; }
|
||||
function GetMinDate() { return false; }
|
||||
function GetLineNbr() { return 0; }
|
||||
function GetAbsHeight() {return 0; }
|
||||
|
||||
|
||||
function Min() {
|
||||
return array(false,false);
|
||||
}
|
||||
|
||||
function StrokeMargin(&$aImg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function Stroke($aImg,$axscale,$ayscale) {
|
||||
$this->StrokeWithScale($aImg,$axscale,$ayscale);
|
||||
}
|
||||
|
||||
function StrokeWithScale($aImg,$axscale,$ayscale) {
|
||||
if( $this->iScalePosX === null ||
|
||||
$this->iScalePosY === null ) {
|
||||
$this->_Stroke($aImg);
|
||||
}
|
||||
else {
|
||||
$this->_Stroke($aImg,
|
||||
round($axscale->Translate($this->iScalePosX)),
|
||||
round($ayscale->Translate($this->iScalePosY)));
|
||||
}
|
||||
}
|
||||
|
||||
function GetWidthHeight() {
|
||||
$dummy=0;
|
||||
return $this->_Stroke($dummy,null,null,true);
|
||||
}
|
||||
|
||||
function _Stroke($aImg,$x=null,$y=null,$aReturnWidthHeight=false) {
|
||||
if( $this->iFile != '' && $this->iCountryFlag != '' ) {
|
||||
JpGraphError::RaiseL(8003);//('It is not possible to specify both an image file and a country flag for the same icon.');
|
||||
}
|
||||
if( $this->iFile != '' ) {
|
||||
$gdimg = Graph::LoadBkgImage('',$this->iFile);
|
||||
}
|
||||
elseif( $this->iImgString != '') {
|
||||
$gdimg = Image::CreateFromString($this->iImgString);
|
||||
}
|
||||
|
||||
else {
|
||||
if( ! class_exists('FlagImages',false) ) {
|
||||
JpGraphError::RaiseL(8004);//('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
|
||||
}
|
||||
$fobj = new FlagImages($this->iCountryStdSize);
|
||||
$dummy='';
|
||||
$gdimg = $fobj->GetImgByName($this->iCountryFlag,$dummy);
|
||||
}
|
||||
|
||||
$iconw = imagesx($gdimg);
|
||||
$iconh = imagesy($gdimg);
|
||||
|
||||
if( $aReturnWidthHeight ) {
|
||||
return array(round($iconw*$this->iScale),round($iconh*$this->iScale));
|
||||
}
|
||||
|
||||
if( $x !== null && $y !== null ) {
|
||||
$this->iX = $x; $this->iY = $y;
|
||||
}
|
||||
if( $this->iX >= 0 && $this->iX <= 1.0 ) {
|
||||
$w = imagesx($aImg->img);
|
||||
$this->iX = round($w*$this->iX);
|
||||
}
|
||||
if( $this->iY >= 0 && $this->iY <= 1.0 ) {
|
||||
$h = imagesy($aImg->img);
|
||||
$this->iY = round($h*$this->iY);
|
||||
}
|
||||
|
||||
if( $this->iHorAnchor == 'center' )
|
||||
$this->iX -= round($iconw*$this->iScale/2);
|
||||
if( $this->iHorAnchor == 'right' )
|
||||
$this->iX -= round($iconw*$this->iScale);
|
||||
if( $this->iVertAnchor == 'center' )
|
||||
$this->iY -= round($iconh*$this->iScale/2);
|
||||
if( $this->iVertAnchor == 'bottom' )
|
||||
$this->iY -= round($iconh*$this->iScale);
|
||||
|
||||
$aImg->CopyMerge($gdimg,$this->iX,$this->iY,0,0,
|
||||
round($iconw*$this->iScale),round($iconh*$this->iScale),
|
||||
$iconw,$iconh,
|
||||
$this->iMix);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_ICONPLOT.PHP
|
||||
// Description: PHP4 Graph Plotting library. Extension module.
|
||||
// Created: 2004-02-18
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_iconplot.php 184 2005-08-31 16:17:19Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
|
||||
//===================================================
|
||||
// CLASS IconPlot
|
||||
// Description: Make it possible to add a (small) image
|
||||
// to the graph
|
||||
//===================================================
|
||||
class IconPlot {
|
||||
var $iHorAnchor='left',$iVertAnchor='top';
|
||||
var $iX=0,$iY=0;
|
||||
var $iFile='';
|
||||
var $iScale=1.0,$iMix=100;
|
||||
var $iAnchors = array('left','right','top','bottom','center');
|
||||
var $iCountryFlag='',$iCountryStdSize=3;
|
||||
var $iScalePosY=null,$iScalePosX=null;
|
||||
var $iImgString='';
|
||||
|
||||
function IconPlot($aFile="",$aX=0,$aY=0,$aScale=1.0,$aMix=100) {
|
||||
$this->iFile = $aFile;
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
$this->iScale= $aScale;
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix ;
|
||||
}
|
||||
|
||||
function CreateFromString($aStr) {
|
||||
$this->iImgString = $aStr;
|
||||
}
|
||||
|
||||
function SetCountryFlag($aFlag,$aX=0,$aY=0,$aScale=1.0,$aMix=100,$aStdSize=3) {
|
||||
$this->iCountryFlag = $aFlag;
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
$this->iScale= $aScale;
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix;
|
||||
$this->iCountryStdSize = $aStdSize;
|
||||
}
|
||||
|
||||
function SetPos($aX,$aY) {
|
||||
$this->iX=$aX;
|
||||
$this->iY=$aY;
|
||||
}
|
||||
|
||||
function SetScalePos($aX,$aY) {
|
||||
$this->iScalePosX = $aX;
|
||||
$this->iScalePosY = $aY;
|
||||
}
|
||||
|
||||
function SetScale($aScale) {
|
||||
$this->iScale = $aScale;
|
||||
}
|
||||
|
||||
function SetMix($aMix) {
|
||||
if( $aMix < 0 || $aMix > 100 ) {
|
||||
JpGraphError::Raise('Mix value for icon must be between 0 and 100.');
|
||||
}
|
||||
$this->iMix = $aMix ;
|
||||
}
|
||||
|
||||
function SetAnchor($aXAnchor='left',$aYAnchor='center') {
|
||||
if( !in_array($aXAnchor,$this->iAnchors) ||
|
||||
!in_array($aYAnchor,$this->iAnchors) ) {
|
||||
JpGraphError::Raise("Anchor position for icons must be one of 'top', 'bottom', 'left', 'right' or 'center'");
|
||||
}
|
||||
$this->iHorAnchor=$aXAnchor;
|
||||
$this->iVertAnchor=$aYAnchor;
|
||||
}
|
||||
|
||||
function PreStrokeAdjust($aGraph) {
|
||||
// Nothing to do ...
|
||||
}
|
||||
|
||||
function DoLegend($aGraph) {
|
||||
// Nothing to do ...
|
||||
}
|
||||
|
||||
function Max() {
|
||||
return array(false,false);
|
||||
}
|
||||
|
||||
|
||||
// The next four function are framework function tht gets called
|
||||
// from Gantt and is not menaiungfull in the context of Icons but
|
||||
// they must be implemented to avoid errors.
|
||||
function GetMaxDate() { return false; }
|
||||
function GetMinDate() { return false; }
|
||||
function GetLineNbr() { return 0; }
|
||||
function GetAbsHeight() {return 0; }
|
||||
|
||||
|
||||
function Min() {
|
||||
return array(false,false);
|
||||
}
|
||||
|
||||
function StrokeMargin(&$aImg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function Stroke($aImg,$axscale,$ayscale) {
|
||||
$this->StrokeWithScale($aImg,$axscale,$ayscale);
|
||||
}
|
||||
|
||||
function StrokeWithScale($aImg,$axscale,$ayscale) {
|
||||
if( $this->iScalePosX === null ||
|
||||
$this->iScalePosY === null ) {
|
||||
$this->_Stroke($aImg);
|
||||
}
|
||||
else {
|
||||
$this->_Stroke($aImg,
|
||||
round($axscale->Translate($this->iScalePosX)),
|
||||
round($ayscale->Translate($this->iScalePosY)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _Stroke($aImg,$x=null,$y=null) {
|
||||
if( $this->iFile != '' && $this->iCountryFlag != '' ) {
|
||||
JpGraphError::Raise('It is not possible to specify both an image file and a country flag for the same icon.');
|
||||
}
|
||||
if( $this->iFile != '' ) {
|
||||
$gdimg = Graph::LoadBkgImage('',$this->iFile);
|
||||
}
|
||||
elseif( $this->iImgString != '') {
|
||||
$gdimg = Image::CreateFromString($this->iImgString);
|
||||
}
|
||||
else {
|
||||
if( ! class_exists('FlagImages') ) {
|
||||
JpGraphError::Raise('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
|
||||
}
|
||||
$fobj = new FlagImages($this->iCountryStdSize);
|
||||
$dummy='';
|
||||
$gdimg = $fobj->GetImgByName($this->iCountryFlag,$dummy);
|
||||
}
|
||||
if( $x !== null && $y !== null ) {
|
||||
$this->iX = $x; $this->iY = $y;
|
||||
}
|
||||
if( $this->iX >= 0 && $this->iX <= 1.0 ) {
|
||||
$w = imagesx($aImg->img);
|
||||
$this->iX = round($w*$this->iX);
|
||||
}
|
||||
if( $this->iY >= 0 && $this->iY <= 1.0 ) {
|
||||
$h = imagesy($aImg->img);
|
||||
$this->iY = round($h*$this->iY);
|
||||
}
|
||||
$iconw = imagesx($gdimg);
|
||||
$iconh = imagesy($gdimg);
|
||||
|
||||
if( $this->iHorAnchor == 'center' )
|
||||
$this->iX -= round($iconw*$this->iScale/2);
|
||||
if( $this->iHorAnchor == 'right' )
|
||||
$this->iX -= round($iconw*$this->iScale);
|
||||
if( $this->iVertAnchor == 'center' )
|
||||
$this->iY -= round($iconh*$this->iScale/2);
|
||||
if( $this->iVertAnchor == 'bottom' )
|
||||
$this->iY -= round($iconh*$this->iScale);
|
||||
|
||||
$aImg->CopyMerge($gdimg,$this->iX,$this->iY,0,0,
|
||||
round($iconw*$this->iScale),round($iconh*$this->iScale),
|
||||
$iconw,$iconh,
|
||||
$this->iMix);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,224 +1,223 @@
|
|||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_IMGTRANS.PHP
|
||||
// Description: Extension for JpGraph to do some simple img transformations
|
||||
// Created: 2003-09-06
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_imgtrans.php 478 2006-02-04 12:17:06Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Class ImgTrans
|
||||
// Perform some simple image transformations.
|
||||
//------------------------------------------------------------------------
|
||||
class ImgTrans {
|
||||
private $gdImg=null;
|
||||
|
||||
function ImgTrans($aGdImg) {
|
||||
// Constructor
|
||||
$this->gdImg = $aGdImg;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// _TransVert3D() and _TransHor3D() are helper methods to
|
||||
// Skew3D().
|
||||
// --------------------------------------------------------------------
|
||||
function _TransVert3D($aGdImg,$aHorizon=100,$aSkewDist=120,$aDir=SKEW3D_DOWN,$aMinSize=true,$aFillColor='#FFFFFF',$aQuality=false,$aBorder=false,$aHorizonPos=0.5) {
|
||||
|
||||
|
||||
// Parameter check
|
||||
if( $aHorizonPos < 0 || $aHorizonPos > 1.0 ) {
|
||||
JpGraphError::RaiseL(9001);
|
||||
//("Value for image transformation out of bounds.\nVanishing point on horizon must be specified as a value between 0 and 1.");
|
||||
}
|
||||
|
||||
$w = imagesx($aGdImg);
|
||||
$h = imagesy($aGdImg);
|
||||
|
||||
// Create new image
|
||||
$ww = $w;
|
||||
if( $aMinSize )
|
||||
$hh = ceil($h * $aHorizon / ($aSkewDist+$h));
|
||||
else
|
||||
$hh = $h;
|
||||
|
||||
$newgdh = imagecreatetruecolor($ww,$hh);
|
||||
$crgb = new RGB( $newgdh );
|
||||
$fillColor = $crgb->Allocate($aFillColor);
|
||||
imagefilledrectangle($newgdh,0,0,$ww-1,$hh-1,$fillColor);
|
||||
|
||||
if( $aBorder ) {
|
||||
$colidx = $crgb->Allocate($aBorder);
|
||||
imagerectangle($newgdh,0,0,$ww-1,$hh-1,$colidx);
|
||||
}
|
||||
|
||||
$mid = round($w * $aHorizonPos);
|
||||
|
||||
$last=$h;
|
||||
for($y=0; $y < $h; ++$y) {
|
||||
|
||||
$yp = $h-$y-1;
|
||||
$yt = floor($yp * $aHorizon / ($aSkewDist + $yp));
|
||||
|
||||
if( !$aQuality ) {
|
||||
if( $last <= $yt ) continue ;
|
||||
$last = $yt;
|
||||
}
|
||||
|
||||
for($x=0; $x < $w; ++$x) {
|
||||
$xt = ($x-$mid) * $aSkewDist / ($aSkewDist + $yp);
|
||||
if( $aDir == SKEW3D_UP )
|
||||
$rgb = imagecolorat($aGdImg,$x,$h-$y-1);
|
||||
else
|
||||
$rgb = imagecolorat($aGdImg,$x,$y);
|
||||
$r = ($rgb >> 16) & 0xFF;
|
||||
$g = ($rgb >> 8) & 0xFF;
|
||||
$b = $rgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,$r,$g,$b);
|
||||
$xt = round($xt+$mid);
|
||||
if( $aDir == SKEW3D_UP ) {
|
||||
$syt = $yt;
|
||||
}
|
||||
else {
|
||||
$syt = $hh-$yt-1;
|
||||
}
|
||||
|
||||
if( !empty($set[$yt]) ) {
|
||||
$nrgb = imagecolorat($newgdh,$xt,$syt);
|
||||
$nr = ($nrgb >> 16) & 0xFF;
|
||||
$ng = ($nrgb >> 8) & 0xFF;
|
||||
$nb = $nrgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,floor(($r+$nr)/2),
|
||||
floor(($g+$ng)/2),floor(($b+$nb)/2));
|
||||
}
|
||||
|
||||
imagesetpixel($newgdh,$xt,$syt,$colidx);
|
||||
}
|
||||
|
||||
$set[$yt] = true;
|
||||
}
|
||||
|
||||
return $newgdh;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// _TransVert3D() and _TransHor3D() are helper methods to
|
||||
// Skew3D().
|
||||
// --------------------------------------------------------------------
|
||||
function _TransHor3D($aGdImg,$aHorizon=100,$aSkewDist=120,$aDir=SKEW3D_LEFT,$aMinSize=true,$aFillColor='#FFFFFF',$aQuality=false,$aBorder=false,$aHorizonPos=0.5) {
|
||||
|
||||
$w = imagesx($aGdImg);
|
||||
$h = imagesy($aGdImg);
|
||||
|
||||
// Create new image
|
||||
$hh = $h;
|
||||
if( $aMinSize )
|
||||
$ww = ceil($w * $aHorizon / ($aSkewDist+$w));
|
||||
else
|
||||
$ww = $w;
|
||||
|
||||
$newgdh = imagecreatetruecolor($ww,$hh);
|
||||
$crgb = new RGB( $newgdh );
|
||||
$fillColor = $crgb->Allocate($aFillColor);
|
||||
imagefilledrectangle($newgdh,0,0,$ww-1,$hh-1,$fillColor);
|
||||
|
||||
if( $aBorder ) {
|
||||
$colidx = $crgb->Allocate($aBorder);
|
||||
imagerectangle($newgdh,0,0,$ww-1,$hh-1,$colidx);
|
||||
}
|
||||
|
||||
$mid = round($h * $aHorizonPos);
|
||||
|
||||
$last = -1;
|
||||
for($x=0; $x < $w-1; ++$x) {
|
||||
$xt = floor($x * $aHorizon / ($aSkewDist + $x));
|
||||
if( !$aQuality ) {
|
||||
if( $last >= $xt ) continue ;
|
||||
$last = $xt;
|
||||
}
|
||||
|
||||
for($y=0; $y < $h; ++$y) {
|
||||
$yp = $h-$y-1;
|
||||
$yt = ($yp-$mid) * $aSkewDist / ($aSkewDist + $x);
|
||||
|
||||
if( $aDir == SKEW3D_RIGHT )
|
||||
$rgb = imagecolorat($aGdImg,$w-$x-1,$y);
|
||||
else
|
||||
$rgb = imagecolorat($aGdImg,$x,$y);
|
||||
$r = ($rgb >> 16) & 0xFF;
|
||||
$g = ($rgb >> 8) & 0xFF;
|
||||
$b = $rgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,$r,$g,$b);
|
||||
$yt = floor($hh-$yt-$mid-1);
|
||||
if( $aDir == SKEW3D_RIGHT ) {
|
||||
$sxt = $ww-$xt-1;
|
||||
}
|
||||
else
|
||||
$sxt = $xt ;
|
||||
|
||||
if( !empty($set[$xt]) ) {
|
||||
$nrgb = imagecolorat($newgdh,$sxt,$yt);
|
||||
$nr = ($nrgb >> 16) & 0xFF;
|
||||
$ng = ($nrgb >> 8) & 0xFF;
|
||||
$nb = $nrgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,floor(($r+$nr)/2),
|
||||
floor(($g+$ng)/2),floor(($b+$nb)/2));
|
||||
}
|
||||
imagesetpixel($newgdh,$sxt,$yt,$colidx);
|
||||
}
|
||||
|
||||
$set[$xt] = true;
|
||||
}
|
||||
|
||||
return $newgdh;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Skew image for the apperance of a 3D effect
|
||||
// This transforms an image into a 3D-skewed version
|
||||
// of the image. The transformation is specified by giving the height
|
||||
// of the artificial horizon and specifying a "skew" factor which
|
||||
// is the distance on the horizon line between the point of
|
||||
// convergence and perspective line.
|
||||
//
|
||||
// The function returns the GD handle of the transformed image
|
||||
// leaving the original image untouched.
|
||||
//
|
||||
// Parameters:
|
||||
// * $aGdImg, GD handle to the image to be transformed
|
||||
// * $aHorizon, Distance to the horizon
|
||||
// * $aSkewDist, Distance from the horizon point of convergence
|
||||
// on the horizon line to the perspective points. A larger
|
||||
// value will fore-shorten the image more
|
||||
// * $aDir, parameter specifies type of convergence. This of this
|
||||
// as the walls in a room you are looking at. This specifies if the
|
||||
// image should be applied on the left,right,top or bottom walls.
|
||||
// * $aMinSize, true=make the new image just as big as needed,
|
||||
// false = keep the image the same size as the original image
|
||||
// * $aFillColor, Background fill color in the image
|
||||
// * $aHiQuality, true=performa some interpolation that improves
|
||||
// the image quality but at the expense of performace. Enabling
|
||||
// high quality will have a dramatic effect on the time it takes
|
||||
// to transform an image.
|
||||
// * $aBorder, if set to anything besides false this will draw a
|
||||
// a border of the speciied color around the image
|
||||
// --------------------------------------------------------------------
|
||||
function Skew3D($aHorizon=120,$aSkewDist=150,$aDir=SKEW3D_DOWN,$aHiQuality=false,$aMinSize=true,$aFillColor='#FFFFFF',$aBorder=false) {
|
||||
return $this->_Skew3D($this->gdImg,$aHorizon,$aSkewDist,$aDir,$aHiQuality,
|
||||
$aMinSize,$aFillColor,$aBorder);
|
||||
}
|
||||
|
||||
function _Skew3D($aGdImg,$aHorizon=120,$aSkewDist=150,$aDir=SKEW3D_DOWN,$aHiQuality=false,$aMinSize=true,$aFillColor='#FFFFFF',$aBorder=false) {
|
||||
if( $aDir == SKEW3D_DOWN || $aDir == SKEW3D_UP )
|
||||
return $this->_TransVert3D($aGdImg,$aHorizon,$aSkewDist,$aDir,$aMinSize,$aFillColor,$aHiQuality,$aBorder);
|
||||
else
|
||||
return $this->_TransHor3D($aGdImg,$aHorizon,$aSkewDist,$aDir,$aMinSize,$aFillColor,$aHiQuality,$aBorder);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
//=======================================================================
|
||||
// File: JPGRAPH_IMGTRANS.PHP
|
||||
// Description: Extension for JpGraph to do some simple img transformations
|
||||
// Created: 2003-09-06
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_imgtrans.php 21 2005-05-30 20:35:34Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Class ImgTrans
|
||||
// Perform some simple image transformations.
|
||||
//------------------------------------------------------------------------
|
||||
class ImgTrans {
|
||||
var $gdImg=null;
|
||||
|
||||
function ImgTrans($aGdImg) {
|
||||
// Constructor
|
||||
$this->gdImg = $aGdImg;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// _TransVert3D() and _TransHor3D() are helper methods to
|
||||
// Skew3D().
|
||||
// --------------------------------------------------------------------
|
||||
function _TransVert3D($aGdImg,$aHorizon=100,$aSkewDist=120,$aDir=SKEW3D_DOWN,$aMinSize=true,$aFillColor='#FFFFFF',$aQuality=false,$aBorder=false,$aHorizonPos=0.5) {
|
||||
|
||||
|
||||
// Parameter check
|
||||
if( $aHorizonPos < 0 || $aHorizonPos > 1.0 ) {
|
||||
JpGraphError::Raise("Value for image transformation out of bounds.\nVanishing point on horizon must be specified as a value between 0 and 1.");
|
||||
}
|
||||
|
||||
$w = imagesx($aGdImg);
|
||||
$h = imagesy($aGdImg);
|
||||
|
||||
// Create new image
|
||||
$ww = $w;
|
||||
if( $aMinSize )
|
||||
$hh = ceil($h * $aHorizon / ($aSkewDist+$h));
|
||||
else
|
||||
$hh = $h;
|
||||
|
||||
$newgdh = imagecreatetruecolor($ww,$hh);
|
||||
$crgb = new RGB( $newgdh );
|
||||
$fillColor = $crgb->Allocate($aFillColor);
|
||||
imagefilledrectangle($newgdh,0,0,$ww-1,$hh-1,$fillColor);
|
||||
|
||||
if( $aBorder ) {
|
||||
$colidx = $crgb->Allocate($aBorder);
|
||||
imagerectangle($newgdh,0,0,$ww-1,$hh-1,$colidx);
|
||||
}
|
||||
|
||||
$mid = round($w * $aHorizonPos);
|
||||
|
||||
$last=$h;
|
||||
for($y=0; $y < $h; ++$y) {
|
||||
|
||||
$yp = $h-$y-1;
|
||||
$yt = floor($yp * $aHorizon / ($aSkewDist + $yp));
|
||||
|
||||
if( !$aQuality ) {
|
||||
if( $last <= $yt ) continue ;
|
||||
$last = $yt;
|
||||
}
|
||||
|
||||
for($x=0; $x < $w; ++$x) {
|
||||
$xt = ($x-$mid) * $aSkewDist / ($aSkewDist + $yp);
|
||||
if( $aDir == SKEW3D_UP )
|
||||
$rgb = imagecolorat($aGdImg,$x,$h-$y-1);
|
||||
else
|
||||
$rgb = imagecolorat($aGdImg,$x,$y);
|
||||
$r = ($rgb >> 16) & 0xFF;
|
||||
$g = ($rgb >> 8) & 0xFF;
|
||||
$b = $rgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,$r,$g,$b);
|
||||
$xt = round($xt+$mid);
|
||||
if( $aDir == SKEW3D_UP ) {
|
||||
$syt = $yt;
|
||||
}
|
||||
else {
|
||||
$syt = $hh-$yt-1;
|
||||
}
|
||||
|
||||
if( !empty($set[$yt]) ) {
|
||||
$nrgb = imagecolorat($newgdh,$xt,$syt);
|
||||
$nr = ($nrgb >> 16) & 0xFF;
|
||||
$ng = ($nrgb >> 8) & 0xFF;
|
||||
$nb = $nrgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,floor(($r+$nr)/2),
|
||||
floor(($g+$ng)/2),floor(($b+$nb)/2));
|
||||
}
|
||||
|
||||
imagesetpixel($newgdh,$xt,$syt,$colidx);
|
||||
}
|
||||
|
||||
$set[$yt] = true;
|
||||
}
|
||||
|
||||
return $newgdh;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// _TransVert3D() and _TransHor3D() are helper methods to
|
||||
// Skew3D().
|
||||
// --------------------------------------------------------------------
|
||||
function _TransHor3D($aGdImg,$aHorizon=100,$aSkewDist=120,$aDir=SKEW3D_LEFT,$aMinSize=true,$aFillColor='#FFFFFF',$aQuality=false,$aBorder=false,$aHorizonPos=0.5) {
|
||||
|
||||
$w = imagesx($aGdImg);
|
||||
$h = imagesy($aGdImg);
|
||||
|
||||
// Create new image
|
||||
$hh = $h;
|
||||
if( $aMinSize )
|
||||
$ww = ceil($w * $aHorizon / ($aSkewDist+$w));
|
||||
else
|
||||
$ww = $w;
|
||||
|
||||
$newgdh = imagecreatetruecolor($ww,$hh);
|
||||
$crgb = new RGB( $newgdh );
|
||||
$fillColor = $crgb->Allocate($aFillColor);
|
||||
imagefilledrectangle($newgdh,0,0,$ww-1,$hh-1,$fillColor);
|
||||
|
||||
if( $aBorder ) {
|
||||
$colidx = $crgb->Allocate($aBorder);
|
||||
imagerectangle($newgdh,0,0,$ww-1,$hh-1,$colidx);
|
||||
}
|
||||
|
||||
$mid = round($h * $aHorizonPos);
|
||||
|
||||
$last = -1;
|
||||
for($x=0; $x < $w-1; ++$x) {
|
||||
$xt = floor($x * $aHorizon / ($aSkewDist + $x));
|
||||
if( !$aQuality ) {
|
||||
if( $last >= $xt ) continue ;
|
||||
$last = $xt;
|
||||
}
|
||||
|
||||
for($y=0; $y < $h; ++$y) {
|
||||
$yp = $h-$y-1;
|
||||
$yt = ($yp-$mid) * $aSkewDist / ($aSkewDist + $x);
|
||||
|
||||
if( $aDir == SKEW3D_RIGHT )
|
||||
$rgb = imagecolorat($aGdImg,$w-$x-1,$y);
|
||||
else
|
||||
$rgb = imagecolorat($aGdImg,$x,$y);
|
||||
$r = ($rgb >> 16) & 0xFF;
|
||||
$g = ($rgb >> 8) & 0xFF;
|
||||
$b = $rgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,$r,$g,$b);
|
||||
$yt = floor($hh-$yt-$mid-1);
|
||||
if( $aDir == SKEW3D_RIGHT ) {
|
||||
$sxt = $ww-$xt-1;
|
||||
}
|
||||
else
|
||||
$sxt = $xt ;
|
||||
|
||||
if( !empty($set[$xt]) ) {
|
||||
$nrgb = imagecolorat($newgdh,$sxt,$yt);
|
||||
$nr = ($nrgb >> 16) & 0xFF;
|
||||
$ng = ($nrgb >> 8) & 0xFF;
|
||||
$nb = $nrgb & 0xFF;
|
||||
$colidx = imagecolorallocate($newgdh,floor(($r+$nr)/2),
|
||||
floor(($g+$ng)/2),floor(($b+$nb)/2));
|
||||
}
|
||||
imagesetpixel($newgdh,$sxt,$yt,$colidx);
|
||||
}
|
||||
|
||||
$set[$xt] = true;
|
||||
}
|
||||
|
||||
return $newgdh;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Skew image for the apperance of a 3D effect
|
||||
// This transforms an image into a 3D-skewed version
|
||||
// of the image. The transformation is specified by giving the height
|
||||
// of the artificial horizon and specifying a "skew" factor which
|
||||
// is the distance on the horizon line between the point of
|
||||
// convergence and perspective line.
|
||||
//
|
||||
// The function returns the GD handle of the transformed image
|
||||
// leaving the original image untouched.
|
||||
//
|
||||
// Parameters:
|
||||
// * $aGdImg, GD handle to the image to be transformed
|
||||
// * $aHorizon, Distance to the horizon
|
||||
// * $aSkewDist, Distance from the horizon point of convergence
|
||||
// on the horizon line to the perspective points. A larger
|
||||
// value will fore-shorten the image more
|
||||
// * $aDir, parameter specifies type of convergence. This of this
|
||||
// as the walls in a room you are looking at. This specifies if the
|
||||
// image should be applied on the left,right,top or bottom walls.
|
||||
// * $aMinSize, true=make the new image just as big as needed,
|
||||
// false = keep the image the same size as the original image
|
||||
// * $aFillColor, Background fill color in the image
|
||||
// * $aHiQuality, true=performa some interpolation that improves
|
||||
// the image quality but at the expense of performace. Enabling
|
||||
// high quality will have a dramatic effect on the time it takes
|
||||
// to transform an image.
|
||||
// * $aBorder, if set to anything besides false this will draw a
|
||||
// a border of the speciied color around the image
|
||||
// --------------------------------------------------------------------
|
||||
function Skew3D($aHorizon=120,$aSkewDist=150,$aDir=SKEW3D_DOWN,$aHiQuality=false,$aMinSize=true,$aFillColor='#FFFFFF',$aBorder=false) {
|
||||
return $this->_Skew3D($this->gdImg,$aHorizon,$aSkewDist,$aDir,$aHiQuality,
|
||||
$aMinSize,$aFillColor,$aBorder);
|
||||
}
|
||||
|
||||
function _Skew3D($aGdImg,$aHorizon=120,$aSkewDist=150,$aDir=SKEW3D_DOWN,$aHiQuality=false,$aMinSize=true,$aFillColor='#FFFFFF',$aBorder=false) {
|
||||
if( $aDir == SKEW3D_DOWN || $aDir == SKEW3D_UP )
|
||||
return $this->_TransVert3D($aGdImg,$aHorizon,$aSkewDist,$aDir,$aMinSize,$aFillColor,$aHiQuality,$aBorder);
|
||||
else
|
||||
return $this->_TransHor3D($aGdImg,$aHorizon,$aSkewDist,$aDir,$aMinSize,$aFillColor,$aHiQuality,$aBorder);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,267 +1,262 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_LOG.PHP
|
||||
// Description: Log scale plot extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_log.php 480 2006-02-04 12:17:57Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
|
||||
DEFINE('LOGLABELS_PLAIN',0);
|
||||
DEFINE('LOGLABELS_MAGNITUDE',1);
|
||||
|
||||
//===================================================
|
||||
// CLASS LogScale
|
||||
// Description: Logarithmic scale between world and screen
|
||||
//===================================================
|
||||
class LogScale extends LinearScale {
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
|
||||
// Log scale is specified using the log of min and max
|
||||
function LogScale($min,$max,$type="y") {
|
||||
$this->LinearScale($min,$max,$type);
|
||||
$this->ticks = new LogTicks();
|
||||
$this->name = 'log';
|
||||
}
|
||||
|
||||
//----------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
// Translate between world and screen
|
||||
function Translate($a) {
|
||||
if( !is_numeric($a) ) {
|
||||
if( $a != '' && $a != '-' && $a != 'x' )
|
||||
JpGraphError::RaiseL(11001);
|
||||
//('Your data contains non-numeric values.');
|
||||
return 1;
|
||||
}
|
||||
if( $a < 0 ) {
|
||||
JpGraphError::RaiseL(11002);
|
||||
//("Negative data values can not be used in a log scale.");
|
||||
exit(1);
|
||||
}
|
||||
if( $a==0 ) $a=1;
|
||||
$a=log10($a);
|
||||
return ceil($this->off + ($a*1.0 - $this->scale[0]) * $this->scale_factor);
|
||||
}
|
||||
|
||||
// Relative translate (don't include offset) usefull when we just want
|
||||
// to know the relative position (in pixels) on the axis
|
||||
function RelTranslate($a) {
|
||||
if( !is_numeric($a) ) {
|
||||
if( $a != '' && $a != '-' && $a != 'x' )
|
||||
JpGraphError::RaiseL(11001);
|
||||
//('Your data contains non-numeric values.');
|
||||
return 1;
|
||||
}
|
||||
if( $a==0 ) $a=1;
|
||||
$a=log10($a);
|
||||
return round(($a*1.0 - $this->scale[0]) * $this->scale_factor);
|
||||
}
|
||||
|
||||
// Use bcpow() for increased precision
|
||||
function GetMinVal() {
|
||||
if( function_exists("bcpow") )
|
||||
return round(bcpow(10,$this->scale[0],15),14);
|
||||
else
|
||||
return round(pow(10,$this->scale[0]),14);
|
||||
}
|
||||
|
||||
function GetMaxVal() {
|
||||
if( function_exists("bcpow") )
|
||||
return round(bcpow(10,$this->scale[1],15),14);
|
||||
else
|
||||
return round(pow(10,$this->scale[1]),14);
|
||||
}
|
||||
|
||||
// Logarithmic autoscaling is much simplier since we just
|
||||
// set the min and max to logs of the min and max values.
|
||||
// Note that for log autoscale the "maxstep" the fourth argument
|
||||
// isn't used. This is just included to give the method the same
|
||||
// signature as the linear counterpart.
|
||||
function AutoScale($img,$min,$max,$maxsteps,$majend=true) {
|
||||
if( $min==0 ) $min=1;
|
||||
|
||||
if( $max <= 0 ) {
|
||||
JpGraphError::RaiseL(11004);
|
||||
//('Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.');
|
||||
}
|
||||
$smin = floor(log10($min));
|
||||
$smax = ceil(log10($max));
|
||||
$this->Update($img,$smin,$smax);
|
||||
}
|
||||
//---------------
|
||||
// PRIVATE METHODS
|
||||
} // Class
|
||||
|
||||
//===================================================
|
||||
// CLASS LogTicks
|
||||
// Description:
|
||||
//===================================================
|
||||
class LogTicks extends Ticks{
|
||||
private $label_logtype=LOGLABELS_MAGNITUDE;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function LogTicks() {
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function IsSpecified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function SetLabelLogType($aType) {
|
||||
$this->label_logtype = $aType;
|
||||
}
|
||||
|
||||
// For log scale it's meaningless to speak about a major step
|
||||
// We just return -1 to make the framework happy (specifically
|
||||
// StrokeLabels() )
|
||||
function GetMajor() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
function SetTextLabelStart($aStart) {
|
||||
JpGraphError::RaiseL(11005);
|
||||
//('Specifying tick interval for a logarithmic scale is undefined. Remove any calls to SetTextLabelStart() or SetTextTickInterval() on the logarithmic scale.');
|
||||
}
|
||||
|
||||
function SetXLabelOffset($dummy) {
|
||||
// For log scales we dont care about XLabel offset
|
||||
}
|
||||
|
||||
// Draw ticks on image "img" using scale "scale". The axis absolute
|
||||
// position in the image is specified in pos, i.e. for an x-axis
|
||||
// it specifies the absolute y-coord and for Y-ticks it specified the
|
||||
// absolute x-position.
|
||||
function Stroke($img,$scale,$pos) {
|
||||
$start = $scale->GetMinVal();
|
||||
$limit = $scale->GetMaxVal();
|
||||
$nextMajor = 10*$start;
|
||||
$step = $nextMajor / 10.0;
|
||||
|
||||
|
||||
$img->SetLineWeight($this->weight);
|
||||
|
||||
if( $scale->type == "y" ) {
|
||||
// member direction specified if the ticks should be on
|
||||
// left or right side.
|
||||
$a=$pos + $this->direction*$this->GetMinTickAbsSize();
|
||||
$a2=$pos + $this->direction*$this->GetMajTickAbsSize();
|
||||
|
||||
$count=1;
|
||||
$this->maj_ticks_pos[0]=$scale->Translate($start);
|
||||
$this->maj_ticklabels_pos[0]=$scale->Translate($start);
|
||||
if( $this->supress_first )
|
||||
$this->maj_ticks_label[0]="";
|
||||
else {
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[0]=call_user_func($f,$start);
|
||||
}
|
||||
elseif( $this->label_logtype == LOGLABELS_PLAIN )
|
||||
$this->maj_ticks_label[0]=$start;
|
||||
else
|
||||
$this->maj_ticks_label[0]='10^'.round(log10($start));
|
||||
}
|
||||
$i=1;
|
||||
for($y=$start; $y<=$limit; $y+=$step,++$count ) {
|
||||
$ys=$scale->Translate($y);
|
||||
$this->ticks_pos[]=$ys;
|
||||
$this->ticklabels_pos[]=$ys;
|
||||
if( $count % 10 == 0 ) {
|
||||
if( !$this->supress_tickmarks ) {
|
||||
if( $this->majcolor!="" ) {
|
||||
$img->PushColor($this->majcolor);
|
||||
$img->Line($pos,$ys,$a2,$ys);
|
||||
$img->PopColor();
|
||||
}
|
||||
else
|
||||
$img->Line($pos,$ys,$a2,$ys);
|
||||
}
|
||||
|
||||
$this->maj_ticks_pos[$i]=$ys;
|
||||
$this->maj_ticklabels_pos[$i]=$ys;
|
||||
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[$i]=call_user_func($f,$nextMajor);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[$i]=$nextMajor;
|
||||
else
|
||||
$this->maj_ticks_label[$i]='10^'.round(log10($nextMajor));
|
||||
++$i;
|
||||
$nextMajor *= 10;
|
||||
$step *= 10;
|
||||
$count=1;
|
||||
}
|
||||
else {
|
||||
if( !$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
|
||||
if( $this->mincolor!="" ) $img->PushColor($this->mincolor);
|
||||
$img->Line($pos,$ys,$a,$ys);
|
||||
if( $this->mincolor!="" ) $img->PopColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$a=$pos - $this->direction*$this->GetMinTickAbsSize();
|
||||
$a2=$pos - $this->direction*$this->GetMajTickAbsSize();
|
||||
$count=1;
|
||||
$this->maj_ticks_pos[0]=$scale->Translate($start);
|
||||
$this->maj_ticklabels_pos[0]=$scale->Translate($start);
|
||||
if( $this->supress_first )
|
||||
$this->maj_ticks_label[0]="";
|
||||
else {
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[0]=call_user_func($f,$start);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[0]=$start;
|
||||
else
|
||||
$this->maj_ticks_label[0]='10^'.round(log10($start));
|
||||
}
|
||||
$i=1;
|
||||
for($x=$start; $x<=$limit; $x+=$step,++$count ) {
|
||||
$xs=$scale->Translate($x);
|
||||
$this->ticks_pos[]=$xs;
|
||||
$this->ticklabels_pos[]=$xs;
|
||||
if( $count % 10 == 0 ) {
|
||||
if( !$this->supress_tickmarks ) {
|
||||
$img->Line($xs,$pos,$xs,$a2);
|
||||
}
|
||||
$this->maj_ticks_pos[$i]=$xs;
|
||||
$this->maj_ticklabels_pos[$i]=$xs;
|
||||
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[$i]=call_user_func($f,$nextMajor);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[$i]=$nextMajor;
|
||||
else
|
||||
$this->maj_ticks_label[$i]='10^'.round(log10($nextMajor));
|
||||
++$i;
|
||||
$nextMajor *= 10;
|
||||
$step *= 10;
|
||||
$count=1;
|
||||
}
|
||||
else {
|
||||
if( !$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
|
||||
$img->Line($xs,$pos,$xs,$a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // Class
|
||||
/* EOF */
|
||||
?>
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_LOG.PHP
|
||||
// Description: Log scale plot extension for JpGraph
|
||||
// Created: 2001-01-08
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_log.php 56 2005-06-06 20:14:44Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
|
||||
DEFINE('LOGLABELS_PLAIN',0);
|
||||
DEFINE('LOGLABELS_MAGNITUDE',1);
|
||||
|
||||
//===================================================
|
||||
// CLASS LogScale
|
||||
// Description: Logarithmic scale between world and screen
|
||||
//===================================================
|
||||
class LogScale extends LinearScale {
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
|
||||
// Log scale is specified using the log of min and max
|
||||
function LogScale($min,$max,$type="y") {
|
||||
$this->LinearScale($min,$max,$type);
|
||||
$this->ticks = new LogTicks();
|
||||
$this->name = 'log';
|
||||
}
|
||||
|
||||
//----------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
// Translate between world and screen
|
||||
function Translate($a) {
|
||||
if( !is_numeric($a) ) {
|
||||
if( $a != '' && $a != '-' && $a != 'x' )
|
||||
JpGraphError::Raise('Your data contains non-numeric values.');
|
||||
return 1;
|
||||
}
|
||||
if( $a < 0 ) {
|
||||
JpGraphError::Raise("Negative data values can not be used in a log scale.");
|
||||
exit(1);
|
||||
}
|
||||
if( $a==0 ) $a=1;
|
||||
$a=log10($a);
|
||||
return ceil($this->off + ($a*1.0 - $this->scale[0]) * $this->scale_factor);
|
||||
}
|
||||
|
||||
// Relative translate (don't include offset) usefull when we just want
|
||||
// to know the relative position (in pixels) on the axis
|
||||
function RelTranslate($a) {
|
||||
if( !is_numeric($a) ) {
|
||||
if( $a != '' && $a != '-' && $a != 'x' )
|
||||
JpGraphError::Raise('Your data contains non-numeric values.');
|
||||
return 1;
|
||||
}
|
||||
if( $a==0 ) $a=1;
|
||||
$a=log10($a);
|
||||
return round(($a*1.0 - $this->scale[0]) * $this->scale_factor);
|
||||
}
|
||||
|
||||
// Use bcpow() for increased precision
|
||||
function GetMinVal() {
|
||||
if( function_exists("bcpow") )
|
||||
return round(bcpow(10,$this->scale[0],15),14);
|
||||
else
|
||||
return round(pow(10,$this->scale[0]),14);
|
||||
}
|
||||
|
||||
function GetMaxVal() {
|
||||
if( function_exists("bcpow") )
|
||||
return round(bcpow(10,$this->scale[1],15),14);
|
||||
else
|
||||
return round(pow(10,$this->scale[1]),14);
|
||||
}
|
||||
|
||||
// Logarithmic autoscaling is much simplier since we just
|
||||
// set the min and max to logs of the min and max values.
|
||||
// Note that for log autoscale the "maxstep" the fourth argument
|
||||
// isn't used. This is just included to give the method the same
|
||||
// signature as the linear counterpart.
|
||||
function AutoScale(&$img,$min,$max,$dummy) {
|
||||
if( $min==0 ) $min=1;
|
||||
|
||||
if( $max <= 0 ) {
|
||||
JpGraphError::Raise('Scale error for logarithmic scale. You have a problem with your data values. The max value must be greater than 0. It is mathematically impossible to have 0 in a logarithmic scale.');
|
||||
}
|
||||
$smin = floor(log10($min));
|
||||
$smax = ceil(log10($max));
|
||||
$this->Update($img,$smin,$smax);
|
||||
}
|
||||
//---------------
|
||||
// PRIVATE METHODS
|
||||
} // Class
|
||||
|
||||
//===================================================
|
||||
// CLASS LogTicks
|
||||
// Description:
|
||||
//===================================================
|
||||
class LogTicks extends Ticks{
|
||||
var $label_logtype=LOGLABELS_MAGNITUDE;
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function LogTicks() {
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function IsSpecified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function SetLabelLogType($aType) {
|
||||
$this->label_logtype = $aType;
|
||||
}
|
||||
|
||||
// For log scale it's meaningless to speak about a major step
|
||||
// We just return -1 to make the framework happy (specifically
|
||||
// StrokeLabels() )
|
||||
function GetMajor() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
function SetTextLabelStart($aStart) {
|
||||
JpGraphError::Raise('Specifying tick interval for a logarithmic scale is undefined. Remove any calls to SetTextLabelStart() or SetTextTickInterval() on the logarithmic scale.');
|
||||
}
|
||||
|
||||
function SetXLabelOffset($dummy) {
|
||||
// For log scales we dont care about XLabel offset
|
||||
}
|
||||
|
||||
// Draw ticks on image "img" using scale "scale". The axis absolute
|
||||
// position in the image is specified in pos, i.e. for an x-axis
|
||||
// it specifies the absolute y-coord and for Y-ticks it specified the
|
||||
// absolute x-position.
|
||||
function Stroke(&$img,&$scale,$pos) {
|
||||
$start = $scale->GetMinVal();
|
||||
$limit = $scale->GetMaxVal();
|
||||
$nextMajor = 10*$start;
|
||||
$step = $nextMajor / 10.0;
|
||||
|
||||
|
||||
$img->SetLineWeight($this->weight);
|
||||
|
||||
if( $scale->type == "y" ) {
|
||||
// member direction specified if the ticks should be on
|
||||
// left or right side.
|
||||
$a=$pos + $this->direction*$this->GetMinTickAbsSize();
|
||||
$a2=$pos + $this->direction*$this->GetMajTickAbsSize();
|
||||
|
||||
$count=1;
|
||||
$this->maj_ticks_pos[0]=$scale->Translate($start);
|
||||
$this->maj_ticklabels_pos[0]=$scale->Translate($start);
|
||||
if( $this->supress_first )
|
||||
$this->maj_ticks_label[0]="";
|
||||
else {
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[0]=call_user_func($f,$start);
|
||||
}
|
||||
elseif( $this->label_logtype == LOGLABELS_PLAIN )
|
||||
$this->maj_ticks_label[0]=$start;
|
||||
else
|
||||
$this->maj_ticks_label[0]='10^'.round(log10($start));
|
||||
}
|
||||
$i=1;
|
||||
for($y=$start; $y<=$limit; $y+=$step,++$count ) {
|
||||
$ys=$scale->Translate($y);
|
||||
$this->ticks_pos[]=$ys;
|
||||
$this->ticklabels_pos[]=$ys;
|
||||
if( $count % 10 == 0 ) {
|
||||
if( !$this->supress_tickmarks ) {
|
||||
if( $this->majcolor!="" ) {
|
||||
$img->PushColor($this->majcolor);
|
||||
$img->Line($pos,$ys,$a2,$ys);
|
||||
$img->PopColor();
|
||||
}
|
||||
else
|
||||
$img->Line($pos,$ys,$a2,$ys);
|
||||
}
|
||||
|
||||
$this->maj_ticks_pos[$i]=$ys;
|
||||
$this->maj_ticklabels_pos[$i]=$ys;
|
||||
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[$i]=call_user_func($f,$nextMajor);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[$i]=$nextMajor;
|
||||
else
|
||||
$this->maj_ticks_label[$i]='10^'.round(log10($nextMajor));
|
||||
++$i;
|
||||
$nextMajor *= 10;
|
||||
$step *= 10;
|
||||
$count=1;
|
||||
}
|
||||
else {
|
||||
if( !$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
|
||||
if( $this->mincolor!="" ) $img->PushColor($this->mincolor);
|
||||
$img->Line($pos,$ys,$a,$ys);
|
||||
if( $this->mincolor!="" ) $img->PopColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$a=$pos - $this->direction*$this->GetMinTickAbsSize();
|
||||
$a2=$pos - $this->direction*$this->GetMajTickAbsSize();
|
||||
$count=1;
|
||||
$this->maj_ticks_pos[0]=$scale->Translate($start);
|
||||
$this->maj_ticklabels_pos[0]=$scale->Translate($start);
|
||||
if( $this->supress_first )
|
||||
$this->maj_ticks_label[0]="";
|
||||
else {
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[0]=call_user_func($f,$start);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[0]=$start;
|
||||
else
|
||||
$this->maj_ticks_label[0]='10^'.round(log10($start));
|
||||
}
|
||||
$i=1;
|
||||
for($x=$start; $x<=$limit; $x+=$step,++$count ) {
|
||||
$xs=$scale->Translate($x);
|
||||
$this->ticks_pos[]=$xs;
|
||||
$this->ticklabels_pos[]=$xs;
|
||||
if( $count % 10 == 0 ) {
|
||||
if( !$this->supress_tickmarks ) {
|
||||
$img->Line($xs,$pos,$xs,$a2);
|
||||
}
|
||||
$this->maj_ticks_pos[$i]=$xs;
|
||||
$this->maj_ticklabels_pos[$i]=$xs;
|
||||
|
||||
if( $this->label_formfunc != '' ) {
|
||||
$f = $this->label_formfunc;
|
||||
$this->maj_ticks_label[$i]=call_user_func($f,$nextMajor);
|
||||
}
|
||||
elseif( $this->label_logtype == 0 )
|
||||
$this->maj_ticks_label[$i]=$nextMajor;
|
||||
else
|
||||
$this->maj_ticks_label[$i]='10^'.round(log10($nextMajor));
|
||||
++$i;
|
||||
$nextMajor *= 10;
|
||||
$step *= 10;
|
||||
$count=1;
|
||||
}
|
||||
else {
|
||||
if( !$this->supress_tickmarks && !$this->supress_minor_tickmarks) {
|
||||
$img->Line($xs,$pos,$xs,$a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // Class
|
||||
/* EOF */
|
||||
?>
|
|
@ -1,203 +1,189 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_REGSTAT.PHP
|
||||
// Description: Regression and statistical analysis helper classes
|
||||
// Created: 2002-12-01
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_regstat.php 614 2006-04-19 19:36:32Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// CLASS Spline
|
||||
// Create a new data array from an existing data array but with more points.
|
||||
// The new points are interpolated using a cubic spline algorithm
|
||||
//------------------------------------------------------------------------
|
||||
class Spline {
|
||||
// 3:rd degree polynom approximation
|
||||
|
||||
private $xdata,$ydata; // Data vectors
|
||||
private $y2; // 2:nd derivate of ydata
|
||||
private $n=0;
|
||||
|
||||
function Spline($xdata,$ydata) {
|
||||
$this->y2 = array();
|
||||
$this->xdata = $xdata;
|
||||
$this->ydata = $ydata;
|
||||
|
||||
$n = count($ydata);
|
||||
$this->n = $n;
|
||||
if( $this->n !== count($xdata) ) {
|
||||
JpGraphError::RaiseL(19001);
|
||||
//('Spline: Number of X and Y coordinates must be the same');
|
||||
}
|
||||
|
||||
// Natural spline 2:derivate == 0 at endpoints
|
||||
$this->y2[0] = 0.0;
|
||||
$this->y2[$n-1] = 0.0;
|
||||
$delta[0] = 0.0;
|
||||
|
||||
// Calculate 2:nd derivate
|
||||
for($i=1; $i < $n-1; ++$i) {
|
||||
$d = ($xdata[$i+1]-$xdata[$i-1]);
|
||||
if( $d == 0 ) {
|
||||
JpGraphError::RaiseL(19002);
|
||||
//('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||
}
|
||||
$s = ($xdata[$i]-$xdata[$i-1])/$d;
|
||||
$p = $s*$this->y2[$i-1]+2.0;
|
||||
$this->y2[$i] = ($s-1.0)/$p;
|
||||
$delta[$i] = ($ydata[$i+1]-$ydata[$i])/($xdata[$i+1]-$xdata[$i]) -
|
||||
($ydata[$i]-$ydata[$i-1])/($xdata[$i]-$xdata[$i-1]);
|
||||
$delta[$i] = (6.0*$delta[$i]/($xdata[$i+1]-$xdata[$i-1])-$s*$delta[$i-1])/$p;
|
||||
}
|
||||
|
||||
// Backward substitution
|
||||
for( $j=$n-2; $j >= 0; --$j ) {
|
||||
$this->y2[$j] = $this->y2[$j]*$this->y2[$j+1] + $delta[$j];
|
||||
}
|
||||
}
|
||||
|
||||
// Return the two new data vectors
|
||||
function Get($num=50) {
|
||||
$n = $this->n ;
|
||||
$step = ($this->xdata[$n-1]-$this->xdata[0]) / ($num-1);
|
||||
$xnew=array();
|
||||
$ynew=array();
|
||||
$xnew[0] = $this->xdata[0];
|
||||
$ynew[0] = $this->ydata[0];
|
||||
for( $j=1; $j < $num; ++$j ) {
|
||||
$xnew[$j] = $xnew[0]+$j*$step;
|
||||
$ynew[$j] = $this->Interpolate($xnew[$j]);
|
||||
}
|
||||
return array($xnew,$ynew);
|
||||
}
|
||||
|
||||
// Return a single interpolated Y-value from an x value
|
||||
function Interpolate($xpoint) {
|
||||
|
||||
$max = $this->n-1;
|
||||
$min = 0;
|
||||
|
||||
// Binary search to find interval
|
||||
while( $max-$min > 1 ) {
|
||||
$k = ($max+$min) / 2;
|
||||
if( $this->xdata[$k] > $xpoint )
|
||||
$max=$k;
|
||||
else
|
||||
$min=$k;
|
||||
}
|
||||
|
||||
// Each interval is interpolated by a 3:degree polynom function
|
||||
$h = $this->xdata[$max]-$this->xdata[$min];
|
||||
|
||||
if( $h == 0 ) {
|
||||
JpGraphError::RaiseL(19002);
|
||||
//('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||
}
|
||||
|
||||
|
||||
$a = ($this->xdata[$max]-$xpoint)/$h;
|
||||
$b = ($xpoint-$this->xdata[$min])/$h;
|
||||
return $a*$this->ydata[$min]+$b*$this->ydata[$max]+
|
||||
(($a*$a*$a-$a)*$this->y2[$min]+($b*$b*$b-$b)*$this->y2[$max])*($h*$h)/6.0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// CLASS Bezier
|
||||
// Create a new data array from a number of control points
|
||||
//------------------------------------------------------------------------
|
||||
class Bezier {
|
||||
/**
|
||||
* @author Thomas Despoix, openXtrem company
|
||||
* @license released under QPL
|
||||
* @abstract Bezier interoplated point generation,
|
||||
* computed from control points data sets, based on Paul Bourke algorithm :
|
||||
* http://astronomy.swin.edu.au/~pbourke/curves/bezier/
|
||||
*/
|
||||
private $datax = array();
|
||||
private $datay = array();
|
||||
private $n=0;
|
||||
|
||||
function Bezier($datax, $datay, $attraction_factor = 1) {
|
||||
// Adding control point multiple time will raise their attraction power over the curve
|
||||
$this->n = count($datax);
|
||||
if( $this->n !== count($datay) ) {
|
||||
JpGraphError::RaiseL(19003);
|
||||
//('Bezier: Number of X and Y coordinates must be the same');
|
||||
}
|
||||
$idx=0;
|
||||
foreach($datax as $datumx) {
|
||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||
$this->datax[$idx++] = $datumx;
|
||||
}
|
||||
}
|
||||
$idx=0;
|
||||
foreach($datay as $datumy) {
|
||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||
$this->datay[$idx++] = $datumy;
|
||||
}
|
||||
}
|
||||
$this->n *= $attraction_factor;
|
||||
}
|
||||
|
||||
function Get($steps) {
|
||||
$datax = array();
|
||||
$datay = array();
|
||||
for ($i = 0; $i < $steps; $i++) {
|
||||
list($datumx, $datumy) = $this->GetPoint((double) $i / (double) $steps);
|
||||
$datax[] = $datumx;
|
||||
$datay[] = $datumy;
|
||||
}
|
||||
|
||||
$datax[] = end($this->datax);
|
||||
$datay[] = end($this->datay);
|
||||
|
||||
return array($datax, $datay);
|
||||
}
|
||||
|
||||
function GetPoint($mu) {
|
||||
$n = $this->n - 1;
|
||||
$k = 0;
|
||||
$kn = 0;
|
||||
$nn = 0;
|
||||
$nkn = 0;
|
||||
$blend = 0.0;
|
||||
$newx = 0.0;
|
||||
$newy = 0.0;
|
||||
|
||||
$muk = 1.0;
|
||||
$munk = (double) pow(1-$mu,(double) $n);
|
||||
|
||||
for ($k = 0; $k <= $n; $k++) {
|
||||
$nn = $n;
|
||||
$kn = $k;
|
||||
$nkn = $n - $k;
|
||||
$blend = $muk * $munk;
|
||||
$muk *= $mu;
|
||||
$munk /= (1-$mu);
|
||||
while ($nn >= 1) {
|
||||
$blend *= $nn;
|
||||
$nn--;
|
||||
if ($kn > 1) {
|
||||
$blend /= (double) $kn;
|
||||
$kn--;
|
||||
}
|
||||
if ($nkn > 1) {
|
||||
$blend /= (double) $nkn;
|
||||
$nkn--;
|
||||
}
|
||||
}
|
||||
$newx += $this->datax[$k] * $blend;
|
||||
$newy += $this->datay[$k] * $blend;
|
||||
}
|
||||
|
||||
return array($newx, $newy);
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
?>
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_REGSTAT.PHP
|
||||
// Description: Regression and statistical analysis helper classes
|
||||
// Created: 2002-12-01
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_regstat.php 327 2005-12-10 08:24:50Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// CLASS Spline
|
||||
// Create a new data array from an existing data array but with more points.
|
||||
// The new points are interpolated using a cubic spline algorithm
|
||||
//------------------------------------------------------------------------
|
||||
class Spline {
|
||||
// 3:rd degree polynom approximation
|
||||
|
||||
var $xdata,$ydata; // Data vectors
|
||||
var $y2; // 2:nd derivate of ydata
|
||||
var $n=0;
|
||||
|
||||
function Spline($xdata,$ydata) {
|
||||
$this->y2 = array();
|
||||
$this->xdata = $xdata;
|
||||
$this->ydata = $ydata;
|
||||
|
||||
$n = count($ydata);
|
||||
$this->n = $n;
|
||||
|
||||
// Natural spline 2:derivate == 0 at endpoints
|
||||
$this->y2[0] = 0.0;
|
||||
$this->y2[$n-1] = 0.0;
|
||||
$delta[0] = 0.0;
|
||||
|
||||
// Calculate 2:nd derivate
|
||||
for($i=1; $i < $n-1; ++$i) {
|
||||
$d = ($xdata[$i+1]-$xdata[$i-1]);
|
||||
if( $d == 0 ) {
|
||||
JpGraphError::Raise('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||
}
|
||||
$s = ($xdata[$i]-$xdata[$i-1])/$d;
|
||||
$p = $s*$this->y2[$i-1]+2.0;
|
||||
$this->y2[$i] = ($s-1.0)/$p;
|
||||
$delta[$i] = ($ydata[$i+1]-$ydata[$i])/($xdata[$i+1]-$xdata[$i]) -
|
||||
($ydata[$i]-$ydata[$i-1])/($xdata[$i]-$xdata[$i-1]);
|
||||
$delta[$i] = (6.0*$delta[$i]/($xdata[$i+1]-$xdata[$i-1])-$s*$delta[$i-1])/$p;
|
||||
}
|
||||
|
||||
// Backward substitution
|
||||
for( $j=$n-2; $j >= 0; --$j ) {
|
||||
$this->y2[$j] = $this->y2[$j]*$this->y2[$j+1] + $delta[$j];
|
||||
}
|
||||
}
|
||||
|
||||
// Return the two new data vectors
|
||||
function Get($num=50) {
|
||||
$n = $this->n ;
|
||||
$step = ($this->xdata[$n-1]-$this->xdata[0]) / ($num-1);
|
||||
$xnew=array();
|
||||
$ynew=array();
|
||||
$xnew[0] = $this->xdata[0];
|
||||
$ynew[0] = $this->ydata[0];
|
||||
for( $j=1; $j < $num; ++$j ) {
|
||||
$xnew[$j] = $xnew[0]+$j*$step;
|
||||
$ynew[$j] = $this->Interpolate($xnew[$j]);
|
||||
}
|
||||
return array($xnew,$ynew);
|
||||
}
|
||||
|
||||
// Return a single interpolated Y-value from an x value
|
||||
function Interpolate($xpoint) {
|
||||
|
||||
$max = $this->n-1;
|
||||
$min = 0;
|
||||
|
||||
// Binary search to find interval
|
||||
while( $max-$min > 1 ) {
|
||||
$k = ($max+$min) / 2;
|
||||
if( $this->xdata[$k] > $xpoint )
|
||||
$max=$k;
|
||||
else
|
||||
$min=$k;
|
||||
}
|
||||
|
||||
// Each interval is interpolated by a 3:degree polynom function
|
||||
$h = $this->xdata[$max]-$this->xdata[$min];
|
||||
|
||||
if( $h == 0 ) {
|
||||
JpGraphError::Raise('Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.');
|
||||
}
|
||||
|
||||
|
||||
$a = ($this->xdata[$max]-$xpoint)/$h;
|
||||
$b = ($xpoint-$this->xdata[$min])/$h;
|
||||
return $a*$this->ydata[$min]+$b*$this->ydata[$max]+
|
||||
(($a*$a*$a-$a)*$this->y2[$min]+($b*$b*$b-$b)*$this->y2[$max])*($h*$h)/6.0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// CLASS Bezier
|
||||
// Create a new data array from a number of control points
|
||||
//------------------------------------------------------------------------
|
||||
class Bezier {
|
||||
/**
|
||||
* @author Thomas Despoix, openXtrem company
|
||||
* @license released under QPL
|
||||
* @abstract Bezier interoplated point generation,
|
||||
* computed from control points data sets, based on Paul Bourke algorithm :
|
||||
* http://astronomy.swin.edu.au/~pbourke/curves/bezier/
|
||||
*/
|
||||
var $datax = array();
|
||||
var $datay = array();
|
||||
|
||||
function Bezier($datax, $datay, $attraction_factor = 1) {
|
||||
// Adding control point multiple time will raise their attraction power over the curve
|
||||
foreach($datax as $datumx) {
|
||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||
$this->datax[] = $datumx;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($datay as $datumy) {
|
||||
for ($i = 0; $i < $attraction_factor; $i++) {
|
||||
$this->datay[] = $datumy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get($steps) {
|
||||
$datax = array();
|
||||
$datay = array();
|
||||
for ($i = 0; $i < $steps; $i++) {
|
||||
list($datumx, $datumy) = $this->GetPoint((double) $i / (double) $steps);
|
||||
$datax[] = $datumx;
|
||||
$datay[] = $datumy;
|
||||
}
|
||||
|
||||
$datax[] = end($this->datax);
|
||||
$datay[] = end($this->datay);
|
||||
|
||||
return array($datax, $datay);
|
||||
}
|
||||
|
||||
function GetPoint($mu) {
|
||||
$n = count($this->datax)-1;
|
||||
$k = 0;
|
||||
$kn = 0;
|
||||
$nn = 0;
|
||||
$nkn = 0;
|
||||
$blend = 0.0;
|
||||
$newx = 0.0;
|
||||
$newy = 0.0;
|
||||
|
||||
$muk = 1.0;
|
||||
$munk = (double) pow(1-$mu,(double) $n);
|
||||
|
||||
for ($k = 0; $k <= $n; $k++) {
|
||||
$nn = $n;
|
||||
$kn = $k;
|
||||
$nkn = $n - $k;
|
||||
$blend = $muk * $munk;
|
||||
$muk *= $mu;
|
||||
$munk /= (1-$mu);
|
||||
while ($nn >= 1) {
|
||||
$blend *= $nn;
|
||||
$nn--;
|
||||
if ($kn > 1) {
|
||||
$blend /= (double) $kn;
|
||||
$kn--;
|
||||
}
|
||||
if ($nkn > 1) {
|
||||
$blend /= (double) $nkn;
|
||||
$nkn--;
|
||||
}
|
||||
}
|
||||
$newx += $this->datax[$k] * $blend;
|
||||
$newy += $this->datay[$k] * $blend;
|
||||
}
|
||||
|
||||
return array($newx, $newy);
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
?>
|
||||
|
|
|
@ -1,225 +1,225 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_SCATTER.PHP
|
||||
// Description: Scatter (and impuls) plot extension for JpGraph
|
||||
// Created: 2001-02-11
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_scatter.php 492 2006-02-04 12:29:02Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
require_once ('jpgraph_plotmark.inc.php');
|
||||
|
||||
//===================================================
|
||||
// CLASS FieldArrow
|
||||
// Description: Draw an arrow at (x,y) with angle a
|
||||
//===================================================
|
||||
class FieldArrow {
|
||||
public $iColor='black';
|
||||
public $iSize=10; // Length in pixels for arrow
|
||||
public $iArrowSize = 2;
|
||||
private $isizespec = array(
|
||||
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10));
|
||||
function FieldArrow() {
|
||||
}
|
||||
|
||||
function SetSize($aSize,$aArrowSize=2) {
|
||||
$this->iSize = $aSize;
|
||||
$this->iArrowSize = $aArrowSize;
|
||||
}
|
||||
|
||||
function SetColor($aColor) {
|
||||
$this->iColor = $aColor;
|
||||
}
|
||||
|
||||
function Stroke($aImg,$x,$y,$a) {
|
||||
// First rotate the center coordinates
|
||||
list($x,$y) = $aImg->Rotate($x,$y);
|
||||
|
||||
$old_origin = $aImg->SetCenter($x,$y);
|
||||
$old_a = $aImg->a;
|
||||
$aImg->SetAngle(-$a+$old_a);
|
||||
|
||||
$dx = round($this->iSize/2);
|
||||
$c = array($x-$dx,$y,$x+$dx,$y);
|
||||
$x += $dx;
|
||||
|
||||
list($dx,$dy) = $this->isizespec[$this->iArrowSize];
|
||||
$ca = array($x,$y,$x-$dx,$y-$dy,$x-$dx,$y+$dy,$x,$y);
|
||||
|
||||
$aImg->SetColor($this->iColor);
|
||||
$aImg->Polygon($c);
|
||||
$aImg->FilledPolygon($ca);
|
||||
|
||||
$aImg->SetCenter($old_origin[0],$old_origin[1]);
|
||||
$aImg->SetAngle($old_a);
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// CLASS FieldPlot
|
||||
// Description: Render a field plot
|
||||
//===================================================
|
||||
class FieldPlot extends Plot {
|
||||
private $iAngles;
|
||||
private $iCallback='';
|
||||
function FieldPlot($datay,$datax,$angles) {
|
||||
if( (count($datax) != count($datay)) )
|
||||
JpGraphError::RaiseL(20001);//("Fieldplots must have equal number of X and Y points.");
|
||||
if( (count($datax) != count($angles)) )
|
||||
JpGraphError::RaiseL(20002);//("Fieldplots must have an angle specified for each X and Y points.");
|
||||
|
||||
$this->iAngles = $angles;
|
||||
|
||||
$this->Plot($datay,$datax);
|
||||
$this->value->SetAlign('center','center');
|
||||
$this->value->SetMargin(15);
|
||||
|
||||
$this->arrow = new FieldArrow();
|
||||
}
|
||||
|
||||
function SetCallback($aFunc) {
|
||||
$this->iCallback = $aFunc;
|
||||
}
|
||||
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
|
||||
// Remeber base color and size
|
||||
$bc = $this->arrow->iColor;
|
||||
$bs = $this->arrow->iSize;
|
||||
$bas = $this->arrow->iArrowSize;
|
||||
|
||||
for( $i=0; $i<$this->numpoints; ++$i ) {
|
||||
// Skip null values
|
||||
if( $this->coords[0][$i]==="" )
|
||||
continue;
|
||||
|
||||
$f = $this->iCallback;
|
||||
if( $f != "" ) {
|
||||
list($cc,$cs,$cas) = call_user_func($f,$this->coords[1][$i],$this->coords[0][$i],$this->iAngles[$i]);
|
||||
// Fall back on global data if the callback isn't set
|
||||
if( $cc == "" ) $cc = $bc;
|
||||
if( $cs == "" ) $cs = $bs;
|
||||
if( $cas == "" ) $cas = $bas;
|
||||
//echo "f=$f, cc=$cc, cs=$cs, cas=$cas<br>";
|
||||
$this->arrow->SetColor($cc);
|
||||
$this->arrow->SetSize($cs,$cas);
|
||||
}
|
||||
|
||||
$xt = $xscale->Translate($this->coords[1][$i]);
|
||||
$yt = $yscale->Translate($this->coords[0][$i]);
|
||||
|
||||
$this->arrow->Stroke($img,$xt,$yt,$this->iAngles[$i]);
|
||||
$this->value->Stroke($img,$this->coords[0][$i],$xt,$yt);
|
||||
}
|
||||
}
|
||||
|
||||
// Framework function
|
||||
function Legend($aGraph) {
|
||||
if( $this->legend != "" ) {
|
||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||
$this->legendcsimtarget,$this->legendcsimalt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// CLASS ScatterPlot
|
||||
// Description: Render X and Y plots
|
||||
//===================================================
|
||||
class ScatterPlot extends Plot {
|
||||
private $impuls = false;
|
||||
private $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ScatterPlot($datay,$datax=false) {
|
||||
if( (count($datax) != count($datay)) && is_array($datax))
|
||||
JpGraphError::RaiseL(20003);//("Scatterplot must have equal number of X and Y points.");
|
||||
$this->Plot($datay,$datax);
|
||||
$this->mark = new PlotMark();
|
||||
$this->mark->SetType(MARK_SQUARE);
|
||||
$this->mark->SetColor($this->color);
|
||||
$this->value->SetAlign('center','center');
|
||||
$this->value->SetMargin(0);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function SetImpuls($f=true) {
|
||||
$this->impuls = $f;
|
||||
}
|
||||
|
||||
// Combine the scatter plot points with a line
|
||||
function SetLinkPoints($aFlag=true,$aColor="black",$aWeight=1) {
|
||||
$this->linkpoints=$aFlag;
|
||||
$this->linkpointcolor=$aColor;
|
||||
$this->linkpointweight=$aWeight;
|
||||
}
|
||||
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
|
||||
$ymin=$yscale->scale_abs[0];
|
||||
if( $yscale->scale[0] < 0 )
|
||||
$yzero=$yscale->Translate(0);
|
||||
else
|
||||
$yzero=$yscale->scale_abs[0];
|
||||
|
||||
$this->csimareas = '';
|
||||
for( $i=0; $i<$this->numpoints; ++$i ) {
|
||||
|
||||
// Skip null values
|
||||
if( $this->coords[0][$i]==='' || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x')
|
||||
continue;
|
||||
|
||||
if( isset($this->coords[1]) )
|
||||
$xt = $xscale->Translate($this->coords[1][$i]);
|
||||
else
|
||||
$xt = $xscale->Translate($i);
|
||||
$yt = $yscale->Translate($this->coords[0][$i]);
|
||||
|
||||
|
||||
if( $this->linkpoints && isset($yt_old) ) {
|
||||
$img->SetColor($this->linkpointcolor);
|
||||
$img->SetLineWeight($this->linkpointweight);
|
||||
$img->Line($xt_old,$yt_old,$xt,$yt);
|
||||
}
|
||||
|
||||
if( $this->impuls ) {
|
||||
$img->SetColor($this->color);
|
||||
$img->SetLineWeight($this->weight);
|
||||
$img->Line($xt,$yzero,$xt,$yt);
|
||||
}
|
||||
|
||||
if( !empty($this->csimtargets[$i]) ) {
|
||||
$this->mark->SetCSIMTarget($this->csimtargets[$i]);
|
||||
$this->mark->SetCSIMAlt($this->csimalts[$i]);
|
||||
}
|
||||
|
||||
if( isset($this->coords[1]) ) {
|
||||
$this->mark->SetCSIMAltVal($this->coords[0][$i],$this->coords[1][$i]);
|
||||
}
|
||||
else {
|
||||
$this->mark->SetCSIMAltVal($this->coords[0][$i],$i);
|
||||
}
|
||||
|
||||
$this->mark->Stroke($img,$xt,$yt);
|
||||
|
||||
$this->csimareas .= $this->mark->GetCSIMAreas();
|
||||
$this->value->Stroke($img,$this->coords[0][$i],$xt,$yt);
|
||||
|
||||
$xt_old = $xt;
|
||||
$yt_old = $yt;
|
||||
}
|
||||
}
|
||||
|
||||
// Framework function
|
||||
function Legend($aGraph) {
|
||||
if( $this->legend != "" ) {
|
||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||
$this->legendcsimtarget,$this->legendcsimalt);
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
/* EOF */
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_SCATTER.PHP
|
||||
// Description: Scatter (and impuls) plot extension for JpGraph
|
||||
// Created: 2001-02-11
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_scatter.php 53 2005-06-06 18:12:54Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
require_once ('jpgraph_plotmark.inc');
|
||||
|
||||
//===================================================
|
||||
// CLASS FieldArrow
|
||||
// Description: Draw an arrow at (x,y) with angle a
|
||||
//===================================================
|
||||
class FieldArrow {
|
||||
var $iSize=10; // Length in pixels for arrow
|
||||
var $iArrowSize = 2;
|
||||
var $iColor='black';
|
||||
var $isizespec = array(
|
||||
array(2,1),array(3,2),array(4,3),array(6,4),array(7,4),array(8,5),array(10,6),array(12,7),array(16,8),array(20,10));
|
||||
function FieldArrow() {
|
||||
}
|
||||
|
||||
function SetSize($aSize,$aArrowSize=2) {
|
||||
$this->iSize = $aSize;
|
||||
$this->iArrowSize = $aArrowSize;
|
||||
}
|
||||
|
||||
function SetColor($aColor) {
|
||||
$this->iColor = $aColor;
|
||||
}
|
||||
|
||||
function Stroke($aImg,$x,$y,$a) {
|
||||
// First rotate the center coordinates
|
||||
list($x,$y) = $aImg->Rotate($x,$y);
|
||||
|
||||
$old_origin = $aImg->SetCenter($x,$y);
|
||||
$old_a = $aImg->a;
|
||||
$aImg->SetAngle(-$a+$old_a);
|
||||
|
||||
$dx = round($this->iSize/2);
|
||||
$c = array($x-$dx,$y,$x+$dx,$y);
|
||||
$x += $dx;
|
||||
|
||||
list($dx,$dy) = $this->isizespec[$this->iArrowSize];
|
||||
$ca = array($x,$y,$x-$dx,$y-$dy,$x-$dx,$y+$dy,$x,$y);
|
||||
|
||||
$aImg->SetColor($this->iColor);
|
||||
$aImg->Polygon($c);
|
||||
$aImg->FilledPolygon($ca);
|
||||
|
||||
$aImg->SetCenter($old_origin[0],$old_origin[1]);
|
||||
$aImg->SetAngle($old_a);
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// CLASS FieldPlot
|
||||
// Description: Render a field plot
|
||||
//===================================================
|
||||
class FieldPlot extends Plot {
|
||||
var $iAngles;
|
||||
var $iCallback='';
|
||||
function FieldPlot($datay,$datax,$angles) {
|
||||
if( (count($datax) != count($datay)) )
|
||||
JpGraphError::Raise("Fieldplots must have equal number of X and Y points.");
|
||||
if( (count($datax) != count($angles)) )
|
||||
JpGraphError::Raise("Fieldplots must have an angle specified for each X and Y points.");
|
||||
|
||||
$this->iAngles = $angles;
|
||||
|
||||
$this->Plot($datay,$datax);
|
||||
$this->value->SetAlign('center','center');
|
||||
$this->value->SetMargin(15);
|
||||
|
||||
$this->arrow = new FieldArrow();
|
||||
}
|
||||
|
||||
function SetCallback($aFunc) {
|
||||
$this->iCallback = $aFunc;
|
||||
}
|
||||
|
||||
function Stroke(&$img,&$xscale,&$yscale) {
|
||||
|
||||
// Remeber base color and size
|
||||
$bc = $this->arrow->iColor;
|
||||
$bs = $this->arrow->iSize;
|
||||
$bas = $this->arrow->iArrowSize;
|
||||
|
||||
for( $i=0; $i<$this->numpoints; ++$i ) {
|
||||
// Skip null values
|
||||
if( $this->coords[0][$i]==="" )
|
||||
continue;
|
||||
|
||||
$f = $this->iCallback;
|
||||
if( $f != "" ) {
|
||||
list($cc,$cs,$cas) = call_user_func($f,$this->coords[1][$i],$this->coords[0][$i],$this->iAngles[$i]);
|
||||
// Fall back on global data if the callback isn't set
|
||||
if( $cc == "" ) $cc = $bc;
|
||||
if( $cs == "" ) $cs = $bs;
|
||||
if( $cas == "" ) $cas = $bas;
|
||||
//echo "f=$f, cc=$cc, cs=$cs, cas=$cas<br>";
|
||||
$this->arrow->SetColor($cc);
|
||||
$this->arrow->SetSize($cs,$cas);
|
||||
}
|
||||
|
||||
$xt = $xscale->Translate($this->coords[1][$i]);
|
||||
$yt = $yscale->Translate($this->coords[0][$i]);
|
||||
|
||||
$this->arrow->Stroke($img,$xt,$yt,$this->iAngles[$i]);
|
||||
$this->value->Stroke($img,$this->coords[0][$i],$xt,$yt);
|
||||
}
|
||||
}
|
||||
|
||||
// Framework function
|
||||
function Legend(&$aGraph) {
|
||||
if( $this->legend != "" ) {
|
||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||
$this->legendcsimtarget,$this->legendcsimalt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================
|
||||
// CLASS ScatterPlot
|
||||
// Description: Render X and Y plots
|
||||
//===================================================
|
||||
class ScatterPlot extends Plot {
|
||||
var $impuls = false;
|
||||
var $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function ScatterPlot($datay,$datax=false) {
|
||||
if( (count($datax) != count($datay)) && is_array($datax))
|
||||
JpGraphError::Raise("Scatterplot must have equal number of X and Y points.");
|
||||
$this->Plot($datay,$datax);
|
||||
$this->mark = new PlotMark();
|
||||
$this->mark->SetType(MARK_SQUARE);
|
||||
$this->mark->SetColor($this->color);
|
||||
$this->value->SetAlign('center','center');
|
||||
$this->value->SetMargin(0);
|
||||
}
|
||||
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
function SetImpuls($f=true) {
|
||||
$this->impuls = $f;
|
||||
}
|
||||
|
||||
// Combine the scatter plot points with a line
|
||||
function SetLinkPoints($aFlag=true,$aColor="black",$aWeight=1) {
|
||||
$this->linkpoints=$aFlag;
|
||||
$this->linkpointcolor=$aColor;
|
||||
$this->linkpointweight=$aWeight;
|
||||
}
|
||||
|
||||
function Stroke(&$img,&$xscale,&$yscale) {
|
||||
|
||||
$ymin=$yscale->scale_abs[0];
|
||||
if( $yscale->scale[0] < 0 )
|
||||
$yzero=$yscale->Translate(0);
|
||||
else
|
||||
$yzero=$yscale->scale_abs[0];
|
||||
|
||||
$this->csimareas = '';
|
||||
for( $i=0; $i<$this->numpoints; ++$i ) {
|
||||
|
||||
// Skip null values
|
||||
if( $this->coords[0][$i]==="" || $this->coords[0][$i]==='-' || $this->coords[0][$i]==='x')
|
||||
continue;
|
||||
|
||||
if( isset($this->coords[1]) )
|
||||
$xt = $xscale->Translate($this->coords[1][$i]);
|
||||
else
|
||||
$xt = $xscale->Translate($i);
|
||||
$yt = $yscale->Translate($this->coords[0][$i]);
|
||||
|
||||
|
||||
if( $this->linkpoints && isset($yt_old) ) {
|
||||
$img->SetColor($this->linkpointcolor);
|
||||
$img->SetLineWeight($this->linkpointweight);
|
||||
$img->Line($xt_old,$yt_old,$xt,$yt);
|
||||
}
|
||||
|
||||
if( $this->impuls ) {
|
||||
$img->SetColor($this->color);
|
||||
$img->SetLineWeight($this->weight);
|
||||
$img->Line($xt,$yzero,$xt,$yt);
|
||||
}
|
||||
|
||||
if( !empty($this->csimtargets[$i]) ) {
|
||||
$this->mark->SetCSIMTarget($this->csimtargets[$i]);
|
||||
$this->mark->SetCSIMAlt($this->csimalts[$i]);
|
||||
}
|
||||
|
||||
if( isset($this->coords[1]) ) {
|
||||
$this->mark->SetCSIMAltVal($this->coords[0][$i],$this->coords[1][$i]);
|
||||
}
|
||||
else {
|
||||
$this->mark->SetCSIMAltVal($this->coords[0][$i],$i);
|
||||
}
|
||||
|
||||
$this->mark->Stroke($img,$xt,$yt);
|
||||
|
||||
$this->csimareas .= $this->mark->GetCSIMAreas();
|
||||
$this->value->Stroke($img,$this->coords[0][$i],$xt,$yt);
|
||||
|
||||
$xt_old = $xt;
|
||||
$yt_old = $yt;
|
||||
}
|
||||
}
|
||||
|
||||
// Framework function
|
||||
function Legend(&$aGraph) {
|
||||
if( $this->legend != "" ) {
|
||||
$aGraph->legend->Add($this->legend,$this->mark->fill_color,$this->mark,0,
|
||||
$this->legendcsimtarget,$this->legendcsimalt);
|
||||
}
|
||||
}
|
||||
} // Class
|
||||
/* EOF */
|
||||
?>
|
|
@ -1,184 +1,182 @@
|
|||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_STOCK.PHP
|
||||
// Description: Stock plot extension for JpGraph
|
||||
// Created: 2003-01-27
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_stock.php 494 2006-02-04 12:31:05Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS StockPlot
|
||||
//===================================================
|
||||
class StockPlot extends Plot {
|
||||
protected $iTupleSize = 4;
|
||||
private $iWidth=9;
|
||||
private $iEndLines=1;
|
||||
private $iStockColor1='white',$iStockColor2='darkred',$iStockColor3='darkred';
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function StockPlot($datay,$datax=false) {
|
||||
if( count($datay) % $this->iTupleSize ) {
|
||||
JpGraphError::RaiseL(21001,$this->iTupleSize);
|
||||
//('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.');
|
||||
}
|
||||
$this->Plot($datay,$datax);
|
||||
$this->numpoints /= $this->iTupleSize;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
function SetColor($aColor,$aColor1='white',$aColor2='darkred',$aColor3='darkred') {
|
||||
$this->color = $aColor;
|
||||
$this->iStockColor1 = $aColor1;
|
||||
$this->iStockColor2 = $aColor2;
|
||||
$this->iStockColor3 = $aColor3;
|
||||
}
|
||||
|
||||
function SetWidth($aWidth) {
|
||||
// Make sure it's odd
|
||||
$this->iWidth = 2*floor($aWidth/2)+1;
|
||||
}
|
||||
|
||||
function HideEndLines($aHide=true) {
|
||||
$this->iEndLines = !$aHide;
|
||||
}
|
||||
|
||||
// Gets called before any axis are stroked
|
||||
function PreStrokeAdjust($graph) {
|
||||
if( $this->center ) {
|
||||
$a=0.5; $b=0.5;
|
||||
$this->numpoints++;
|
||||
} else {
|
||||
$a=0; $b=0;
|
||||
}
|
||||
$graph->xaxis->scale->ticks->SetXLabelOffset($a);
|
||||
$graph->SetTextScaleOff($b);
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
$n=$this->numpoints;
|
||||
if( $this->center ) $n--;
|
||||
if( isset($this->coords[1]) ) {
|
||||
if( count($this->coords[1])!=$n )
|
||||
JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints);
|
||||
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||
else
|
||||
$exist_x = true;
|
||||
}
|
||||
else
|
||||
$exist_x = false;
|
||||
|
||||
if( $exist_x )
|
||||
$xs=$this->coords[1][0];
|
||||
else
|
||||
$xs=0;
|
||||
|
||||
$ts = $this->iTupleSize;
|
||||
$this->csimareas = '';
|
||||
for( $i=0; $i<$n; ++$i) {
|
||||
|
||||
//If value is NULL, then don't draw a bar at all
|
||||
if ($this->coords[0][$i] === null) continue;
|
||||
|
||||
if( $exist_x ) $x=$this->coords[1][$i];
|
||||
else $x=$i;
|
||||
$xt = $xscale->Translate($x);
|
||||
|
||||
$neg = $this->coords[0][$i*$ts] > $this->coords[0][$i*$ts+1] ;
|
||||
$yopen = $yscale->Translate($this->coords[0][$i*$ts]);
|
||||
$yclose = $yscale->Translate($this->coords[0][$i*$ts+1]);
|
||||
$ymin = $yscale->Translate($this->coords[0][$i*$ts+2]);
|
||||
$ymax = $yscale->Translate($this->coords[0][$i*$ts+3]);
|
||||
|
||||
$dx = floor($this->iWidth/2);
|
||||
$xl = $xt - $dx;
|
||||
$xr = $xt + $dx;
|
||||
|
||||
if( $neg )
|
||||
$img->SetColor($this->iStockColor3);
|
||||
else
|
||||
$img->SetColor($this->iStockColor1);
|
||||
$img->FilledRectangle($xl,$yopen,$xr,$yclose);
|
||||
$img->SetLineWeight($this->weight);
|
||||
if( $neg )
|
||||
$img->SetColor($this->iStockColor2);
|
||||
else
|
||||
$img->SetColor($this->color);
|
||||
|
||||
$img->Rectangle($xl,$yopen,$xr,$yclose);
|
||||
|
||||
if( $yopen < $yclose ) {
|
||||
$ytop = $yopen ;
|
||||
$ybottom = $yclose ;
|
||||
}
|
||||
else {
|
||||
$ytop = $yclose ;
|
||||
$ybottom = $yopen ;
|
||||
}
|
||||
$img->SetColor($this->color);
|
||||
$img->Line($xt,$ytop,$xt,$ymax);
|
||||
$img->Line($xt,$ybottom,$xt,$ymin);
|
||||
|
||||
if( $this->iEndLines ) {
|
||||
$img->Line($xl,$ymax,$xr,$ymax);
|
||||
$img->Line($xl,$ymin,$xr,$ymin);
|
||||
}
|
||||
|
||||
// A chance for subclasses to add things to the bar
|
||||
// for data point i
|
||||
$this->ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg);
|
||||
|
||||
// Setup image maps
|
||||
if( !empty($this->csimtargets[$i]) ) {
|
||||
$this->csimareas.= '<area shape="rect" coords="'.
|
||||
round($xl).','.round($ytop).','.
|
||||
round($xr).','.round($ybottom).'" ';
|
||||
$this->csimareas .= ' href="'.$this->csimtargets[$i].'"';
|
||||
if( !empty($this->csimalts[$i]) ) {
|
||||
$sval=$this->csimalts[$i];
|
||||
$this->csimareas .= " title=\"$sval\" ";
|
||||
}
|
||||
$this->csimareas.= " alt=\"$sval\" />\n";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// A hook for subclasses to modify the plot
|
||||
function ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg) {}
|
||||
|
||||
} // Class
|
||||
|
||||
//===================================================
|
||||
// CLASS BoxPlot
|
||||
//===================================================
|
||||
class BoxPlot extends StockPlot {
|
||||
private $iPColor='black',$iNColor='white';
|
||||
function BoxPlot($datay,$datax=false) {
|
||||
$this->iTupleSize=5;
|
||||
parent::StockPlot($datay,$datax);
|
||||
}
|
||||
|
||||
function SetMedianColor($aPos,$aNeg) {
|
||||
$this->iPColor = $aPos;
|
||||
$this->iNColor = $aNeg;
|
||||
}
|
||||
|
||||
function ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg) {
|
||||
if( $neg )
|
||||
$img->SetColor($this->iNColor);
|
||||
else
|
||||
$img->SetColor($this->iPColor);
|
||||
|
||||
$y = $yscale->Translate($this->coords[0][$i*5+4]);
|
||||
$img->Line($xl,$y,$xr,$y);
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
<?php
|
||||
/*=======================================================================
|
||||
// File: JPGRAPH_STOCK.PHP
|
||||
// Description: Stock plot extension for JpGraph
|
||||
// Created: 2003-01-27
|
||||
// Author: Johan Persson (johanp@aditus.nu)
|
||||
// Ver: $Id: jpgraph_stock.php 41 2005-06-06 10:46:10Z ljp $
|
||||
//
|
||||
// Copyright (c) Aditus Consulting. All rights reserved.
|
||||
//========================================================================
|
||||
*/
|
||||
|
||||
//===================================================
|
||||
// CLASS StockPlot
|
||||
//===================================================
|
||||
class StockPlot extends Plot {
|
||||
var $iTupleSize = 4;
|
||||
var $iWidth=9;
|
||||
var $iEndLines=1;
|
||||
var $iStockColor1='white',$iStockColor2='darkred',$iStockColor3='darkred';
|
||||
//---------------
|
||||
// CONSTRUCTOR
|
||||
function StockPlot(&$datay,$datax=false) {
|
||||
if( count($datay) % $this->iTupleSize ) {
|
||||
JpGraphError::Raise('Data values for Stock charts must contain an even multiple of '.$this->iTupleSize.' data points.');
|
||||
}
|
||||
$this->Plot($datay,$datax);
|
||||
$this->numpoints /= $this->iTupleSize;
|
||||
}
|
||||
//---------------
|
||||
// PUBLIC METHODS
|
||||
|
||||
function SetColor($aColor,$aColor1='white',$aColor2='darkred',$aColor3='darkred') {
|
||||
$this->color = $aColor;
|
||||
$this->iStockColor1 = $aColor1;
|
||||
$this->iStockColor2 = $aColor2;
|
||||
$this->iStockColor3 = $aColor3;
|
||||
}
|
||||
|
||||
function SetWidth($aWidth) {
|
||||
// Make sure it's odd
|
||||
$this->iWidth = 2*floor($aWidth/2)+1;
|
||||
}
|
||||
|
||||
function HideEndLines($aHide=true) {
|
||||
$this->iEndLines = !$aHide;
|
||||
}
|
||||
|
||||
// Gets called before any axis are stroked
|
||||
function PreStrokeAdjust(&$graph) {
|
||||
if( $this->center ) {
|
||||
$a=0.5; $b=0.5;
|
||||
$this->numpoints++;
|
||||
} else {
|
||||
$a=0; $b=0;
|
||||
}
|
||||
$graph->xaxis->scale->ticks->SetXLabelOffset($a);
|
||||
$graph->SetTextScaleOff($b);
|
||||
}
|
||||
|
||||
// Method description
|
||||
function Stroke($img,$xscale,$yscale) {
|
||||
$n=$this->numpoints;
|
||||
if( $this->center ) $n--;
|
||||
if( isset($this->coords[1]) ) {
|
||||
if( count($this->coords[1])!=$n )
|
||||
JpGraphError::Raise("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
|
||||
else
|
||||
$exist_x = true;
|
||||
}
|
||||
else
|
||||
$exist_x = false;
|
||||
|
||||
if( $exist_x )
|
||||
$xs=$this->coords[1][0];
|
||||
else
|
||||
$xs=0;
|
||||
|
||||
$ts = $this->iTupleSize;
|
||||
$this->csimareas = '';
|
||||
for( $i=0; $i<$n; ++$i) {
|
||||
|
||||
//If value is NULL, then don't draw a bar at all
|
||||
if ($this->coords[0][$i] === null) continue;
|
||||
|
||||
if( $exist_x ) $x=$this->coords[1][$i];
|
||||
else $x=$i;
|
||||
$xt = $xscale->Translate($x);
|
||||
|
||||
$neg = $this->coords[0][$i*$ts] > $this->coords[0][$i*$ts+1] ;
|
||||
$yopen = $yscale->Translate($this->coords[0][$i*$ts]);
|
||||
$yclose = $yscale->Translate($this->coords[0][$i*$ts+1]);
|
||||
$ymin = $yscale->Translate($this->coords[0][$i*$ts+2]);
|
||||
$ymax = $yscale->Translate($this->coords[0][$i*$ts+3]);
|
||||
|
||||
$dx = floor($this->iWidth/2);
|
||||
$xl = $xt - $dx;
|
||||
$xr = $xt + $dx;
|
||||
|
||||
if( $neg )
|
||||
$img->SetColor($this->iStockColor3);
|
||||
else
|
||||
$img->SetColor($this->iStockColor1);
|
||||
$img->FilledRectangle($xl,$yopen,$xr,$yclose);
|
||||
$img->SetLineWeight($this->weight);
|
||||
if( $neg )
|
||||
$img->SetColor($this->iStockColor2);
|
||||
else
|
||||
$img->SetColor($this->color);
|
||||
|
||||
$img->Rectangle($xl,$yopen,$xr,$yclose);
|
||||
|
||||
if( $yopen < $yclose ) {
|
||||
$ytop = $yopen ;
|
||||
$ybottom = $yclose ;
|
||||
}
|
||||
else {
|
||||
$ytop = $yclose ;
|
||||
$ybottom = $yopen ;
|
||||
}
|
||||
$img->SetColor($this->color);
|
||||
$img->Line($xt,$ytop,$xt,$ymax);
|
||||
$img->Line($xt,$ybottom,$xt,$ymin);
|
||||
|
||||
if( $this->iEndLines ) {
|
||||
$img->Line($xl,$ymax,$xr,$ymax);
|
||||
$img->Line($xl,$ymin,$xr,$ymin);
|
||||
}
|
||||
|
||||
// A chance for subclasses to add things to the bar
|
||||
// for data point i
|
||||
$this->ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg);
|
||||
|
||||
// Setup image maps
|
||||
if( !empty($this->csimtargets[$i]) ) {
|
||||
$this->csimareas.= '<area shape="rect" coords="'.
|
||||
round($xl).','.round($ytop).','.
|
||||
round($xr).','.round($ybottom).'" ';
|
||||
$this->csimareas .= ' href="'.$this->csimtargets[$i].'"';
|
||||
if( !empty($this->csimalts[$i]) ) {
|
||||
$sval=$this->csimalts[$i];
|
||||
$this->csimareas .= " title=\"$sval\" ";
|
||||
}
|
||||
$this->csimareas.= " alt=\"$sval\" />\n";
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// A hook for subclasses to modify the plot
|
||||
function ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg) {}
|
||||
|
||||
} // Class
|
||||
|
||||
//===================================================
|
||||
// CLASS BoxPlot
|
||||
//===================================================
|
||||
class BoxPlot extends StockPlot {
|
||||
var $iPColor='black',$iNColor='white';
|
||||
function BoxPlot($datay,$datax=false) {
|
||||
$this->iTupleSize=5;
|
||||
parent::StockPlot($datay,$datax);
|
||||
}
|
||||
|
||||
function SetMedianColor($aPos,$aNeg) {
|
||||
$this->iPColor = $aPos;
|
||||
$this->iNColor = $aNeg;
|
||||
}
|
||||
|
||||
function ModBox($img,$xscale,$yscale,$i,$xl,$xr,$neg) {
|
||||
if( $neg )
|
||||
$img->SetColor($this->iNColor);
|
||||
else
|
||||
$img->SetColor($this->iPColor);
|
||||
|
||||
$y = $yscale->Translate($this->coords[0][$i*5+4]);
|
||||
$img->Line($xl,$y,$xr,$y);
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
?>
|