Subversion Repositories Applications.annuaire

Compare Revisions

No changes between revisions

Ignore whitespace Rev 209 → Rev 210

/tags/v1.0-aigle/.settings/org.eclipse.core.resources.prefs
New file
0,0 → 1,20
#Thu Mar 25 17:30:01 CET 2010
eclipse.preferences.version=1
encoding//doc/bdd/annuaire_vocabulaire.ini=UTF-8
encoding//squelettes/annuaire.tpl.html=UTF-8
encoding//squelettes/annuaire_inscription_reussie.tpl.html=UTF-8
encoding//squelettes/annuaire_tela_inscrits_fiche.tpl.html=UTF-8
encoding//squelettes/annuaire_tela_inscrits_inscription.tpl.html=UTF-8
encoding//squelettes/checkbox.tpl.html=UTF-8
encoding//squelettes/index_annuaire.tpl.html=UTF-8
encoding//squelettes/liste_annu.tpl.html=UTF-8
encoding//squelettes/liste_ontologie.tpl.html=UTF-8
encoding//squelettes/liste_ontologie_ajout.tpl.html=UTF-8
encoding//squelettes/liste_ontologie_modification.tpl.html=UTF-8
encoding//squelettes/mail_confirmation_inscription.tpl.html=UTF-8
encoding//squelettes/metadonnee_ajout.tpl.html=UTF-8
encoding//squelettes/metadonnee_modification.tpl.html=UTF-8
encoding//squelettes/select.tpl.html=UTF-8
encoding//squelettes/text.tpl.html=UTF-8
encoding//squelettes/textearea.tpl.html=UTF-8
encoding/<project>=UTF-8
/tags/v1.0-aigle/controleurs/MessageControleur.php
New file
0,0 → 1,224
<?
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
Class MessageControleur extends Controleur {
 
/**
* Les mails doivent ils être modérés ?
*/
private $moderer_mail = false;
 
/**
* Le ou les mails des modérateurs, si ce sont plusieurs mails,
* ils doivent être séparés par des virgules
*/
private $mail_moderateur = '';
 
/**
* Nombre de destinataires au dessus duquel on modère les mails
*/
private $seuil_moderation = 10;
 
/**
* Adresse mail de l'expéditeur à partir laquelle sont envoyée les mails de modération
*/
private $adresse_mail_annuaire = '';
 
/**
*
* Constructeur sans paramètres
*/
public function MessageControleur() {
 
$this->__construct();
 
// doit on modérer ?
if(Config::get('moderer_mail') != null) {
$this->moderer_mail = Config::get('moderer_mail');
}
 
// mail du modérateur pour l'envoi de messages au dessus d'un certain seuil
if($this->moderer_mail && Config::get('mail_moderateur') != null) {
$this->mail_moderateur = Config::get('mail_moderateur');
}
 
// seuil de modération
if($this->moderer_mail && Config::get('seuil_moderation_messages') != null) {
$this->seuil_moderation = Config::get('seuil_moderation_messages');
}
 
// adresse d'expéditeur
if(Config::get('adresse_mail_annuaire') != null) {
$this->adresse_mail_annuaire = Config::get('adresse_mail_annuaire');
}
}
 
/** Envoie un mail avec l'adresse de l'utilisateur donné en paramètre,
* à l'adresse donnée en paramètre
* @param string $expediteur l'expediteur du message
* @param mixed $destinataires un string ou un tableau de mails qui contiennent les destinataire
* @param string $sujet sujet du mail
* @return boolean true ou false suivant le succès ou non de l'envoi
*/
private function envoyerMail($expediteur, $destinataires, $sujet, $message) {
 
if(is_array($destinataires)) {
$destinataires = implode(',',$destinataires);
}
 
// Pour envoyer un mail HTML, l'en-tête Content-type doit être défini
$entetes = 'MIME-Version: 1.0' . "\r\n";
$entetes .= 'Content-type: text/html; charset='.Config::get('appli_encodage'). "\r\n";
// En-têtes additionnels
$entetes .= 'To: '.$destinataires."\r\n";
$entetes .= 'From: '.$expediteur."\r\n";
 
$contenu_mail = $message;
 
//return mail($destinataires, $sujet, $contenu_mail, $entetes);
return true;
}
 
/**
* Avec des l'informations d'expéditions données en paramètres, décide si un mail peut être envoyé directement
* ou bien s'il doit être stocké et soumis à modération
* @param int $id_annuaire l'identifiant de l'annuaire à utiliser
* @param string $expediteur l'expéditeur du mail
* @param array $destinataires les destinataires du mail
* @param string $sujet sujet du message
* @param string $message corps du message
*/
public function envoyerMailDirectOuModere($id_annuaire, $expediteur, $destinataires, $sujet = '', $message = '') {
 
// on remplace les identifiants par leurs destinataires
$this->chargerModele('AnnuaireModele');
$destinataires = $this->AnnuaireModele->obtenirMailParTableauId($id_annuaire, $destinataires);
 
// si on modere les mails et s'il y a trop de destinataires
if($this->moderer_mail && count($destinataires) >= $this->seuil_moderation) {
// on prévient le moderateur
$this->stockerMailPourModeration($expediteur, $destinataires, $sujet, $message);
$donnees['moderation'] = true;
} else {
// sinon, envoi direct
$this->envoyerMail($expediteur, $destinataires, $sujet, $message);
$donnees['moderation'] = false;
}
 
$resultat = $this->getVue(Config::get('dossier_squelettes_annuaires').'message_envoi_confirmation',$donnees);
 
return $resultat;
 
}
 
/**
* Retrouve les informations d'un mail en attente de modération et envoie le mail
* @param string $code_confirmation le code associé au données en attente
*/
public function envoyerMailModere($code_confirmation) {
 
// chargement des données temporaire
$message_modele = $this->getModele('DonneeTemporaireModele');
$mail_a_moderer = $message_modele->chargerDonneeTemporaire($code_confirmation);
 
if($mail_a_moderer) {
// envoi
$this->envoyerMail($mail_a_moderer['expediteur'],
$mail_a_moderer['destinataires'],
$mail_a_moderer['sujet'],
$mail_a_moderer['message']);
// suppression des données temporaires
// TODO: envoyer un message à l'utilisateur original ?
$supression_donnees_temp = $message_modele->supprimerDonneeTemporaire($code_confirmation);
 
return true;
}
 
return false;
}
 
/**
* Supprime un mail en attente de modération grâce au code donné en paramètre
* @param string $code_confirmation le code associé au données en attente
*/
public function supprimerMailModere($code_confirmation) {
 
$message_modele = $this->getModele('DonneeTemporaireModele');
$supression_donnees_temp = $message_modele->supprimerDonneeTemporaire($code_confirmation);
 
return true;
}
 
/**
* Stocke un mail dans la base des données temporaires et envoie un mail au modérateur
* @param string $expediteur l'expéditeur du mail
* @param array $destinataires les destinataires du mail
* @param string $sujet sujet du message
* @param string $message corps du message
*/
private function stockerMailPourModeration($expediteur ,$destinataires, $sujet, $message) {
 
$mail = array('expediteur' => $expediteur,
'destinataires' => $destinataires,
'sujet' => $sujet,
'message' => $message);
 
$message_modele = $this->getModele('DonneeTemporaireModele');
$id_stockage = $message_modele->stockerDonneeTemporaire($mail, true);
 
if($id_stockage) {
$this->envoyerMailModeration($id_stockage,$sujet , $message);
return true;
}
 
return false;
 
}
 
/**
* Envoie un mail au modérateur contenant les lien pour, au choix, refuser ou bien accepter l'envoi du mail
* @param int $id_mail_a_moderer identifiant du mail à modérer (dans la table des données temporaires)
* @param string $sujet_message_a_moderer sujet du message
* @param string $message_a_moderer corps du message
*/
private function envoyerMailModeration($id_mail_a_moderer, $sujet_message_a_moderer, $message_a_moderer) {
 
$url_cette_page = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url_base = $url_cette_page;
 
$base_url = new URL($url_base);
 
$base_url->setVariablesRequete(array());
 
$donnees = array();
 
$base_url->setVariableRequete('id',$id_mail_a_moderer);
 
$lien_accepter_mail = clone($base_url);
$lien_refuser_mail = clone($base_url);
 
$lien_accepter_mail->setVariableRequete('m','message_moderation_confirmation');
$lien_refuser_mail->setVariableRequete('m','message_moderation_suppression');
 
$donnees['lien_accepter_mail'] = $lien_accepter_mail;
$donnees['lien_refuser_mail'] = $lien_refuser_mail;
$donnees['sujet_message'] = $sujet_message_a_moderer;
$donnees['contenu_message'] = $message_a_moderer;
 
$contenu_mail = $this->getVue(Config::get('dossier_squelettes_mails').'mail_moderation_message',$donnees);
 
return $this->envoyerMail($this->adresse_mail_annuaire, $this->mail_moderateur, 'Un message est en attente de modération', $contenu_mail);
 
}
 
}
/tags/v1.0-aigle/controleurs/RSSControleur.php
New file
0,0 → 1,52
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class RssControleur extends Controleur {
 
/**
* (fonction héritée de la classe Controleur)
* Avant chaque chargement de vue, on ajoute l'url de la page dans
* les variables à insérer.
* @param Array $donnes les données à insérer dans la vue
* @return Array $donnees les données modifiées
*/
public function preTraiterDonnees($donnees) {
 
// ajout de l'url de l'appli
$donnees['base_url'] = new Url(Registre::getInstance()->get('base_url_application'));
$donnees['url_cette_page'] = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
 
//ajout des variables d'identification
$donnees['est_admin'] = Registre::getInstance()->get('est_admin');
$donnees['identification_id'] = Registre::getInstance()->get('identification_id');
$donnees['identification_mail'] = Registre::getInstance()->get('identification_mail');
 
return $donnees;
}
 
public function obtenirDerniersInscritsRSS($id_annuaire) {
 
$annuaire_controleur = new AnnuaireControleur();
$tableau_valeurs = $annuaire_controleur->obtenirTableauDerniersInscrits($id_annuaire);
$donnees['derniers_inscrits'] = $tableau_valeurs;
 
$retour_rss = $this->getVue(Config::get('dossier_squelettes_rss').'derniers_inscrits',$donnees);
 
return $retour_rss;
 
}
 
}
?>
/tags/v1.0-aigle/controleurs/CartoControleur.php
New file
0,0 → 1,350
<?php
// declare(encoding='UTF-8');
/**
* classe Controleur du module Carte.
*
* @package Collection
* @category Php5
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurélien Peronnet <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version SVN: $Id$
*/
class CartoControleur extends Controleur {
 
 
// identifiant de la france pour l'accès direct
private $id_france = 'fr';
 
// nom du fond de carte en cours
private $nom_fond = '';
 
//+----------------------------------------------------------------------------------------------------------------+
// Méthodes
 
/**
* Fonction d'affichage par défaut, elle appelle la cartographie
*/
public function executerActionParDefaut() {
return $this->cartographier(1);
}
 
/**
* Cartographier un annuaire.
* @param int $id_annuaire l'identitifiant de l'annuaire à cartographier
* @param int $continent l'identitifiant du continent sur lequel on se trouve
* @param string $pays l'identitifiant du pays sur lequel on se trouve (normalement seulement la france si présent)
* @return string la vue correspondante
*/
public function cartographier($id_annuaire, $continent= null , $pays = null) {
// Initialisation de variable
$donnees = array();
 
// la présence d'un pays (non) et d'un continent (ou non) détermine le niveau de carte à afficher
$niveau = $this->calculerNiveau($continent, $pays);
 
// suivant le niveau, continent et pays, on renvoie un template html différent
$fond = $this->renvoyerPrefixePourNiveau($niveau, $continent, $pays);
 
$carte = '';
 
// chaque continent possède un fond de carte différent
if($niveau == 1) {
$carte = $this->renvoyerSuffixePourContinent($niveau, $continent, $pays);
}
 
// Création de la carte
$options = array(
'carte_nom' => $fond.$carte,
'formule' => Cartographie::FORMULE_PROPORTIONNEL,
'couleur_claire' => Config::get('carte_couleur_claire'),
'couleur_foncee' => Config::get('carte_couleur_foncee'),
'fond_fichier' => Config::get('carte_base_nom_'.$fond).$carte,
'fond_dossier' => Application::getChemin().Config::get('carte_fonds_chemin'),
'stock_dossier' => Config::get('carte_stockage_chemin'),
'stock_url' => Config::get('carte_stockage_url'),
'debug' => Config::get('carte_mode_debug'));
$cartographie = Composant::fabrique('cartographie', $options);
 
$this->nom_fond = Config::get('carte_base_nom_'.$fond).$carte;
 
// Construction des données nécessaires à la cartographie
$zones = $cartographie->getCarteZones();
$this->chargerZonesNbre($id_annuaire,$zones, $niveau);
$this->chargerZonesUrls($id_annuaire, $zones, $continent, $pays, $niveau);
 
 
 
$cartographie->setCarteZones($zones);
 
$cartographie->creerCarte();
$donnees['map'] = $cartographie->getImageMap();
 
$resultat = $this->getVue('cartes/'.$fond, $donnees);
return $resultat;
}
 
/**
* Charge le nombre d'inscrit par zone pour un annuaire donné
* @param int $id_annuaire l'identifiant de l'annuaire
* @param array $zones les zones à cartographier (attention, passage par référence, donc les zones sont modifiées)
* @param int $niveau le niveau de la carto (monde, continent, ou pays)
*/
private function chargerZonesNbre($id_annuaire, &$zones, $niveau = 0) {
 
$metaModele = $this->getModele('AnnuaireModele');
// on charge les inscrits pour le niveau donné
$zones_infos = $this->chargerNombreInscritsParNiveauGeographique($id_annuaire, $niveau);
 
foreach ($zones as $id => &$infos) {
 
// si l'on a des données pour la zone, on renseigne le nombre d'inscrits
if (isset($zones_infos[$id])) {
 
$nbre = $zones_infos[$id];
$infos['info_nombre'] = $nbre;
} else {
// sinon on le met à 0
$infos['info_nombre'] = 0;
}
}
}
 
/**
* Charge les des zones pour un annuaire donné
* @param int $id_annuaire l'identifiant de l'annuaire
* @param array $zones les zones à cartographier (attention, passage par référence, donc les zones sont modifiées)
* @param int $continent l'identitifiant du continent sur lequel on se trouve
* @param string $pays l'identitifiant du pays sur lequel on se trouve (normalement seulement la france si présent)
* @param int $niveau le niveau de la carto (monde, continent, ou pays)
*/
private function chargerZonesUrls($id_annuaire, &$zones, $continent = null, $pays = null, $niveau = 0) {
 
$url = new URL(Config::get('url_base'));
 
$url->setVariableRequete('id_annuaire', $id_annuaire);
//$url->setVariableRequete('m', 'annuaire_inscrits_carto');
 
foreach ($zones as $id => &$infos) {
 
switch ($niveau) {
// niveau 0 de la carte : on affiche tous les continents
// l'url va pointer vers un continent en particulier
case 0:
$url->setVariableRequete('m', 'annuaire_afficher_carte');
$url->setVariableRequete('continent', $id);
break;
 
// niveau 1, on est sur un continent en particulier : on affiche le détail du continent demandé
// l'url pointe sur des pays
case 1:
$url->setVariableRequete('continent', $continent);
 
// si le pays c'est la france alors l'url pointera vers la carte des départements
if($id == $this->id_france) {
$url->setVariableRequete('m', 'annuaire_afficher_carte');
} else {
// sinon l'url pointe vers la liste des inscrits de ce pays
$url->setVariableRequete('m', 'annuaire_inscrits_carto');
}
$url->setVariableRequete('pays', $id);
 
break;
 
// niveau 2, si on a cliqué sur la france pour afficher les départements :
case 2:
$url->setVariableRequete('m','annuaire_inscrits_carto');
$url->setVariableRequete('continent', $continent);
$url->setVariableRequete('pays', $pays);
$url->setVariableRequete('departement', $id);
break;
}
$infos['url'] = sprintf($url, $id);
}
}
 
/**
* Renvoie le niveau auquel on se trouve suivant la présence ou non de certains paramètres
* @param int $continent l'identitifiant du continent sur lequel on se trouve
* @param string $pays l'identitifiant du pays sur lequel on se trouve (normalement seulement la france si présent)
*/
private function calculerNiveau($continent, $pays) {
 
// le niveau 0 c'est la carte de base
$niveau = 0;
 
// le niveau 1 on consulte un continent en particulier (ex. Amérique du Sud)
if($continent != null) {
$niveau = 1;
}
 
// le niveau 2 c'est un pays en particulier (ce cas là n'arrive que pour la france)
if($pays != null) {
$niveau = 2;
}
 
return $niveau;
}
 
/**
* Renvoie le type de template à utiliser suivant le niveau de certains paramètres
* @param int $niveau le niveau de la carto
* @return string le type de template
*/
private function renvoyerPrefixePourNiveau($niveau) {
switch ($niveau) {
case 0:
$fond = 'continents';
break;
 
case 1:
$fond = 'pays';
break;
 
case 2 :
$fond = 'france';
break;
 
default:
$fond = '';
break;
}
 
return $fond;
}
 
/**
* Renvoie le suffixe de fond de carte à utiliser pour un continent donné
* @param int $niveau le niveau de la carto
* @param int $niveau l'identifiant de continent
* @return string le suffixe
*/
private function renvoyerSuffixePourContinent($niveau, $continent) {
 
switch ($continent) {
case 1:
$carte = '_afrique';
break;
 
case 2:
$carte = '_nord_amerique';
break;
 
case 3:
$carte = '_asie';
break;
 
case 4:
$carte = '_europe';
break;
 
case 5:
$carte = '_oceanie';
break;
 
case 6:
$carte = '_sud_amerique';
break;
 
case 7:
$carte = '_moyen_orient';
break;
 
default:
$carte = '';
break;
}
 
return $carte;
}
 
/**
* renvoie tous les noms templates pour chaque zone du monde
* @return array un tableau associatif indexé par les identifiants de zone et contenant les noms de templates
*/
private function renvoyerTousTemplates() {
return array(1 => 'pays_afrique', 2 => 'pays_nord_amerique', 3 => 'pays_asie', 4 => 'pays_europe', 5 => 'pays_oceanie', 6 => 'pays_sud_amerique', 7 => 'pays_moyen_orient');
}
 
/**
* Charge la liste des inscrits par zone pour un niveau géographique donné
* @param int $id_annuaire l'identifiant de l'annuaire
* @param int $niveau le niveau où l'on se situe
* @return array un tableau associatif indexé par les identifiants de zone et contenant le nombre d'inscrits pour chaque zone
*/
private function chargerNombreInscritsParNiveauGeographique($id_annuaire, $niveau) {
 
$nb_inscrits = array();
 
if($niveau == 0) {
// si on est au niveau des continents
$zones_ids = array();
// il faut faire la somme des inscrits par zones géographique
$templates = $this->renvoyerTousTemplates();
} else {
// sinon on appelle la fonction pour la zone demandée
$zones_ids = $this->chargerZonesParCsv(Application::getChemin().Config::get('carte_fonds_chemin').$this->nom_fond);
}
 
$annuaire_controleur = new AnnuaireControleur();
 
switch ($niveau) {
// niveau de la carte du monde
case 0:
// pour chacun des continents, on fait la somme des membres de sa zone
foreach($templates as $id_continent => $template) {
$zones_continent_ids = $this->chargerZonesParCsv(Application::getChemin().Config::get('carte_fonds_chemin').$template);
$nb_inscrits[$id_continent] = array_sum($annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_continent_ids));
}
break;
 
// niveau de la carte des pays d'un continent
case 1:
$nb_inscrits = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_ids);
break;
 
// détail d'un pays
case 2 :
$nb_inscrits = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParDepartement($id_annuaire);
break;
 
// action par défaut, on renvoie les departements
// TODO: changer ça, ça n'a pas de sens
default:
// $nb_inscrits = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParDepartement($id_annuaire);
 
break;
}
 
return $nb_inscrits;
}
 
/**
* Récupère les identifiants de zone dans un fichier csv donné
* @param string $nom_csv chemin vers le fichier csv (sans extension) qui contient les données
* @return array un tableau contenant les identifiants des zones
*/
private function chargerZonesParCsv($nom_csv) {
 
$fichier_csv = $nom_csv.'.csv';
$zones_id = array();
 
if (($handle = fopen($fichier_csv, 'r')) !== false) {
$ligne = 0;
 
while (($donnees = fgetcsv($handle, 1000, ',')) !== false) {
 
if($ligne != 0 && trim($donnees[0]) != '') {
$zones_id[] = "'".$donnees[0]."'";
}
$ligne++;
}
fclose($handle);
}
 
return $zones_id;
}
}
?>
/tags/v1.0-aigle/controleurs/IdentificationControleur.php
New file
0,0 → 1,57
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
Class IdentificationControleur extends Controleur {
 
private $nom_cookie_persistant = '';
private $duree_identification = '0';
private $fonction_cryptage_mdp_cookie = 'md5';
private $objet_identification = null;
/*public function IdentificationControleur() {
 
Controleur::__construct();
$this->cookie_persistant_nom = session_name().'-memo';
$this->cookie_persistant_nom = 'pap-admin_papyrus_-memo';
$this->duree_identification = time()+Config::get('duree_session_identification');
$this->fonction_cryptage_mdp_cookie = Config::get('fonction_cryptage_mdp_cookie');
}*/
 
public function afficherFormulaireIdentification($id_annuaire, $donnees = array()) {
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
 
if(!isset($donnees['informations'])) {
$donnees['informations'] = array();
}
 
$donnees['id_annuaire'] = $id_annuaire;
 
return $this->getVue(Config::get('dossier_squelettes_formulaires').'identification',$donnees);
}
 
public function loggerUtilisateur($utilisateur, $pass) {
$this->objet_identification = Config::get('objet_identification');
 
// On loggue l'utilisateur
$this->objet_identification->username = $utilisateur;
$this->objet_identification->password = $pass;
$this->objet_identification->login();
 
return true;
}
}
?>
/tags/v1.0-aigle/controleurs/ApplicationExterneControleur.php
New file
0,0 → 1,204
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
/**
* Controleur chargé de la propagation et le rassemblement d'informations extérieures
* lors dce la consultation et modification des fiches utilisateurs
*/
Class ApplicationExterneControleur extends Controleur {
 
private $applications_resume = null;
private $applications_gestion = null;
private $mode_reponse = 'json';
 
public function ApplicationExterneControleur() {
 
$this->__construct();
 
// on charge les variables de classes à partir du fichier de configuration
if(Config::get('url_services_applications_inscription') != null) {
 
$application_str = Config::get('url_services_applications_inscription');
$this->applications_inscription = explode('##',$application_str);
} else {
$this->applications_inscription = array();
}
 
// on charge les variables de classes à partir du fichier de configuration
if(Config::get('url_services_applications_resume') != null) {
 
$application_str = Config::get('url_services_applications_resume');
$this->applications_resume = explode('##',$application_str);
} else {
$this->applications_resume = array();
}
 
// on charge les variables de classes à partir du fichier de configuration
if(Config::get('url_services_applications_gestion') != null) {
 
$application_str = Config::get('url_services_applications_gestion');
$this->applications_gestion = explode('##',$application_str);
} else {
$this->applications_gestion = array();
}
}
 
/**
* parcourt la liste des applications et appelle une adresse spécifique pour l'inscription
* et l'inclut, le cas échéant.
* @param l'identifiant de l'utilisateur
* @param le mail de l'utilisateur
*/
public function ajouterInscription($id_utilisateur, $params) {
 
if(count($this->applications_inscription) > 0) {
foreach($this->applications_inscription as $application) {
 
$inscription = @file_get_contents($application.'Inscription/'.$this->fabriquerRequete($id_utilisateur, $params));
$inscription = json_decode($inscription);
 
if($inscription && $inscription == "OK") {
 
} else {
echo 'Erreur d\'inscription à l\'application '.$application;
}
}
}
 
return true;
}
 
 
/**
* parcourt la liste des applications et appelle une adresse spécifique pour la modification
* et l'inclut, le cas échéant.
* @param l'identifiant de l'utilisateur
* @param le mail de l'utilisateur
*/
public function modifierInscription($id_utilisateur,$params) {
 
if(count($this->applications_inscription) > 0) {
foreach($this->applications_inscription as $application) {
 
$modification = @file_get_contents($application.'Modification/'.$this->fabriquerRequete($id_utilisateur, $params));
$modification = json_decode($modification);
if($modification && $modification == "OK") {
 
} else {
echo 'Erreur de modification l\'application '.$application.'<br />'.$modification;
}
}
}
 
return true;
}
 
/**
* parcourt la liste des applications et appelle une adresse spécifique pour la suppression
* et l'inclut, le cas échéant.
* @param l'identifiant de l'utilisateur
* @param le mail de l'utilisateur
*/
public function supprimerInscription($id_utilisateur, $params) {
 
if(count($this->applications_inscription) > 0) {
foreach($this->applications_inscription as $application) {
 
$suppression = @file_get_contents($application.'Suppression/'.$this->fabriquerRequete($id_utilisateur, $params));
$suppression = json_decode($suppression);
 
if($suppression && $suppression == "OK") {
 
} else {
echo 'Erreur de desinscription à l\'application '.$application;
}
}
}
 
return true;
}
 
/**
* Parcourt le repertoire racine des applications et appelle un web service contenant la méthode
* Resume qui renvoie les informations associées à l'utilisateur qui seront affichées dans la fiche
* de profil
* @param l'identifiant de l'utilisateur
* @param le mail de l'utilisateur
* @return array un tableau associatif dont les clés sont les noms des applis et les valeurs sont le html qui sera
* inclus dans la fiche profil
*/
public function obtenirResume($id_utilisateur, $mail) {
 
$resumes = array();
 
if(count($this->applications_resume) > 0) {
foreach($this->applications_resume as $application) {
 
$resume = @file_get_contents($application.'Resume'.DS.$id_utilisateur.DS.$mail);
 
 
if($resume) {
$resume = json_decode($resume, true);
$resumes[] = $resume;
} else {
echo $application.'Resume'.DS.$id_utilisateur.DS.$mail;
}
}
}
 
return $resumes;
}
 
/** Parcourt le repertoire racine des applications et cherche un fichier spécifique contenant la méthode
* obtenirResume qui renvoie les informations associées à l'utilisateur qui seront affichées dans la fiche
* de profil
* @param l'identifiant de l'utilisateur
* @param le mail de l'utilisateur
* @return array un tableau associatif dont les clés sont les noms des applis et les valeurs sont le html qui sera
* inclus dans la fiche profil
*/
public function gererInscription($id_utilisateur, $mail) {
 
$gestions = array();
 
if(count($this->applications_gestion) > 0) {
foreach($this->applications_gestion as $application) {
 
$gestion = file_get_contents($application.'Gestion'.DS.$id_utilisateur.DS.$mail);
 
if($gestion) {
$gestion = json_decode($gestion, true);
$gestions[] = $gestion;
} else {
echo $application.'Gestion'.DS.$id_utilisateur.DS.$mail;
}
}
}
 
return $gestions;
}
 
private function fabriquerRequete($id, $params) {
 
$requete = '?';
 
foreach($params as $cle => $param) {
$requete .= '&'.$cle.'='.$param;
}
 
return $requete;
}
}
 
 
?>
/tags/v1.0-aigle/controleurs/OpenIdControleur.php
New file
0,0 → 1,18
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class OpenIdControleur extends Controleur {
 
 
}
?>
/tags/v1.0-aigle/controleurs/LettreControleur.php
New file
0,0 → 1,196
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
/**
* Controleur permettant l'abonnement à une liste de diffusion
* à travers un mécanisme de mail ou de web services
*/
class LettreControleur extends Controleur {
 
/** Adresse de base des web services
* ex : http://mail.domaine.com/
*/
private $adresse_service_lettre = null;
 
/**
* Nom du service permettant de s'inscrire
* ex : inscription.php
*/
private $service_inscription_lettre = null;
 
/**
* Nom du service permettant de s'inscrire
* ex : desinscription.php
*/
private $service_desinscription_lettre = null;
 
/**
* domaine de la liste
* ex : domaine.org
*/
private $domaine_lettre = null;
 
/**
* nom de la liste de diffusion
* ex : actualite
*/
private $nom_lettre = null;
 
/**
* adresse mail d'inscription (si on utilise les mails)
*/
private $adresse_inscription_lettre = null;
 
/**
* adresse mail de desinscription (si on utilise les mails)
*/
private $adresse_desinscription_lettre = null;
 
/**
* indique si on utilise les mails ou non
* (si les infos des web services sont entrées, on met cette variable à true)
*/
private $utilise_mail = false;
 
/**
* Constructeur sans paramètres
*/
public function LettreControleur() {
 
$this->__construct();
 
// on charge les variables de classes à partir du fichier de configuration
if(Config::get('adresse_service_lettre') != null) {
$this->adresse_service_lettre = Config::get('adresse_service_lettre');
} else {
$this->utilise_mail = true;
}
 
if(Config::get('service_inscription_lettre') != null) {
$this->service_inscription_lettre = Config::get('service_inscription_lettre');
} else {
$this->utilise_mail = true;
}
 
if(Config::get('service_desinscription_lettre') != null) {
$this->service_desinscription_lettre = Config::get('service_desinscription_lettre');
} else{
$this->utilise_mail = true;
}
 
if(Config::get('domaine_lettre') != null) {
$this->domaine_lettre = Config::get('domaine_lettre');
} else {
$this->utilise_mail = true;
}
 
if(Config::get('nom_lettre') != null) {
$this->nom_lettre = Config::get('nom_lettre');
} else {
$this->utilise_mail = true;
}
// si l'une des variables pour les web services n'est pas valide
 
// alors on utilise les mails
if(Config::get('adresse_inscription_lettre') != null) {
$this->adresse_inscription_lettre = Config::get('adresse_inscription_lettre');
}
 
if(Config::get('adresse_desinscription_lettre') != null) {
$this->adresse_desinscription_lettre = Config::get('adresse_desinscription_lettre');
}
}
 
/**
* Envoie un mail avec l'adresse de l'utilisateur donné en paramètre,
* à l'adresse donnée en paramètre
* @param string $adresse l'adresse de la liste à laquelle on veut abonner
* @param string $inscrit l'adresse de l'inscrit qui doit être abonné
* @param string $sujet sujet du mail
* @return boolean true ou false suivant le succès ou non de l'envoi
*/
private function envoyerMail($adresse, $inscrit, $sujet) {
 
// Pour envoyer un mail HTML, l'en-tête Content-type doit être défini
$entetes = 'MIME-Version: 1.0' . "\r\n";
$entetes .= 'Content-type: text/html; charset='.Config::get('appli_encodage'). "\r\n";
// En-têtes additionnels
$entetes .= 'To: '.$adresse."\r\n";
$entetes .= 'From: '.$inscrit."\r\n";
 
$contenu_mail = '';
 
return mail($adresse, $sujet, $contenu_mail, $entetes);
}
 
/**
* Inscrit une adresse à la lettre d'actu
* @param string $mail le mail à inscrire à la lettre
* @return boolean true ou false suivant le succès de la requete
*/
public function inscriptionLettreActualite($mail) {
 
if($this->utilise_mail) {
return $this->envoyerMail($this->adresse_inscription_lettre, $mail, 'inscription à la lettre d\'actualité');
} else {
$params = '?domaine='.$this->domaine_lettre.'&liste='.$this->nom_lettre.'&mail='.$mail;
//Log::getInstance()->ajouterEntree('lettre','inscription params '.$this->adresse_service_lettre.$this->service_inscription_lettre.$params);
//return file_get_contents($this->adresse_service_lettre.$this->service_inscription_lettre.$params);
}
 
}
 
/**
* Desinscrit une adresse à une liste donnée
* @param string $mail le mail à desinscrire à la lettre
* @return boolean true ou false suivant le succès de la requete
*/
public function desinscriptionLettreActualite($mail) {
 
if($this->utilise_mail) {
return $this->envoyerMail($this->adresse_inscription_lettre, $mail, 'desinscription à la lettre d\'actualité');
} else {
$params = '?domaine='.$this->domaine_lettre.'&liste='.$this->nom_lettre.'&mail='.$mail;
//Log::getInstance()->ajouterEntree('lettre','desinscription params '.$this->adresse_service_lettre.$this->service_desinscription_lettre.$params);
//return file_get_contents($this->adresse_service_lettre.$this->service_desinscription_lettre.$params);
}
 
}
 
/**
* Desinscrit l'ancien mail d'un utilisateur et réinscrit le nouveau
* @param string $ancien_mail l'ancien mail à desinscrire à la lettre
* @param string $nouveau_mail l'ancien mail à inscrire à la lettre
* @return boolean true ou false suivant le succès de la requete
*/
public function modificationInscriptionLettreActualite($ancien_mail, $nouveau_mail) {
 
if($this->utilise_mail) {
 
$adresse_deinscription_lettre = Config::get('adresse_desinscription_lettre');
$suppression_ancien_mail = $this->envoyerMail($adresse_deinscription_lettre, $ancien_mail, 'desinscription à la lettre d\'actualité');
 
$adresse_inscription_lettre = Config::get('adresse_inscription_lettre');
$ajout_nouveau_mail = $this->envoyerMail($adresse_inscription_lettre, $nouveau_mail, 'inscription à la lettre d\'actualité');
 
return $suppression_ancien_mail && $ajout_nouveau_mail;
} else {
$desinscription = $this->desinscriptionLettreActualite($ancien_mail);
$inscription = $this->inscriptionLettreActualite($nouveau_mail);
 
return ($desinscription && $inscription);
}
 
}
}
?>
/tags/v1.0-aigle/controleurs/MetadonneeControleur.php
New file
0,0 → 1,158
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class MetadonneeControleur extends Controleur {
 
/**
* (fonction héritée de la classe Controleur)
* Avant chaque chargement de vue, on ajoute l'url de la page dans
* les variables à insérer.
* @param Array $donnes les données à insérer dans la vue
* @return Array $donnees les données modifiées
*/
public function preTraiterDonnees($donnees) {
$donnees['base_url'] = Registre::getInstance()->get('base_url_application');
return $donnees;
}
 
/**
* Charge la vue contenant les informations d'un annuaire géré par l'application
* @param int $id l'annuaire dont on veut consulter les informations
* @return string la vue contenant les informations
*/
public function chargerAnnuaire($id) {
$this->chargerModele('AnnuaireModele');
$this->chargerModele('MetadonneeModele');
$data['erreurs'] = array();
$data['annuaire'] = $this->AnnuaireModele->chargerAnnuaire($id,true);
$data['metadonnees'] = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id);
$annuaire = $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire', $data);
 
return $annuaire;
}
 
/**--------Fonctions de gestion des métadonnées associées à un annuaire--------*/
/**
* Affiche le formulaire d'ajout d'une metadonnee
* @param Array $valeurs les valeurs à inclure dans le formulaire (dans le cas du retour erreur)
* @return string la vue contenant le formulaire
*/
public function afficherFormulaireAjoutMetadonnee($valeurs) {
 
if(!isset($valeurs['amc_nom'])) {
$valeurs['amc_nom'] = '';
}
 
if(!isset($valeurs['amc_abreviation'])) {
$valeurs['amc_abreviation'] = '';
}
 
if(!isset($valeurs['amc_description'])) {
$valeurs['amc_description'] = '';
}
$data['valeur'] = $valeurs;
 
$this->chargerModele('MetadonneeModele');
$data['types'] = $this->MetadonneeModele->chargerListeDesTypesDeChamps();
$data['listes'] = $this->MetadonneeModele->chargerListeDesListes();
$metadonnee_ajout = $this->getVue(Config::get('dossier_squelettes_metadonnees').'metadonnee_ajout',$data);
 
return $metadonnee_ajout;
}
 
/**
* Affiche le formulaire de modification d'une metadonnee
* @param Array $valeurs les valeurs à inclure dans le formulaire
* @return string la vue contenant le formulaire
*/
public function afficherFormulaireModificationMetadonnee($valeurs) {
 
if(!isset($valeurs['amc_nom'])) {
$valeurs['amc_nom'] = '';
}
 
if(!isset($valeurs['amc_abreviation'])) {
$valeurs['amc_abreviation'] = '';
}
 
if(!isset($valeurs['amc_description'])) {
$valeurs['amc_description'] = '';
}
$data['valeur'] = $valeurs;
 
$this->chargerModele('MetadonneeModele');
$data['valeur'] = $this->MetadonneeModele->chargerInformationsMetadonnee($valeurs['amc_id_champ']);
$data['types'] = $this->MetadonneeModele->chargerListeDesTypesDeChamps();
$data['listes'] = $this->MetadonneeModele->chargerListeDesListes();
$metadonnee_modification = $this->getVue(Config::get('dossier_squelettes_metadonnees').'metadonnee_modification',$data);
 
return $metadonnee_modification;
}
 
/**
* Ajoute un nouveau champ de métadonnée à un annuaire
* @param Array $valeurs les valeurs à ajouter
* @return string la vue contenant l'annuaire associé, ou le formulaire en cas d'échec
*/
public function ajouterNouvelleMetadonnee($valeurs) {
 
if(isset($valeurs['amc_nom'])
&& isset($valeurs['amc_abreviation'])
&& isset($valeurs['amc_description'])
&& isset($valeurs['amc_ce_annuaire'])
&& isset($valeurs['amc_ce_type_affichage'])) {
$this->chargerModele('MetadonneeModele');
$this->MetadonneeModele->ajouterNouvelleMetadonnee($valeurs);
} else {
return $this->afficherFormulaireAjoutMetadonnee($valeurs);
}
return $this->chargerAnnuaire($valeurs['amc_ce_annuaire']);
}
 
/**
* Modifie un champ de métadonnée associé à un annuaire
* @param Array $valeurs les valeurs à modifier
* @return string la vue contenant l'annuaire associé, ou le formulaire en cas d'échec
*/
public function modifierMetadonnee($valeurs) {
 
if(isset($valeurs['amc_id_champ'])
&& isset($valeurs['amc_nom'])
&& isset($valeurs['amc_abreviation'])
&& isset($valeurs['amc_description'])
&& isset($valeurs['amc_ce_annuaire'])
&& isset($valeurs['amc_ce_type_affichage'])) {
$this->chargerModele('MetadonneeModele');
$this->MetadonneeModele->modifierMetadonnee($valeurs);
} else {
return $this->afficherFormulaireModificationMetadonnee($valeurs);
}
return $this->chargerAnnuaire($valeurs['amc_ce_annuaire']);
}
 
/**
* Supprime un champ de métadonnée associé à un annuaire
* @return string la vue contenant l'annuaire associé, ou le formulaire en cas d'échec
*/
public function supprimerMetadonnee($id_annuaire, $id_metadonnee) {
 
if($id_metadonnee != '') {
$this->chargerModele('MetadonneeModele');
$this->MetadonneeModele->supprimerMetadonneeParId($id_metadonnee);
} else {
return false;
}
return $this->chargerAnnuaire($id_annuaire);
}
 
}
/tags/v1.0-aigle/controleurs/OntologieControleur.php
New file
0,0 → 1,161
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class OntologieControleur extends Controleur {
 
/**
* (fonction héritée de la classe Controleur)
* Avant chaque chargement de vue, on ajoute l'url de la page dans
* les variables à insérer.
* @param Array $donnes les données à insérer dans la vue
* @return Array $donnees les données modifiées
*/
public function preTraiterDonnees($donnees) {
$donnees['base_url'] = Registre::getInstance()->get('base_url_application');
return $donnees;
}
 
/**--------Fonctions de gestion des ontologies --------------------------------*/
 
/**
* charge et renvoie la vue contenant la liste des listes
* @return string le html contenant la liste des listes
*/
public function chargerListeListe() {
 
$this->chargerModele('OntologieModele');
$data['ontologie'] = $this->OntologieModele->chargerListeListes();
$data['titre'] = 'Liste des listes';
$liste_des_listes = $this->getVue(Config::get('dossier_squelettes_ontologies').'liste_des_listes', $data);
 
return $liste_des_listes;
}
 
/**
* charge et renvoie la vue contenant la liste ontologie et ses éléments dont l'identifiant est passé en paramètre
* @param int $identifiant l'identifiant de la liste d'ontologie
* @return string le html contenant la liste et ses éléments
*/
public function chargerListeOntologie($identifiant) {
 
$this->chargerModele('OntologieModele');
 
// On charge les informations de la liste (nom description etc...)
$data['informations'] = $this->OntologieModele->chargerInformationsOntologie($identifiant);
$data['ontologie'] = $this->OntologieModele->chargerListeOntologie($identifiant);
 
$liste_ontologie = $this->getVue(Config::get('dossier_squelettes_ontologies').'liste_ontologie', $data);
 
return $liste_ontologie;
}
 
/**
* Affiche le formulaire d'ajout de liste ontologie
* @param Array $valeurs un tableau de valeurs (dans le cas du retour erreur)
* @return string le formulaire de liste d'ontologie
*/
public function afficherFormulaireAjoutListeOntologie($valeurs) {
 
if(!isset($valeurs['amo_nom'])) {
$valeurs['amo_nom'] = '';
}
 
if(!isset($valeurs['amo_abreviation'])) {
$valeurs['amo_abreviation'] = '';
}
 
if(!isset($valeurs['amo_description'])) {
$valeurs['amo_description'] = '';
}
 
if(!isset($valeurs['amo_ce_parent'])) {
$valeurs['amo_ce_parent'] = '';
}
 
$liste_ontologie_ajout = $this->getVue(Config::get('dossier_squelettes_ontologies').'liste_ontologie_ajout', $valeurs);
 
return $liste_ontologie_ajout;
}
 
/**
* Affiche le formulaire de modification de liste ontologie
* @param Array un tableau de valeurs contenant l'id de la liste (et les élements pour le retour erreur)
* @return string le formulaire de modification ou la liste des liste si l'id est invalide
*/
public function afficherFormulaireModificationListeOntologie($id_ontologie) {
 
if(trim($id_ontologie) != '') {
$this->chargerModele('OntologieModele');
$data['valeurs'] = $this->OntologieModele->chargerInformationsOntologie($id_ontologie);
$liste_ontologie_modification = $this->getVue(Config::get('dossier_squelettes_ontologies').'liste_ontologie_modification', $data);
return $liste_ontologie_modification;
} else {
return $this->chargerListeListe();
}
}
 
/**
* Ajoute une nouvelle liste d'ontologie
* @param Array $valeurs les valeurs à ajouter
* @return string la vue contenant la liste des liste, ou bien le formulaire d'ajout en cas d'erreur
*/
public function ajouterNouvelleListeOntologie($valeurs) {
 
if(isset($valeurs['amo_nom'])
&& isset($valeurs['amo_abreviation'])
&& isset($valeurs['amo_description'])
&& isset($valeurs['amo_ce_parent'])) {
$this->chargerModele('OntologieModele');
$this->OntologieModele->ajouterNouvelleListeOntologie($valeurs);
} else {
return $this->afficherFormulaireAjoutListeOntologie($valeurs);
}
return $this->chargerListeListe();
}
 
/**
* Affiche le formulaire d'ajout ou de modification de liste ontologie
* @param Array $valeurs les valeurs à modifier
* @return String la vue contenant liste des liste, ou le formulaire de modification si erreur
*/
public function modifierListeOntologie($valeurs) {
 
if(isset($valeurs['amo_nom']) &&isset($valeurs['amo_abreviation']) && isset($valeurs['amo_description'])) {
$this->chargerModele('OntologieModele');
$this->OntologieModele->modifierListeOntologie($valeurs);
} else {
// TODO: afficher une erreur si la modification n'a pas fonctionné
return $this->afficherFormulaireListeOntologie($valeurs, true);
}
 
return $this->chargerListeListe();
}
 
/**
* Supprime une liste d'ontologie
* @param int $id_ontologie l'identifant de la liste à supprimer
* @return string la vue contenant la liste des listes
*/
public function supprimerListeOntologie($id_ontologie) {
 
if(trim($id_ontologie) != '') {
$this->chargerModele('OntologieModele');
$this->OntologieModele->supprimerListeOntologie($id_ontologie);
} else {
// TODO: afficher une erreur si la suppression n'a pas fonctionné
return $this->chargerListeListe();
}
return $this->chargerListeListe();
}
}
?>
/tags/v1.0-aigle/controleurs/AnnuaireControleur.php
New file
0,0 → 1,1558
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class AnnuaireControleur extends Controleur {
 
/**
* (fonction héritée de la classe Controleur)
* Avant chaque chargement de vue, on ajoute l'url de la page dans
* les variables à insérer.
* @param Array $donnes les données à insérer dans la vue
* @return Array $donnees les données modifiées
*/
public function preTraiterDonnees($donnees) {
 
// ajout de l'url de l'appli
$donnees['base_url'] = new Url(Registre::getInstance()->get('base_url_application'));
$donnees['url_cette_page'] = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
 
//ajout des variables d'identification
$donnees['est_admin'] = Registre::getInstance()->get('est_admin');
$donnees['identification_id'] = Registre::getInstance()->get('identification_id');
$donnees['identification_mail'] = Registre::getInstance()->get('identification_mail');
 
return $donnees;
}
 
/**
* Fonction affichant la vue par défaut, ici le menu principal
* @return String la vue contenant le menu
*/
public function index() {
$data = array();
$index_annuaire = $this->getVue('index_annuaire', $data);
 
return $index_annuaire;
}
 
/**
* Fonction d'affichage par défaut
*/
public function executerActionParDefaut() {
 
if(Registre::getInstance()->get('est_admin')) {
$data = array();
$index_annuaire = $this->getVue('index_annuaire', $data);
 
return $index_annuaire;
} else {
return $this->afficherFicheUtilisateur(Registre::getInstance()->get('identification_id'));
}
}
 
/**-------- Fonctions de gestion des annuaires --------------------------------*/
 
/**
* Charge la vue contenant la liste des annuaires gérés par l'application
* @return string la vue contenant la liste des annuaires
*/
public function chargerListeAnnuaire() {
$this->chargerModele('AnnuaireModele');
$data['erreurs'] = null;
$data['annuaires'] = $this->AnnuaireModele->chargerListeAnnuaire();
$liste_annu = $this->getVue(Config::get('dossier_squelettes_annuaires').'liste_annu', $data);
 
return $liste_annu;
}
 
/**
* Charge la vue contenant les informations d'un annuaire donné en paramètre
* @param int $id l'identifiant de l'annuaire
* @return string la vue contenant les informations sur l'annuaire
*/
public function chargerAnnuaire($id) {
$this->chargerModele('AnnuaireModele');
$this->chargerModele('MetadonneeModele');
$data['erreurs'] = array();
$data['champs_mappage'] = $this->AnnuaireModele->obtenirChampsMappageAnnuaire($id);
$data['annuaire'] = $this->AnnuaireModele->chargerAnnuaire($id, true);
$data['metadonnees'] = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id);
$annuaire = $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire', $data);
 
return $annuaire;
}
 
/**
* Charge et affiche la liste des inscrits à un annuaire donné en paramètre
* @param $id int l'identifiant de l'annuaire
* @return string la vue contenant les inscrits à l'annuaire
*/
public function chargerAnnuaireListeInscrits($id, $numero_page = 1, $taille_page = 50) {
 
$this->chargerModele('AnnuaireModele');
$data['erreurs'] = array();
$data['champs'] = $this->obtenirChampsMappageAnnuaire($id);
$total_inscrits = $this->AnnuaireModele->chargerNombreAnnuaireListeInscrits($id);
$data['annuaire'] = $this->AnnuaireModele->chargerAnnuaireListeInscrits($id, $data['champs'][0], $numero_page, $taille_page);
 
$url_pagination = new URL(Registre::getInstance()->get('base_url_application'));
$url_pagination->setVariableRequete('m','annuaire_inscrits');
$url_pagination->setVariableRequete('id_annuaire',$id);
 
$data['pagination'] = $this->paginer($numero_page,$taille_page,$total_inscrits,$url_pagination);
 
$annuaires_inscrits = $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire_inscrits', $data);
 
return $annuaires_inscrits;
}
 
/**-------- Fonctions d'affichage du formulaire de saisie d'un champ de metadonnée suivant le type de champ---------*/
 
/**
* Affiche le formulaire d'inscription pour un annuaire donné
* @param int $id_annuaire l'identifiant de l'annuaire pour lequel on veut afficher le formulaire
* @param Array $donnees le tableau de données pour préremplir le formulaire si besoin (en cas de retour erreur)
*/
public function afficherFormulaireInscription($id_annuaire, $donnees=array()) {
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, false);
 
$this->chargerModele('MetadonneeModele');
$donnees['aa_id_annuaire'] = $id_annuaire;
 
$metadonnees = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id_annuaire);
 
// TODO: ceci charge toutes les métadonnées, voir si l'on ne peut pas parser le formulaire
// pour ne charger que ce qui est nécéssaire
foreach($metadonnees as $metadonnee) {
 
$id_champ = $metadonnee['amc_id_champ'];
$type_champ = $metadonnee['amc_ce_template_affichage'];
$nom_champ = $metadonnee['amc_abreviation'];
 
$metadonnee['aa_id_annuaire'] = $id_annuaire;
if(isset($donnees['erreurs'])) {
$metadonnee['erreurs'] = $donnees['erreurs'];
}
 
if(isset($donnees[$type_champ.'_'.$id_champ])) {
$metadonnee['valeur_defaut']['amv_valeur'] = $donnees[$type_champ.'_'.$id_champ];
}
 
// on charge le formulaire d'affichage de chacune des métadonnées
$donnees['champs'][$nom_champ] = $this->afficherFormulaireChampMetadonnees($id_champ,$metadonnee);
}
 
// si le formulaire existe, on le charge
if(!$this->templateExiste($annuaire['informations']['aa_code'].'_inscription','formulaires/')) {
$formulaire_inscription = $this->genererFormulaireInscription($donnees);
} else {
// sinon on en génère un qui contient tous les champs
$formulaire_inscription = $this->GetVue(Config::get('dossier_squelettes_formulaires').$annuaire['informations']['aa_code'].'_inscription',$donnees);
}
 
return $formulaire_inscription;
}
 
/**
* Charge et affiche le champ correspondant à la modification ou l'ajout d'un champ de metadonnée
* @param int $id_champ l'identifiant du champ demandé
* @return string la vue contenant le champ de formulaire correspondant
*/
public function afficherFormulaireChampMetadonnees($id_champ, $donnees) {
 
// si le champ est restreint à une valeur de liste
if($donnees['amc_ce_ontologie'] != 0) {
$this->chargerModele('OntologieModele');
$donnees['liste_valeurs'] = $this->OntologieModele->chargerListeOntologie($donnees['amc_ce_ontologie']);
}
 
$donnees['amc_id_champ'] = $id_champ;
 
if(isset($donnees['amc_ce_template_affichage'])) {
$nom_type_champ = $donnees['amc_ce_template_affichage'];
} else {
$this->chargerModele('MetadonneeModele');
$nom_type_champ = $this->MetadonneeModele->renvoyerTypeAffichageParId($donnees['amc_ce_type_affichage']);
}
 
return $this->getVue(Config::get('dossier_squelettes_champs').$nom_type_champ,$donnees);
}
 
/**-------- Fonctions d'inscription -------------------------------------------------------------------------------*/
 
/**
* Lors d'une tentative d'inscription, ajoute les infos dans la table d'inscription
* temporaire et envoie le mail contenant le lien de confirmation si tout s'est bien passé
* @param Array $valeurs les valeurs à ajouter
* @return string la vue contenant la confirmation de l'inscription
*/
public function ajouterInscriptionTemporaire($valeurs) {
 
$this->chargerModele('MetadonneeModele');
$id_annuaire = $valeurs['aa_id_annuaire'];
unset($valeurs['aa_id_annuaire']);
$valeurs_mappees = array();
$valeurs_a_inserer = array();
 
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
 
$verificateur = new VerificationControleur();
 
$valeurs_collectees = $verificateur->collecterValeurInscription($valeurs, $tableau_mappage);
$valeurs_mappees = $valeurs_collectees['valeurs_mappees'];
$valeurs_a_inserer = $valeurs_collectees['valeurs_a_inserer'];
 
// vérification des champs minimaux : nom, prénom, mail, mot de passe
/*if($erreurs = $verificateur->verifierErreursChampsSelonType($id_annuaire,$valeurs_mappees, $tableau_mappage)) {
$valeurs['erreurs'] = $erreurs;
return $this->afficherFormulaireInscription($id_annuaire, $valeurs);
}*/
$valeurs_a_inserer['aa_id_annuaire'] = $id_annuaire ;
 
$this->chargerModele('DonneeTemporaireModele');
$code_confirmation = $this->DonneeTemporaireModele->stockerDonneeTemporaire($valeurs_a_inserer);
$mail = $valeurs_mappees[$tableau_mappage[1]['champ_mail']]['valeur'];
$nom = $valeurs_mappees[$tableau_mappage[1]['champ_nom']]['valeur'];
$prenom = $valeurs_mappees[$tableau_mappage[1]['champ_prenom']]['valeur'];
 
 
$this->envoyerMailConfirmationInscription($mail,
$nom,
$prenom,
$code_confirmation);
// Si tout s'est bien passé, on affiche la page de confirmation
return $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire_inscription_reussie',array());
}
 
/**
* Ajoute une nouvelle inscription à un annuaire à partir de données d'une table temporaire.
* Typiquement, on déclenche cette fonction en cliquant sur le lien contenu dans le mail de confirmation
* @param int $indentifant L'identifant de session d'une tentative d'inscription
*/
public function ajouterNouvelleInscription($identifiant) {
 
$this->chargerModele('DonneeTemporaireModele');
$valeurs = $this->DonneeTemporaireModele->chargerDonneeTemporaire($identifiant);
 
if(!$valeurs || count($valeurs) == 0) {
// TODO afficher vue en cas d'echec
}
 
$this->chargerModele('AnnuaireModele');
 
$id_annuaire = $valeurs['aa_id_annuaire'];
unset($valeurs['aa_id_annuaire']);
 
$this->chargerModele('MetadonneeModele');
 
$verificateur = new VerificationControleur();
 
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
 
$valeurs_mappees = array();
$valeurs_metadonnees = array();
 
$mail_nouvel_inscrit = $valeurs['mail_'.$tableau_mappage[1]['champ_mail']];
$pass_nouvel_inscrit = $valeurs['password_'.$tableau_mappage[1]['champ_pass']];
 
$nom = $valeurs['text_'.$tableau_mappage[1]['champ_nom']];
$prenom = $valeurs['text_'.$tableau_mappage[1]['champ_prenom']];
$mail = $mail_nouvel_inscrit;
$pass = $valeurs['password_'.$tableau_mappage[1]['champ_pass']];
$pays = $valeurs['select_'.$tableau_mappage[1]['champ_pays']];
 
// on itère sur le tableau de valeur pour récupérer les métadonnées;
foreach($valeurs as $nom_champ => $valeur) {
 
// pour chaque valeur
// on extrait l'id du champ
$ids_champ = mb_split("_",$nom_champ, 2);
 
$type = $ids_champ[0];
$condition = false;
$id_champ = $ids_champ[1];
 
// on fait des vérifications et des remplacements sur certaines valeurs
$valeur = $verificateur->remplacerValeurChampPourInsertion($type,$valeur,$mail_nouvel_inscrit);
 
// Si le champ fait partie des champs mappés
$cle_champ = array_search($id_champ, $tableau_mappage[1]);
if($cle_champ) {
// on ajoute sa clé correspondante dans l'annuaire mappé et sa valeur dans le tableau des champs mappés
$valeurs_mappees[$tableau_mappage[0][$cle_champ]] = $valeur;
// et on supprime sa valeur du tableau de valeurs pour ne pas la retrouver lors
// de l'insertion des métadonnées
unset($valeurs[$nom_champ]);
} else {
$valeurs_metadonnees[$nom_champ] = $valeur;
}
}
 
if(isset($valeurs_mappees[$tableau_mappage[0]['champ_pays']])) {
$pays = $valeurs_mappees[$tableau_mappage[0]['champ_pays']];
$valeurs_metadonnees[$tableau_mappage[1]['champ_pays']] = $pays;
$pays = $this->MetadonneeModele->renvoyerCorrespondanceAbreviationId($pays);
$valeurs_mappees[$tableau_mappage[0]['champ_pays']] = $pays;
}
 
// obtenir l'id du nouvel arrivant en faisant un select sur le mail qui doit être unique
$id_nouvel_inscrit = $this->AnnuaireModele->ajouterInscriptionDansAnnuaireMappe($id_annuaire,$valeurs_mappees, $tableau_mappage[0]);
 
// les champs de metadonnees arrivent avec un identifiant sous la forme type_condition_id
foreach($valeurs_metadonnees as $nom_champ => $valeur) {
 
// pour chaque valeur
// on extrait l'id du champ
$ids_champ = mb_split("_",$nom_champ);
$id_champ = $ids_champ[count($ids_champ) - 1];
 
// Si l'insertion dans la base a réussi
if($this->MetadonneeModele->ajouterNouvelleValeurMetadonnee($id_champ,$id_nouvel_inscrit,$valeur)) {
// on continue
} else {
 
// Si une des insertions échoue, on supprime les méta valeurs déjà entrées.
// La transaction du pauvre en quelque sorte
$this->MetadonneeModele->supprimerValeursMetadonneesParIdEnregistrementLie($id_nouvel_inscrit);
return false;
}
}
 
$appli_controleur = new ApplicationExterneControleur();
 
$params = array (
'id_utilisateur' => $id_nouvel_inscrit,
'prenom' => $prenom,
'nom' => $nom,
'mail' => $mail,
'pass' => $pass,
'pays' => $pays,
'nouveau_pass' => '',
'nouveau_mail' => ''
);
 
// on crée un controleur qui appelle les webservice pour chaque application externe
$resumes_controleur = new ApplicationExterneControleur();
$resumes_controleur->ajouterInscription($id_nouvel_inscrit, $params);
 
// Si tout a réussi on supprime les données d'inscription temporaire
$this->AnnuaireModele->supprimerDonneesInscriptionTemporaire($identifiant);
 
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, false);
 
// Identifier l'utilisateur !
$identificateur = new IdentificationControleur();
$identificateur->loggerUtilisateur($mail, $pass);
 
// S'il existe une page d'accueil spécifique à l'annuaire pour la confirmation d'inscription
if($this->templateExiste($annuaire['informations']['aa_code'].'_inscription_confirmation', Config::get('dossier_squelettes_annuaires'))) {
// on l'affiche
$donnees = array('id_utilisateur' => $id_nouvel_inscrit, 'id_annuaire' => $id_annuaire);
return $this->getVue(Config::get('dossier_squelettes_annuaires').$annuaire['informations']['aa_code'].'_inscription_confirmation', $donnees);
 
} else {
// sinon on le redirige
return $this->afficherFicheUtilisateur($id_annuaire, $id_nouvel_inscrit);
}
}
 
/**
* Affiche la fiche principale d'un utilisateur
* @param int $id_annuaire l'identifiant de l'annuaire
* @param int $id_utilisateur l'identifiant de l'utilisateur
* @return string la vue contenant la fiche utilisateur
*/
public function afficherFicheUtilisateur($id_annuaire, $id_utilisateur) {
 
// Chargement des informations de l'utilisateur dans la table annuaire principale
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
 
$donnees['id_annuaire'] = $id_annuaire;
$donnees['id_utilisateur'] = $id_utilisateur;
$verificateur = new VerificationControleur();
$champs = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
 
foreach($champs as $cle => $champ) {
 
if(is_array($champ) && isset($champ['amc_ce_type_affichage'])) {
$type = $champ['amc_ce_type_affichage'];
} else {
$type = false;
}
// on remplace les valeurs de certains champs pour l'affichage (ex: checkbox cochée de se transforme en oui )
$champs[$cle] = $verificateur->verifierEtRemplacerValeurChampPourAffichage($type,$champ ,$id_annuaire);
}
 
$donnees['champs'] = $champs;
 
/*if(Registre::getInstance()->get('est_admin')) {
$donnees['formulaire_blocage'] = $this->getVue(Config::get('dossier_squelettes_elements').'blocage',$donnees);
}*/
 
$fiche_inscrit = $this->getVue(Config::get('dossier_squelettes_fiches').$annuaire['informations']['aa_code'].'_fiche',$donnees);
 
return $fiche_inscrit;
}
 
/** Affiche le resumé des contributions d'un utilisateur
* @param int $id_annuaire l'identifiant de l'annuaire
* @param int $id_utilisateur l'identifiant de l'utilisateur
* @return string la vue contenant les contributions utilisateur
*/
public function afficherFicheResumeUtilisateur($id_annuaire, $id_utilisateur) {
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
$tableau_valeurs = $this->AnnuaireModele->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur,$tableau_mappage[0]);
 
$this->chargerModele('MetadonneeModele');
$champs_metadonnees= $this->MetadonneeModele->chargerListeValeursMetadonneesUtilisateur($id_annuaire, $id_utilisateur);
 
$verificateur = new VerificationControleur();
 
// on vérifie s'il existe un type d'affichage particulier pour les colonnes de l'annuaire mappé
foreach($tableau_mappage[0] as $cle => $nom_champ) {
 
$valeur = $tableau_valeurs[$nom_champ] ;
if(isset($tableau_mappage[1][$cle])) {
 
$tableau_valeurs[$cle] = array('amv_valeur' => $valeur,'amc_id_champ' => $tableau_mappage[1][$cle]);
$type_affichage = $this->MetadonneeModele->renvoyerTypeAffichagePourColonne($tableau_mappage[1][$cle]);
if($type_affichage) {
$tableau_valeurs[$cle]['amc_ce_type_affichage'] = $type_affichage;
}
 
} else {
$tableau_valeurs[$cle] = $valeur;
}
unset($tableau_valeurs[$nom_champ]);
}
 
$mail_utilisateur = $this->AnnuaireModele->obtenirMailParId($id_annuaire,$id_utilisateur);
 
$donnees['id_annuaire'] = $id_annuaire;
$donnees['id_utilisateur'] = $id_utilisateur;
$donnees['mail_utilisateur'] = $mail_utilisateur;
$champs = array_merge($tableau_valeurs, $champs_metadonnees);
 
foreach($champs as $cle => $champ) {
 
if(is_array($champ) && isset($champ['amc_ce_type_affichage'])) {
$type = $champ['amc_ce_type_affichage'];
} else {
$type = false;
}
$champs[$cle] = $verificateur->verifierEtRemplacerValeurChampPourAffichage($type,$champ ,$id_annuaire);
}
 
$url_modification_profil = new Url(Config::get('base_url_application'));
$url_modification_profil->setVariableRequete('m','annuaire_formulaire_modification_inscription');
$url_modification_profil->setVariableRequete('id_annuaire',$id_annuaire);
$url_modification_profil->setVariableRequete('id_utilisateur',$id_utilisateur);
 
$url_oubli_mdp = new Url(Config::get('base_url_application'));
$url_oubli_mdp->setVariableRequete('m','annuaire_afficher_formulaire_oubli_mdp');
$url_oubli_mdp->setVariableRequete('id_annuaire',$id_annuaire);
$url_oubli_mdp->setVariableRequete('id_utilisateur',$id_utilisateur);
 
$donnees['url_oubli_mdp'] = $url_oubli_mdp;
 
$donnees['url_modification_profil'] = $url_modification_profil;
 
$donnees['champs'] = $champs;
 
// on crée un controleur appelle les hooks de résumé pour chaque application externe
$resumes_controleur = new ApplicationExterneControleur();
 
$donnees['resumes'] = $resumes_controleur->obtenirResume($id_utilisateur,$mail_utilisateur);
$donnees['carte_id'] = $this->getVue(Config::get('dossier_squelettes_fiches').$annuaire['informations']['aa_code'].'_carte_id',$donnees);
 
$fiche_contrib = $this->getVue(Config::get('dossier_squelettes_fiches').$annuaire['informations']['aa_code'].'_resume',$donnees);
 
return $fiche_contrib;
}
 
public function gererInscriptionExterne($id_annuaire, $id_utilisateur) {
 
$this->chargerModele('AnnuaireModele');
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
$tableau_valeurs = $this->AnnuaireModele->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur,$tableau_mappage[0]);
 
$this->chargerModele('MetadonneeModele');
$champs_metadonnees= $this->MetadonneeModele->chargerListeValeursMetadonneesUtilisateur($id_annuaire, $id_utilisateur);
 
$verificateur = new VerificationControleur();
 
// on vérifie s'il existe un type d'affichage particulier pour les colonnes de l'annuaire mappé
foreach($tableau_mappage[0] as $cle => $nom_champ) {
 
$valeur = $tableau_valeurs[$nom_champ] ;
if(isset($tableau_mappage[1][$cle])) {
 
$tableau_valeurs[$cle] = array('amv_valeur' => $valeur,'amc_id_champ' => $tableau_mappage[1][$cle]);
$type_affichage = $this->MetadonneeModele->renvoyerTypeAffichagePourColonne($tableau_mappage[1][$cle]);
if($type_affichage) {
$tableau_valeurs[$cle]['amc_ce_type_affichage'] = $type_affichage;
}
 
} else {
$tableau_valeurs[$cle] = $valeur;
}
unset($tableau_valeurs[$nom_champ]);
}
 
$mail_utilisateur = $this->AnnuaireModele->obtenirMailParId($id_annuaire,$id_utilisateur);
 
$donnees['id_annuaire'] = $id_annuaire;
$donnees['id_utilisateur'] = $id_utilisateur;
$champs = array_merge($tableau_valeurs, $champs_metadonnees);
 
foreach($champs as $cle => $champ) {
 
if(is_array($champ) && isset($champ['amc_ce_type_affichage'])) {
$type = $champ['amc_ce_type_affichage'];
} else {
$type = false;
}
$champs[$cle] = $verificateur->verifierEtRemplacerValeurChampPourAffichage($type,$champ ,$id_annuaire);
}
 
$mail_utilisateur = $this->AnnuaireModele->obtenirMailParId($id_annuaire,$id_utilisateur);
 
// on crée un controleur appelle les hooks de résumé pour chaque application externe
$resumes_controleur = new ApplicationExterneControleur();
 
$donnees['champs'] = $champs;
$donnees['resumes'] = $resumes_controleur->gererInscription($id_utilisateur,$mail_utilisateur);
$donnees['carte_id'] = $this->getVue(Config::get('dossier_squelettes_fiches').'annuaire_tela_inscrits_carte_id',$donnees);
 
$fiche_contrib = $this->getVue(Config::get('dossier_squelettes_fiches').'annuaire_tela_inscrits_gestion_inscription',$donnees);
 
return $fiche_contrib;
}
 
public function afficherFormulaireModificationInscription($id_annuaire, $id_utilisateur, $erreurs = array()) {
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
$donnees['aa_id_annuaire'] = $id_annuaire;
$this->chargerModele('MetadonneeModele');
$champ_metadonnees = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id_annuaire);
$valeurs_metadonnees = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
// TODO: ceci charge toutes les métadonnées, voir si l'on ne peut pas parser le formulaire
// pour ne charger que ce qui est nécéssaire
foreach($champ_metadonnees as $champ_metadonnee) {
 
$id_champ = $champ_metadonnee['amc_id_champ'];
$nom_champ = $champ_metadonnee['amc_abreviation'];
if(isset($valeurs_metadonnees[$nom_champ])) {
$champ_metadonnee['valeur_defaut'] = $valeurs_metadonnees[$nom_champ];
}
 
$champ_metadonnee['aa_id_annuaire'] = $id_annuaire;
// on charge le formulaire d'affichage de chacune des métadonnées
$donnees['champs'][$nom_champ] = $this->afficherFormulaireChampMetadonnees($id_champ,$champ_metadonnee);
 
}
 
$donnees['id_utilisateur'] = $id_utilisateur;
$donnees['erreurs'] = $erreurs;
 
// le nom du formulaire d'inscription est le même que le code de l'annuaire du genre code_annuaire_inscription
if(!$this->formulaireExiste($annuaire['informations']['aa_code'])) {
$formulaire_inscription = $this->genererFormulaireInscription($donnees);
} else {
$formulaire_inscription = $this->GetVue(Config::get('dossier_squelettes_formulaires').$annuaire['informations']['aa_code'].'_modification',$donnees);
}
 
return $formulaire_inscription;
 
}
 
public function modifierInscription($valeurs) {
 
$this->chargerModele('MetadonneeModele');
 
$id_utilisateur = $valeurs['id_utilisateur'];
unset($valeurs['id_utilisateur']);
 
$id_annuaire = $valeurs['aa_id_annuaire'];
unset($valeurs['aa_id_annuaire']);
 
$this->chargerModele('MetadonneeModele');
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
 
$mail_utilisateur = $this->AnnuaireModele->obtenirMailParId($id_annuaire, $id_utilisateur);
$ancien_mail = $mail_utilisateur;
 
$verificateur = new VerificationControleur();
 
$valeurs_mappees = array();
$valeurs_metadonnees = array();
 
$erreurs = array();
 
// on itère sur le tableau de valeur pour récupérer les métadonnées
// et les valeurs
foreach($valeurs as $nom_champ => $valeur) {
 
// pour chaque valeur
// on extrait l'id du champ
$ids_champ = mb_split("_",$nom_champ);
 
$confirmation = false;
$valeur_a_ignorer = false;
 
// l'identifiant du champ est la dernière valeur du tableau
if(count($ids_champ) == 3) {
 
$type = $ids_champ[0];
$id_champ = $ids_champ[2];
$condition = $ids_champ[1];
 
} else {
$type = $ids_champ[0];
$condition = false;
$id_champ = $ids_champ[1];
}
 
if($type == 'checkbox' && $condition != 'hidden') {
// on récupère la valeur
$nom_champ = $type.'_'.$id_champ;
$valeur = $valeurs[$type.'_'.$id_champ];
}
 
// cas de la checkbox qui devrait être là mais pas cochée
if($condition == 'hidden') {
 
if(!isset($valeurs[$type.'_'.$id_champ])) {
// dans ce cas là on fabrique une valeur qui vaut 0
$nom_champ = $type.'_'.$id_champ;
$valeur = '0';
} else {
// sinon la valeur a déjà été traitée et doit être ignorée
$valeur_a_ignorer = true;
}
}
 
if($type == 'mail') {
$mail_utilisateur = $valeur;
}
 
// cas du changement de mot de passe
if($type == 'password') {
 
if($condition == 'conf') {
$valeur_a_ignorer = true;
}
 
$tentative_changemement_mdp = false;
 
if(isset($valeurs[$type.'_conf_'.$id_champ]) && trim($valeurs[$type.'_conf_'.$id_champ]) != '') {
$tentative_changemement_mdp = true;
} else {
$valeur_a_ignorer = true;
}
 
if($tentative_changemement_mdp) {
$confirmation = $valeurs[$type.'_conf_'.$id_champ];
}
}
 
// Si la valeur n'est présente dans le formulaire que pour des raisons de vérification
// on passe à l'iteration suivante
if($valeur_a_ignorer) {
continue;
}
 
$verification = $verificateur->verifierErreurChampModification($id_annuaire, $id_utilisateur, $type , $valeur, $confirmation);
 
if($verification[0] == false) {
$erreurs[$type.'_'.$id_champ] = $verification[1];
 
}
 
// on fait des vérifications et des remplacements sur certaines valeurs
// et quelques fois des actions externes
$valeur = $verificateur->remplacerValeurChampPourModification($id_annuaire, $id_utilisateur, $type, $valeur, $mail_utilisateur);
 
// Si le champ fait partie des champs mappés
$cle_champ = array_search($id_champ, $tableau_mappage[1]);
if($cle_champ) {
// on ajoute sa clé correspondante dans l'annuaire mappé et sa valeur dans le tableau des champs mappés
$valeurs_mappees[$tableau_mappage[0][$cle_champ]] = $valeur;
} else {
// sinon, il est stocké dans les valeurs de metadonnées
$valeurs_metadonnees[$id_champ] = $valeur;
}
}
 
if(count($erreurs) > 0) {
return $this->afficherFormulaireModificationInscription($id_annuaire,$id_utilisateur,$erreurs);
}
 
 
if(isset($valeurs_mappees[$tableau_mappage[0]['champ_pays']])) {
$pays = $valeurs_mappees[$tableau_mappage[0]['champ_pays']];
$valeurs_metadonnees[$tableau_mappage[1]['champ_pays']] = $pays;
$pays = $this->MetadonneeModele->renvoyerCorrespondanceAbreviationId($pays);
$valeurs_mappees[$tableau_mappage[0]['champ_pays']] = $pays;
}
 
 
$this->chargerModele('AnnuaireModele');
$modification_annuaire = $this->AnnuaireModele->modifierInscriptionDansAnnuaireMappe($id_annuaire, $id_utilisateur ,$valeurs_mappees, $tableau_mappage[0]);
 
$nouveau_mail = $this->AnnuaireModele->obtenirMailParId($id_annuaire, $id_utilisateur);
 
// Si le mail a changé alors il faut appeler les applications externes pour modification
if($ancien_mail != $mail_utilisateur || $tentative_changemement_mdp) {
 
$nom = $valeurs['text_'.$tableau_mappage[1]['champ_nom']];
$prenom = $valeurs['text_'.$tableau_mappage[1]['champ_prenom']];
$ancien_mail = $ancien_mail;
$mail = $mail_utilisateur;
$pass = $valeurs['password_'.$tableau_mappage[1]['champ_pass']];
 
$appli_controleur = new ApplicationExterneControleur();
 
$params = array (
'id_utilisateur' => $id_utilisateur,
'prenom' => $prenom,
'nom' => $nom,
'mail' => $mail,
'pass' => $pass,
'pays' => $pays,
'nouveau_pass' => $pass,
'nouveau_mail' => $nouveau_mail
);
 
$appli_controleur->modifierInscription($id_utilisateur, $params);
 
// pour qu'ils lancent les procédures de désinscription associées
$lettre_controleur = new LettreControleur();
$lettre_controleur->modificationInscriptionLettreActualite($ancien_mail, $nouveau_mail);
}
 
// les champs arrivent avec un identifiant sous la forme type_xxx_id
foreach($valeurs_metadonnees as $id_champ => $valeur) {
 
// S'il existe déjà une valeur de metadonnée pour cette colonne et cet utilisateur
// car on a pu ajouter de nouveaux champs entre temps
if($this->MetadonneeModele->valeurExiste($id_champ,$id_utilisateur)) {
// On se contente de la modifier
$this->MetadonneeModele->modifierValeurMetadonnee($id_champ,$id_utilisateur,$valeur);
 
} else {
// S'il n'existe pas de valeur, on ajoute une nouvelle ligne à la table de valeurs de meta données
if($this->MetadonneeModele->ajouterNouvelleValeurMetadonnee($id_champ,$id_utilisateur,$valeur)) {
// Si l'insertion a réussi, on continue
} else {
return false;
}
}
}
 
return $this->afficherFicheUtilisateur($id_annuaire, $id_utilisateur);
}
 
public function estAbonneLettreActualite($id_annuaire, $id_utilisateur) {
 
$annuaire_modele = $this->getModele('AnnuaireModele');
$champs_description = $annuaire_modele->obtenirChampsDescriptionAnnuaire($id_annuaire);
 
$valeur = $annuaire_modele->obtenirValeurChampAnnuaireMappe($id_annuaire, $id_utilisateur, 'champ_lettre');
 
return $valeur;
}
 
public function abonnerDesabonnerLettreActualite($id_annuaire, $id_utilisateur, $abonner = true) {
 
$annuaire_modele = $this->getModele('AnnuaireModele');
$champs_description = $annuaire_modele->obtenirChampsDescriptionAnnuaire($id_annuaire);
 
$mail_utilisateur = $annuaire_modele->obtenirMailParId($id_annuaire, $id_utilisateur);
 
$champ_lettre = $champs_description[0]['champ_lettre'];
 
if($abonner) {
$valeur = 'on';
} else {
$valeur = '0';
}
 
$verificateur = new VerificationControleur();
$valeur_modif = $verificateur->remplacerValeurChampPourModification($id_annuaire, $id_utilisateur, 'lettre', $valeur, $mail_utilisateur);
 
 
$annuaire_modele = $this->getModele('AnnuaireModele');
$valeur_modif = $annuaire_modele->modifierValeurChampAnnuaireMappe($id_annuaire, $id_utilisateur, $champ_lettre, $valeur_modif);
//$this->chargerModele('MetadonneeModele');
//$this->MetadonneeModele->modifierValeurMetadonnee($champ_lettre,$id_utilisateur,$valeur_modif);
 
return $valeur_modif;
}
 
public function bloquerDebloquerUtilisateur($id_annuaire, $id_utilisateur, $bloquer = true) {
 
$annuaire_modele = $this->getModele('AnnuaireModele');
$champs_description = $annuaire_modele->obtenirChampsDescriptionAnnuaire($id_annuaire);
 
$valeur = '0';
 
if($bloquer) {
$valeur = '1';
}
 
$metadonne_modele = $this->getModele('MetadonneeModele');
$metadonne_modele->modifierValeurMetadonnee($champs_description[1]['champ_statut'],$id_utilisateur,$valeur);
 
return $this->afficherFicheUtilisateur($id_annuaire, $id_utilisateur);
}
 
/**
* Affiche le formulaire permettant d'entrer un mail et de recevoir le mot de passe
* associé sur cette adresse
* @param int $id_annuaire l'identifiant de l'annuaire associé
*/
public function afficherFormulaireOubliMotDePasse($id_annuaire) {
 
$donnees['aa_id_annuaire'] = $id_annuaire;
return $this->getVue(Config::get('dossier_squelettes_formulaires').'oubli_mdp',$donnees);
}
 
/**
* Supprime l'ancien mot de passe d'un utilisateur et crée un nouveau mot de passe
* aléatoire qui sera envoyé par mail
* @param int $id_annuaire l'identifiant de l'annuaire associé
* @param int $mail le mail auquel on envoie le mot de passe
*
*/
public function reinitialiserMotDePasse($id_annuaire, $mail) {
 
$this->chargerModele('AnnuaireModele');
$verificateur = new VerificationControleur('VerificationControleur');
 
$donnees = array();
 
if(!$verificateur->mailValide($mail) || !$this->AnnuaireModele->utilisateurExisteParMail($id_annuaire,$mail)) {
$donnees['erreurs']['mail'] = 'Cet utilisateur n\'existe pas';
$donnees['aa_id_annuaire'] = $id_annuaire;
return $this->getVue(Config::get('dossier_squelettes_formulaires').'oubli_mdp',$donnees);
}
 
$nouveau_mdp = $this->AnnuaireModele->reinitialiserMotDePasse($id_annuaire, $mail);
 
if(!$nouveau_mdp) {
$donnees['erreurs']['mdp'] = 'Impossible de générer un nouveau mot de passe';
$donnees['aa_id_annuaire'] = $id_annuaire;
return $this->getVue('oubli_mdp',$donnees);
}
 
$donnees['nouveau_mdp'] = $nouveau_mdp;
 
return $this->envoyerMailOubliMdp($id_annuaire,$mail , $nouveau_mdp);
}
 
/**
* Supprime l'inscription d'un utilisateur dans un annuaire donné
* @param int $id_annuaire l'identifiant de l'annuaire associé
* @param int $id_utilisateur l'identifiant de l'utilisateur à supprimer
*/
public function supprimerInscription($id_annuaire, $id_utilisateur) {
 
$this->chargerModele('AnnuaireModele');
$champs_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
$suppression_inscription = $this->AnnuaireModele->supprimerInscriptionDansAnnuaireMappe($id_annuaire, $id_utilisateur);
 
$mail_utilisateur = $this->AnnuaireModele->obtenirMailParId($id_utilisateur);
 
$donnees = array('erreurs' => array());
 
$this->chargerModele('MetadonneeModele');
$suppression_metadonnees = $this->MetadonneeModele->supprimerValeursMetadonneesParIdEnregistrementLie($id_utilisateur);
 
/*if(!$suppression_inscription || !$suppression_metadonnees) {
$donnees['erreurs']['inscription'] = $suppression_inscription;
$donnees['erreurs']['metadonnees'] = $suppression_metadonnees;
$donnees['erreurs']['titre'] = 'Impossible de supprimer l\'inscription ';
 
return $this->getVue(Config::get('dossier_squelettes_elements').'erreurs',$donnees);
}*/
 
$params = array (
'id_utilisateur' => $id_utilisateur,
'prenom' => '',
'nom' => '',
'mail' => $mail_utilisateur,
'pass' => '',
'pays' => '',
'nouveau_pass' => '',
'nouveau_mail' => ''
);
 
// on appelle les controleur de lettre actu et d'applications externes
$appli_controleur = new ApplicationExterneControleur();
$appli_controleur->supprimerInscription($id_utilisateur, $params);
 
// pour qu'ils lancent les procédures de désinscription associées
$lettre_controleur = new LettreControleur();
$lettre_controleur->desinscriptionLettreActualite($mail_utilisateur);
 
return $this->index();
}
 
/**
* Affiche le formulaire de recherche pour un annuaire donné ou en génère un à la volée
* @param int $id_annuaire l'identifiant de l'annuaire
* @param array $donnees des données utilisées pour pré remplir le formulaire
* @return string le html contenant le formulaire de recherche
*/
public function afficherFormulaireRecherche($id_annuaire, $donnees = array()) {
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, false);
 
$this->chargerModele('MetadonneeModele');
$metadonnees = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id_annuaire);
 
$donnees['aa_id_annuaire'] = $id_annuaire;
 
// TODO: ceci charge toutes les métadonnées, voir si l'on ne peut pas parser le formulaire
// pour ne charger que ce qui est nécéssaire
 
foreach($metadonnees as $nom_champ => $metadonnee) {
 
$id_champ = $metadonnee['amc_id_champ'];
$type_champ = $metadonnee['amc_ce_template_affichage'];
$nom_champ = $metadonnee['amc_abreviation'];
 
if(isset($donnees[$type_champ.'_'.$id_champ])) {
$metadonnee['valeur_defaut']['amv_valeur'] = $donnees[$type_champ.'_'.$id_champ];
}
 
$metadonnee['aa_id_annuaire'] = $id_annuaire;
// on charge le formulaire d'affichage de chacune des métadonnées
$donnees['champs'][$nom_champ] = $this->afficherFormulaireChampMetadonnees($id_champ,$metadonnee);
}
 
// Si le formulaire spécifique à l'annuaire existe, on l'affiche
if(!$this->templateExiste($annuaire['informations']['aa_code'].'_recherche','/formulaires/')) {
$formulaire_recherche = $this->genererFormulaireRecherche($donnees);
} else {
// Sinon on prend celui par defaut
$formulaire_recherche = $this->GetVue(Config::get('dossier_squelettes_formulaires').$annuaire['informations']['aa_code'].'_recherche',$donnees);
}
 
return $formulaire_recherche;
}
 
/**
* Recherche un ou plusieurs inscrits selon les valeurs passées en paramètres, qui peuvent êtres des valeurs
* dans l'annuaire mappé ou bien des valeurs de metadonnées
* @param int $id_annuaire l'identifiant de l'annuaire
* @param array $valeurs_recherchees les valeurs à rechercher
* @param boolean $exclusive indique si la recherche si fait sur tous les critères ou bien sur au moins un
* @param int $numero_page le numero de page demandé
* @param int $taille_page la taille de page
*/
public function rechercherInscrit($id_annuaire,$valeurs_recherchees, $exclusive = true, $numero_page = 1, $taille_page = 50) {
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, true);
 
if(isset($_GET['numero_page'])) {
$numero_page = $_GET['numero_page'];
}
 
if(isset($_GET['taille_page'])) {
$taille_page = $_GET['taille_page'];
}
 
$tableau_mappage = $this->AnnuaireModele->obtenirChampsMappageAnnuaire($id_annuaire);
 
$valeurs_mappees = array();
$valeurs = array();
 
// on itère sur le tableau de valeur pour récupérer les métadonnées;
foreach($valeurs_recherchees as $nom_champ => $valeur) {
 
// pour chaque valeur
// on extrait l'id du champ
$ids_champ = mb_split("_",$nom_champ);
 
if(count($ids_champ) == 2) {
 
// l'identifiant du champ est la dernière valeur du tableau
$type = $ids_champ[0];
$id_champ = $ids_champ[1];
 
// Si le champ fait partie des champs mappés
$cle_champ = array_search($id_champ, $tableau_mappage[1]);
if($cle_champ) {
// on ajoute sa clé correspondante dans l'annuaire mappé et sa valeur dans le tableau des champs mappés
$valeurs_mappees[$tableau_mappage[0][$cle_champ]] = $valeur;
// et on supprime sa valeur du tableau de valeurs pour ne pas la retrouver lors
// de l'insertion des métadonnées
} else {
$valeurs_recherchees[$id_champ] = $valeur;
}
// on retire la valeur du tableau pour ne pas la retrouver dans les deux recherches
$valeurs_get[$nom_champ] = $valeur;
}
 
unset($valeurs_recherchees[$nom_champ]);
}
 
$admin = Registre::getInstance()->get('est_admin');
 
//if(!$admin) {
// $champs_blocage = $this->AnnuaireModele->obtenirChampsDescriptionAnnuaire($id_annuaire);
// $valeurs_recherchees[$champs_blocage[1]['champ_statut']] = '0';
//}
 
$champ_id_annuaire = $tableau_mappage[0]['champ_id'];
 
// on recherche dans les métadonnées
$this->chargerModele('MetadonneeModele');
// le résultat est un ensemble d'identifiants
$resultat_metadonnees = $this->MetadonneeModele->rechercherDansValeurMetadonnees($id_annuaire,$valeurs_recherchees, $exclusive);
 
// on recherche les infos dans la table annuaire mappée
// en incluant ou excluant les id déjà trouvées dans les metadonnées
// suivant le critères d'exclusivité ou non
$resultat_annuaire_mappe = $this->AnnuaireModele->rechercherInscritDansAnnuaireMappe($id_annuaire,$valeurs_mappees, $resultat_metadonnees, $exclusive, $numero_page, $taille_page);
 
$resultat_recherche = $resultat_annuaire_mappe['resultat'];
 
$nb_resultats = $resultat_annuaire_mappe['total'];
 
// on renvoie une liste identique à celle de la liste des inscrits
$donnees['resultats_recherche'] = $resultat_recherche;
$donnees['tableau_mappage'] = $tableau_mappage[0];
$donnees['id_annuaire'] = $id_annuaire;
$donnees['nb_resultats'] = $nb_resultats;
 
$url_base = new URL(Registre::getInstance()->get('base_url_application'));
$url_pagination = clone($url_base);
 
$valeurs_get['id_annuaire'] = $id_annuaire;
$valeurs_get['m'] = $_GET['m'];
 
$donnees['pagination'] = $this->paginer($numero_page,$taille_page,$nb_resultats,$url_pagination, $valeurs_get);
$vue_resultat_recherche = $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire_resultat_recherche', $donnees);
 
return $this->afficherFormulaireRecherche($id_annuaire, $valeurs_get).$vue_resultat_recherche;
}
 
/** Recherche un ou plusieurs inscrits selon des indications géographiques, qui peuvent êtres des valeurs
* dans l'annuaire mappé ou bien des valeurs de metadonnées
* @param int $id_annuaire l'identifiant de l'annuaire
* @param array $valeurs_recherchees les valeurs à rechercher
* @param boolean $exclusive indique si la recherche si fait sur tous les critères ou bien sur au moins un
* @param int $numero_page le numero de page demandé
* @param int $taille_page la taille de page
*/
public function rechercherInscritParlocalisation($id_annuaire,$valeurs_recherchees, $numero_page = 1, $taille_page = 50) {
 
if(isset($_GET['taille_page'])) {
$taille_page = $_GET['taille_page'];
} else {
$taille_page = 50;
}
 
if(isset($_GET['numero_page'])) {
$numero_page = $_GET['numero_page'];
} else {
$numero_page = 1;
}
 
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, true);
 
$tableau_mappage = $this->AnnuaireModele->obtenirChampsMappageAnnuaire($id_annuaire);
 
$valeurs_get = $valeurs_recherchees;
 
$valeurs_mappees = array();
$valeurs = array();
 
$champ_id_annuaire = $tableau_mappage[0]['champ_id'];
 
$valeur = $valeurs_recherchees['pays'];
$champ_critere = $tableau_mappage[0]['champ_pays'];
 
if(isset($valeurs_recherchees['departement'])) {
$valeur = $valeurs_recherchees['departement'];
$champ_critere = $tableau_mappage[0]['champ_code_postal'];
}
 
$resultat_annuaire_mappe = $this->AnnuaireModele->rechercherInscritDansAnnuaireMappeParChamp($id_annuaire, $champ_critere, $valeur, true, $taille_page, $numero_page);
 
$resultat_recherche = $resultat_annuaire_mappe;
 
$nb_resultats = $resultat_recherche['total'];
$inscrits_resultats = $resultat_recherche['resultat'];
 
// on renvoie une liste identique à celle de la liste des inscrits
$donnees['resultats_recherche'] = $inscrits_resultats;
$donnees['tableau_mappage'] = $tableau_mappage[0];
$donnees['id_annuaire'] = $id_annuaire;
$donnees['nb_resultats'] = $nb_resultats;
 
//Debug::printr($donnees['resultats_recherche']);
 
$url_base = new URL(Registre::getInstance()->get('base_url_application'));
$url_pagination = new URL($url_base);
 
$donnees['pagination'] = $this->paginer($numero_page,$taille_page,$nb_resultats,$url_pagination, $valeurs_get);
$vue_resultat_recherche = $this->getVue(Config::get('dossier_squelettes_annuaires').'annuaire_resultat_recherche', $donnees);
 
return $vue_resultat_recherche;
}
 
 
/** --------------------------------- Fonction d'extraction d'informations utilisées par les web services -------------------------------------------*/
 
public function obtenirIdParMail($id_annuaire, $mail_utilisateur) {
$this->chargerModele('AnnuaireModele');
$id = $this->AnnuaireModele->obtenirIdParMail('1',$mail_utilisateur);
return $id;
}
public function utilisateurExiste($id_annuaire,$id, $utilise_mail = true) {
 
$this->chargerModele('AnnuaireModele');
 
if($utilise_mail) {
$existe = $this->AnnuaireModele->utilisateurExisteParMail($id_annuaire,$id);
} else {
$existe = $this->AnnuaireModele->utilisateurExisteParId($id_annuaire,$id);
}
 
return $existe;
}
 
public function obtenirInfosUtilisateurOpenId($id_annuaire,$id, $mail = true) {
 
$this->chargerModele('AnnuaireModele');
 
if($mail) {
$id = $this->AnnuaireModele->obtenirIdParMail($id_annuaire,$id);
}
 
$champs_mappage = $this->AnnuaireModele->obtenirChampsMappageAnnuaire($id_annuaire);
 
$valeurs = $this->AnnuaireModele->obtenirValeursUtilisateur($id_annuaire,$id, $champs_mappage[0]);
 
// TODO: valeurs incomplètes, voir ce qu'on renvoie obligatoirement
// et ce qu'on ne renvoie pas
$valeurs_open_id = array('fullname' => $valeurs[$champs_mappage[0]['champ_nom']].' '.$valeurs[$champs_mappage[0]['champ_prenom']],
'nickname' => $valeurs[$champs_mappage[0]['champ_nom']],
'dob' => '25/10/1984',
'email' => $valeurs[$champs_mappage[0]['champ_mail']],
'gender' => 'M',
'postcode' => $valeurs[$champs_mappage[0]['champ_code_postal']],
'country' => 'FR',
'language' => 'fr',
'timezone' => 'Europe/Paris');
 
return $valeurs_open_id;
}
 
public function comparerIdentifiantMotDePasse($id_annuaire,$id_utilisateur,$mot_de_passe, $utilise_mail = true, $mdp_deja_crypte = true) {
 
$this->chargerModele('AnnuaireModele');
 
if($utilise_mail) {
$id_utilisateur = $this->AnnuaireModele->obtenirIdParMail($id_annuaire,$id_utilisateur);
}
 
if(!$mdp_deja_crypte) {
$mot_de_passe = VerificationControleur::encrypterMotDePasseStatic($mot_de_passe);
}
 
return $this->AnnuaireModele->comparerIdentifiantMotDePasse($id_annuaire,$id_utilisateur,$mot_de_passe);
}
 
 
/** --------------------------------- Fonction privées -------------------------------------------*/
 
/**
* En cas de tentative d'inscription, envoie un mail contenant un lien de confirmation à l'utilisateur
* @param string $adresse_mail adresse mail
* @param string $nom nom
* @param string $prenom prénom
* @param string $code_confirmation_inscription code de confirmation à inclure dans le mail
*
* @return boolean le succès ou l'échec de l'envoi du mail
*/
private function envoyerMailConfirmationInscription($adresse_mail, $nom, $prenom, $code_confirmation_inscription) {
 
$url_cette_page = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$base_url = new URL($url_cette_page);
$base_url->setVariablesRequete(array());
$base_url->setVariableRequete('m','annuaire_inscription_confirmation');
$base_url->setVariableRequete('id',$code_confirmation_inscription);
 
$donnees = array('nom' => $nom, 'prenom' => $prenom, 'lien_confirmation_inscription' => $base_url->getURL());
$contenu_mail = $this->getVue(Config::get('dossier_squelettes_mails').'mail_confirmation_inscription',$donnees);
 
// Pour envoyer un mail HTML, l'en-tête Content-type doit être défini
$entetes = 'MIME-Version: 1.0' . "\r\n";
$entetes .= 'Content-type: text/html; charset='.Config::get('appli_encodage'). "\r\n";
// En-têtes additionnels
$entetes .= 'To: '.$adresse_mail."\r\n";
$entetes .= 'From: '.Config::get('adresse_mail_annuaire')."\r\n";
 
return mail($adresse_mail,'Inscription à l\'annuaire',$contenu_mail, $entetes);
 
}
 
/** En cas d'oubli de mot de passe, régénère le mot de passe et envoie un mail à l'utilisateur
* @param int $id_annuaire l'identifiant d'annuaire
* @param string $adresse_mail adresse mail
* @return boolean le succès ou l'échec de l'envoi du mail
*/
private function envoyerMailOubliMdp($id_annuaire,$mail, $nouveau_mdp) {
 
$base_url = clone(Registre::getInstance()->get('base_url_application'));
 
$base_url->setVariableRequete('m','annuaire_fiche_utilisateur_consultation');
$base_url->setVariableRequete('id',1);
 
$donnees['nouveau_mdp'] = $nouveau_mdp;
$donnees['lien_profil'] = $base_url;
 
$contenu_mail = $this->getVue(Config::get('dossier_squelettes_mails').'mail_oubli_mdp',$donnees);
 
// Pour envoyer un mail HTML, l'en-tête Content-type doit être défini
$entetes = 'MIME-Version: 1.0' . "\r\n";
$entetes .= 'Content-type: text/html; charset='.Config::get('appli_encodage'). "\r\n";
// En-têtes additionnels
$entetes .= 'To: '.$mail."\r\n";
$entetes .= 'From: '.Config::get('adresse_mail_annuaire')."\r\n";
 
return mail($mail,'Inscription à l\'annuaire',$contenu_mail, $entetes);
 
}
 
 
/**--------------------------- Fonctions de vérification et de correspondance des champs --------------------*/
 
/**
* Renvoie les champs de mappage correspondant à un annuaire donné
* @param int $id_annuaire l'indentifant de l'annuaire pour lequel on veut ces informations
* @return Array un tableau de mappage des champs
*
*/
private function obtenirChampsMappageAnnuaire($id_annuaire) {
 
$this->chargerModele('AnnuaireModele');
$tableau_mappage = $this->AnnuaireModele->obtenirChampsMappageAnnuaire($id_annuaire);
 
return $tableau_mappage;
}
 
/**
* Renvoie le formulaire demandé s'il existe, sinon faux
* @param string $nom_formulaire le nom du formulaire demandé (qui est normalement le code d'un annuaire)
* @return boolean true si le formulaire existe, false sinon
*/
private function formulaireExiste($nom_formulaire) {
 
return $this->templateExiste($nom_formulaire.'_inscription', Config::get('dossier_squelettes_formulaires'));
}
 
/**
* Renvoie le template demandé s'il existe, sinon faux
* @param string $nom_formulaire le nom du formulaire demandé (qui est normalement le code d'un annuaire)
* @param string $dossier le nom du dossier sous dossier demandé
* @return boolean true si le formulaire existe, false sinon
*/
private function templateExiste($nom_template, $dossier = '/') {
 
return file_exists(Config::get('chemin_squelettes').$dossier.$nom_template.'.tpl.html');
}
 
/**
* Renvoie un formulaire d'inscription minimal auto-généré
* @param string $donnees les donnée à inclure dans le formulaire
* @return string la vue contenant le formulaire généré
*/
private function genererFormulaireInscription($donnees) {
 
$formulaire_modele = $this->getVue(Config::get('dossier_squelettes_formulaires').'inscription',$donnees);
 
if($formulaire_modele) {
return $formulaire_modele;
} else {
trigger_error("impossible de trouver le squelette de référence pour le formulaire");
}
 
return false;
}
 
/**
* Renvoie un formulaire d'inscription minimal auto-généré
* @param string $donnees les donnée à inclure dans le formulaire
* @return string la vue contenant le formulaire généré
*/
private function genererFormulaireRecherche($donnees) {
 
$formulaire_modele = $this->getVue(Config::get('dossier_squelettes_formulaires').'recherche',$donnees);
 
if($formulaire_modele) {
return $formulaire_modele;
} else {
trigger_error("impossible de trouver le squelette de référence pour le formulaire");
}
 
return false;
}
 
/**
* Renvoie le template de pagination, considérant des éléments donnés en paramètre
* @param int $numero_page le numéro de page en cours
* @param int $taille_page la taille de page
* @param int $total le nombre total de pages
* @param object $url_base l'url de base de la page
* @param array $valeurs les valeurs à concatener à l'url
* @return string le html contenu la template de pagination rempli avec les infos
*/
private function paginer($numero_page = 1, $taille_page = 50, $total, $url_base, $valeurs) {
 
// TODO, faire plus complexe, tri alphabétique etc...
$page_precedente = $numero_page-1;
$page_suivante = $numero_page+1;
 
if($taille_page <= 0) {
$taille_page = 1;
}
 
$nombre_pages = round($total/$taille_page,'PHP_ROUND_HALF_DOWN') ;
 
foreach($valeurs as $cle => $variable) {
$url_base->setVariableRequete($cle,$variable);
}
 
if($numero_page < 2) {
$page_precedente = false;
$url_page_precedente = '';
} else {
$url_page_prec = clone($url_base);
$url_page_prec->setVariableRequete('numero_page',($page_precedente));
$url_page_prec->setVariableRequete('taille_page',($taille_page));
$url_page_precedente = $url_page_prec->getUrl();
}
 
if($taille_page*($numero_page) >= $total) {
$page_suivante = false;
$url_page_suivante = '';
} else {
$url_page_suiv = clone($url_base);
$url_page_suiv->setVariableRequete('numero_page',($page_suivante));
$url_page_suiv->setVariableRequete('taille_page',($taille_page));
$url_page_suivante = $url_page_suiv->getUrl();
}
 
$url_pages = array();
 
for($i = 1; $i <= $nombre_pages ; $i++) {
 
$url_page_prev = clone($url_base);
$url_page_prev->setVariableRequete('numero_page',($i));
$url_page_prev->setVariableRequete('taille_page',($taille_page));
$url_pages[$i] = $url_page_prev->getUrl();
}
 
$donnees = array('url_pages' => $url_pages, 'numero_page' => $numero_page,
'page_precedente' => $page_precedente, 'page_suivante' => $page_suivante,
'url_page_precedente' => $url_page_precedente, 'url_page_suivante' => $url_page_suivante,
'nombre_pages' => $nombre_pages, 'taille_page' => $taille_page);
$donnees['base_url_pagination'] = $url_base;
 
return $this->getVue(Config::get('dossier_squelettes_elements').'pagination',$donnees);
}
 
 
/** --- Fonction pour les images ------------------------------------------------------------------------*/
 
public function afficherFormulaireUploadImage($id_annuaire,$id_utilisateur, $donnees = array()) {
 
$donnees['aa_id_annuaire'] = $id_annuaire;
$donnees['id_utilisateur'] = $id_utilisateur;
 
$donnees['amc_nom'] = 'Avatar';
 
$this->chargerModele('AnnuaireModele');
$id_champ_image = $this->AnnuaireModele->obtenirChampAvatar($id_annuaire);
 
if(!$id_champ_image) {
$donnees['erreurs'] = 'Aucun champ n\'est défini pour l\'image de profil';
return $this->getVue(Config::get('dossier_squelettes_elements').'erreurs',$donnees);
}
 
$donnees['amc_id_champ'] = $id_champ_image;
 
return $this->getVue(Config::get('dossier_squelettes_champs').'image',$donnees);
}
 
/**
* Ajoute une image uploadée à travers le formulaire
*
*/
public function ajouterImageUtilisateur($id_annuaire, $id_utilisateur, $fichier_a_stocker, $retourner_booleen = false) {
 
$donnees = array('erreurs' => array());
 
foreach($fichier_a_stocker as $nom_champ => $fichier) {
 
$ids_champ = mb_split("_",$nom_champ, 3);
 
if(count($ids_champ) == 2) {
 
$type = $ids_champ[0];
$id_champ = $ids_champ[1];
 
 
} else {
trigger_error('Ce champ n\'est pas relié à un annuaire');
return false;
}
 
$this->chargerModele('ImageModele');
 
$format_accepte = $this->ImageModele->verifierFormat($fichier['name']);
 
if(!$format_accepte) {
$donnees['erreurs'][$id_champ] = 'Cette extension de fichier n\'est pas prise en charge';
return $this->afficherFormulaireUploadImage($id_annuaire, $id_utilisateur,$id_champ,$donnees);
}
 
$stockage_image = $this->ImageModele->stockerFichier($id_annuaire, $id_utilisateur, $fichier);
 
$this->chargerModele('MetadonneeModele');
 
if($this->MetadonneeModele->valeurExiste($id_champ,$id_utilisateur)) {
// On se contente de la modifier
if($stockage_image && $this->MetadonneeModele->modifierValeurMetadonnee($id_champ,$id_utilisateur,$id_utilisateur)) {
 
} else {
$donnees['erreurs'][$id_champ] = 'Problème durant le stockage de l\'image';
return $this->afficherFormulaireUploadImage($id_annuaire, $id_utilisateur,$id_champ,$donnees);
}
 
} else {
// S'il n'existe pas de valeur, on ajoute une nouvelle ligne à la table de valeurs de meta données
if($stockage_image && $this->MetadonneeModele->ajouterNouvelleValeurMetadonnee($id_champ,$id_utilisateur,$id_utilisateur)) {
// Si l'insertion a réussi, on continue
} else {
$donnees['erreurs'][$id_champ] = 'Problème durant le stockage de l\'image';
return $this->afficherFormulaireUploadImage($id_annuaire, $id_utilisateur,$id_champ,$donnees);
}
}
}
 
if($retourner_booleen) {
return true;
} else {
return $this->afficherFicheUtilisateur($id_annuaire, $id_utilisateur) ;
}
}
public function obtenirValeursUtilisateur($id_annuaire, $id_utilisateur) {
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire, false);
 
$this->chargerModele('MetadonneeModele');
 
$metadonnees = $this->MetadonneeModele->chargerListeMetadonneeAnnuaire($id_annuaire);
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
 
$valeurs_annuaire = $this->AnnuaireModele->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur,$tableau_mappage[0]);
$valeurs_metadonnees= $this->MetadonneeModele->chargerListeValeursMetadonneesUtilisateur($id_annuaire, $id_utilisateur);
 
foreach($tableau_mappage[0] as $cle => $nom_champ) {
 
if($cle != 'champ_id') {
 
$nom_champ_formulaire = $metadonnees[$tableau_mappage[1][$cle]]['amc_abreviation'];
$valeur = $valeurs_annuaire[$nom_champ] ;
if(isset($valeurs_metadonnees[$nom_champ_formulaire])) {
if(isset($valeurs_metadonnees[$nom_champ_formulaire]['amv_valeur']) && $valeurs_metadonnees[$nom_champ_formulaire]['amv_valeur'] != '') {
$valeur = $valeurs_metadonnees[$nom_champ_formulaire]['amv_valeur'];
}
$informations_champ = array('amv_valeur' => $valeur,'amc_id_champ' => $tableau_mappage[1][$cle]) ;
$valeurs_metadonnees[$nom_champ_formulaire] = array_merge($valeurs_metadonnees[$nom_champ_formulaire],$informations_champ);
} else {
$informations_champ = array('amv_valeur' => $valeur,'amc_id_champ' => $tableau_mappage[1][$cle]) ;
$valeurs_metadonnees[$nom_champ_formulaire] = $informations_champ;
}
}
}
return $valeurs_metadonnees;
}
public function obtenirTableauDerniersInscrits($id_annuaire, $limite = '20') {
// Chargement des informations de l'utilisateur dans la table annuaire principale
$this->chargerModele('AnnuaireModele');
$annuaire = $this->AnnuaireModele->chargerAnnuaire($id_annuaire);
$tableau_mappage = $this->obtenirChampsMappageAnnuaire($id_annuaire);
$this->chargerModele('AnnuaireModele');
$tableau_ids = $this->AnnuaireModele->obtenirTableauIdsUtilisateurs($id_annuaire, $tableau_mappage[0]);
$derniers_inscrits = array();
foreach($tableau_ids as $id) {
$id_utilisateur = $id[$tableau_mappage[0][champ_id]];
$derniers_inscrits[$id_utilisateur] = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
}
return $derniers_inscrits;
}
 
public function chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $id_zones) {
 
$annuaire_modele = $this->getModele('AnnuaireModele');
return $annuaire_modele->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $id_zones);
}
 
public function chargerNombreAnnuaireListeInscritsParDepartement($id_annuaire) {
$this->chargerModele('AnnuaireModele');
return $this->AnnuaireModele->chargerNombreAnnuaireListeInscritsParDepartement($id_annuaire);
}
}
?>
/tags/v1.0-aigle/controleurs/StatistiquesControleur.php
New file
0,0 → 1,137
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class StatistiquesControleur extends Controleur {
 
private $statistiques = null;
 
private $champ_pays = '12';
private $onto_pays = '1074';
 
private $champ_rapport_activite_bota = '102';
private $onto_rapport_activite_bota = '30797';
 
private $champ_experience_bota = '4';
private $onto_experience_bota = '30785';
 
public function StatistiquesControleur() {
$this->statistiques = Composant::fabrique('statistiques', array());
}
 
public function obtenirGraphiques($id_annuaire) {
 
$graph = array();
 
//$this->obtenirStatistiquesParPays($id_annuaire);
$graph['pays'] = $this->obtenirStatistiquesParCritere($id_annuaire, $this->champ_pays, $this->onto_pays);
$graph['activite_bota'] = $this->obtenirStatistiquesParCritere($id_annuaire, $this->champ_rapport_activite_bota, $this->onto_rapport_activite_bota, 'Répartition des inscrits selon leur activité');
$graph['experience_bota'] = $this->obtenirStatistiquesParCritere($id_annuaire, $this->champ_experience_bota, $this->onto_experience_bota, 'Répartition des inscrits selon leur expérience botanique');
 
$image = $this->statistiques->combinerGraphiques($graph);
 
// Envoi d'une image png
header("Content-type: image/png");
imagepng ($image);
 
return $graph ;
}
 
public function obtenirStatistiquesParPays($id_annuaire, $titre = 'Répartition des inscrits par pays') {
 
$controleur = new AnnuaireControleur();
 
$modele_meta = new MetadonneeModele();
$modele_onto = new OntologieModele();
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($this->champ_experience_bota);
$legendes = $modele_onto->chargerListeOntologie($this->onto_experience_bota);
 
$valeurs_a_stat_code = array();
$valeurs_a_stat_legende = array();
 
foreach($valeurs as $valeur) {
$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
}
 
foreach($legendes as $legende) {
$legende_nom = $legende['amo_nom'];
$legende_code = $legende['amo_id_ontologie'];
 
if(isset($valeurs_a_stat_code[$legende_code])) {
$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
}
}
 
return $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
 
}
 
public function obtenirStatistiquesParCritere($id_annuaire, $id_champ, $id_onto, $titre = '') {
 
$controleur = new AnnuaireControleur();
 
$modele_meta = new MetadonneeModele();
$modele_onto = new OntologieModele();
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ);
$legendes = $modele_onto->chargerListeOntologie($id_onto);
 
$valeurs_a_stat_code = array();
$valeurs_a_stat_legende = array();
 
foreach($valeurs as $valeur) {
$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
}
 
foreach($legendes as $legende) {
$legende_nom = $legende['amo_nom'];
$legende_code = $legende['amo_id_ontologie'];
 
if(isset($valeurs_a_stat_code[$legende_code])) {
$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
}
}
 
return $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre);
 
}
 
public function obtenirStatistiquesParAnnees($id_annuaire) {
 
$controleur = new AnnuaireControleur();
 
$modele_stats = new StatistiquesModele();
$valeurs = $modele_stats->obtenirNombreInscriptionsParDate($id_annuaire);
$legendes = $modele_onto->chargerListeOntologie('1074');
 
 
$valeurs_a_stat_code = array();
$valeurs_a_stat_legende = array();
 
foreach($valeurs as $valeur) {
$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
}
 
foreach($legendes as $legende) {
$legende_nom = $legende['amo_nom'];
$legende_code = $legende['amo_id_ontologie'];
 
if(isset($valeurs_a_stat_code[$legende_code])) {
$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
}
}
 
return $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
 
}
 
}
?>
/tags/v1.0-aigle/controleurs/VerificationControleur.php
New file
0,0 → 1,451
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*
*/
 
/**
* Controleur chargé de la vérification des formulaire
* Remplace aussi les valeurs lors des actions spéciales comme la modification du mail
* (l'inscription à la lettre d'actu se fait aussi ici même si ça n'estp as totalement sa place)
*/
class VerificationControleur extends Controleur {
 
/**
* Vérifie que les valeurs des champs de mappage et les valeurs obligatoires d'un annuaire donné
* sont correctes
* @param int $id_annuaire l'identifiant de l'annuaire
* @param Array $valeurs les valeurs à vérifier
*/
public function verifierErreursChampsSelonType($id_annuaire, $valeurs, $tableau_mappage) {
 
$erreurs = array();
 
$this->chargerModele('AnnuaireModele');
$tableau_champs_obligatoire = $this->AnnuaireModele->obtenirChampsObligatoires($id_annuaire);
 
foreach($valeurs as $id => $valeur_champ) {
 
$type = $valeur_champ['type'];
$valeur = $valeur_champ['valeur'];
$condition = $valeur_champ['condition'];
 
switch($type) {
 
case 'text':
if($this->estUnchampObligatoire($id, $tableau_champs_obligatoire) && trim($valeur) == '') {
$erreurs[$id] = 'Ce champ est obligatoire';
}
break;
 
case 'mail':
if($this->estUnchampObligatoire($id, $tableau_champs_obligatoire) && trim($valeur) == '') {
$erreurs[$id] = 'Le mail est obligatoire ';
}
 
if($this->estUnchampObligatoire($id, $tableau_champs_obligatoire) && !$this->mailValide($valeur)) {
$erreurs[$id] = 'Le mail est invalide ';
}
 
if($this->AnnuaireModele->utilisateurExisteParMail($id_annuaire, $valeur)) {
$erreurs[$id] = 'Cet email est déjà utilisé par quelqu\'un d\'autre ';
}
break;
 
case 'password':
if($this->estUnchampObligatoire($id, $tableau_champs_obligatoire) && trim($valeur) == ''
|| $valeur != $condition) {
$erreurs[$id] = 'Le mot de passe est invalide';
}
break;
 
// cas du champ checkbox
case 'checkbox':
if($this->estUnchampObligatoire($id, $tableau_champs_obligatoire) && trim($condition) != 'on') {
$erreurs[$id] = 'N\'oubliez pas de cocher cette case';
}
break;
 
default:
 
break;
}
}
 
if(count($erreurs) == 0) {
$erreurs = false;
}
 
return $erreurs;
}
 
/**
* Vérifie les valeurs des champs pour la modification d'un formulaire
*/
public function verifierErreurChampModification($id_annuaire, $id_utilisateur, $type ,$valeur, $confirmation = false) {
 
$retour = array(true,false);
 
switch($type) {
case 'mail':
if(!$this->mailValide($valeur)) {
$retour[0] = false;
$retour[1] = 'mail invalide';
break;
}
 
$this->chargerModele('AnnuaireModele');
$ancien_mail = $this->AnnuaireModele->obtenirMailParId($id_annuaire,$id_utilisateur);
 
if($ancien_mail != $valeur && $this->AnnuaireModele->utilisateurExisteParMail($id_annuaire, $valeur)) {
$retour[0] = false;
$retour[1] = 'cet email est déjà utilisé par quelqu\'un d\'autre';
}
 
break;
 
case 'password':
 
if(trim($valeur) != trim($confirmation)) {
$retour[0] = false;
$retour[1] = 'mot de passe invalide';
}
}
 
return $retour;
}
 
public function remplacerValeurChampPourInsertion($type, $valeur, $mail_utilisateur) {
 
$valeur_modifiee = $valeur;
 
switch($type) {
 
// cas du champ texte, à priori, rien de particulier
case 'text':
$valeur_modifiee = $valeur;
break;
 
// cas du champ password : on le crypte
case 'password':
$valeur_modifiee = $this->encrypterMotDePasse($valeur);
break;
 
// cas du champ checkbox
case 'checkbox':
// Si c'est un groupe checkbox, alors c'est une liste de checkbox liée à une ontologie
if(is_array($valeur)) {
// on stocke les valeurs d'ontologies liées au cases cochées
$valeur_modifiee = implode(Config::get('separateur_metadonnee'), array_keys($valeur));
 
} else {
if($valeur == 'on') {
// sinon on stocke 1 pour indique que la case est cochée (cas de la checkbox oui/non)
$valeur_modifiee = 1;
} else {
$valeur_modifiee = 0;
}
}
 
break;
 
case 'lettre':
if($valeur == 'on') {
// sinon on stocke 1 pour indique que la case est cochée (cas de la checkbox oui/non)
$valeur_modifiee = 1;
// Si c'est une inscription à la lettre d'actualité, on appelle la fonction d'inscription
$lettre_controleur = new LettreControleur();
$lettre_controleur->inscriptionLettreActualite($mail_utilisateur);
} else {
$valeur_modifiee = 0;
}
break;
 
default:
$valeur_modifiee = $valeur;
break;
}
 
return $valeur_modifiee;
}
 
public function remplacerValeurChampPourModification($id_annuaire, $id_utilisateur, $type, $valeur, $mail_utilisateur) {
 
$valeur_modifiee = $valeur;
 
switch($type) {
 
// cas du champ texte, à priori, rien de particulier
case 'text':
$valeur_modifiee = $valeur;
break;
 
// cas du champ password : on le crypte
case 'password':
$valeur_modifiee = $this->encrypterMotDePasse($valeur);
break;
 
// cas du champ checkbox
case 'checkbox':
// Si c'est un groupe checkbox, alors c'est une liste de checkbox liée à une ontologie
if(is_array($valeur)) {
 
// on stocke les valeurs d'ontologies liées au cases cochées
$valeur_modifiee = implode(Config::get('separateur_metadonnee'), array_keys($valeur));
 
} else {
if($valeur == 'on') {
// sinon on stocke 1 pour indique que la case est cochée (cas de la checkbox oui/non)
$valeur_modifiee = 1;
} else {
$valeur_modifiee = 0;
}
}
 
break;
 
case 'lettre':
 
// Si c'est une inscription à la lettre d'actualité, on appelle la fonction d'inscription
$lettre_controleur = new LettreControleur();
 
$this->chargerModele('AnnuaireModele');
$ancien_mail = $this->AnnuaireModele->obtenirMailParId($id_annuaire, $id_utilisateur);
 
$changement_mail = false;
 
if($ancien_mail != $mail_utilisateur) {
$changement_mail = true;
}
 
if($valeur == 'on') {
// on stocke 1 pour indique que la case est cochée (comme la checkbox oui/non)
$valeur_modifiee = 1;
 
// si le mail a changé on désinscrit l'ancien mail et on inscrit le nouveau
if($changement_mail) {
$lettre_controleur->ModificationInscriptionLettreActualite($ancien_mail, $mail_utilisateur);
} else {
$lettre_controleur->inscriptionLettreActualite($mail_utilisateur);
}
 
} else {
// sinon, si la case est vide
$valeur_modifiee = 0;
$mail_a_desinscrire = $mail_utilisateur;
if($changement_mail) {
$mail_a_desinscrire = $ancien_mail;
}
// on desinscrit l'utilisateur
$lettre_controleur->desinscriptionLettreActualite($mail_a_desinscrire);
}
break;
 
default:
$valeur_modifiee = $valeur;
break;
}
 
return $valeur_modifiee;
}
 
public function verifierEtRemplacerValeurChampPourAffichage($type, $valeur, $id_annuaire) {
 
if(!$type) {
$valeur_modifiee = array();
 
$valeur_modifiee['amv_type'] = 'champ_annuaire';
$valeur_modifiee['amv_valeur_affichage'] = $valeur;
 
} else {
 
$valeur_modifiee = $valeur;
 
switch($type) {
 
// cas du champ texte, à priori, rien de particulier
case 'text':
$valeur_modifiee['amv_valeur_affichage'] = $valeur['amv_valeur'];
break;
 
// cas du champ checkbox
case 'checkbox':
// si c'est un groupe checkbox, alors c'est une liste de checkbox liée à une ontologie
if(isset($valeur['amo_nom'])) {
if(is_array($valeur['amo_nom']) && count($valeur['amo_nom']) > 0) {
// on stocke les valeurs d'ontologies liées au cases cochées
$valeur_modifiee['amv_valeur_affichage'] = implode(', ', $valeur['amo_nom']);
} else {
$valeur_modifiee['amv_valeur_affichage'] = $valeur['amo_nom'];
}
} else {
// sinon on stocke 1 pour indique que la case est cochée (cas de la checkbox oui/non)
if($valeur_modifiee == 1) {
$valeur_modifiee['amv_valeur_affichage'] = 'oui';
} else {
$valeur_modifiee['amv_valeur_affichage'] = 'non';
}
}
break;
 
case 'select':
// TODO: si ça n'existe pas on va le chercher ?
if(isset($valeur['amo_nom'])) {
$valeur_modifiee['amv_valeur_affichage'] = $valeur['amo_nom'];
} else {
if(isset($valeur['amv_valeur'])) {
$ontologie_modele = new OntologieModele();
$infos_onto = $ontologie_modele->chargerInformationsOntologie($valeur['amv_valeur']);
if(is_array($infos_onto) && !empty($infos_onto)) {
$valeur_modifiee['amv_valeur_affichage'] = $infos_onto['amo_nom'];
} else {
$valeur_modifiee['amv_valeur_affichage'] = '';
}
}
}
break;
 
case 'radio':
$valeur_modifiee['amv_valeur_affichage'] = $valeur['amo_nom'];
break;
 
case 'image':
// si c'est une image, on recherche son url véritable à partir de l'id donnée en paramètre
if(isset($valeur['amv_valeur']) && $valeur['amv_valeur'] != '') {
$this->chargerModele('ImageModele');
$valeur_modifiee['amv_valeur_affichage'] = $this->ImageModele->obtenirEmplacementFichierParId($valeur['amv_valeur'],$id_annuaire, 'S');
}
break;
 
// cas du champ lettre
case 'lettre':
 
// on affiche oui ou non
if($valeur_modifiee['amv_valeur'] == 1) {
$valeur_modifiee['amv_valeur_affichage'] = 'oui';
} else {
$valeur_modifiee['amv_valeur_affichage'] = 'non';
}
break;
 
default:
$valeur_modifiee['amv_valeur_affichage'] = $valeur['amv_valeur'];
break;
}
}
 
return $valeur_modifiee;
}
public function collecterValeurInscription($valeurs, $tableau_mappage) {
$valeurs_mappees = array();
$valeurs_a_inserer = array();
// on itère sur le tableau de valeur pour récupérer les champs de mappage;
foreach($valeurs as $nom_champ => $valeur) {
 
// pour chaque valeur
// on extrait l'id du champ
$ids_champ = mb_split("_",$nom_champ, 3);
 
if(count($ids_champ) == 3) {
 
$type = $ids_champ[0];
$id_champ = $ids_champ[2];
$condition = $ids_champ[1];
 
// cas de la checkbox qui devrait être là mais pas cochée
if($condition == 'hidden' && !isset($valeurs[$type.'_'.$id_champ])) {
// dans ce cas là on fabrique une valeur vide
$valeurs[$type.'_'.$id_champ] = 0;
}
 
} else {
$type = $ids_champ[0];
$condition = false;
$id_champ = $ids_champ[1];
}
 
// Si le champ fait partie des champs mappés
$cle_champ = array_search($id_champ, $tableau_mappage[1]);
 
// on ajoute sa clé correspondante dans le tableau des champs mappés
// qui sont les champs à vérifier
if($condition) {
$condition = $valeurs[$type.'_'.$id_champ];
$valeurs_mappees[$id_champ] = array('valeur' => $valeur, 'type' => $type, 'condition' => $condition);
} else {
//$valeurs_mappees[$cle_champ] = $valeur;
$valeurs_mappees[$id_champ] = array('valeur' => $valeur, 'type' => $type, 'condition' => false);
}
 
if(!$condition) {
$valeurs_a_inserer[$nom_champ] = $valeur;
}
}
return array('valeurs_mappees' => $valeurs_mappees, 'valeurs_a_inserer' => $valeurs_a_inserer);
}
 
/**
* Renvoie vrai ou faux suivant qu'un mail donné en paramètre est syntaxiquement valide (ne vérifie pas l'existence
* de l'adresse)
* @param string $mail le mail à tester
* @return boolean vrai ou faux suivant que le mail est valide ou non
*/
public function mailValide($mail) {
 
$regexp_mail = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/';
return preg_match($regexp_mail, $mail);
 
}
 
/**
* Renvoie un mot de passe crypté selon la fonction d'encryptage définie dans le fichier de configuration
* (si celle-ci n'existe pas on utilise une fonction par défaut)
* @param string $pass le mot de passe à encrypter
* @return string le mot de passe encrypté
*/
public function encrypterMotDePasse($pass) {
 
$fonction = Config::get('pass_crypt_fonct');
 
if(function_exists($fonction)) {
return $fonction($pass);
} else {
return md5($pass);
}
}
 
//TODO: créer une class util
static function encrypterMotDepasseStatic($pass) {
 
$fonction = Config::get('pass_crypt_fonct');
 
if(function_exists($fonction)) {
return $fonction($pass);
} else {
return md5($pass);
}
}
 
/**
* Suivant un identifiant de champ et un tableau, renvoie vrai ou faux suivant que le champs est obligatoire ou non
* @param int $id_champ l'identifiant de champ
* @param int $champ_obligatoire le tableau des champs obligatoires
*/
private function estUnchampObligatoire($id_champ, $champs_obligatoire) {
 
return in_array($id_champ, $champs_obligatoire) || in_array($id_champ, array_keys($champs_obligatoire));
}
}
?>
/tags/v1.0-aigle/cartes/pays_europe.html
New file
0,0 → 1,48
<div id="cartographie">
<img id="carte-img" src="http://162.38.234.9/annuaire/cartes/pays_europe.png" alt="info" usemap="#carte-map" />
<map name="carte-map">
<area shape="poly" title="Albanie (0 inscrit)" class="zone-al" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=al" coords="346,416,351,422,351,435,356,439,357,444,354,447,352,451,348,454,346,454,339,450,337,444,338,438,341,432,340,427,338,425,340,418" />
<area shape="poly" title="Allemagne (20 inscrits)" class="zone-de" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=de" coords="239,247,254,231,261,234,274,240,292,240,300,250,297,263,295,264,300,269,299,278,301,287,299,292,298,294,287,298,280,299,275,301,276,305,277,312,278,313,288,324,286,327,283,329,279,331,280,340,275,339,266,338,263,342,258,339,253,338,252,340,249,337,247,337,243,334,236,331,236,334,232,334,227,332,228,327,236,314,222,308,220,304,221,296,221,293,223,291,222,287,219,285,219,282,220,281,223,277,224,276,223,273,223,270,227,271,229,270,231,268,233,267,234,266,233,265,231,264,232,261,233,260,235,260,237,258,238,254,238,254" />
<area shape="poly" title="Andorre (2 inscrits)" class="zone-an" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=an" coords="150,389,154,390,155,394,150,394" />
<area shape="poly" title="Autriche (4 inscrits)" class="zone-at" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=at" coords="249,344,249,347,251,347,254,346,256,348,259,349,260,347,270,347,272,352,281,356,284,356,293,358,296,356,306,356,311,350,312,346,316,341,318,341,318,338,316,336,316,329,310,328,307,326,305,326,303,324,300,324,299,328,297,330,291,330,288,329,286,330,285,332,280,334,280,337,282,340,282,342,280,345,276,342,272,342,267,341,264,344,260,344,257,341,255,341,255,343,253,345,251,344,250,341,248,340,247,342" />
<area shape="poly" title="Belgique (306 inscrits)" class="zone-be" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=be" coords="190,275,191,280,196,280,198,285,201,288,201,291,201,293,204,295,206,293,206,292,207,293,208,296,209,298,211,301,213,302,215,302,215,297,215,296,218,295,219,295,222,293,222,290,219,286,218,285,218,283,220,280,220,279,217,277,214,275,212,275,208,275,206,276,203,274,200,273,197,275" />
<area shape="poly" title="Biélorussie (1 inscrit)" class="zone-by" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=by" coords="425,282,429,281,430,283,432,283,438,282,440,283,440,275,443,272,447,269,446,267,447,265,442,259,442,256,444,254,446,254,450,255,454,252,451,248,448,248,445,246,445,244,440,240,439,237,436,236,435,230,433,228,434,224,427,220,425,223,423,223,422,220,420,220,417,221,415,219,412,219,406,225,404,225,401,226,401,228,403,230,403,233,401,235,398,237,396,240,396,248,394,249,392,248,390,250,386,253,381,254,378,253,378,258,381,262,381,271,377,275,380,279,380,284,382,285,384,284,386,281,396,278,401,278,403,280,410,280,413,283,416,283,420,282,422,281" />
<area shape="poly" title="Bosnie-Herzégovine (0 inscrit)" class="zone-ba" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ba" coords="333,402,338,399,338,397,340,396,336,391,338,384,335,384,333,382,326,381,324,382,321,379,314,379,310,380,308,381,305,379,305,382,307,384,307,387,308,390,310,392,315,399,318,402,323,408,323,410,327,410,330,411,330,407,332,405" />
<area shape="poly" title="Bulgarie (2 inscrits)" class="zone-bg" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=bg" coords="374,393,392,398,406,395,416,390,425,387,435,393,436,393,429,400,429,411,433,418,415,422,412,423,412,428,403,430,398,431,391,427,385,431,378,428,376,421,373,416,372,409,375,405,374,402" />
<area shape="poly" title="Chypre (1 inscrit)" class="zone-cy" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=cy" coords="230,427,218,427,216,452,220,459,224,460,231,457,236,434" />
<area shape="poly" title="Croatie (0 inscrit)" class="zone-hr" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=hr" coords="302,369,302,361,307,360,309,359,313,360,315,360,318,362,320,366,321,368,326,369,329,369,333,369,335,371,335,374,336,377,334,379,332,380,329,379,323,380,322,377,319,377,311,376,306,376,305,376,303,378,303,379,305,383,306,385,306,388,307,392,322,408,326,411,330,414,329,417,322,413,312,411,293,392,283,380,282,370,292,370" />
<area shape="poly" title="Danemark (1 inscrit)" class="zone-dk" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=dk" coords="254,205,273,193,286,218,286,234,281,240,271,236,262,233,253,230,249,233" />
<area shape="poly" title="Espagne (57 inscrits)" class="zone-es" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=es" coords="47,363,46,351,52,349,55,349,59,346,63,346,71,351,78,353,83,355,89,359,93,363,98,364,103,365,107,367,114,369,119,372,123,373,125,375,127,378,129,380,131,382,134,385,136,385,140,387,142,388,145,386,150,389,155,392,155,395,157,397,164,399,168,398,169,403,169,405,176,437,139,449,95,465,51,461,37,438,38,433,48,428,43,421,49,418,52,412,47,404,55,404,63,387,68,384,71,382,67,378,67,372,62,374,54,370,49,370,52,363" />
<area shape="poly" title="Estonie (0 inscrit)" class="zone-ee" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ee" coords="403,168,389,168,376,173,372,176,362,178,360,187,362,194,381,191,387,191,394,196,404,195,405,192,401,177,405,175" />
<area shape="poly" title="Finlande (1 inscrit)" class="zone-fi" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=fi" coords="401,154,369,167,355,153,354,121,377,86,370,81,364,49,351,36,355,33,360,41,365,38,370,42,374,37,376,35,377,24,384,21,391,26,391,44,396,46,401,51,397,60,399,67,404,73,404,85,407,86,404,91,410,93,410,98,413,102,410,107,420,114,420,125,410,143" />
<area shape="poly" title="France (8114 inscrits)" class="zone-fr" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=4&amp;pays=fr" coords="115,291,133,291,144,298,145,284,175,287,179,284,182,277,188,276,191,279,198,282,197,285,201,288,201,293,204,296,206,293,209,298,212,301,215,303,218,305,223,309,229,311,234,313,236,314,230,323,228,327,228,333,226,334,218,333,221,337,208,346,210,350,216,349,218,351,219,355,216,356,215,358,217,363,217,365,211,367,215,382,219,381,219,388,240,402,235,423,230,425,169,397,155,396,154,391,145,386,142,388,133,384,122,372" />
<area shape="poly" title="Grèce (3 inscrits)" class="zone-gr" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=gr" coords="378,430,385,431,392,428,398,432,406,430,412,430,413,423,417,423,419,428,416,433,413,436,520,496,515,509,493,517,402,522,379,513,363,497,351,480,346,472,348,457,350,455,351,450,355,449,355,444,358,438,363,438,367,435" />
<area shape="poly" title="Hongrie (0 inscrit)" class="zone-hu" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=hu" coords="337,366,339,366,346,363,354,363,357,362,357,360,359,358,360,355,362,353,363,347,368,342,369,340,372,339,373,337,371,337,367,333,363,334,362,331,360,331,355,332,353,331,351,333,346,339,342,338,339,340,336,340,335,342,325,343,320,338,320,342,317,343,315,345,313,352,312,354,313,359,316,362,318,362,320,364,324,369,331,369,335,368" />
<area shape="poly" title="Irlande (2 inscrits)" class="zone-ie" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ie" coords="125,191,114,194,101,196,85,222,84,228,85,235,91,238,120,238,129,226,130,212,125,205,121,207,120,203,120,198" />
<area shape="poly" title="Islande (1 inscrit)" class="zone-is" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=is" coords="98,3,88,24,92,39,103,54,119,57,151,58,161,43,162,25,135,9,124,1" />
<area shape="poly" title="Italie (31 inscrits)" class="zone-it" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=it" coords="216,357,217,365,212,367,215,382,219,381,219,387,232,381,242,385,245,392,249,402,250,409,255,416,217,431,217,454,221,460,276,433,284,439,286,442,288,444,292,449,294,451,259,475,260,482,287,500,291,499,332,450,273,375,281,366,281,360,284,355,277,354,272,351,269,346,259,347,258,349,254,347,251,350,252,351,248,352,246,354,243,351,240,353,240,355,237,357,236,356,232,353,229,356,225,357" />
<area shape="poly" title="Lettonie (0 inscrit)" class="zone-lv" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=lv" coords="384,191,360,200,356,206,354,212,356,219,363,215,373,213,376,218,383,215,389,218,395,220,402,225,411,217,408,210,406,205,409,201,401,197,393,196" />
<area shape="poly" title="Liechtenstein (0 inscrit)" class="zone-li" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=li" coords="246,340,244,341,244,346,248,346" />
<area shape="poly" title="Lituanie (0 inscrit)" class="zone-lt" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=lt" coords="356,220,362,214,374,214,376,218,380,217,384,216,389,220,393,220,399,225,401,230,398,232,394,236,395,246,391,246,384,250,378,251,372,245,369,239,371,234,364,233,358,231,356,226" />
<area shape="poly" title="Luxembourg (11 inscrits)" class="zone-lu" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=lu" coords="220,305,221,301,220,297,219,297,217,300,217,304" />
<area shape="poly" title="Macédoine (0 inscrit)" class="zone-mk" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=mk" coords="362,439,366,435,375,435,377,432,377,426,370,418,369,418,366,420,364,420,354,423,353,434,357,439" />
<area shape="poly" title="Malte (0 inscrit)" class="zone-mt" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=mt" coords="294,508,290,510,292,516,297,517,301,513,299,509" />
<area shape="poly" title="Moldavie (0 inscrit)" class="zone-md" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=md" coords="436,353,438,353,443,354,443,349,440,348,439,346,440,343,438,343,435,340,435,338,434,335,431,334,430,332,425,332,421,329,418,329,412,330,412,332,416,336,418,341,428,350,428,352,429,356,428,366,429,368,431,367,432,363,435,360,435,357,434,355" />
<area shape="poly" title="Monaco (7 inscrits)" class="zone-mc" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=mc" coords="218,390,212,387,211,390" />
<area shape="poly" title="Norvège (0 inscrit)" class="zone-no" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=no" coords="283,175,279,160,275,174,270,175,259,185,246,188,239,170,246,126,262,115,290,96,308,49,359,10,368,7,387,7,401,11,400,23,391,33,391,23,383,20,376,24,375,35,371,41,365,37,360,41,353,33,349,36,345,44,339,44,337,45,334,51,329,53,325,58,327,64,320,75,314,78,307,99,309,103,307,105,303,105,301,106,295,112,294,140,296,143,297,148,292,147,292,161,288,164" />
<area shape="poly" title="Pays-Bas (9 inscrits)" class="zone-nl" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=nl" coords="215,252,225,246,236,251,237,254,234,258,232,260,231,261,231,265,234,266,231,267,229,270,226,271,223,270,222,271,223,274,223,278,221,278,217,277,214,275,211,273,208,274,206,275,204,275,200,271,201,269,207,268,212,261,214,258" />
<area shape="poly" title="Pologne (0 inscrit)" class="zone-pl" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=pl" coords="302,249,311,248,322,241,334,239,338,245,347,245,354,246,374,246,377,249,376,257,381,261,380,266,376,269,373,273,375,276,378,279,379,285,378,287,380,291,381,294,381,298,380,300,377,303,374,307,370,314,370,317,372,319,370,320,364,316,359,315,356,316,351,317,346,317,345,318,340,315,338,316,337,316,333,311,333,308,330,308,327,306,319,300,318,306,315,302,311,298,300,291,301,287,299,282,299,278,300,272,300,269,294,265,297,262,299,254" />
<area shape="poly" title="Portugal (9 inscrits)" class="zone-pt" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=pt" coords="45,366,30,387,22,398,22,405,20,419,19,430,19,433,21,438,27,439,31,439,37,439,38,433,47,428,46,424,44,421,46,419,49,418,52,413,47,403,51,405,54,405,55,404,62,386,68,385,71,382,69,379,67,379,66,373,61,375,55,370,50,370,52,364" />
<area shape="poly" title="République Tchèque (4 inscrits)" class="zone-cz" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=cz" coords="316,326,318,327,321,325,323,325,330,326,330,323,335,318,333,315,333,313,331,311,327,311,324,308,323,306,320,305,320,308,316,309,314,307,313,303,312,301,307,299,305,297,301,296,299,298,293,297,290,298,288,300,278,303,277,305,279,307,279,309,278,312,282,316,285,320,288,322,293,328,297,327,297,325,299,322,304,322,306,324,308,324,311,326" />
<area shape="poly" title="Roumanie (6 inscrits)" class="zone-ro" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ro" coords="375,334,394,339,408,331,416,335,418,340,427,350,427,354,427,363,430,369,433,370,439,367,444,368,444,373,442,374,436,377,437,385,434,392,424,388,402,395,391,396,382,395,373,391,371,387,372,384,369,381,366,382,360,382,360,376,356,372,349,364,358,362,363,350,364,343" />
<area shape="poly" title="Royaume-Uni (7 inscrits)" class="zone-uk" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=uk" coords="129,192,125,197,121,199,119,204,121,207,125,205,127,209,128,210,131,212,132,214,136,243,127,244,128,249,115,266,120,272,167,279,174,276,183,271,192,253,205,131,194,135,142,154,137,167" />
<area shape="poly" title="Russie (0 inscrit)" class="zone-ru" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ru" coords="345,237,350,234,354,228,362,234,369,234,370,238,369,241,373,246,347,245 488,1,463,21,405,17,400,24,396,29,394,31,393,37,392,39,392,44,393,45,396,46,398,51,399,53,399,57,398,60,398,65,400,69,401,74,403,78,404,83,405,86,406,88,404,90,407,92,409,95,411,98,412,101,414,102,412,104,412,105,413,109,417,111,420,114,422,118,423,119,423,123,422,125,421,129,420,129,419,130,416,134,415,137,413,140,411,142,408,143,406,147,403,150,402,151,401,153,405,169,404,175,402,179,404,198,407,201,407,206,412,215,428,217,436,222,436,223,437,228,437,232,440,237,444,240,446,242,451,244,453,246,454,247,456,249,456,251,452,254,450,255,449,255,447,255,446,254,443,253,442,256,445,258,446,262,448,266,448,268,449,269,451,269,453,269,454,267,455,265,458,263,461,262,467,263,472,268,474,268,474,271,473,274,473,276,477,277,479,276,482,275,485,279,486,283,487,285,489,286,492,284,496,284,500,284,503,282,505,282,511,286,518,286,521,286,525,287,524,0" />
<area shape="poly" title="San Marin (0 inscrit)" class="zone-sm" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=sm" coords="267,374,264,371,261,375,262,377" />
<area shape="poly" title="Slovaquie (0 inscrit)" class="zone-sk" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=sk" coords="332,341,334,340,335,338,338,338,341,336,346,336,349,333,352,329,355,329,358,330,363,328,364,331,366,331,368,322,361,318,358,318,356,320,350,320,347,322,344,321,342,319,340,319,335,321,332,324,332,327,320,328,318,331,318,335,322,336,326,341" />
<area shape="poly" title="Slovénie (2 inscrits)" class="zone-si" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=si" coords="297,372,299,372,299,370,302,368,302,365,301,363,303,361,306,361,308,359,311,359,311,356,309,355,307,358,297,358,293,361,286,359,284,361,284,365,283,367,285,369,285,371,288,371,295,370" />
<area shape="poly" title="Suède (0 inscrit)" class="zone-se" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=se" coords="306,236,339,204,349,158,347,113,356,103,358,85,362,83,370,81,367,74,367,70,368,68,367,63,365,58,365,55,364,47,348,35,348,41,345,45,337,45,335,52,330,52,325,58,326,64,322,69,320,75,314,79,313,86,307,99,310,101,310,104,306,106,303,105,296,112,294,139,296,141,296,145,296,148,292,149,293,153,293,160,289,163,288,167,287,173,286,177,280,174,281,185,287,215,291,229,301,235" />
<area shape="poly" title="Suisse (148 inscrits)" class="zone-ch" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ch" coords="237,358,239,356,240,353,244,352,245,354,248,354,249,352,252,352,253,349,248,349,244,345,244,342,245,340,244,338,241,338,239,336,232,337,228,336,222,337,222,339,219,342,216,343,213,347,211,348,212,349,216,348,219,350,219,354,221,357,226,357,228,355,230,352,233,352,234,355" />
<area shape="poly" title="Ukraine (4 inscrits)" class="zone-ua" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=ua" coords="522,287,504,284,497,288,490,288,486,286,482,276,476,278,473,273,475,269,463,263,457,265,454,267,452,269,448,269,444,269,441,273,440,274,440,284,437,281,434,282,429,283,427,280,424,281,423,281,421,280,412,283,408,279,404,280,398,277,385,281,383,284,379,284,379,287,382,295,382,301,371,312,373,319,371,321,367,326,367,331,369,334,373,335,376,334,394,339,408,332,414,328,420,326,425,330,430,331,436,334,438,337,439,342,443,346,445,348,442,353,435,354,436,358,437,360,434,363,430,366,431,368,433,369,441,366,442,366,444,364,445,364,448,361,450,359,451,354,464,346,464,351,466,354,469,357,471,364,486,376,489,376,513,361,513,354,524,327" />
<area shape="poly" title="Yougoslavie (1 inscrit)" class="zone-yu" href="?id_annuaire=1&amp;m=annuaire_inscrits_carto&amp;continent=4&amp;pays=yu" coords="337,400,332,403,329,406,330,412,331,414,332,420,336,425,339,425,339,419,343,416,348,413,346,410,341,405 352,421,355,419,361,419,370,415,370,412,372,410,374,409,374,406,370,403,369,395,370,391,369,389,371,387,368,389,359,385,358,381,359,378,356,378,353,375,352,371,345,365,342,367,340,367,337,368,336,375,338,377,338,379,337,382,340,384,338,389,338,391,342,395,342,397,339,398,339,401,342,406,344,408,348,409,349,414,348,416,350,418" />
</map>
</div>
/tags/v1.0-aigle/cartes/pays_europe.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/v1.0-aigle/cartes/pays_europe.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/v1.0-aigle/cartes/continents.html
New file
0,0 → 1,12
<div id="cartographie">
<img id="carte-img" src="http://162.38.234.9/annuaire/cartes/continents.png" alt="info" usemap="#carte-map" />
<map name="carte-map">
<area shape="poly" title="Afrique (872 inscrits)" class="zone-1" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=1" coords="383,202,349,217,334,194,334,183,320,176,293,168,271,174,213,174,249,245,249,353,383,353" />
<area shape="poly" title="Amérique du Nord (124 inscrits)" class="zone-2" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=2" coords="0,220,116,220,116,225,153,224,153,211,200,211,200,199,206,199,206,193,220,193,212,174,296,0,0,0" />
<area shape="poly" title="Asie (15 inscrits)" class="zone-3" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=3" coords="579,20,579,150,501,225,501,252,494,252,485,249,473,254,384,256,383,193,392,193,392,182,398,182,396,181,396,171,401,172,401,166,409,166,409,156,355,156,357,154,358,150,354,146,360,142,363,143,377,144,378,132,381,131,379,127,382,125,381,122,378,117,384,110,384,87,379,79,379,20,431,20" />
<area shape="poly" title="Europe (8754 inscrits)" class="zone-4" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=4" coords="287,19,214,173,269,173,286,168,298,168,319,175,319,166,323,165,327,157,336,158,344,163,355,164,353,156,356,152,352,145,360,140,364,143,377,143,376,131,380,130,377,127,381,123,376,117,384,107,384,98,384,94,382,86,378,80,378,20" />
<area shape="poly" title="Océanie (3 inscrits)" class="zone-5" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=5" coords="578,151,502,226,502,253,495,253,486,250,473,255,384,256,384,353,579,353" />
<area shape="poly" title="Amérique du Sud (28 inscrits)" class="zone-6" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=6" coords="222,194,207,194,207,200,201,200,201,212,154,212,154,225,114,225,114,221,0,221,0,353,248,353,248,246" />
<area shape="poly" title="Moyen-Orient (21 inscrits)" class="zone-7" href="?id_annuaire=1&amp;m=annuaire_afficher_carte&amp;continent=7" coords="408,157,354,157,357,164,344,165,335,160,328,159,324,166,320,168,321,175,335,182,335,194,350,216,382,203,382,192,391,192,391,181,396,181,395,171,400,171,400,165,408,165,408,162" />
</map>
</div>
/tags/v1.0-aigle/cartes/continents.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
/tags/v1.0-aigle/cartes/continents.png
New file
Property changes:
Added: svn:mime-type
+image/png
\ No newline at end of property
/tags/v1.0-aigle/.project
New file
0,0 → 1,17
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>annuaire</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>net.sourceforge.phpeclipse.parserbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sourceforge.phpeclipse.phpnature</nature>
</natures>
</projectDescription>
/tags/v1.0-aigle/composants/statistiques/Statistiques.php
New file
0,0 → 1,139
<?php
/**
* PHP Version 5
*
* @category PHP
* @package annuaire
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @version SVN: <svn_id>
* @link /doc/annuaire/
*/
 
class Statistiques {
 
const GRAPH_CAMEMBERT = 'pie';
const GRAPH_COURBE = 'courbe';
 
public function genererGraphique($type_graphique, $valeurs, $titre = '', $nom_axe_x = '', $nom_axe_y = '') {
 
// Inclusion de la librairie JpGraph
include_once("lib/jpgraph.php");
$graph = null;
 
switch($type_graphique) {
case Statistiques::GRAPH_CAMEMBERT:
$graph = $this->genererGraphiqueCamembert($valeurs, $titre);
break;
 
case Statistiques::GRAPH_COURBE:
$graph = $this->genererGraphiqueCourbe($valeurs, $titre, $nom_axe_x, $nom_axe_y);
break;
 
default:
$graph = $this->genererGraphiqueCourbe($valeurs);
break;
}
 
return $graph;
}
 
public function genererGraphiqueCamembert($valeurs, $titre) {
 
include_once("lib/jpgraph_pie.php");
$graph = new PieGraph(500,500);
 
$oPie = new PiePlot(array_values($valeurs));
$oPie->SetLegends(array_keys($valeurs));
 
// Ajouter le titre du graphique
$graph->title->Set($titre);
 
// position du graphique (légèrement à droite)
$oPie->SetCenter(0.4);
 
$oPie->SetValueType(PIE_VALUE_PER);
 
// Format des valeurs de type "entier"
$oPie->value->SetFormat('%d');
 
$graph->Add($oPie);
return $graph/*->Stroke(_IMG_HANDLER)*/;
}
 
public function genererGraphiqueCourbe($valeurs, $titre, $nom_axe_x, $nom_axe_y) {
 
include_once("lib/jpgraph_line.php");
 
// Création du conteneur
$graph = new Graph(500,500);
 
// Fixer les marges
$graph->img->SetMargin(40,30,50,40);
 
// Lissage sur fond blanc (évite la pixellisation)
$graph->img->SetAntiAliasing("white");
 
// A détailler
$graph->SetScale("textlin");
 
// Ajouter une ombre
$graph->SetShadow();
 
// Ajouter le titre du graphique
$graph->title->Set($titre);
 
// Afficher la grille de l'axe des ordonnées
$graph->ygrid->Show();
// Fixer la couleur de l'axe (bleu avec transparence : @0.7)
$graph->ygrid->SetColor('blue@0.7');
// Des tirets pour les lignes
$graph->ygrid->SetLineStyle('solid');
 
// Afficher la grille de l'axe des abscisses
$graph->xgrid->Show();
// Fixer la couleur de l'axe (rouge avec transparence : @0.7)
$graph->xgrid->SetColor('red@0.7');
// Des tirets pour les lignes
$graph->xgrid->SetLineStyle('solid');
 
// Créer une courbes
$courbe = new LinePlot(array_values($valeurs));
 
// Chaque point de la courbe ****
// Type de point
$courbe->mark->SetType(MARK_FILLEDCIRCLE);
// Couleur de remplissage
$courbe->mark->SetFillColor("green");
// Taille
$courbe->mark->SetWidth(5);
 
// Paramétrage des axes
$graph->xaxis->title->Set($nom_axe_x);
$graph->xaxis->SetTickLabels(array_keys($valeurs));
 
// Paramétrage des axes
$graph->yaxis->title->Set($nom_axe_y);
 
// Ajouter la courbe au conteneur
$graph->Add($courbe);
 
return $graph/*->Stroke(_IMG_HANDLER)*/;
}
 
public function combinerGraphiques($graph) {
 
include_once('lib/jpgraph_mgraph.php');
$mgraph = new MGraph(2000,2000);
$xpos1=3;$ypos1=3;
$xpos2=3;$ypos2=500;
$xpos3=3;$ypos3=1000;
$mgraph->Add($graph['pays'],$xpos1,$ypos1);
$mgraph->Add($graph['activite_bota'],$xpos2,$ypos2);
$mgraph->Add($graph['experience_bota'],$xpos3,$ypos3);
return $mgraph->Stroke(_IMG_HANDLER);
}
 
}
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_canvas.php
New file
0,0 → 1,95
<?php
/*=======================================================================
// File: JPGRAPH_CANVAS.PHP
// Description: Canvas drawing extension for JpGraph
// Created: 2001-01-08
// Ver: $Id: jpgraph_canvas.php 1923 2010-01-11 13:48:49Z 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 __construct($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
parent::__construct($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',false) ) {
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 */
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_antispam.php
New file
0,0 → 1,615
<?php
//=======================================================================
// File: JPGRAPH_ANTISPAM.PHP
// Description: Genarate anti-spam challenge
// Created: 2004-10-07
// Ver: $Id: jpgraph_antispam.php 1106 2009-02-22 20:16:35Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
 
class HandDigits {
public $chars = array();
public $iHeight=30, $iWidth=30;
 
function __construct() {
 
//==========================================================
// lj-small.jpg
//==========================================================
$this->chars['j'][0]= 658 ;
$this->chars['j'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABUDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAUGBAf/xAAsEAACAQMDAwMBCQAAAAAAAAAB'.
'AgMEBREAEjEGIUEUUXGBBxMVIiNSYWKC/8QAFgEBAQEAAAAAAAAAAAAAAAAAAwEC/8QAGhEAAwADAQAAAAAAAAAAAAAAAAECERIh'.
'Mv/aAAwDAQACEQMRAD8A6veK2st8zRWSyV1dUBfvHaGVI4hknsS7AFv4AyM57ayWbqeS+11xtT2etttwo4YqhEqnQs5bcAfyk4AZ'.
'SOeD441TKRTyingUBG4/ah8j684+dSFzh/BvtaslejMUu9DPQTDnLx4lQ/ONw1TGBm0jdRWqguEMghEisWilgDmNs4Ze+MEEEH40'.
'aUVFTa7JeLjRXu4GjhmnNbSfqFQVlA3rkckOjH/Q99Glmkl0C/Q06pvsvT9vttXHDF6T1KrWbs5gRgQJM+FDlQxPhjpF1XcVq+qe'.
'jEoKiOecXBqh2TDDYIXLKuP6549xk8auI6aJqV45oknWdNswkAIkGMYIxjGO2NR1F0LZY5qkWqkS1xrM0M8lMSJpY+TGrnJiQ577'.
'cEgeNHhi7D3qC3UN69M8tIakRhgrh9o748+eNGtcCiKjjpkQKlMTEg3ZwoxtHHtgfTRpYXArvp//2Q==' ;
 
//==========================================================
// lf-small.jpg
//==========================================================
$this->chars['f'][0]= 633 ;
$this->chars['f'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAQFBgcC/8QAKxAAAgEDAwMCBQUAAAAAAAAA'.
'AQIDBBEhAAUGEjFBEyIHFFFhoRUzYnGS/8QAFQEBAQAAAAAAAAAAAAAAAAAAAQP/xAAaEQACAwEBAAAAAAAAAAAAAAAAAQIRMRIh'.
'/9oADAMBAAIRAxEAPwDcnmLoIkiSYsouC3tA++O2lU9WkqVjJ+YdhZLsQI/4/YfQm50kZP0vbmaCSU0SRNIH6sghb9INs3t38dvp'.
'akUuz8x5DwdN5peS1jV1dSipSiVUigIcdQjQ26lIB/c6r3F86SZpE/zCFJaqsihQNhRgdj3Jyfxo0jDSbXHt9Oph9RAoV3qJGltY'.
'HDOxyb/nRpV0D3RXle21m48XraOk3IUSemUaV4g4Zc9ShcDtgff+tQfwvjq34Dtku7buamFqeJKemCCMxKFsEJU+/FrX8d76sEHG'.
'aNItzr4usVNdG3S0rmRYAVwEUmyjyQLZ11x7aF4zs9DQOyzml29I2cLa/pixIHi99DFCtU9dFuLIaijo9qiYPmR2mZmB9thgAHOD'.
'4+mjUrURyrUNMZFEkkIOFuFAbsP9d/OjVIQ6Vh4tP//Z' ;
 
//==========================================================
// lb-small.jpg
//==========================================================
$this->chars['b'][0]= 645 ;
$this->chars['b'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABUDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAYCAwUH/8QAKxAAAQMDAwMDAwUAAAAAAAAA'.
'AQIDBAAFEQYSIRMxUSJBYQcVI2JxgqHw/8QAFQEBAQAAAAAAAAAAAAAAAAAAAQL/xAAYEQEBAQEBAAAAAAAAAAAAAAAAATERYf/a'.
'AAwDAQACEQMRAD8A6H95mxNYwLXcX+pCuilSLXJ6YSplaUELjqxwe4IJ5PIPamJ2V0bPcS7+NxCX1cHggAnIP+xSd9RyzHh2m7FQ'.
'Q1CvMNQWTjCt+HFD+PB/Y1fI1PL1HFFt0zaGblFdJQ9cJjpZiqPJUlBAKnPcEpGB5NNRKdrOl1NlgiQol4R2w4Sc5VtGf7opZteo'.
'LhdorjUSM5FnQnlR50NeHQysYxtVxlJHIPgjtRRD3xkaghs6juumdHz4+Y7RVPnt59K2mk7W+fcKWsZ7djTXMkW+xMP3GRJjwIEN'.
'HTG/CWx5wPY8AADx2NYk3SL9wukvUjGobnBkORksIbjdMANozgEqSo8qJPGO/wAVO36IsjUmBIfZfuM7epZk3F9UhSSk5O0K9Kcq'.
'8AcU3UzFuhUSBFud6nRXoz96mqmJZWg7m2dqUNhWBwdqQSP1UU5c/FFCn//Z' ;
 
//==========================================================
// d6-small.jpg
//==========================================================
$this->chars['6'][0]= 645 ;
$this->chars['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' ;
 
//==========================================================
// lx-small.jpg
//==========================================================
$this->chars['x'][0]= 650 ;
$this->chars['x'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABMDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAUHBgj/xAApEAABAwMDAwQCAwAAAAAAAAAB'.
'AgMEBQYRACFBBxIxFCJRgRNxkcHw/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAH/xAAWEQEBAQAAAAAAAAAAAAAAAAAAEQH/2gAMAwEA'.
'AhEDEQA/AH9t3pKvO14UykVARa/HfAlxlDKXR24V2p3z7RlPwdtMep91uWdRGHWELjuTFFtLvcC4SNznnH+21O7ttiodOq1BvC0E'.
'p9I0lSX2kgqCSklK+5PKCMAng6zV2XRO6u3lSIURtbDRShltlZHa0tW7q/0MeTwnjxq1Jiw2xc9xTLbhSVU5iaXUFfqFFILgJOCd'.
'9Gt3SXabR6REpkL8yo0RpLCFNx1qBCRjOQMHxo0pEr6o3um2LVYpMEpTVqg25lHn08dfcB9kEgfZ1LIFDuawqZRb7aQlLTzqglsg'.
'9wQdveOEqBIB425xqhQuk8qo9UKlPrlRblw2ZBeCSVKW6CcoSrI2AGOT41SKzT4dYtmdS5bIXDZhNoWgbZJ94x8AYT/GkM03oNUc'.
'uKgwqtTZDTMOU0FttqRkoHggnPkEEHRrkJ6t1SlSHYUOc6zHaWrsbQrATk5/vRqK/9k=' ;
 
//==========================================================
// d2-small.jpg
//==========================================================
$this->chars['2'][0]= 606 ;
$this->chars['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' ;
 
//==========================================================
// lm-small.jpg
//==========================================================
$this->chars['m'][0]= 649 ;
$this->chars['m'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGgAAAgMBAQAAAAAAAAAAAAAAAAcDBAUCBv/EAC0QAAICAQMCBAMJAAAAAAAA'.
'AAECAwQRAAUSBiETMVFhB2KhFSIyQVJxgZHB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAgED/8QAGREBAQEAAwAAAAAAAAAAAAAAAQAR'.
'EiEx/9oADAMBAAIRAxEAPwB0MI2lIdgI0Cly3kFXLEn2zx1FDdp7rbpbjUtRWKio3hyxOGQllJzkegX66rQ2qW87Zuk9S5FNVmru'.
'iywyBhjDKTkeXfSr+GRfYtq2KAO32b1BGxAZu0dyJ2DKPTxY1wPddVszycUq2Golq8jRWbcnJWwCVGMjz+VQP50atxMtm2ZUOY4l'.
'4qfUnBP0x/Z0amy4jJm10Tt2yddWasFmfaRfdrlG3UcgArnxKzJ+Fu4DqCMkcgNem2DoWav8PLfTm+FPEkuSNTnqueS5bnHIv6CG'.
'LNjJwM99bm67NB1Ht89KSxNXnr2hNDbiUc47K4KyD2GQMfmMjUnS+7vuIktTqPCaaWCqAMMojPFyw8hyYMQBnAwNJHYGXPTsW9VN'.
'jg2zf50W9zk524GAEihuz+xbIOD82jW5TkjtRPZkTkJ+4VgDhQfuj/f3OjUxl1f/2Q==' ;
 
//==========================================================
// lt-small.jpg
//==========================================================
$this->chars['t'][0]= 648 ;
$this->chars['t'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAQDBQYH/8QAJxAAAQMDAgYDAQEAAAAAAAAA'.
'AQIDBAUGEQASEyExQVFhIjJxFSP/xAAWAQEBAQAAAAAAAAAAAAAAAAABAAP/xAAZEQADAQEBAAAAAAAAAAAAAAAAAREhMUH/2gAM'.
'AwEAAhEDEQA/AO4BLEiEy7uG4IGxxs5IOOx76wd2XYidSp1HoD70240gcNNPbDyI6wQQpaz8E9MczkdhqtbsKYLieDk6WLKmZmmL'.
'Hk7AHVkbkLI+RQc7uRxgkfr1tx2rGu6VbToLVKkhU+kbugGf9WfaknCk5ycaX0zmaa+3JkqvW/CmzojsB9xoF6OoFK0r6HOcEDI0'.
'aefTuKX5ScMdC14HYq8n12zo1DEUcKTGg1Z+hyBwoPBVIiA/VQyOIgedhUCB4WMfXSV3UufVLcTUIqVf26K6mXDbPVRRzKT54iMg'.
'+zjtq6mtsyJjclxpKlUhSXEbkgkqWnBx4+J5e/zU0pZemPvJJQzEPDfQOrwwFY9AZ5eeYPLV6FwhoFYZuigxpkJeIjqAeIoAk9wA'.
'D46EnuD+6Nc1smDNrTlRkxqtMo1vzKhIdYgU9YDqVpISrLhHxSSd21I0aYyqP//Z' ;
 
//==========================================================
// li-small.jpg
//==========================================================
$this->chars['i'][0]= 639 ;
$this->chars['i'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABYDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAABwAGBP/EACcQAAEEAQMEAgIDAAAAAAAAAAEC'.
'AwQRBQAGEiExQVEHExSBFWFx/8QAFgEBAQEAAAAAAAAAAAAAAAAAAgMB/8QAGBEBAQEBAQAAAAAAAAAAAAAAAAECMRH/2gAMAwEA'.
'AhEDEQA/AE7c+5M9BeRG29t1WUfKFFYW+GvrI7WD3B9g140YD5T36rcErDjbUR6dCBdejsKUpxITXI2FUrooCh70yvxzHyIlMvuK'.
'eVSH7IKEpJoKqu/ahddLryR/aMiO187bsmrWShhp1AZS2XHHrWhNJrzdf7f7GiVcHk3sptmHkJcJ2DIftS2FrKlJPXudWuLGYeQp'.
't2fmEIckqIZaaKuSGG0lQ4gduRoFRHQ9AOgs2lOJbk9aSUlpjGvAWeSVH2VKq/2dFPw3IjyJe8s281ct3I9UoHJXGiQkD2STrSZ7'.
'Yf8AOl7JTdw5eOCz0jw3+LbYCfA9nz71msb8KMxoTGTw+5srjsipAdDqFBQBIuiOl6KrdYyJMyTCshlw2G3Fr/HiNqNNAqJJUoGl'.
'KND+h47km1bZwsvCbYYjycxIyK1qDv2yEi0hQviK8atKDcy9j//Z' ;
 
 
//==========================================================
// lp-small.jpg
//==========================================================
$this->chars['p'][0]= 700 ;
$this->chars['p'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGgAAAQUBAAAAAAAAAAAAAAAAAAECBAUGB//EAC8QAAEDAwMCBAMJAAAAAAAA'.
'AAECAwQFESEABhIiMRMVUWEHFEEWIzIzcYGRocH/xAAWAQEBAQAAAAAAAAAAAAAAAAADAgH/xAAcEQACAgIDAAAAAAAAAAAAAAAA'.
'AQIxAxESIUH/2gAMAwEAAhEDEQA/AOh703xG21DMeOyqoVNDjSzERiwU6Ep5qtZNycA97HTF13d33KWtmlt9xwkLl1NkXVxIuQgK'.
'wLj+hqBvel0qmbR8GnR22nJNZiLeeKr8nDIT1OLJucX+uPbWom7iocRpafOac5MX1ALltp/Cbi+cJH++utdh+WVNL3PNdNYpdWgx'.
'Y0qmLZSrwJJcQoOJ5XKlJFu4HbJOjVbt+V5nu7eopNRivqcdhK+bFnWwA1Y2AOcgjvj9dGlxy0g5y0xd+hNXoG24C4obizq3HZUh'.
'YHqtRHD06bG/8a0MbbG1mqekxaBSGmgkrcdcitlLfrckZIz7DUatbeFak0tyRLUwzT5vmiGm0cufEkFBJItfkD+59tKmiO12atFa'.
'eQukO3ejUxgENqTcfnE5WbkHiOnJ76N2IqI1DibabptS+zkZhtp90F2Y0S026EkAFK/qL46cXv65NVZDfxHmVCK4DE2/RX/lRFbA'.
'C5LwAyq2EtpHZI7mxPYDRqoctdESimz/2Q==' ;
 
//==========================================================
// le-small.jpg
//==========================================================
$this->chars['e'][0]= 700 ;
$this->chars['e'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABgDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAYEBQcB/8QAKhAAAQMCBAUEAwEAAAAAAAAA'.
'AgEDBAURAAYSIQciMTJBE0JRYRQVFoH/xAAXAQEBAQEAAAAAAAAAAAAAAAAAAgED/8QAGREAAwEBAQAAAAAAAAAAAAAAAAERAjFB'.
'/9oADAMBAAIRAxEAPwDTszvhEYCoS80BTm2bCjQRwdAzVe2yopkpJtpRUVfjEIc4V2oMerByg5Ji30oMyS3GeMunK0upfnu09MdJ'.
'p2scTmWnnGfx6HThktgLfKj7xEOqyr7QBbL41LhBzpxbcOru0LKDLdSnOHoaltNqSC4qWL0x9xbJYum69caczSaHmGmTmpDUYn4l'.
'UiqjkynzAVtwV23Ud+X4Ibpa2DCPkjhfUaRO/p8yzpb+YHhUmhbev6ZEll1lvqK3jt2XrbBgp6HVwsK3THpfEubGSoOUyFMpbJmL'.
'Deh6SgOGKti57EuY6l62JMWdJy7k3hg1LkOozEbVm7suQSkTiKtkEfP1pH664Za/QItccgI4bseTHdNxiXHLQ8yVl7V32XyioqL5'.
'TGc1ng6eYs0idczXUZscBBABWgEhEtfKNuUezwPnBhEuj8X2M21z9BR6NUX211Kk/UKKAjuhkPhL7XVf8vtgw7UPJlEyrDWFSYLb'.
'LBNF6qrzG6t0spEu6+fpL7YMXhUndp//2Q==' ;
 
//==========================================================
// la-small.jpg
//==========================================================
$this->chars['a'][0]= 730 ;
$this->chars['a'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABoDASIAAhEBAxEB/8QAGAABAAMBAAAAAAAAAAAAAAAABgMEBwX/xAAvEAABAwIFAQcCBwAAAAAAAAAB'.
'AgMEBREAEiExQQYHFBUiUXGBE2EyQkNSgpHh/8QAFwEBAQEBAAAAAAAAAAAAAAAAAAMBAv/EABkRAAMBAQEAAAAAAAAAAAAAAAAB'.
'IQIRMf/aAAwDAQACEQMRAD8AfdQ1pxjqZMSn0mRUZRYDaklJCE3OawO2ttTxY4hl07qFMVs1Ku02kpPnRGhsAqz8W9T9wDjozq6o'.
'Q1lDrcZLGVcmUoZg0obpufxK3Ftt9ccqB1GgBcmLSqtVEqOZcr6ARm/kbXHt7DEtc7WTJKTJqEWvRKfLqL9QplSjuPtGVYOJKBrm'.
't+U+n94WGStZzNypmRWqckUKTbixy6jAfxPxHtCgKqFNlU5huK6pLMndSlegG4J45N8aKmTMKQRBsCNMzwB+RbHWHGEAZlPZX2hx'.
'qZIC34ygZoYUbB50JSkFXFhZR9BrpheR4fIbQ6gvurJ7q02bIQTuAOAN8x40HAxRr3TrNRpBmSHVt1KMlTyJTCsqkKAPlSf28W+c'.
'UGaD1c9HSR1HFUh9tJU45EBcAtcC9+P9wqbg8IAto9o81yputrVGpiUkgHKkqUTZI32+cKm1z1tIUgPBBAKQ4UBQH3uL3xmXSXep'.
'HVDtXStE5K5jlPU7PF3Q41+okJFkjgC+3OuNSYiSzHaLtRcW4UDMpLYSCbakDW3thhum5p//2Q==' ;
 
//==========================================================
// d9-small.jpg
//==========================================================
$this->chars['9'][0]= 680 ;
$this->chars['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->chars['5'][0]= 632 ;
$this->chars['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->chars['1'][0]= 646 ;
$this->chars['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==' ;
 
//==========================================================
// ll-small.jpg
//==========================================================
$this->chars['l'][0]= 626 ;
$this->chars['l'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGAAAAgMAAAAAAAAAAAAAAAAAAAYEBQf/xAArEAACAQIFAwIGAwAAAAAAAAAB'.
'AgMEEQAFBhIhFEFREzEHFSIyYcFxgZH/xAAXAQEAAwAAAAAAAAAAAAAAAAACAAED/8QAGhEAAwEAAwAAAAAAAAAAAAAAAAECMREh'.
'Qf/aAAwDAQACEQMRAD8A15Zfm1VURj1Fp5AqLKv3OARcL4W5Nzx+MLWjdRz5hqXU6TSb6OCr6WghiQbrJ91gOTy1yT5xZ55myZFk'.
'Gb5ozX6Ondm28XYqpQDwu7jEH4c5S2UaDy4xxrLmlUDWzk8XaQ3O49hbj+RiB85HNg8Ee3aqwIqhDuux7G/HHbvzgxEqaWOvy09R'.
'O0o3hjdQoUji20g+fY3wYSM6pJ4Ylr7V+Zz5PSaezHTlTRNWzxySSxt6q1MSkH6AOT2Fu3Aw7RfF/T9DEkLUeawuF2mKSgdWQj2/'.
'q3+fnDZDlqRZzQGaOGcpTOaeR1u8R+ncN3gj94so2jNWHeMNNKzorEX2qp9v3imNPoRE1zpjUtZ09HJmYq5lury0benZeTww23t3'.
'Ivgw+T0yRRyyxIqNfkLcA8jt7YMKcBWn/9k=' ;
 
 
//==========================================================
// ls-small.jpg
//==========================================================
$this->chars['s'][0]= 701 ;
$this->chars['s'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGgAAAgMBAQAAAAAAAAAAAAAAAAMCBAUGB//EACwQAAEEAQIFAgUFAAAAAAAA'.
'AAECAwQFEQAGEhMUITEiYQcjQVFxFRZCUoH/xAAWAQEBAQAAAAAAAAAAAAAAAAADAgH/xAAZEQADAQEBAAAAAAAAAAAAAAAAAQIR'.
'EiH/2gAMAwEAAhEDEQA/APWZMhmFXSJU+SGmWFiQtAWMJQAnJUr8Z+w/OuQk71uZnMsqnbjy9s8st9UMCQ6kZJdZaIHEkZ/JHceN'.
'N3HtizuY1JLrG48yLBSC9UTFKQiY4nACir+wAOOMEe2rm2bTbzlqtE1MyBuZAPybpw85KSfDRJ4Cg+Pl/wC61hJeGjV31VuuKqwr'.
'LGU+whZZK+Rw+oYJAyj3GjS4dZFpZVkqPLktdfMXNcaU2kBC1BIITkdx6c599GlnvPAa3TL2vNvU76n0063acr3YSLCEjpUpUQtW'.
'Dhf14SMEnOc57aZ8Tegm7dbrEQGZt1PeTDgc1PEW3FeXAvyAkZVkeMDOm2G3f3O7Cl/qEuqkQg4lp6CRxraWfUlRUD24kZA741Ko'.
'2k1HvlT3ri2sLOCgtsyJz6XEtBwZPAgJAGQMHUNPWKqWItsqh0UCFVyLeKhyLHQ2TMdHNVj+RKlAnJyfto1FW2ahgjrq6LYTFjjf'.
'lymUOLdWfJyoHA+gA7AAAaNPE3ysJdLT/9k=' ;
 
//==========================================================
// lh-small.jpg
//==========================================================
$this->chars['h'][0]= 677 ;
$this->chars['h'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABUDASIAAhEBAxEB/8QAGgAAAQUBAAAAAAAAAAAAAAAAAAIDBAUGB//EACwQAAIBAwMCBQIHAAAAAAAA'.
'AAECAwQFEQAGEiExExQiQVEVggcyU2GRocH/xAAXAQADAQAAAAAAAAAAAAAAAAAAAwQB/8QAGhEBAQEAAwEAAAAAAAAAAAAAAQAC'.
'AyEyMf/aAAwDAQACEQMRAD8A6DZb95q9bmpK6ieOCzNHJTxmE+NMhQ5fr1fLq3Ejvkak2e7ipiFsqb3R0m4qkPPJRiRXenU9VjKE'.
'5JVcA9R7nWc3/BUbfoKTdO3VRXhpjbZ2D8Rwk6RyZH6chB+46m7i2hDYtgA2ePlV2VkuKysoLzzRnlIScZJZeeevvjtrX7LK2rp7'.
'tTwwJ9WjhILDrTKnIdMEDl2+P80aVdJZb1QW+vgqENLPH4sBCDLIwUgnOf4GjVvDnLgUk79T81voqjb8NnuUx8pVRCiEaYUSuynl'.
'jHU9mOfnOoOx6hqz8PrbNdfEkMUXg1LSM3rKOUywJ7YAJ1ZTWmSpvdvlaVTDSUzJAhH5ZJBgv0x2RSAPlz21WXqoet3ba9nuW8n4'.
'Jr6qTPqnUNxSM/f6mPvxA9zqJnExTbR+h0nkhVu1uE8j0UBRQ9PGxBKFjnkAScdsDp10a0lc7z0tI7Y5YYN+5GAf7GjVXF4Icj3f'.
'/9k=' ;
 
 
//==========================================================
// ld-small.jpg
//==========================================================
$this->chars['d'][0]= 681 ;
$this->chars['d'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAQFBgH/xAAsEAABAwMEAAQFBQAAAAAAAAAB'.
'AgMEBQYRABIhMQcTI0EUMlFhkRgicaGx/8QAFgEBAQEAAAAAAAAAAAAAAAAAAgEA/8QAGBEBAQEBAQAAAAAAAAAAAAAAAAECETH/'.
'2gAMAwEAAhEDEQA/ALUhp6h3W/X63UlypbhCY0WMjLqGzwDtPCfv/WtealNpVInuVBBqCogcdbU36YUkAkJWVHG8YPXBxxzxqPcN'.
'YtWyWnIlUeW05VEOAvrCnnSkftK1H5lKJPHsMDoDUWq+KdrSbIqsalVsImiEtLUZ2MU71bcYJWkhZ/36ayLHhi/IXZVOmzKqp5uU'.
'688hTyjuGVEFJKvoQesD86NL2jGZp1EoLDSmk+ZAQ8d7oPzp3YGesFWMfxo1YGvSzLsT9QExVX8phTlMaFOExAJIBGQjJwCcL+/e'.
'rd+W7GuO0Kw05CQ6+ww69Gfdb2kFIKk7DgEkjgnr86rXRa9HuyP8LV4SH0sIBbWFFDiFEgDaocgdkjo8ccay0qw7ut5nyrcviQqC'.
'slsRKo0HwlODkBRzxj2AGoXTtpzIdQ8MbffUChz4NCPRaClAo9Mn6c7T3o13wytmo0K05VIqkiPJbizFiMWs4CTgnIIHOST796NL'.
'Ia1JX//Z' ;
 
//==========================================================
// d8-small.jpg
//==========================================================
$this->chars['8'][0]= 694 ;
$this->chars['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==' ;
 
//==========================================================
// lz-small.jpg
//==========================================================
$this->chars['z'][0]= 690 ;
$this->chars['z'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABYDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAABgAHA//EACsQAAEDAwQBAwIHAAAAAAAAAAEC'.
'AwQFESEABhIxBxMiQVFxCCM0UmGRof/EABYBAQEBAAAAAAAAAAAAAAAAAAECAP/EABgRAAMBAQAAAAAAAAAAAAAAAAABEVEC/9oA'.
'DAMBAAIRAxEAPwBTWfLu1KXXZDbM4uewNvLajlwhaCbBAwDe5uehYd3xm6t6bi3jvulwqc7KgxXZZeYQLNLeF73WRg4HEdgfzrSa'.
'P45pNEkznITDc9ypLShtyWhJDJyXC2qxJHZvjoZOjyVv1v8AESt6FFS4ijxvTLbawEApSccrYHJf0+OtJMQ2rNXk7GZMufJgJjTH'.
'Un9M4qzxT7hyCiThIyRnPXWrRvyLElVBUF6vlhl0lwRYCFKcQhAtyWpVhyWTx+w++rUvp4EWjOvbniUOnVatcS43BYDbJSPZyIBw'.
'ejclIx+3Wa+J63T6DQanuGszI0eZVJJV60p0Jum5GEi6le7l0PjvSjyRsaTvJqI1BqhhR46ksuMrQVJcUSEoUbHNr/7o7C8L7eiz'.
'4lLlyJk2cEqW+6V+m0AE9ISLnsj5+O9UhsFK92bZZqb9SRu9p2c4A0OCEqDbYAJSlJwAVZv3fBvbFrg/462btlhuS1RG5nL8pYkq'.
'KrnsKH06I/rVrQKkf//Z' ;
 
//==========================================================
// d4-small.jpg
//==========================================================
$this->chars['4'][0]= 643 ;
$this->chars['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==' ;
 
//==========================================================
// lv-small.jpg
//==========================================================
$this->chars['v'][0]= 648 ;
$this->chars['v'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAQDBQYH/8QAKBAAAQQBAwMEAgMAAAAAAAAA'.
'AQIDBBEFAAYhEzFBEhQiYQdRFTKB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAFxEBAQEBAAAAAAAAAAAAAAAAAAERIf/aAAwD'.
'AQACEQMRAD8A6Ngt1SZ4yrYgrecgTFsFJA9aGwAUrUaF2D2Avjzq6CIjiBPkB9bwQVIkIYIDae/wq+P9N+dY4SGMf+Txlev7KBmY'.
'PoadKRy4zxSgRxaTwO/x09u7KPYnasmHjlsyFZZXt4K23ezjvBpNGgLUrvXfVZyLLbWambiwEbKvvxYAkeotNlIJW2FEJWb7WBda'.
'NSQI0fHYyJjkrjKRDZQwnpQ1vgBIr+w8+a+9GocZr8iKkuY1eXhsKH8U8iZE9BHz6ZHUc48UfSPqzqH3kfeO9kTTDQYGGietpTaO'.
'shyW6AocpHNIrv8AvWzk9BUSdPdYS4BcRlomkhIV6KP0VE39V+tU2wdlRMHtZUB8NuTQ+51X27+Kr46ZPIAFV540D8zeLsJ5LMHa'.
'ubmMBCVJdjx0pRyLoWR4I8aNIQ8BvZMNtMTeUcsptKfc4tC1gAkCyFC+K0aJtf/Z' ;
 
//==========================================================
// lk-small.jpg
//==========================================================
$this->chars['k'][0]= 680 ;
$this->chars['k'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABUDASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAAUGBAMH/8QALhAAAQMDAwIEBAcAAAAAAAAA'.
'AQIDBAUREgAGITFBEyIyYQcVUYEUIzNicZHx/8QAFgEBAQEAAAAAAAAAAAAAAAAAAwEE/8QAGxEAAwACAwAAAAAAAAAAAAAAAAEC'.
'AxESMeH/2gAMAwEAAhEDEQA/APVK/V36dU6NSJDTT8esPLiqfK8S2cCoeTkKvZQ6jm2ldSqKqbu+OgMOvSX3m4UBrLnDlbqiefKl'.
'Nzz2x1m+IwNP27CkJQ7JkR6rCkMJbP5jp8S2CPfkgD6H+dJ6Ca0nerr+64rTNSqMYrg+C9mmOwhVpDfsuxSbi97DmybaoZeQ5jTl'.
'PEp18JTIfeW3kq3ly4H26aNZqvTWZsjFcZTsVtSg0G8Rio+vr2vb7g6NLPRnuXy8F+8kl+obUh4KXJdqSJJQnohlkZqJPYBXh3P+'.
'a4b5Hyp6k1bO7sOotPyXkj9NlwFl0ewstJA9ifrqkVSmET4csoS7UTHXFQ+6SQlskKUMb/tH9ddLVUmS7DqdBqD7U6OsqfS46jzl'.
'hQ5bXb1K9Scuybdxo2OTu92dwSZkWn0Sb8viQWyn8Qq5D6ifSLd0BIv7q0arTBRSKPToMZbi2GWylsvLK148Wue/XRrRjxOpT2R2'.
'k9aP/9k=' ;
 
//==========================================================
// lr-small.jpg
//==========================================================
$this->chars['r'][0]= 681 ;
$this->chars['r'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABYDASIAAhEBAxEB/8QAGgAAAgIDAAAAAAAAAAAAAAAAAAYCBQMEB//EAC4QAAICAQIFAgMJAQAAAAAA'.
'AAECAwQRBQYAEiExQQdRFGFxEyIyM0JSYoGC8P/EABYBAQEBAAAAAAAAAAAAAAAAAAEAAv/EABcRAQEBAQAAAAAAAAAAAAAAAAAB'.
'EUH/2gAMAwEAAhEDEQA/AOs0ZdETU54Gt1INSmlPJEsyo7J+jlXPUYBPY9c+eE/dO9tY0a7ren6BVrW7VJTZtW5kZkjXkBSIKveQ'.
'gHp0AAJ4w+q2hVdT2Md0h46+saS4mr3EUK0gWTAB+vQj2PboeL/ZVOqmhaZVjkFmxdC6tctt3tM2G5/7bAx4C4+qxiWwd3prWzKe'.
'r3IBAth5OYxozKsgc8y4GTgnJB9uncdTi6tXq2140rRVM13JMEMAVAg7sMdBjJB/18uDgRO9R2Oo6FX2vShkFzURFUq1whIj+8DI'.
'7EdAFjXv7MeNb0kuStsFEmIaajZaos2fy2Q4VGH7SGxn+Rzw9yMLOm/FzRhZazmOTkP4grYyD3B8j2PTyeFfZ+z7G3BeSS8lmprl'.
'2K2qcnK0Z5S8gPjrgAY8cNEWmq7u23pEos6/Zji+Kd0rLLGWwseA3joeZj/w4OET1g0vlmrWV+ydFnkUxSgsvM4V+YYIwfHz6cHB'.
'ZeKZ1//Z' ;
 
//==========================================================
// lg-small.jpg
//==========================================================
$this->chars['g'][0]= 655 ;
$this->chars['g'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAQCBQYH/8QAJxAAAQQBAwQCAgMAAAAAAAAA'.
'AQIDBBEFAAYhBxIxQRNhcYEiQlH/xAAYAQACAwAAAAAAAAAAAAAAAAACAwABBP/EABkRAAMBAQEAAAAAAAAAAAAAAAABAhEhIv/a'.
'AAwDAQACEQMRAD8AayO4t6bq3hmMHtxyLi4OKeKH5jyASiiQCCQeTRNAeB61FrBb+jTGpLO+BMW24EFMhkhpQru8m7B/H70x09Yi'.
'q3nv/vLfwpnJ7UNkqSRbngf2ofWkpXV7brymC2malLfagurjW0aHk89xPJ9cX9aprURHWbYEaMHHEBfwpv8AnXPk+/8AdGqGJOxO'.
'4YbOSxK4y4boIStUWysgkEmxY54r60aOI8oTV9MHtjJwunPUbO46WWo0HLlD8KY4goboFVoquOVEVwLT963WdnxYfT6ZJyz0JvHm'.
'KvtaSkW4tYNVSqKiTwB+fw5n9sY/cuOXCzDDcluyW3Ckd7V+0n0eNZTH9DdouFalHIOJBUhtDki0pNV3UALo81ehG6IdKjPZ6d47'.
'4ywltanVJvuJI+RQs/sHRqy2r003JhsImEc/CUyhxRZBjKV2oJ8eRXNmufPnRo1WIz3DdNn/2Q==' ;
 
//==========================================================
// lc-small.jpg
//==========================================================
$this->chars['c'][0]= 629 ;
$this->chars['c'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAAUGBwID/8QALRAAAgICAQIEBAYDAAAAAAAA'.
'AQIDBAURACExBhIiQRMVUWEHMkJScYFykaH/xAAWAQEBAQAAAAAAAAAAAAAAAAABAgP/xAAXEQEBAQEAAAAAAAAAAAAAAAAAATER'.
'/9oADAMBAAIRAxEAPwDcoGkmiT4Q8kWvzuPU38D2/v8A1zwrCFayq1qTaFk2H7aJHt05MeMvENzC4upDWkjW9kJXiricAJCigvJN'.
'IB1IVQT5frrv24twPgunk6a288crbklUSJNNdnSTZ2STHHqOP/Eb17njdZtAoqwEvrEiGVyG117/AG6HhyV8H1sljMldoxXTksGC'.
'zV7M0oaWGQOVeGQ92I6EMR22D11w4LmEPjaOL51iL8ssc9Z69zHtZkYCGGeQK0ez2UEoU39wCeX1S/LLiEt+mPSbMLxsGVv2kEjR'.
'305xkaEV/GTULMUT1LD/AAGh8gIZS2jv+vpybb8NMIb0dVLWYWgiiU0vmMphOj6V0TvQI3rfsON1E6dYjGtisa0F1mAWR2NhG0WZ'.
'3Ls3TqNs5Hc9h23w49NWL9K+Q/VD5T/zhwPH/9k=' ;
 
//==========================================================
// d7-small.jpg
//==========================================================
$this->chars['7'][0]= 658 ;
$this->chars['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==' ;
 
//==========================================================
// ly-small.jpg
//==========================================================
$this->chars['y'][0]= 672 ;
$this->chars['y'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGAAAAwEBAAAAAAAAAAAAAAAAAAQGBQf/xAArEAABAwMEAQIFBQAAAAAAAAAB'.
'AgMEBREhAAYSEzEHIhQkQVGxQmFxgaH/xAAWAQEBAQAAAAAAAAAAAAAAAAADAQL/xAAeEQEAAgEEAwAAAAAAAAAAAAABABECAxIh'.
'MUGR8P/aAAwDAQACEQMRAD8Ar3tys07dVHohemz5dWQ7fk91MsA3IIRY8rkKFySceTqw3JVV0KhyKw+0C1CQp9aUOFSiAk4AIAvn'.
'76xtz0ioVvbcJ6msx2JtOfZmw1PKI5LQcJNh7UqBKcn6+NRfqPu6s1fYc6GxSJsRfWDUVSGA22ygEckJWSexRNgOP0udXzDKOJ0I'.
'yo62mHm25Sy80l1Z4lSgpQvZRGLgWwPGjTjbchyLH+Ejx22EtJSgO8kki3kADA/nOjWjGzv73CyQZjUWNVp7bNSrj7qJDqflqUlQ'.
'DMds24l3HvcNr3Pi9gME6T9WWVsemdYWswwC2lPta4m5WMA3OdUExCmozUJD6g84ntMjrHIFBTdQz5yLDx/WDNytpwW6nAkViqVe'.
'uvmXdlme6n4dCwlRBKEgA2tj99QG7Ilncp5QqpU31PMsJ6x7A32f6SPxo0hPVCD45oVyKf0MtgeT97/nRrO7UOCFla3tn//Z' ;
 
//==========================================================
// d3-small.jpg
//==========================================================
$this->chars['3'][0]= 662 ;
$this->chars['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=' ;
 
//==========================================================
// ln-small.jpg
//==========================================================
$this->chars['n'][0]= 643 ;
$this->chars['n'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGwAAAgEFAAAAAAAAAAAAAAAAAAYCAQMEBQf/xAAtEAACAQMCBAUCBwAAAAAA'.
'AAABAgMEBREAIQYSE0EHIjFRcWGRIzIzQoGCwf/EABYBAQEBAAAAAAAAAAAAAAAAAAMEAP/EABkRAQEBAQEBAAAAAAAAAAAAAAEA'.
'AhEhUf/aAAwDAQACEQMRAD8A6FR3p7v4oV9rlkMQsjL00RyOss0KkFxnDcrc2PbI1NOJKyTjW+W5OmKeA0UEJx5meRZS2/8AUfbS'.
'LVGS1+K16vCzfiR3GmoqqXGyxz06hWPsFlVMfOmq1iNvE69KjBYo3oJMZ3GKeYYPxg/fW+xzZX1FLQyxwSTcpWNceu4G3+aNSmpY'.
'qmQzzwh2k8yhv2r2H23/AJ0aoy+EWh7I1ntacR3PxDtEzhjWy0wkkIwYmanU5GO6sNh7rrU8AVdTceNbhDXxNHUQvS0tZ3DzwxVA'.
'fB7hj59/XJ08cPWaKj4gvlwSQiG7dCboqvLy9NOmQT9SM7ayJrBa6K5V91hjlWorp4JGUOAglRSiMMDb82/vgaBGTpVvtNUVtyJg'.
'5+WNAh5ZCu/r2+dGrgq0pi0DhmlRsSSAfqMd+b6ZyNu3po1Rk1yNBe3/2Q==' ;
 
//==========================================================
// lu-small.jpg
//==========================================================
$this->chars['u'][0]= 671 ;
$this->chars['u'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAYDBAUH/8QAJRAAAQQBAwQDAQEAAAAAAAAA'.
'AQIDBBEFAAYhBxMxYRJBURSB/8QAFgEBAQEAAAAAAAAAAAAAAAAAAQAD/8QAGhEBAQEAAwEAAAAAAAAAAAAAAQARITFBAv/aAAwD'.
'AQACEQMRAD8A6dLkQmJzu3WVtHIqjf0duKFNuBr5UTQ45F1R8/XI1PMmsYoJyjhS9iI7BKHeKjkXZVXqhyLHP+rrHeR1pZlx1W1M'.
'wTiW0ukkrS28nn5fV2SPPFfurHUKQhzYG7pLYKEfyBhaSOS7dG/YCki/uvWn3LPDOJrwa4kyEzOYeakqkpC3Hk0bNePQHgDRpchY'.
'leIZwzUWauKtuPctTSUlCAUmrBHIKuAPV/ujQsmHdm7hya43UbbD3ZVElOQJsdTS6IQaQUqBHCk8E2Pocgam6oYwObHy0Zm0oi45'.
'T1KBPdpV2f0pom/1Ws7cmPazu98Ltvcq3VzRHfehz8a4pirFEKRZo8eQT+eCdWYfS/b+WYnxpbuVcDRMdHcyTqg2fiAfiLoi+Rf+'.
'jT7Xc74HtOYnHyUOh8yWUvKeHhy0CiPVUAPoDRrm+OeznTva6lzsyMjCYbbaiNJjJSWElagD5tRpNUSALFeNGoOCH7Bv/9k=' ;
 
//==========================================================
// lw-small.jpg
//==========================================================
$this->chars['w'][0]= 673 ;
$this->chars['w'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABcDASIAAhEBAxEB/8QAGAAAAgMAAAAAAAAAAAAAAAAAAAYDBAX/xAAtEAACAQMDAgMHBQAAAAAAAAAB'.
'AgMEBREABhIhMRMUQRUiIzJRYZEWNIGx0f/EABYBAQEBAAAAAAAAAAAAAAAAAAABA//EABoRAAICAwAAAAAAAAAAAAAAAAABERIh'.
'MVH/2gAMAwEAAhEDEQA/AHXbV13ZLu6t2/uaa1JijWopVp4XUTKSAXRyc+6ehBGeoPbTSlwpql0K3GneqpZViqUhI5JzGMEZJGeh'.
'GlXfaFILDf7FQzXC426rDLTojs8sLqVkXBGcfKf40twWbdWzZY75R0s90ul3jPtKjVMJDNn4DDp8iEhW+wJ1WZG2KWt3Lv26U1tv'.
'92o7PaYkgYUbqVepYlmUBlIwqnB++O2jTDt/bBtth9jcpvEWNGqalZQryTlmeR8jPct6+mNGmRC4a1U13htzVFItB5nA/cyOUVfp'.
'7oz/ALqitJulYJKuqvFsppHALLFb3cp9FBaXr+O51bq0q6i38KK5PDVAAxSzU6SIpz3Kjjn8jUFoS7uFmut1gq17xLFQ+DxOccj8'.
'Rsn+tVpiyJnqv09YfOXu5AycgZZQEhBZjgDBOOgwO/po0sttWHdNzqLruioa4UwmdaC3kYp4IwSvJlBHKQ4OSe3po0qxM6P/2Q==' ;
 
//==========================================================
// lq-small.jpg
//==========================================================
$this->chars['q'][0]= 671 ;
$this->chars['q'][1]=
'/9j/4AAQSkZJRgABAQEASgBKAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAx'.
'NDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy'.
'MjIyMjIyMjL/wAARCAAeABQDASIAAhEBAxEB/8QAGQAAAgMBAAAAAAAAAAAAAAAAAAcDBAUG/8QAKRAAAQQBBAICAQQDAAAAAAAA'.
'AQIDBBEFAAYSIQcxIlETCBQVgSNBYf/EABUBAQEAAAAAAAAAAAAAAAAAAAAB/8QAFhEBAQEAAAAAAAAAAAAAAAAAAAER/9oADAMB'.
'AAIRAxEAPwDT3H5Qz+O3LN2vtrF/y86NYLzzVlAABJITQPv2a/17vXMboz3lDEYWPuafNx7CFrS03+2jpK2bs0CUkUa7pRvrUu63'.
'sr438yv7pLEo4XIK5Kcji0uJUkckm+uQUOVH6GsnyJv7A5vaJwuFdkONLmolgONFH4vioKRXYqyCADXvRMh0yspmZ4jyIEtDTK47'.
'aiA0lQUopBJBI/7X9aNT7amRo228e3a31iO3yUzCcdSPiKAIFdCho0TIswZ7GQlO/hlRxBooih1YXzAoKUkX0LPEBX110dJ7zbuv'.
'AORpO04cIpmxH23FSEIRwKuNnsdk0o31702XhFMKbuRUZJWP8LTQ6HBCuIB+iVWSR2BXuqK93/hDlvGzEphmG3Ml5JpDi1I7TzNA'.
'BYFlPafY+/7LBiv1CYDH4iFDOGySlMR22lFP4wCUpANfL11o1r4bxXlWMNEaE/bqlIbCFl/ANPK5Do/M0VDr2Rf3o0TX/9k=' ;
 
 
 
}
}
 
class AntiSpam {
 
private $iData='';
private $iDD=null;
 
function __construct($aData='') {
$this->iData = $aData;
$this->iDD = new HandDigits();
}
 
function Set($aData) {
$this->iData = $aData;
}
 
function Rand($aLen) {
$d='';
for($i=0; $i < $aLen; ++$i) {
if( rand(0,9) < 6 ) {
// Digits
$d .= chr( ord('1') + rand(0,8) );
}
else {
// Letters
do {
$offset = rand(0,25);
} while ( $offset==14 );
$d .= chr( ord('a') + $offset );
}
}
$this->iData = $d;
return $d;
}
 
function Stroke() {
 
$n=strlen($this->iData);
if( $n==0 ) {
return false;
}
 
for($i=0; $i < $n; ++$i ) {
if( $this->iData[$i]==='0' || strtolower($this->iData[$i])==='o') {
return false;
}
}
 
$img = @imagecreatetruecolor($n*$this->iDD->iWidth, $this->iDD->iHeight);
if( $img < 1 ) {
return false;
}
 
$start=0;
for($i=0; $i < $n; ++$i ) {
$dimg = imagecreatefromstring(base64_decode($this->iDD->chars[strtolower($this->iData[$i])][1]));
imagecopy($img,$dimg,$start,0,0,0,imagesx($dimg), $this->iDD->iHeight);
$start += imagesx($dimg);
}
$resimg = @imagecreatetruecolor($start+4, $this->iDD->iHeight+4);
if( $resimg < 1 ) {
return false;
}
 
imagecopy($resimg,$img,2,2,0,0,$start, $this->iDD->iHeight);
header("Content-type: image/jpeg");
imagejpeg($resimg);
return true;
}
}
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_polar.php
New file
0,0 → 1,897
<?php
/*=======================================================================
// File: JPGRAPH_POLAR.PHP
// Description: Polar plot extension for JpGraph
// Created: 2003-02-02
// Ver: $Id: jpgraph_polar.php 1796 2009-09-07 09:37:19Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
 
require_once ('jpgraph_plotmark.inc.php');
require_once "jpgraph_log.php";
 
 
define('POLAR_360',1);
define('POLAR_180',2);
 
//
// Note. Don't attempt to make sense of this code.
// In order not to have to be able to inherit the scaling code
// from the main graph package we have had to make some "tricks" since
// the original scaling and axis was not designed to do what is
// required here.
// There were two option. 1: Re-implement everything and get a clean design
// and 2: do some "small" trickery and be able to inherit most of
// the functionlity from the main graph package.
// We choose 2: here in order to save some time.
//
 
//--------------------------------------------------------------------------
// class PolarPlot
//--------------------------------------------------------------------------
class PolarPlot {
public $line_style='solid',$mark;
public $legendcsimtarget='';
public $legendcsimalt='';
public $legend="";
public $csimtargets=array(); // Array of targets for CSIM
public $csimareas=""; // Resultant CSIM area tags
public $csimalts=null; // ALT:s for corresponding target
public $scale=null;
private $numpoints=0;
private $iColor='navy',$iFillColor='';
private $iLineWeight=1;
private $coord=null;
 
function __construct($aData) {
$n = count($aData);
if( $n & 1 ) {
JpGraphError::RaiseL(17001);
//('Polar plots must have an even number of data point. Each data point is a tuple (angle,radius).');
}
$this->numpoints = $n/2;
$this->coord = $aData;
$this->mark = new PlotMark();
}
 
function SetWeight($aWeight) {
$this->iLineWeight = $aWeight;
}
 
function SetColor($aColor){
$this->iColor = $aColor;
}
 
function SetFillColor($aColor){
$this->iFillColor = $aColor;
}
 
function Max() {
$m = $this->coord[1];
$i=1;
while( $i < $this->numpoints ) {
$m = max($m,$this->coord[2*$i+1]);
++$i;
}
return $m;
}
// Set href targets for CSIM
function SetCSIMTargets($aTargets,$aAlts=null) {
$this->csimtargets=$aTargets;
$this->csimalts=$aAlts;
}
 
// Get all created areas
function GetCSIMareas() {
return $this->csimareas;
}
 
function SetLegend($aLegend,$aCSIM="",$aCSIMAlt="") {
$this->legend = $aLegend;
$this->legendcsimtarget = $aCSIM;
$this->legendcsimalt = $aCSIMAlt;
}
 
// Private methods
 
function Legend($aGraph) {
$color = $this->iColor ;
if( $this->legend != "" ) {
if( $this->iFillColor!='' ) {
$color = $this->iFillColor;
$aGraph->legend->Add($this->legend,$color,$this->mark,0,
$this->legendcsimtarget,$this->legendcsimalt);
}
else {
$aGraph->legend->Add($this->legend,$color,$this->mark,$this->line_style,
$this->legendcsimtarget,$this->legendcsimalt);
}
}
}
 
function Stroke($img,$scale) {
 
$i=0;
$p=array();
$this->csimareas='';
while($i < $this->numpoints) {
list($x1,$y1) = $scale->PTranslate($this->coord[2*$i],$this->coord[2*$i+1]);
$p[2*$i] = $x1;
$p[2*$i+1] = $y1;
 
if( isset($this->csimtargets[$i]) ) {
$this->mark->SetCSIMTarget($this->csimtargets[$i]);
$this->mark->SetCSIMAlt($this->csimalts[$i]);
$this->mark->SetCSIMAltVal($this->coord[2*$i], $this->coord[2*$i+1]);
$this->mark->Stroke($img,$x1,$y1);
$this->csimareas .= $this->mark->GetCSIMAreas();
}
else {
$this->mark->Stroke($img,$x1,$y1);
}
 
++$i;
}
 
if( $this->iFillColor != '' ) {
$img->SetColor($this->iFillColor);
$img->FilledPolygon($p);
}
$img->SetLineWeight($this->iLineWeight);
$img->SetColor($this->iColor);
$img->Polygon($p,$this->iFillColor!='');
}
}
 
//--------------------------------------------------------------------------
// class PolarAxis
//--------------------------------------------------------------------------
class PolarAxis extends Axis {
private $angle_step=15,$angle_color='lightgray',$angle_label_color='black';
private $angle_fontfam=FF_FONT1,$angle_fontstyle=FS_NORMAL,$angle_fontsize=10;
private $angle_fontcolor = 'navy';
private $gridminor_color='lightgray',$gridmajor_color='lightgray';
private $show_minor_grid = false, $show_major_grid = true ;
private $show_angle_mark=true, $show_angle_grid=true, $show_angle_label=true;
private $angle_tick_len=3, $angle_tick_len2=3, $angle_tick_color='black';
private $show_angle_tick=true;
private $radius_tick_color='black';
 
function __construct($img,$aScale) {
parent::__construct($img,$aScale);
}
 
function ShowAngleDegreeMark($aFlg=true) {
$this->show_angle_mark = $aFlg;
}
 
function SetAngleStep($aStep) {
$this->angle_step=$aStep;
}
 
function HideTicks($aFlg=true,$aAngleFlg=true) {
parent::HideTicks($aFlg,$aFlg);
$this->show_angle_tick = !$aAngleFlg;
}
 
function ShowAngleLabel($aFlg=true) {
$this->show_angle_label = $aFlg;
}
 
function ShowGrid($aMajor=true,$aMinor=false,$aAngle=true) {
$this->show_minor_grid = $aMinor;
$this->show_major_grid = $aMajor;
$this->show_angle_grid = $aAngle ;
}
 
function SetAngleFont($aFontFam,$aFontStyle=FS_NORMAL,$aFontSize=10) {
$this->angle_fontfam = $aFontFam;
$this->angle_fontstyle = $aFontStyle;
$this->angle_fontsize = $aFontSize;
}
 
function SetColor($aColor,$aRadColor='',$aAngleColor='') {
if( $aAngleColor == '' )
$aAngleColor=$aColor;
parent::SetColor($aColor,$aRadColor);
$this->angle_fontcolor = $aAngleColor;
}
 
function SetGridColor($aMajorColor,$aMinorColor='',$aAngleColor='') {
if( $aMinorColor == '' )
$aMinorColor = $aMajorColor;
if( $aAngleColor == '' )
$aAngleColor = $aMajorColor;
 
$this->gridminor_color = $aMinorColor;
$this->gridmajor_color = $aMajorColor;
$this->angle_color = $aAngleColor;
}
 
function SetTickColors($aRadColor,$aAngleColor='') {
$this->radius_tick_color = $aRadColor;
$this->angle_tick_color = $aAngleColor;
}
 
// Private methods
function StrokeGrid($pos) {
$x = round($this->img->left_margin + $this->img->plotwidth/2);
$this->scale->ticks->Stroke($this->img,$this->scale,$pos);
 
// Stroke the minor arcs
$pmin = array();
$p = $this->scale->ticks->ticks_pos;
$n = count($p);
$i = 0;
$this->img->SetColor($this->gridminor_color);
while( $i < $n ) {
$r = $p[$i]-$x+1;
$pmin[]=$r;
if( $this->show_minor_grid ) {
$this->img->Circle($x,$pos,$r);
}
$i++;
}
 
$limit = max($this->img->plotwidth,$this->img->plotheight)*1.4 ;
while( $r < $limit ) {
$off = $r;
$i=1;
$r = $off + round($p[$i]-$x+1);
while( $r < $limit && $i < $n ) {
$r = $off+$p[$i]-$x;
$pmin[]=$r;
if( $this->show_minor_grid ) {
$this->img->Circle($x,$pos,$r);
}
$i++;
}
}
 
// Stroke the major arcs
if( $this->show_major_grid ) {
// First determine how many minor step on
// every major step. We have recorded the minor radius
// in pmin and use these values. This is done in order
// to avoid rounding errors if we were to recalculate the
// different major radius.
$pmaj = $this->scale->ticks->maj_ticks_pos;
$p = $this->scale->ticks->ticks_pos;
if( $this->scale->name == 'lin' ) {
$step=round(($pmaj[1] - $pmaj[0])/($p[1] - $p[0]));
}
else {
$step=9;
}
$n = round(count($pmin)/$step);
$i = 0;
$this->img->SetColor($this->gridmajor_color);
$limit = max($this->img->plotwidth,$this->img->plotheight)*1.4 ;
$off = $r;
$i=0;
$r = $pmin[$i*$step];
while( $r < $limit && $i < $n ) {
$r = $pmin[$i*$step];
$this->img->Circle($x,$pos,$r);
$i++;
}
}
 
// Draw angles
if( $this->show_angle_grid ) {
$this->img->SetColor($this->angle_color);
$d = max($this->img->plotheight,$this->img->plotwidth)*1.4 ;
$a = 0;
$p = $this->scale->ticks->ticks_pos;
$start_radius = $p[1]-$x;
while( $a < 360 ) {
if( $a == 90 || $a == 270 ) {
// Make sure there are no rounding problem with
// exactly vertical lines
$this->img->Line($x+$start_radius*cos($a/180*M_PI)+1,
$pos-$start_radius*sin($a/180*M_PI),
$x+$start_radius*cos($a/180*M_PI)+1,
$pos-$d*sin($a/180*M_PI));
 
}
else {
$this->img->Line($x+$start_radius*cos($a/180*M_PI)+1,
$pos-$start_radius*sin($a/180*M_PI),
$x+$d*cos($a/180*M_PI),
$pos-$d*sin($a/180*M_PI));
}
$a += $this->angle_step;
}
}
}
 
function StrokeAngleLabels($pos,$type) {
 
if( !$this->show_angle_label )
return;
 
$x0 = round($this->img->left_margin+$this->img->plotwidth/2)+1;
 
$d = max($this->img->plotwidth,$this->img->plotheight)*1.42;
$a = $this->angle_step;
$t = new Text();
$t->SetColor($this->angle_fontcolor);
$t->SetFont($this->angle_fontfam,$this->angle_fontstyle,$this->angle_fontsize);
$xright = $this->img->width - $this->img->right_margin;
$ytop = $this->img->top_margin;
$xleft = $this->img->left_margin;
$ybottom = $this->img->height - $this->img->bottom_margin;
$ha = 'left';
$va = 'center';
$w = $this->img->plotwidth/2;
$h = $this->img->plotheight/2;
$xt = $x0; $yt = $pos;
$margin=5;
 
$tl = $this->angle_tick_len ; // Outer len
$tl2 = $this->angle_tick_len2 ; // Interior len
 
$this->img->SetColor($this->angle_tick_color);
$rot90 = $this->img->a == 90 ;
 
if( $type == POLAR_360 ) {
 
// Corner angles of the four corners
$ca1 = atan($h/$w)/M_PI*180;
$ca2 = 180-$ca1;
$ca3 = $ca1+180;
$ca4 = 360-$ca1;
$end = 360;
 
while( $a < $end ) {
$ca = cos($a/180*M_PI);
$sa = sin($a/180*M_PI);
$x = $d*$ca;
$y = $d*$sa;
$xt=1000;$yt=1000;
if( $a <= $ca1 || $a >= $ca4 ) {
$yt = $pos - $w * $y/$x;
$xt = $xright + $margin;
if( $rot90 ) {
$ha = 'center';
$va = 'top';
}
else {
$ha = 'left';
$va = 'center';
}
$x1=$xright-$tl2; $x2=$xright+$tl;
$y1=$y2=$yt;
}
elseif( $a > $ca1 && $a < $ca2 ) {
$xt = $x0 + $h * $x/$y;
$yt = $ytop - $margin;
if( $rot90 ) {
$ha = 'left';
$va = 'center';
}
else {
$ha = 'center';
$va = 'bottom';
}
$y1=$ytop+$tl2;$y2=$ytop-$tl;
$x1=$x2=$xt;
}
elseif( $a >= $ca2 && $a <= $ca3 ) {
$yt = $pos + $w * $y/$x;
$xt = $xleft - $margin;
if( $rot90 ) {
$ha = 'center';
$va = 'bottom';
}
else {
$ha = 'right';
$va = 'center';
}
$x1=$xleft+$tl2;$x2=$xleft-$tl;
$y1=$y2=$yt;
}
else {
$xt = $x0 - $h * $x/$y;
$yt = $ybottom + $margin;
if( $rot90 ) {
$ha = 'right';
$va = 'center';
}
else {
$ha = 'center';
$va = 'top';
}
$y1=$ybottom-$tl2;$y2=$ybottom+$tl;
$x1=$x2=$xt;
}
if( $a != 0 && $a != 180 ) {
$t->Align($ha,$va);
if( $this->scale->clockwise ) {
$t->Set(360-$a);
}
else {
$t->Set($a);
}
if( $this->show_angle_mark && $t->font_family > 4 ) {
$a .= SymChar::Get('degree');
}
$t->Stroke($this->img,$xt,$yt);
if( $this->show_angle_tick ) {
$this->img->Line($x1,$y1,$x2,$y2);
}
}
$a += $this->angle_step;
}
}
else {
// POLAR_HALF
$ca1 = atan($h/$w*2)/M_PI*180;
$ca2 = 180-$ca1;
$end = 180;
while( $a < $end ) {
$ca = cos($a/180*M_PI);
$sa = sin($a/180*M_PI);
$x = $d*$ca;
$y = $d*$sa;
if( $a <= $ca1 ) {
$yt = $pos - $w * $y/$x;
$xt = $xright + $margin;
if( $rot90 ) {
$ha = 'center';
$va = 'top';
}
else {
$ha = 'left';
$va = 'center';
}
$x1=$xright-$tl2; $x2=$xright+$tl;
$y1=$y2=$yt;
}
elseif( $a > $ca1 && $a < $ca2 ) {
$xt = $x0 + 2*$h * $x/$y;
$yt = $ytop - $margin;
if( $rot90 ) {
$ha = 'left';
$va = 'center';
}
else {
$ha = 'center';
$va = 'bottom';
}
$y1=$ytop+$tl2;$y2=$ytop-$tl;
$x1=$x2=$xt;
}
elseif( $a >= $ca2 ) {
$yt = $pos + $w * $y/$x;
$xt = $xleft - $margin;
if( $rot90 ) {
$ha = 'center';
$va = 'bottom';
}
else {
$ha = 'right';
$va = 'center';
}
$x1=$xleft+$tl2;$x2=$xleft-$tl;
$y1=$y2=$yt;
}
$t->Align($ha,$va);
if( $this->show_angle_mark && $t->font_family > 4 ) {
$a .= SymChar::Get('degree');
}
$t->Set($a);
$t->Stroke($this->img,$xt,$yt);
if( $this->show_angle_tick ) {
$this->img->Line($x1,$y1,$x2,$y2);
}
$a += $this->angle_step;
}
}
}
 
function Stroke($pos,$dummy=true) {
 
$this->img->SetLineWeight($this->weight);
$this->img->SetColor($this->color);
$this->img->SetFont($this->font_family,$this->font_style,$this->font_size);
if( !$this->hide_line ) {
$this->img->FilledRectangle($this->img->left_margin,$pos,
$this->img->width-$this->img->right_margin,
$pos+$this->weight-1);
}
$y=$pos+$this->img->GetFontHeight()+$this->title_margin+$this->title->margin;
if( $this->title_adjust=="high" ) {
$this->title->SetPos($this->img->width-$this->img->right_margin,$y,"right","top");
}
elseif( $this->title_adjust=="middle" || $this->title_adjust=="center" ) {
$this->title->SetPos(($this->img->width-$this->img->left_margin-$this->img->right_margin)/2+$this->img->left_margin,
$y,"center","top");
}
elseif($this->title_adjust=="low") {
$this->title->SetPos($this->img->left_margin,$y,"left","top");
}
else {
JpGraphError::RaiseL(17002,$this->title_adjust);
//('Unknown alignment specified for X-axis title. ('.$this->title_adjust.')');
}
 
 
if (!$this->hide_labels) {
$this->StrokeLabels($pos,false);
}
$this->img->SetColor($this->radius_tick_color);
$this->scale->ticks->Stroke($this->img,$this->scale,$pos);
 
//
// Mirror the positions for the left side of the scale
//
$mid = 2*($this->img->left_margin+$this->img->plotwidth/2);
$n = count($this->scale->ticks->ticks_pos);
$i=0;
while( $i < $n ) {
$this->scale->ticks->ticks_pos[$i] =
$mid-$this->scale->ticks->ticks_pos[$i] ;
++$i;
}
 
$n = count($this->scale->ticks->maj_ticks_pos);
$i=0;
while( $i < $n ) {
$this->scale->ticks->maj_ticks_pos[$i] =
$mid-$this->scale->ticks->maj_ticks_pos[$i] ;
++$i;
}
 
$n = count($this->scale->ticks->maj_ticklabels_pos);
$i=1;
while( $i < $n ) {
$this->scale->ticks->maj_ticklabels_pos[$i] =
$mid-$this->scale->ticks->maj_ticklabels_pos[$i] ;
++$i;
}
 
// Draw the left side of the scale
$n = count($this->scale->ticks->ticks_pos);
$yu = $pos - $this->scale->ticks->direction*$this->scale->ticks->GetMinTickAbsSize();
 
 
// Minor ticks
if( ! $this->scale->ticks->supress_minor_tickmarks ) {
$i=1;
while( $i < $n/2 ) {
$x = round($this->scale->ticks->ticks_pos[$i]) ;
$this->img->Line($x,$pos,$x,$yu);
++$i;
}
}
 
$n = count($this->scale->ticks->maj_ticks_pos);
$yu = $pos - $this->scale->ticks->direction*$this->scale->ticks->GetMajTickAbsSize();
 
 
// Major ticks
if( ! $this->scale->ticks->supress_tickmarks ) {
$i=1;
while( $i < $n/2 ) {
$x = round($this->scale->ticks->maj_ticks_pos[$i]) ;
$this->img->Line($x,$pos,$x,$yu);
++$i;
}
}
if (!$this->hide_labels) {
$this->StrokeLabels($pos,false);
}
$this->title->Stroke($this->img);
}
}
 
class PolarScale extends LinearScale {
private $graph;
public $clockwise=false;
 
function __construct($aMax,$graph,$aClockwise) {
parent::__construct(0,$aMax,'x');
$this->graph = $graph;
$this->clockwise = $aClockwise;
}
 
function SetClockwise($aFlg) {
$this->clockwise = $aFlg;
}
 
function _Translate($v) {
return parent::Translate($v);
}
 
function PTranslate($aAngle,$aRad) {
 
$m = $this->scale[1];
$w = $this->graph->img->plotwidth/2;
$aRad = $aRad/$m*$w;
 
$a = $aAngle/180 * M_PI;
if( $this->clockwise ) {
$a = 2*M_PI-$a;
}
 
$x = cos($a) * $aRad;
$y = sin($a) * $aRad;
 
$x += $this->_Translate(0);
 
if( $this->graph->iType == POLAR_360 ) {
$y = ($this->graph->img->top_margin + $this->graph->img->plotheight/2) - $y;
}
else {
$y = ($this->graph->img->top_margin + $this->graph->img->plotheight) - $y;
}
return array($x,$y);
}
}
 
class PolarLogScale extends LogScale {
private $graph;
public $clockwise=false;
 
function __construct($aMax,$graph,$aClockwise=false) {
parent::__construct(0,$aMax,'x');
$this->graph = $graph;
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
$this->clockwise = $aClockwise;
 
}
 
function SetClockwise($aFlg) {
$this->clockwise = $aFlg;
}
 
function PTranslate($aAngle,$aRad) {
 
if( $aRad == 0 )
$aRad = 1;
$aRad = log10($aRad);
$m = $this->scale[1];
$w = $this->graph->img->plotwidth/2;
$aRad = $aRad/$m*$w;
 
$a = $aAngle/180 * M_PI;
if( $this->clockwise ) {
$a = 2*M_PI-$a;
}
 
$x = cos( $a ) * $aRad;
$y = sin( $a ) * $aRad;
 
$x += $w+$this->graph->img->left_margin;//$this->_Translate(0);
if( $this->graph->iType == POLAR_360 ) {
$y = ($this->graph->img->top_margin + $this->graph->img->plotheight/2) - $y;
}
else {
$y = ($this->graph->img->top_margin + $this->graph->img->plotheight) - $y;
}
return array($x,$y);
}
}
 
class PolarGraph extends Graph {
public $scale;
public $axis;
public $iType=POLAR_360;
private $iClockwise=false;
 
function __construct($aWidth=300,$aHeight=200,$aCachedName="",$aTimeOut=0,$aInline=true) {
parent::__construct($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline) ;
$this->SetDensity(TICKD_DENSE);
$this->SetBox();
$this->SetMarginColor('white');
}
 
function SetDensity($aDense) {
$this->SetTickDensity(TICKD_NORMAL,$aDense);
}
 
function SetClockwise($aFlg) {
$this->scale->SetClockwise($aFlg);
}
 
function Set90AndMargin($lm=0,$rm=0,$tm=0,$bm=0) {
$adj = ($this->img->height - $this->img->width)/2;
$this->SetAngle(90);
$lm2 = -$adj + ($lm-$rm+$tm+$bm)/2;
$rm2 = -$adj + (-$lm+$rm+$tm+$bm)/2;
$tm2 = $adj + ($tm-$bm+$lm+$rm)/2;
$bm2 = $adj + (-$tm+$bm+$lm+$rm)/2;
$this->SetMargin($lm2, $rm2, $tm2, $bm2);
$this->axis->SetLabelAlign('right','center');
}
 
function SetScale($aScale,$rmax=0,$dummy1=1,$dummy2=1,$dummy3=1) {
if( $aScale == 'lin' ) {
$this->scale = new PolarScale($rmax,$this,$this->iClockwise);
}
elseif( $aScale == 'log' ) {
$this->scale = new PolarLogScale($rmax,$this,$this->iClockwise);
}
else {
JpGraphError::RaiseL(17004);//('Unknown scale type for polar graph. Must be "lin" or "log"');
}
 
$this->axis = new PolarAxis($this->img,$this->scale);
$this->SetMargin(40,40,50,40);
}
 
function SetType($aType) {
$this->iType = $aType;
}
 
function SetPlotSize($w,$h) {
$this->SetMargin(($this->img->width-$w)/2,($this->img->width-$w)/2,
($this->img->height-$h)/2,($this->img->height-$h)/2);
}
 
// Private methods
function GetPlotsMax() {
$n = count($this->plots);
$m = $this->plots[0]->Max();
$i=1;
while($i < $n) {
$m = max($this->plots[$i]->Max(),$m);
++$i;
}
return $m;
}
 
function Stroke($aStrokeFileName="") {
 
// Start by adjusting the margin so that potential titles will fit.
$this->AdjustMarginsForTitles();
 
// 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;
 
//Check if we should autoscale axis
if( !$this->scale->IsSpecified() && count($this->plots)>0 ) {
$max = $this->GetPlotsMax();
$t1 = $this->img->plotwidth;
$this->img->plotwidth /= 2;
$t2 = $this->img->left_margin;
$this->img->left_margin += $this->img->plotwidth+1;
$this->scale->AutoScale($this->img,0,$max,
$this->img->plotwidth/$this->xtick_factor/2);
$this->img->plotwidth = $t1;
$this->img->left_margin = $t2;
}
else {
// The tick calculation will use the user suplied min/max values to determine
// the ticks. If auto_ticks is false the exact user specifed min and max
// values will be used for the scale.
// If auto_ticks is true then the scale might be slightly adjusted
// so that the min and max values falls on an even major step.
//$min = 0;
$max = $this->scale->scale[1];
$t1 = $this->img->plotwidth;
$this->img->plotwidth /= 2;
$t2 = $this->img->left_margin;
$this->img->left_margin += $this->img->plotwidth+1;
$this->scale->AutoScale($this->img,0,$max,
$this->img->plotwidth/$this->xtick_factor/2);
$this->img->plotwidth = $t1;
$this->img->left_margin = $t2;
}
 
if( $this->iType == POLAR_180 ) {
$pos = $this->img->height - $this->img->bottom_margin;
}
else {
$pos = $this->img->plotheight/2 + $this->img->top_margin;
}
 
if( !$_csim ) {
$this->StrokePlotArea();
}
 
$this->iDoClipping = true;
 
if( $this->iDoClipping ) {
$oldimage = $this->img->CloneCanvasH();
}
 
if( !$_csim ) {
$this->axis->StrokeGrid($pos);
}
 
// Stroke all plots for Y1 axis
for($i=0; $i < count($this->plots); ++$i) {
$this->plots[$i]->Stroke($this->img,$this->scale);
}
 
 
if( $this->iDoClipping ) {
// Clipping only supports graphs at 0 and 90 degrees
if( $this->img->a == 0 ) {
$this->img->CopyCanvasH($oldimage,$this->img->img,
$this->img->left_margin,$this->img->top_margin,
$this->img->left_margin,$this->img->top_margin,
$this->img->plotwidth+1,$this->img->plotheight+1);
}
elseif( $this->img->a == 90 ) {
$adj1 = round(($this->img->height - $this->img->width)/2);
$adj2 = round(($this->img->width - $this->img->height)/2);
$lm = $this->img->left_margin;
$rm = $this->img->right_margin;
$tm = $this->img->top_margin;
$bm = $this->img->bottom_margin;
$this->img->CopyCanvasH($oldimage,$this->img->img,
$adj2 + round(($lm-$rm+$tm+$bm)/2),
$adj1 + round(($tm-$bm+$lm+$rm)/2),
$adj2 + round(($lm-$rm+$tm+$bm)/2),
$adj1 + round(($tm-$bm+$lm+$rm)/2),
$this->img->plotheight+1,
$this->img->plotwidth+1);
}
$this->img->Destroy();
$this->img->SetCanvasH($oldimage);
}
 
if( !$_csim ) {
$this->axis->Stroke($pos);
$this->axis->StrokeAngleLabels($pos,$this->iType);
}
 
if( !$_csim ) {
$this->StrokePlotBox();
$this->footer->Stroke($this->img);
 
// The titles and legends never gets rotated so make sure
// that the angle is 0 before stroking them
$aa = $this->img->SetAngle(0);
$this->StrokeTitles();
}
 
for($i=0; $i < count($this->plots) ; ++$i ) {
$this->plots[$i]->Legend($this);
}
 
$this->legend->Stroke($this->img);
 
if( !$_csim ) {
 
$this->StrokeTexts();
$this->img->SetAngle($aa);
 
// Draw an outline around the image map
if(_JPG_DEBUG)
$this->DisplayClientSideaImageMapAreas();
 
// If the filename is given as the special "__handle"
// 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);
}
}
}
}
 
 
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_pie.php
New file
0,0 → 1,1462
<?php
/*=======================================================================
// File: JPGRAPH_PIE.PHP
// Description: Pie plot extension for JpGraph
// Created: 2001-02-14
// Ver: $Id: jpgraph_pie.php 1926 2010-01-11 16:33:07Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
 
 
// Defines for PiePlot::SetLabelType()
define("PIE_VALUE_ABS",1);
define("PIE_VALUE_PER",0);
define("PIE_VALUE_PERCENTAGE",0);
define("PIE_VALUE_ADJPERCENTAGE",2);
define("PIE_VALUE_ADJPER",2);
 
//===================================================
// CLASS PiePlot
// Description: Draws a pie plot
//===================================================
class PiePlot {
public $posx=0.5,$posy=0.5;
protected $radius=0.3;
protected $explode_radius=array(),$explode_all=false,$explode_r=20;
protected $labels=null, $legends=null;
protected $csimtargets=null,$csimwintargets=null; // Array of targets for CSIM
protected $csimareas=''; // Generated CSIM text
protected $csimalts=null; // ALT tags for corresponding target
protected $data=null;
public $title;
protected $startangle=0;
protected $weight=1, $color="black";
protected $legend_margin=6,$show_labels=true;
protected $themearr = array(
"earth" => array(136,34,40,45,46,62,63,134,74,10,120,136,141,168,180,77,209,218,346,395,89,430),
"pastel" => array(27,415,128,59,66,79,105,110,42,147,152,230,236,240,331,337,405,38),
"water" => array(8,370,24,40,335,56,213,237,268,14,326,387,10,388),
"sand" => array(27,168,34,170,19,50,65,72,131,209,46,393));
protected $theme="earth";
protected $setslicecolors=array();
protected $labeltype=0; // Default to percentage
protected $pie_border=true,$pie_interior_border=true;
public $value;
protected $ishadowcolor='',$ishadowdrop=4;
protected $ilabelposadj=1;
protected $legendcsimtargets = array(),$legendcsimwintargets = array();
protected $legendcsimalts = array();
protected $adjusted_data = array();
public $guideline = null;
protected $guidelinemargin=10,$iShowGuideLineForSingle = false;
protected $iGuideLineCurve = false,$iGuideVFactor=1.4,$iGuideLineRFactor=0.8;
protected $la = array(); // Holds the exact angle for each label
 
//---------------
// CONSTRUCTOR
function __construct($data) {
$this->data = array_reverse($data);
$this->title = new Text("");
$this->title->SetFont(FF_FONT1,FS_BOLD);
$this->value = new DisplayValue();
$this->value->Show();
$this->value->SetFormat('%.1f%%');
$this->guideline = new LineProperty();
}
 
//---------------
// PUBLIC METHODS
function SetCenter($x,$y=0.5) {
$this->posx = $x;
$this->posy = $y;
}
 
// Enable guideline and set drwaing policy
function SetGuideLines($aFlg=true,$aCurved=true,$aAlways=false) {
$this->guideline->Show($aFlg);
$this->iShowGuideLineForSingle = $aAlways;
$this->iGuideLineCurve = $aCurved;
}
 
// Adjuste the distance between labels and labels and pie
function SetGuideLinesAdjust($aVFactor,$aRFactor=0.8) {
$this->iGuideVFactor=$aVFactor;
$this->iGuideLineRFactor=$aRFactor;
}
 
function SetColor($aColor) {
$this->color = $aColor;
}
 
function SetSliceColors($aColors) {
$this->setslicecolors = $aColors;
}
 
function SetShadow($aColor='darkgray',$aDropWidth=4) {
$this->ishadowcolor = $aColor;
$this->ishadowdrop = $aDropWidth;
}
 
function SetCSIMTargets($aTargets,$aAlts='',$aWinTargets='') {
$this->csimtargets=array_reverse($aTargets);
if( is_array($aWinTargets) )
$this->csimwintargets=array_reverse($aWinTargets);
if( is_array($aAlts) )
$this->csimalts=array_reverse($aAlts);
}
 
function GetCSIMareas() {
return $this->csimareas;
}
 
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
//Slice number, ellipse centre (x,y), height, width, start angle, end angle
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
 
$sa = 2*M_PI - $sa;
$ea = 2*M_PI - $ea;
 
// Special case when we have only one slice since then both start and end
// angle will be == 0
if( abs($sa - $ea) < 0.0001 ) {
$sa=2*M_PI; $ea=0;
}
 
//add coordinates of the centre to the map
$xc = floor($xc);$yc=floor($yc);
$coords = "$xc, $yc";
 
//add coordinates of the first point on the arc to the map
$xp = floor(($radius*cos($ea))+$xc);
$yp = floor($yc-$radius*sin($ea));
$coords.= ", $xp, $yp";
 
//add coordinates every 0.2 radians
$a=$ea+0.2;
 
// If we cross the 360-limit with a slice we need to handle
// the fact that end angle is smaller than start
if( $sa < $ea ) {
while ($a <= 2*M_PI) {
$xp = floor($radius*cos($a)+$xc);
$yp = floor($yc-$radius*sin($a));
$coords.= ", $xp, $yp";
$a += 0.2;
}
$a -= 2*M_PI;
}
 
 
while ($a < $sa) {
$xp = floor($radius*cos($a)+$xc);
$yp = floor($yc-$radius*sin($a));
$coords.= ", $xp, $yp";
$a += 0.2;
}
 
//Add the last point on the arc
$xp = floor($radius*cos($sa)+$xc);
$yp = floor($yc-$radius*sin($sa));
$coords.= ", $xp, $yp";
if( !empty($this->csimtargets[$i]) ) {
$this->csimareas .= "<area shape=\"poly\" coords=\"$coords\" href=\"".$this->csimtargets[$i]."\"";
$tmp="";
if( !empty($this->csimwintargets[$i]) ) {
$this->csimareas .= " target=\"".$this->csimwintargets[$i]."\" ";
}
if( !empty($this->csimalts[$i]) ) {
$tmp=sprintf($this->csimalts[$i],$this->data[$i]);
$this->csimareas .= " title=\"$tmp\" alt=\"$tmp\" ";
}
$this->csimareas .= " />\n";
}
}
 
 
function SetTheme($aTheme) {
if( in_array($aTheme,array_keys($this->themearr)) )
$this->theme = $aTheme;
else
JpGraphError::RaiseL(15001,$aTheme);//("PiePLot::SetTheme() Unknown theme: $aTheme");
}
 
function ExplodeSlice($e,$radius=20) {
if( ! is_integer($e) )
JpGraphError::RaiseL(15002);//('Argument to PiePlot::ExplodeSlice() must be an integer');
$this->explode_radius[$e]=$radius;
}
 
function ExplodeAll($radius=20) {
$this->explode_all=true;
$this->explode_r = $radius;
}
 
function Explode($aExplodeArr) {
if( !is_array($aExplodeArr) ) {
JpGraphError::RaiseL(15003);
//("Argument to PiePlot::Explode() must be an array with integer distances.");
}
$this->explode_radius = $aExplodeArr;
}
 
function SetStartAngle($aStart) {
if( $aStart < 0 || $aStart > 360 ) {
JpGraphError::RaiseL(15004);//('Slice start angle must be between 0 and 360 degrees.');
}
if( $aStart == 0 ) {
$this->startangle = 0;
}
else {
$this->startangle = 360-$aStart;
$this->startangle *= M_PI/180;
}
}
 
// Size in percentage
function SetSize($aSize) {
if( ($aSize>0 && $aSize<=0.5) || ($aSize>10 && $aSize<1000) )
$this->radius = $aSize;
else
JpGraphError::RaiseL(15006);
//("PiePlot::SetSize() Radius for pie must either be specified as a fraction [0, 0.5] of the size of the image or as an absolute size in pixels in the range [10, 1000]");
}
 
// Set label arrays
function SetLegends($aLegend) {
$this->legends = $aLegend;
}
 
// Set text labels for slices
function SetLabels($aLabels,$aLblPosAdj="auto") {
$this->labels = array_reverse($aLabels);
$this->ilabelposadj=$aLblPosAdj;
}
 
function SetLabelPos($aLblPosAdj) {
$this->ilabelposadj=$aLblPosAdj;
}
 
// Should we display actual value or percentage?
function SetLabelType($aType) {
if( $aType < 0 || $aType > 2 )
JpGraphError::RaiseL(15008,$aType);
//("PiePlot::SetLabelType() Type for pie plots must be 0 or 1 (not $t).");
$this->labeltype = $aType;
}
 
// Deprecated.
function SetValueType($aType) {
$this->SetLabelType($aType);
}
 
// Should the circle around a pie plot be displayed
function ShowBorder($exterior=true,$interior=true) {
$this->pie_border = $exterior;
$this->pie_interior_border = $interior;
}
 
// Setup the legends
function Legend($graph) {
$colors = array_keys($graph->img->rgb->rgb_table);
sort($colors);
$ta=$this->themearr[$this->theme];
$n = count($this->data);
 
if( $this->setslicecolors==null ) {
$numcolors=count($ta);
if( class_exists('PiePlot3D',false) && ($this instanceof PiePlot3D) ) {
$ta = array_reverse(array_slice($ta,0,$n));
}
}
else {
$this->setslicecolors = array_slice($this->setslicecolors,0,$n);
$numcolors=count($this->setslicecolors);
if( $graph->pieaa && !($this instanceof PiePlot3D) ) {
$this->setslicecolors = array_reverse($this->setslicecolors);
}
}
 
$sum=0;
for($i=0; $i < $n; ++$i)
$sum += $this->data[$i];
 
// Bail out with error if the sum is 0
if( $sum==0 )
JpGraphError::RaiseL(15009);//("Illegal pie plot. Sum of all data is zero for Pie!");
 
// Make sure we don't plot more values than data points
// (in case the user added more legends than data points)
$n = min(count($this->legends),count($this->data));
if( $this->legends != "" ) {
$this->legends = array_reverse(array_slice($this->legends,0,$n));
}
for( $i=$n-1; $i >= 0; --$i ) {
$l = $this->legends[$i];
// Replace possible format with actual values
if( count($this->csimalts) > $i ) {
$fmt = $this->csimalts[$i];
}
else {
$fmt = "%d"; // Deafult Alt if no other has been specified
}
if( $this->labeltype==0 ) {
$l = sprintf($l,100*$this->data[$i]/$sum);
$alt = sprintf($fmt,$this->data[$i]);
 
}
elseif( $this->labeltype == 1) {
$l = sprintf($l,$this->data[$i]);
$alt = sprintf($fmt,$this->data[$i]);
 
}
else {
$l = sprintf($l,$this->adjusted_data[$i]);
$alt = sprintf($fmt,$this->adjusted_data[$i]);
}
 
if( empty($this->csimwintargets[$i]) ) {
$wintarg = '';
}
else {
$wintarg = $this->csimwintargets[$i];
}
 
if( $this->setslicecolors==null ) {
$graph->legend->Add($l,$colors[$ta[$i%$numcolors]],"",0,$this->csimtargets[$i],$alt,$wintarg);
}
else {
$graph->legend->Add($l,$this->setslicecolors[$i%$numcolors],"",0,$this->csimtargets[$i],$alt,$wintarg);
}
}
}
 
// Adjust the rounded percetage value so that the sum of
// of the pie slices are always 100%
// Using the Hare/Niemeyer method
function AdjPercentage($aData,$aPrec=0) {
$mul=100;
if( $aPrec > 0 && $aPrec < 3 ) {
if( $aPrec == 1 )
$mul=1000;
else
$mul=10000;
}
 
$tmp = array();
$result = array();
$quote_sum=0;
$n = count($aData) ;
for( $i=0, $sum=0; $i < $n; ++$i )
$sum+=$aData[$i];
foreach($aData as $index => $value) {
$tmp_percentage=$value/$sum*$mul;
$result[$index]=floor($tmp_percentage);
$tmp[$index]=$tmp_percentage-$result[$index];
$quote_sum+=$result[$index];
}
if( $quote_sum == $mul) {
if( $mul > 100 ) {
$tmp = $mul / 100;
for( $i=0; $i < $n; ++$i ) {
$result[$i] /= $tmp ;
}
}
return $result;
}
arsort($tmp,SORT_NUMERIC);
reset($tmp);
for($i=0; $i < $mul-$quote_sum; $i++)
{
$result[key($tmp)]++;
next($tmp);
}
if( $mul > 100 ) {
$tmp = $mul / 100;
for( $i=0; $i < $n; ++$i ) {
$result[$i] /= $tmp ;
}
}
return $result;
}
 
 
function Stroke($img,$aaoption=0) {
// aaoption is used to handle antialias
// aaoption == 0 a normal pie
// aaoption == 1 just the body
// aaoption == 2 just the values
 
// Explode scaling. If anti alias we scale the image
// twice and we also need to scale the exploding distance
$expscale = $aaoption === 1 ? 2 : 1;
 
if( $this->labeltype == 2 ) {
// Adjust the data so that it will add up to 100%
$this->adjusted_data = $this->AdjPercentage($this->data);
}
 
$colors = array_keys($img->rgb->rgb_table);
sort($colors);
$ta=$this->themearr[$this->theme];
$n = count($this->data);
 
if( $this->setslicecolors==null ) {
$numcolors=count($ta);
}
else {
// We need to create an array of colors as long as the data
// since we need to reverse it to get the colors in the right order
$numcolors=count($this->setslicecolors);
$i = 2*$numcolors;
while( $n > $i ) {
$this->setslicecolors = array_merge($this->setslicecolors,$this->setslicecolors);
$i += $n;
}
$tt = array_slice($this->setslicecolors,0,$n % $numcolors);
$this->setslicecolors = array_merge($this->setslicecolors,$tt);
$this->setslicecolors = array_reverse($this->setslicecolors);
}
 
// Draw the slices
$sum=0;
for($i=0; $i < $n; ++$i)
$sum += $this->data[$i];
 
// Bail out with error if the sum is 0
if( $sum==0 ) {
JpGraphError::RaiseL(15009);//("Sum of all data is 0 for Pie.");
}
 
// Set up the pie-circle
if( $this->radius <= 1 ) {
$radius = floor($this->radius*min($img->width,$img->height));
}
else {
$radius = $aaoption === 1 ? $this->radius*2 : $this->radius;
}
 
if( $this->posx <= 1 && $this->posx > 0 ) {
$xc = round($this->posx*$img->width);
}
else {
$xc = $this->posx ;
}
 
if( $this->posy <= 1 && $this->posy > 0 ) {
$yc = round($this->posy*$img->height);
}
else {
$yc = $this->posy ;
}
 
$n = count($this->data);
 
if( $this->explode_all ) {
for($i=0; $i < $n; ++$i) {
$this->explode_radius[$i]=$this->explode_r;
}
}
 
// If we have a shadow and not just drawing the labels
if( $this->ishadowcolor != "" && $aaoption !== 2) {
$accsum=0;
$angle2 = $this->startangle;
$img->SetColor($this->ishadowcolor);
for($i=0; $sum > 0 && $i < $n; ++$i) {
$j = $n-$i-1;
$d = $this->data[$i];
$angle1 = $angle2;
$accsum += $d;
$angle2 = $this->startangle+2*M_PI*$accsum/$sum;
if( empty($this->explode_radius[$j]) ) {
$this->explode_radius[$j]=0;
}
 
if( $d < 0.00001 ) continue;
 
$la = 2*M_PI - (abs($angle2-$angle1)/2.0+$angle1);
 
$xcm = $xc + $this->explode_radius[$j]*cos($la)*$expscale;
$ycm = $yc - $this->explode_radius[$j]*sin($la)*$expscale;
 
$xcm += $this->ishadowdrop*$expscale;
$ycm += $this->ishadowdrop*$expscale;
 
$_sa = round($angle1*180/M_PI);
$_ea = round($angle2*180/M_PI);
 
// The CakeSlice method draws a full circle in case of start angle = end angle
// for pie slices we don't want this behaviour unless we only have one
// slice in the pie in case it is the wanted behaviour
if( $_ea-$_sa > 0.1 || $n==1 ) {
$img->CakeSlice($xcm,$ycm,$radius-1,$radius-1,
$angle1*180/M_PI,$angle2*180/M_PI,$this->ishadowcolor);
}
}
}
 
//--------------------------------------------------------------------------------
// This is the main loop to draw each cake slice
//--------------------------------------------------------------------------------
 
// Set up the accumulated sum, start angle for first slice and border color
$accsum=0;
$angle2 = $this->startangle;
$img->SetColor($this->color);
 
// Loop though all the slices if there is a pie to draw (sum>0)
// There are n slices in total
for($i=0; $sum>0 && $i < $n; ++$i) {
 
// $j is the actual index used for the slice
$j = $n-$i-1;
 
// Make sure we havea valid distance to explode the slice
if( empty($this->explode_radius[$j]) ) {
$this->explode_radius[$j]=0;
}
 
// The actual numeric value for the slice
$d = $this->data[$i];
 
$angle1 = $angle2;
 
// Accumlate the sum
$accsum += $d;
 
// The new angle when we add the "size" of this slice
// angle1 is then the start and angle2 the end of this slice
$angle2 = $this->NormAngle($this->startangle+2*M_PI*$accsum/$sum);
 
// We avoid some trouble by not allowing end angle to be 0, in that case
// we translate to 360
 
// la is used to hold the label angle, which is centered on the slice
if( $angle2 < 0.0001 && $angle1 > 0.0001 ) {
$this->la[$i] = 2*M_PI - (abs(2*M_PI-$angle1)/2.0+$angle1);
}
elseif( $angle1 > $angle2 ) {
// The case where the slice crosses the 3 a'clock line
// Remember that the slices are counted clockwise and
// labels are counted counter clockwise so we need to revert with 2 PI
$this->la[$i] = 2*M_PI-$this->NormAngle($angle1 + ((2*M_PI - $angle1)+$angle2)/2);
}
else {
$this->la[$i] = 2*M_PI - (abs($angle2-$angle1)/2.0+$angle1);
}
 
// Too avoid rounding problems we skip the slice if it is too small
if( $d < 0.00001 ) continue;
 
// If the user has specified an array of colors for each slice then use
// that a color otherwise use the theme array (ta) of colors
if( $this->setslicecolors==null ) {
$slicecolor=$colors[$ta[$i%$numcolors]];
}
else {
$slicecolor=$this->setslicecolors[$i%$numcolors];
}
 
// $_sa = round($angle1*180/M_PI);
// $_ea = round($angle2*180/M_PI);
// $_la = round($this->la[$i]*180/M_PI);
// echo "Slice#$i: ang1=$_sa , ang2=$_ea, la=$_la, color=$slicecolor<br>";
 
 
// If we have enabled antialias then we don't draw any border so
// make the bordedr color the same as the slice color
if( $this->pie_interior_border && $aaoption===0 ) {
$img->SetColor($this->color);
}
else {
$img->SetColor($slicecolor);
}
$arccolor = $this->pie_border && $aaoption===0 ? $this->color : "";
 
// Calculate the x,y coordinates for the base of this slice taking
// the exploded distance into account. Here we use the mid angle as the
// ray of extension and we have the mid angle handy as it is also the
// label angle
$xcm = $xc + $this->explode_radius[$j]*cos($this->la[$i])*$expscale;
$ycm = $yc - $this->explode_radius[$j]*sin($this->la[$i])*$expscale;
 
// If we are not just drawing the labels then draw this cake slice
if( $aaoption !== 2 ) {
 
$_sa = round($angle1*180/M_PI);
$_ea = round($angle2*180/M_PI);
$_la = round($this->la[$i]*180/M_PI);
//echo "[$i] sa=$_sa, ea=$_ea, la[$i]=$_la, (color=$slicecolor)<br>";
 
// The CakeSlice method draws a full circle in case of start angle = end angle
// for pie slices we want this in case the slice have a value larger than 99% of the
// total sum
if( abs($_ea-$_sa) >= 1 || $d == $sum ) {
$img->CakeSlice($xcm,$ycm,$radius-1,$radius-1,$_sa,$_ea,$slicecolor,$arccolor);
}
}
 
// If the CSIM is used then make sure we register a CSIM area for this slice as well
if( $this->csimtargets && $aaoption !== 1 ) {
$this->AddSliceToCSIM($i,$xcm,$ycm,$radius,$angle1,$angle2);
}
}
 
// Format the titles for each slice
if( $aaoption !== 2 ) {
for( $i=0; $i < $n; ++$i) {
if( $this->labeltype==0 ) {
if( $sum != 0 )
$l = 100.0*$this->data[$i]/$sum;
else
$l = 0.0;
}
elseif( $this->labeltype==1 ) {
$l = $this->data[$i]*1.0;
}
else {
$l = $this->adjusted_data[$i];
}
if( isset($this->labels[$i]) && is_string($this->labels[$i]) )
$this->labels[$i]=sprintf($this->labels[$i],$l);
else
$this->labels[$i]=$l;
}
}
 
if( $this->value->show && $aaoption !== 1 ) {
$this->StrokeAllLabels($img,$xc,$yc,$radius);
}
 
// Adjust title position
if( $aaoption !== 1 ) {
$this->title->SetPos($xc,
$yc-$this->title->GetFontHeight($img)-$radius-$this->title->margin,
"center","bottom");
$this->title->Stroke($img);
}
 
}
 
//---------------
// PRIVATE METHODS
 
function NormAngle($a) {
while( $a < 0 ) $a += 2*M_PI;
while( $a > 2*M_PI ) $a -= 2*M_PI;
return $a;
}
 
function Quadrant($a) {
$a=$this->NormAngle($a);
if( $a > 0 && $a <= M_PI/2 )
return 0;
if( $a > M_PI/2 && $a <= M_PI )
return 1;
if( $a > M_PI && $a <= 1.5*M_PI )
return 2;
if( $a > 1.5*M_PI )
return 3;
}
 
function StrokeGuideLabels($img,$xc,$yc,$radius) {
$n = count($this->labels);
 
//-----------------------------------------------------------------------
// Step 1 of the algorithm is to construct a number of clusters
// a cluster is defined as all slices within the same quadrant (almost)
// that has an angular distance less than the treshold
//-----------------------------------------------------------------------
$tresh_hold=25 * M_PI/180; // 25 degrees difference to be in a cluster
$incluster=false; // flag if we are currently in a cluster or not
$clusters = array(); // array of clusters
$cidx=-1; // running cluster index
 
// Go through all the labels and construct a number of clusters
for($i=0; $i < $n-1; ++$i) {
// Calc the angle distance between two consecutive slices
$a1=$this->la[$i];
$a2=$this->la[$i+1];
$q1 = $this->Quadrant($a1);
$q2 = $this->Quadrant($a2);
$diff = abs($a1-$a2);
if( $diff < $tresh_hold ) {
if( $incluster ) {
$clusters[$cidx][1]++;
// Each cluster can only cover one quadrant
// Do we cross a quadrant ( and must break the cluster)
if( $q1 != $q2 ) {
// If we cross a quadrant boundary we normally start a
// new cluster. However we need to take the 12'a clock
// and 6'a clock positions into a special consideration.
// Case 1: WE go from q=1 to q=2 if the last slice on
// the cluster for q=1 is close to 12'a clock and the
// first slice in q=0 is small we extend the previous
// cluster
if( $q1 == 1 && $q2 == 0 && $a2 > (90-15)*M_PI/180 ) {
if( $i < $n-2 ) {
$a3 = $this->la[$i+2];
// If there isn't a cluster coming up with the next-next slice
// we extend the previous cluster to cover this slice as well
if( abs($a3-$a2) >= $tresh_hold ) {
$clusters[$cidx][1]++;
$i++;
}
}
}
elseif( $q1 == 3 && $q2 == 2 && $a2 > (270-15)*M_PI/180 ) {
if( $i < $n-2 ) {
$a3 = $this->la[$i+2];
// If there isn't a cluster coming up with the next-next slice
// we extend the previous cluster to cover this slice as well
if( abs($a3-$a2) >= $tresh_hold ) {
$clusters[$cidx][1]++;
$i++;
}
}
}
 
if( $q1==2 && $q2==1 && $a2 > (180-15)*M_PI/180 ) {
$clusters[$cidx][1]++;
$i++;
}
 
$incluster = false;
}
}
elseif( $q1 == $q2) {
$incluster = true;
// Now we have a special case for quadrant 0. If we previously
// have a cluster of one in quadrant 0 we just extend that
// cluster. If we don't do this then we risk that the label
// for the cluster of one will cross the guide-line
if( $q1 == 0 && $cidx > -1 &&
$clusters[$cidx][1] == 1 &&
$this->Quadrant($this->la[$clusters[$cidx][0]]) == 0 ) {
$clusters[$cidx][1]++;
}
else {
$cidx++;
$clusters[$cidx][0] = $i;
$clusters[$cidx][1] = 1;
}
}
else {
// Create a "cluster" of one since we are just crossing
// a quadrant
$cidx++;
$clusters[$cidx][0] = $i;
$clusters[$cidx][1] = 1;
}
}
else {
if( $incluster ) {
// Add the last slice
$clusters[$cidx][1]++;
$incluster = false;
}
else { // Create a "cluster" of one
$cidx++;
$clusters[$cidx][0] = $i;
$clusters[$cidx][1] = 1;
}
}
}
// Handle the very last slice
if( $incluster ) {
$clusters[$cidx][1]++;
}
else { // Create a "cluster" of one
$cidx++;
$clusters[$cidx][0] = $i;
$clusters[$cidx][1] = 1;
}
 
/*
if( true ) {
// Debug printout in labels
for( $i=0; $i <= $cidx; ++$i ) {
for( $j=0; $j < $clusters[$i][1]; ++$j ) {
$a = $this->la[$clusters[$i][0]+$j];
$aa = round($a*180/M_PI);
$q = $this->Quadrant($a);
$this->labels[$clusters[$i][0]+$j]="[$q:$aa] $i:$j";
}
}
}
*/
 
//-----------------------------------------------------------------------
// Step 2 of the algorithm is use the clusters and draw the labels
// and guidelines
//-----------------------------------------------------------------------
 
// We use the font height as the base factor for how far we need to
// spread the labels in the Y-direction.
$this->value->ApplyFont($img);
$fh = $img->GetFontHeight();
$origvstep=$fh*$this->iGuideVFactor;
$this->value->SetMargin(0);
 
// Number of clusters found
$nc = count($clusters);
 
// Walk through all the clusters
for($i=0; $i < $nc; ++$i) {
 
// Start angle and number of slices in this cluster
$csize = $clusters[$i][1];
$a = $this->la[$clusters[$i][0]];
$q = $this->Quadrant($a);
 
// Now set up the start and end conditions to make sure that
// in each cluster we walk through the all the slices starting with the slice
// closest to the equator. Since all slices are numbered clockwise from "3'a clock"
// we have different conditions depending on in which quadrant the slice lies within.
if( $q == 0 ) {
$start = $csize-1; $idx = $start; $step = -1; $vstep = -$origvstep;
}
elseif( $q == 1 ) {
$start = 0; $idx = $start; $step = 1; $vstep = -$origvstep;
}
elseif( $q == 2 ) {
$start = $csize-1; $idx = $start; $step = -1; $vstep = $origvstep;
}
elseif( $q == 3 ) {
$start = 0; $idx = $start; $step = 1; $vstep = $origvstep;
}
 
// Walk through all slices within this cluster
for($j=0; $j < $csize; ++$j) {
// Now adjust the position of the labels in each cluster starting
// with the slice that is closest to the equator of the pie
$a = $this->la[$clusters[$i][0]+$idx];
 
// Guide line start in the center of the arc of the slice
$r = $radius+$this->explode_radius[$n-1-($clusters[$i][0]+$idx)];
$x = round($r*cos($a)+$xc);
$y = round($yc-$r*sin($a));
 
// The distance from the arc depends on chosen font and the "R-Factor"
$r += $fh*$this->iGuideLineRFactor;
 
// Should the labels be placed curved along the pie or in straight columns
// outside the pie?
if( $this->iGuideLineCurve )
$xt=round($r*cos($a)+$xc);
 
// If this is the first slice in the cluster we need some first time
// proessing
if( $idx == $start ) {
if( ! $this->iGuideLineCurve )
$xt=round($r*cos($a)+$xc);
$yt=round($yc-$r*sin($a));
 
// Some special consideration in case this cluster starts
// in quadrant 1 or 3 very close to the "equator" (< 20 degrees)
// and the previous clusters last slice is within the tolerance.
// In that case we add a font height to this labels Y-position
// so it doesn't collide with
// the slice in the previous cluster
$prevcluster = ($i + ($nc-1) ) % $nc;
$previdx=$clusters[$prevcluster][0]+$clusters[$prevcluster][1]-1;
if( $q == 1 && $a > 160*M_PI/180 ) {
// Get the angle for the previous clusters last slice
$diff = abs($a-$this->la[$previdx]);
if( $diff < $tresh_hold ) {
$yt -= $fh;
}
}
elseif( $q == 3 && $a > 340*M_PI/180 ) {
// We need to subtract 360 to compare angle distance between
// q=0 and q=3
$diff = abs($a-$this->la[$previdx]-360*M_PI/180);
if( $diff < $tresh_hold ) {
$yt += $fh;
}
}
 
}
else {
// The step is at minimum $vstep but if the slices are relatively large
// we make sure that we add at least a step that corresponds to the vertical
// distance between the centers at the arc on the slice
$prev_a = $this->la[$clusters[$i][0]+($idx-$step)];
$dy = abs($radius*(sin($a)-sin($prev_a))*1.2);
if( $vstep > 0 )
$yt += max($vstep,$dy);
else
$yt += min($vstep,-$dy);
}
 
$label = $this->labels[$clusters[$i][0]+$idx];
 
if( $csize == 1 ) {
// A "meta" cluster with only one slice
$r = $radius+$this->explode_radius[$n-1-($clusters[$i][0]+$idx)];
$rr = $r+$img->GetFontHeight()/2;
$xt=round($rr*cos($a)+$xc);
$yt=round($yc-$rr*sin($a));
$this->StrokeLabel($label,$img,$xc,$yc,$a,$r);
if( $this->iShowGuideLineForSingle )
$this->guideline->Stroke($img,$x,$y,$xt,$yt);
}
else {
$this->guideline->Stroke($img,$x,$y,$xt,$yt);
if( $q==1 || $q==2 ) {
// Left side of Pie
$this->guideline->Stroke($img,$xt,$yt,$xt-$this->guidelinemargin,$yt);
$lbladj = -$this->guidelinemargin-5;
$this->value->halign = "right";
$this->value->valign = "center";
}
else {
// Right side of pie
$this->guideline->Stroke($img,$xt,$yt,$xt+$this->guidelinemargin,$yt);
$lbladj = $this->guidelinemargin+5;
$this->value->halign = "left";
$this->value->valign = "center";
}
$this->value->Stroke($img,$label,$xt+$lbladj,$yt);
}
 
// Udate idx to point to next slice in the cluster to process
$idx += $step;
}
}
}
 
function StrokeAllLabels($img,$xc,$yc,$radius) {
// First normalize all angles for labels
$n = count($this->la);
for($i=0; $i < $n; ++$i) {
$this->la[$i] = $this->NormAngle($this->la[$i]);
}
if( $this->guideline->iShow ) {
$this->StrokeGuideLabels($img,$xc,$yc,$radius);
}
else {
$n = count($this->labels);
for($i=0; $i < $n; ++$i) {
$this->StrokeLabel($this->labels[$i],$img,$xc,$yc,
$this->la[$i],
$radius + $this->explode_radius[$n-1-$i]);
}
}
}
 
// Position the labels of each slice
function StrokeLabel($label,$img,$xc,$yc,$a,$r) {
 
// Default value
if( $this->ilabelposadj === 'auto' )
$this->ilabelposadj = 0.65;
 
// We position the values diferently depending on if they are inside
// or outside the pie
if( $this->ilabelposadj < 1.0 ) {
 
$this->value->SetAlign('center','center');
$this->value->margin = 0;
 
$xt=round($this->ilabelposadj*$r*cos($a)+$xc);
$yt=round($yc-$this->ilabelposadj*$r*sin($a));
 
$this->value->Stroke($img,$label,$xt,$yt);
}
else {
 
$this->value->halign = "left";
$this->value->valign = "top";
$this->value->margin = 0;
 
// Position the axis title.
// dx, dy is the offset from the top left corner of the bounding box that sorrounds the text
// that intersects with the extension of the corresponding axis. The code looks a little
// bit messy but this is really the only way of having a reasonable position of the
// axis titles.
$this->value->ApplyFont($img);
$h=$img->GetTextHeight($label);
// For numeric values the format of the display value
// must be taken into account
if( is_numeric($label) ) {
if( $label > 0 )
$w=$img->GetTextWidth(sprintf($this->value->format,$label));
else
$w=$img->GetTextWidth(sprintf($this->value->negformat,$label));
}
else
$w=$img->GetTextWidth($label);
 
if( $this->ilabelposadj > 1.0 && $this->ilabelposadj < 5.0) {
$r *= $this->ilabelposadj;
}
 
$r += $img->GetFontHeight()/1.5;
 
$xt=round($r*cos($a)+$xc);
$yt=round($yc-$r*sin($a));
 
// Normalize angle
while( $a < 0 ) $a += 2*M_PI;
while( $a > 2*M_PI ) $a -= 2*M_PI;
 
if( $a>=7*M_PI/4 || $a <= M_PI/4 ) $dx=0;
if( $a>=M_PI/4 && $a <= 3*M_PI/4 ) $dx=($a-M_PI/4)*2/M_PI;
if( $a>=3*M_PI/4 && $a <= 5*M_PI/4 ) $dx=1;
if( $a>=5*M_PI/4 && $a <= 7*M_PI/4 ) $dx=(1-($a-M_PI*5/4)*2/M_PI);
 
if( $a>=7*M_PI/4 ) $dy=(($a-M_PI)-3*M_PI/4)*2/M_PI;
if( $a<=M_PI/4 ) $dy=(1-$a*2/M_PI);
if( $a>=M_PI/4 && $a <= 3*M_PI/4 ) $dy=1;
if( $a>=3*M_PI/4 && $a <= 5*M_PI/4 ) $dy=(1-($a-3*M_PI/4)*2/M_PI);
if( $a>=5*M_PI/4 && $a <= 7*M_PI/4 ) $dy=0;
 
$this->value->Stroke($img,$label,$xt-$dx*$w,$yt-$dy*$h);
}
}
} // Class
 
 
//===================================================
// CLASS PiePlotC
// Description: Same as a normal pie plot but with a
// filled circle in the center
//===================================================
class PiePlotC extends PiePlot {
private $imidsize=0.5; // Fraction of total width
private $imidcolor='white';
public $midtitle='';
private $middlecsimtarget='',$middlecsimwintarget='',$middlecsimalt='';
 
function __construct($data,$aCenterTitle='') {
parent::__construct($data);
$this->midtitle = new Text();
$this->midtitle->ParagraphAlign('center');
}
 
function SetMid($aTitle,$aColor='white',$aSize=0.5) {
$this->midtitle->Set($aTitle);
 
$this->imidsize = $aSize ;
$this->imidcolor = $aColor ;
}
 
function SetMidTitle($aTitle) {
$this->midtitle->Set($aTitle);
}
 
function SetMidSize($aSize) {
$this->imidsize = $aSize ;
}
 
function SetMidColor($aColor) {
$this->imidcolor = $aColor ;
}
 
function SetMidCSIM($aTarget,$aAlt='',$aWinTarget='') {
$this->middlecsimtarget = $aTarget;
$this->middlecsimwintarget = $aWinTarget;
$this->middlecsimalt = $aAlt;
}
 
function AddSliceToCSIM($i,$xc,$yc,$radius,$sa,$ea) {
//Slice number, ellipse centre (x,y), radius, start angle, end angle
while( $sa > 2*M_PI ) $sa = $sa - 2*M_PI;
while( $ea > 2*M_PI ) $ea = $ea - 2*M_PI;
 
$sa = 2*M_PI - $sa;
$ea = 2*M_PI - $ea;
 
// Special case when we have only one slice since then both start and end
// angle will be == 0
if( abs($sa - $ea) < 0.0001 ) {
$sa=2*M_PI; $ea=0;
}
 
// Add inner circle first point
$xp = floor(($this->imidsize*$radius*cos($ea))+$xc);
$yp = floor($yc-($this->imidsize*$radius*sin($ea)));
$coords = "$xp, $yp";
 
//add coordinates every 0.25 radians
$a=$ea+0.25;
 
// If we cross the 360-limit with a slice we need to handle
// the fact that end angle is smaller than start
if( $sa < $ea ) {
while ($a <= 2*M_PI) {
$xp = floor($radius*cos($a)+$xc);
$yp = floor($yc-$radius*sin($a));
$coords.= ", $xp, $yp";
$a += 0.25;
}
$a -= 2*M_PI;
}
 
while ($a < $sa) {
$xp = floor(($this->imidsize*$radius*cos($a)+$xc));
$yp = floor($yc-($this->imidsize*$radius*sin($a)));
$coords.= ", $xp, $yp";
$a += 0.25;
}
 
// Make sure we end at the last point
$xp = floor(($this->imidsize*$radius*cos($sa)+$xc));
$yp = floor($yc-($this->imidsize*$radius*sin($sa)));
$coords.= ", $xp, $yp";
 
// Straight line to outer circle
$xp = floor($radius*cos($sa)+$xc);
$yp = floor($yc-$radius*sin($sa));
$coords.= ", $xp, $yp";
 
//add coordinates every 0.25 radians
$a=$sa - 0.25;
while ($a > $ea) {
$xp = floor($radius*cos($a)+$xc);
$yp = floor($yc-$radius*sin($a));
$coords.= ", $xp, $yp";
$a -= 0.25;
}
 
//Add the last point on the arc
$xp = floor($radius*cos($ea)+$xc);
$yp = floor($yc-$radius*sin($ea));
$coords.= ", $xp, $yp";
 
// Close the arc
$xp = floor(($this->imidsize*$radius*cos($ea))+$xc);
$yp = floor($yc-($this->imidsize*$radius*sin($ea)));
$coords .= ", $xp, $yp";
 
if( !empty($this->csimtargets[$i]) ) {
$this->csimareas .= "<area shape=\"poly\" coords=\"$coords\" href=\"".
$this->csimtargets[$i]."\"";
if( !empty($this->csimwintargets[$i]) ) {
$this->csimareas .= " target=\"".$this->csimwintargets[$i]."\" ";
}
if( !empty($this->csimalts[$i]) ) {
$tmp=sprintf($this->csimalts[$i],$this->data[$i]);
$this->csimareas .= " title=\"$tmp\" alt=\"$tmp\" ";
}
$this->csimareas .= " />\n";
}
}
 
 
function Stroke($img,$aaoption=0) {
 
// Stroke the pie but don't stroke values
$tmp = $this->value->show;
$this->value->show = false;
parent::Stroke($img,$aaoption);
$this->value->show = $tmp;
 
$xc = round($this->posx*$img->width);
$yc = round($this->posy*$img->height);
 
$radius = floor($this->radius * min($img->width,$img->height)) ;
 
 
if( $this->imidsize > 0 && $aaoption !== 2 ) {
 
if( $this->ishadowcolor != "" ) {
$img->SetColor($this->ishadowcolor);
$img->FilledCircle($xc+$this->ishadowdrop,$yc+$this->ishadowdrop,
round($radius*$this->imidsize));
}
 
$img->SetColor($this->imidcolor);
$img->FilledCircle($xc,$yc,round($radius*$this->imidsize));
 
if( $this->pie_border && $aaoption === 0 ) {
$img->SetColor($this->color);
$img->Circle($xc,$yc,round($radius*$this->imidsize));
}
 
if( !empty($this->middlecsimtarget) )
$this->AddMiddleCSIM($xc,$yc,round($radius*$this->imidsize));
 
}
 
if( $this->value->show && $aaoption !== 1) {
$this->StrokeAllLabels($img,$xc,$yc,$radius);
$this->midtitle->SetPos($xc,$yc,'center','center');
$this->midtitle->Stroke($img);
}
 
}
 
function AddMiddleCSIM($xc,$yc,$r) {
$xc=round($xc);$yc=round($yc);$r=round($r);
$this->csimareas .= "<area shape=\"circle\" coords=\"$xc,$yc,$r\" href=\"".
$this->middlecsimtarget."\"";
if( !empty($this->middlecsimwintarget) ) {
$this->csimareas .= " target=\"".$this->middlecsimwintarget."\"";
}
if( !empty($this->middlecsimalt) ) {
$tmp = $this->middlecsimalt;
$this->csimareas .= " title=\"$tmp\" alt=\"$tmp\" ";
}
$this->csimareas .= " />\n";
}
 
function StrokeLabel($label,$img,$xc,$yc,$a,$r) {
 
if( $this->ilabelposadj === 'auto' )
$this->ilabelposadj = (1-$this->imidsize)/2+$this->imidsize;
 
parent::StrokeLabel($label,$img,$xc,$yc,$a,$r);
 
}
 
}
 
 
//===================================================
// CLASS PieGraph
// Description:
//===================================================
class PieGraph extends Graph {
private $posx, $posy, $radius;
private $legends=array();
public $plots=array();
public $pieaa = false ;
//---------------
// CONSTRUCTOR
function __construct($width=300,$height=200,$cachedName="",$timeout=0,$inline=1) {
parent::__construct($width,$height,$cachedName,$timeout,$inline);
$this->posx=$width/2;
$this->posy=$height/2;
$this->SetColor(array(255,255,255));
}
 
//---------------
// PUBLIC METHODS
function Add($aObj) {
 
if( is_array($aObj) && count($aObj) > 0 )
$cl = $aObj[0];
else
$cl = $aObj;
 
if( $cl instanceof Text )
$this->AddText($aObj);
elseif( class_exists('IconPlot',false) && ($cl instanceof IconPlot) )
$this->AddIcon($aObj);
else {
if( is_array($aObj) ) {
$n = count($aObj);
for($i=0; $i < $n; ++$i ) {
$this->plots[] = $aObj[$i];
}
}
else {
$this->plots[] = $aObj;
}
}
}
 
function SetAntiAliasing($aFlg=true) {
$this->pieaa = $aFlg;
}
 
function SetColor($c) {
$this->SetMarginColor($c);
}
 
 
function DisplayCSIMAreas() {
$csim="";
foreach($this->plots as $p ) {
$csim .= $p->GetCSIMareas();
}
$csim.= $this->legend->GetCSIMareas();
if (preg_match_all("/area shape=\"(\w+)\" coords=\"([0-9\, ]+)\"/", $csim, $coords)) {
$this->img->SetColor($this->csimcolor);
$n = count($coords[0]);
for ($i=0; $i < $n; $i++) {
if ($coords[1][$i]=="poly") {
preg_match_all('/\s*([0-9]+)\s*,\s*([0-9]+)\s*,*/',$coords[2][$i],$pts);
$this->img->SetStartPoint($pts[1][count($pts[0])-1],$pts[2][count($pts[0])-1]);
$m = count($pts[0]);
for ($j=0; $j < $m; $j++) {
$this->img->LineTo($pts[1][$j],$pts[2][$j]);
}
} else if ($coords[1][$i]=="rect") {
$pts = preg_split('/,/', $coords[2][$i]);
$this->img->SetStartPoint($pts[0],$pts[1]);
$this->img->LineTo($pts[2],$pts[1]);
$this->img->LineTo($pts[2],$pts[3]);
$this->img->LineTo($pts[0],$pts[3]);
$this->img->LineTo($pts[0],$pts[1]);
 
}
}
}
}
 
// Method description
function Stroke($aStrokeFileName="") {
// 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);
 
// If we are called the second time (perhaps the user has called GetHTMLImageMap()
// himself then the legends have alsready been populated once in order to get the
// CSIM coordinats. Since we do not want the legends to be populated a second time
// we clear the legends
$this->legend->Clear();
 
// 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;
 
$n = count($this->plots);
 
if( $this->pieaa ) {
 
if( !$_csim ) {
if( $this->background_image != "" ) {
$this->StrokeFrameBackground();
}
else {
$this->StrokeFrame();
$this->StrokeBackgroundGrad();
}
}
 
 
$w = $this->img->width;
$h = $this->img->height;
$oldimg = $this->img->img;
 
$this->img->CreateImgCanvas(2*$w,2*$h);
 
$this->img->SetColor( $this->margin_color );
$this->img->FilledRectangle(0,0,2*$w-1,2*$h-1);
 
// Make all icons *2 i size since we will be scaling down the
// imahe to do the anti aliasing
$ni = count($this->iIcons);
for($i=0; $i < $ni; ++$i) {
$this->iIcons[$i]->iScale *= 2 ;
if( $this->iIcons[$i]->iX > 1 )
$this->iIcons[$i]->iX *= 2 ;
if( $this->iIcons[$i]->iY > 1 )
$this->iIcons[$i]->iY *= 2 ;
}
 
$this->StrokeIcons();
 
for($i=0; $i < $n; ++$i) {
if( $this->plots[$i]->posx > 1 )
$this->plots[$i]->posx *= 2 ;
if( $this->plots[$i]->posy > 1 )
$this->plots[$i]->posy *= 2 ;
 
$this->plots[$i]->Stroke($this->img,1);
 
if( $this->plots[$i]->posx > 1 )
$this->plots[$i]->posx /= 2 ;
if( $this->plots[$i]->posy > 1 )
$this->plots[$i]->posy /= 2 ;
}
 
$indent = $this->doframe ? ($this->frame_weight + ($this->doshadow ? $this->shadow_width : 0 )) : 0 ;
$indent += $this->framebevel ? $this->framebeveldepth + 1 : 0 ;
$this->img->CopyCanvasH($oldimg,$this->img->img,$indent,$indent,$indent,$indent,
$w-2*$indent,$h-2*$indent,2*($w-$indent),2*($h-$indent));
 
$this->img->img = $oldimg ;
$this->img->width = $w ;
$this->img->height = $h ;
 
for($i=0; $i < $n; ++$i) {
$this->plots[$i]->Stroke($this->img,2); // Stroke labels
$this->plots[$i]->Legend($this);
}
 
}
else {
 
if( !$_csim ) {
if( $this->background_image != "" ) {
$this->StrokeFrameBackground();
}
else {
$this->StrokeFrame();
$this->StrokeBackgroundGrad();
}
}
 
$this->StrokeIcons();
 
for($i=0; $i < $n; ++$i) {
$this->plots[$i]->Stroke($this->img);
$this->plots[$i]->Legend($this);
}
}
 
$this->legend->Stroke($this->img);
$this->footer->Stroke($this->img);
$this->StrokeTitles();
 
if( !$_csim ) {
 
// Stroke texts
if( $this->texts != null ) {
$n = count($this->texts);
for($i=0; $i < $n; ++$i ) {
$this->texts[$i]->Stroke($this->img);
}
}
 
if( _JPG_DEBUG ) {
$this->DisplayCSIMAreas();
}
 
// Should we do any final image transformation
if( $this->iImgTrans ) {
if( !class_exists('ImgTrans',false) ) {
require_once('jpgraph_imgtrans.php');
//JpGraphError::Raise('In order to use image transformation you must include the file jpgraph_imgtrans.php in your script.');
}
 
$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 "__handle"
// 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);
}
}
}
} // Class
 
/* EOF */
?>
/tags/v1.0-aigle/composants/statistiques/lib/imgdata_stars.inc.php
New file
0,0 → 1,144
<?php
//=======================================================================
// File: IMGDATA_STARS.INC
// Description: Base64 encoded images for stars
// Created: 2003-03-20
// Ver: $Id: imgdata_stars.inc.php 1106 2009-02-22 20:16:35Z 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 __construct() {
//==========================================================
// 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==' ;
}
}
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/imgdata_balls.inc.php
New file
0,0 → 1,1061
<?php
//=======================================================================
// File: IMGDATA_ROUNDBALLS.INC
// Description: Base64 encoded images for small round markers
// Created: 2003-03-20
// Ver: $Id: imgdata_balls.inc.php 1106 2009-02-22 20:16:35Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
 
class ImgData_Balls extends ImgData {
protected $name = 'Round Balls';
protected $an = array(MARK_IMG_LBALL => 'imgdata_large',
MARK_IMG_MBALL => 'imgdata_small',
MARK_IMG_SBALL => 'imgdata_xsmall',
MARK_IMG_BALL => 'imgdata_xsmall');
protected $colors,$index,$maxidx;
private $colors_1 = array('blue','lightblue','brown','darkgreen',
'green','purple','red','gray','yellow','silver','gray');
private $index_1 = array('blue'=>9,'lightblue'=>1,'brown'=>6,'darkgreen'=>7,
'green'=>8,'purple'=>4,'red'=>0,'gray'=>5,'silver'=>3,'yellow'=>2);
private $maxidx_1 = 9 ;
 
private $colors_2 = array('blue','bluegreen','brown','cyan',
'darkgray','greengray','gray','green',
'greenblue','lightblue','lightred',
'purple','red','white','yellow');
 
private $index_2 = array('blue'=>9,'bluegreen'=>13,'brown'=>8,'cyan'=>12,
'darkgray'=>5,'greengray'=>6,'gray'=>2,'green'=>10,
'greenblue'=>3,'lightblue'=>1,'lightred'=>14,
'purple'=>7,'red'=>0,'white'=>11,'yellow'=>4);
private $maxidx_2 = 14 ;
 
 
private $colors_3 = array('bluegreen','cyan','darkgray','greengray',
'gray','graypurple','green','greenblue','lightblue',
'lightred','navy','orange','purple','red','yellow');
 
private $index_3 = array('bluegreen'=>1,'cyan'=>11,'darkgray'=>14,'greengray'=>10,
'gray'=>3,'graypurple'=>4,'green'=>9,'greenblue'=>7,
'lightblue'=>13,'lightred'=>0,'navy'=>2,'orange'=>12,
'purple'=>8,'red'=>5,'yellow'=>6);
private $maxidx_3 = 14 ;
 
protected $imgdata_large, $imgdata_small, $imgdata_xsmall ;
 
 
function GetImg($aMark,$aIdx) {
switch( $aMark ) {
case MARK_IMG_SBALL:
case MARK_IMG_BALL:
$this->colors = $this->colors_3;
$this->index = $this->index_3 ;
$this->maxidx = $this->maxidx_3 ;
break;
case MARK_IMG_MBALL:
$this->colors = $this->colors_2;
$this->index = $this->index_2 ;
$this->maxidx = $this->maxidx_2 ;
break;
default:
$this->colors = $this->colors_1;
$this->index = $this->index_1 ;
$this->maxidx = $this->maxidx_1 ;
break;
}
return parent::GetImg($aMark,$aIdx);
}
 
function __construct() {
 
//==========================================================
// File: bl_red.png
//==========================================================
$this->imgdata_large[0][0]= 1072 ;
$this->imgdata_large[0][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAByF'.
'BMVEX/////////xsb/vb3/lIz/hIT/e3v/c3P/c2v/a2v/Y2P/'.
'UlL/Skr/SkL/Qjn/MTH/MSn/KSn/ISH/IRj/GBj/GBD/EBD/EA'.
'j/CAj/CAD/AAD3QkL3MTH3KSn3KSH3GBj3EBD3CAj3AAD1zMzv'.
'QkLvISHvIRjvGBjvEBDvEAjvAADnUlLnSkrnMTnnKSnnIRjnGB'.
'DnEBDnCAjnAADec3PeSkreISHeGBjeGBDeEAjWhITWa2vWUlLW'.
'SkrWISnWGBjWEBDWEAjWCAjWAADOnp7Oa2vOGCHOGBjOGBDOEB'.
'DOCAjOAADJrq7Gt7fGGBjGEBDGCAjGAADEpKS/v7+9QkK9GBC9'.
'EBC9CAi9AAC1e3u1a2u1Skq1KSm1EBC1CAi1AACtEBCtCBCtCA'.
'itAACngYGlCAilAACghIScOTmcCAicAACYgYGUGAiUCAiUAAiU'.
'AACMKSmMEACMAACEa2uEGAiEAAB7GBh7CAB7AABzOTlzGBBzCA'.
'BzAABrSkprOTlrGBhrAABjOTljAABaQkJaOTlaCABaAABSKSlS'.
'GBhSAABKKSlKGBhKAABCGBhCCABCAAA5CAA5AAAxCAAxAAApCA'.
'ApAAAhAAAYAACc9eRyAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF'.
'HUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkRFD'.
'UHLytKAAAB4UlEQVR4nGNgIAK4mGjrmNq6BmFIWMmISUpKSmk5'.
'B8ZEokj4qoiLiQCBgqald3xaBpKMj6y4sLCQkJCIvIaFV0RaUR'.
'lCSk5cWEiAn19ASN7QwisuraihHiajKyEixM/NwckjoKrvEACU'.
'qumpg7pAUlREiJdNmZmLT9/cMzwps7Smc3I2WEpGUkxYkJuFiY'.
'lTxszePzY1v7Shc2oX2D+K4iLCgjzsrOw8embuYUmZeTVtPVOn'.
'gqSslYAOF+Ln4ZHWtXMPTcjMrWno7J82rRgoZWOsqaCgrqaqqm'.
'fn5peQmlsK1DR52vRaoFSIs5GRoYG5ub27n19CYm5pdVPnxKnT'.
'pjWDpLydnZwcHTz8QxMSEnJLgDL9U6dNnQ6Sio4PDAgICA+PTU'.
'zNzSkph8hADIxKS46Pj0tKTc3MLSksqWrtmQySAjuDIT8rKy0r'.
'Kz+vtLSmur6jb9JUIJgGdjxDQUVRUVFpaUVNQ1NrZ9+kKVOmTZ'.
'k6vR0sldJUAwQNTU2dnX0TgOJTQLrSIYFY2dPW1NbW2TNxwtQp'.
'U6ZMmjJt2rRGWNB3TO7vnzh5MsgSoB6gy7sREdY7bRrQEDAGOb'.
'wXOQW0TJsOEpwClmxBTTbZ7UDVIPkp7dkYaYqhuLa5trYYUxwL'.
'AADzm6uekAAcXAAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bl_bluegreen.png
//==========================================================
$this->imgdata_large[1][0]= 1368 ;
$this->imgdata_large[1][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABm'.
'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA'.
'B3RJTUUH0wMMFi8hE9b2uAAABOVJREFUeNq9lk2sJFUVx3+3qv'.
'tW95t57zFvhiFxmCFRUJRoNCQiJARMhiFx/Igxii5goTG6ZDAu'.
'/EhcSCIrTAgLEiKsJ8ywABNZEMJXEDYCukAmjgjzBkK/j35V1d'.
'333FtV97io97pfzwxfG86qcu/N+Z3zP+fcW/Apmfk4hx57+R/6'.
'Rqmc9ykhsWjlsUngAA1fXIQ7b73pI/186IGHnn9dH/8frC8v4I'.
'PiG53uaerR4GmKkv31mB8cyfjd946ZTwR66qVX9OTWIi8UKUv9'.
'BOrZXpYZvFeiBvzI0fgSUSFKwbVG+Pl1V3HH0VvNR4KeeukV/f'.
'PmMmdHhst76aXD64AbeVQ9bjNHaiGOC2o3wLrAb2/4LL/84ffn'.
'fCdzkOdayKpLppBemrBsU5Y1Zdmm9LJdGU6E/t4M24Q26jRDRL'.
'j3mdc49cSTekFsMzs5XuTsyLDUNSDQ25NwKOly9YIl22MYhJr/'.
'uoDtBBoT0CxBRGYOAhibIaOCe//2MpfM6KHnX9cXipSlbkKWmS'.
'nk9iv38J0jixw7vJfrTMYBOvhSoQHJBS09ANELloAGDxW8tfoW'.
'J+5/UC8CPS0LU7r3SpYarr7M8rmFjMPLXT6/33L4si7Z2GCrQC'.
'+0ctlOaNs9DReV8vSLr85ndPLpZ/WNvHW+01kAVFBOGvJx0wYg'.
'Sp47RIQ4Emwa8FGJXlDxSCFo5YlVgAo2hwPue/hRndboTV3EW2'.
'Wp3k6wBp8q56QiWzecW6vwQfnPRkAWhFgILnq08jQ+R2nlUzzN'.
'uES9Q7Vd+9fba7NmWJW61db2247qACmcjxXr45psYphsFGSLBu'.
'kIajxqtjNwHkvAjQt0sg3crhPA2+fPz0CuyNFOghsGsr19mnFg'.
'DGwrRm8UoAtNmQPQtRXDgdC4HImCFEKcCE0oieUWUYq2LtbiGp'.
'mBQmppfIkjw45DK0QNNkvQ0jMBtPL0UnDRM1rN+cxKwzvOo2NP'.
'tykR9a1kfpZNDLMG6QDYJqCTBvUe1+uxs+YKyPoGrTwY2HhvC4'.
'CDWQd5d4xNApNQEEMgjgLdUCLBQ5cprL/trwNwKG2IUmDqDFd5'.
'sr5BWrlxuSdLDFEFlqAzXGc4zFjupqh6uqYihpxJcEgp026l2w'.
'7wFUv7Z6AvrfRo/n0OYzPwIKE3HUKAJg2otMBiElnsF7wngis9'.
'3ZDjNnLi7huCWUZfueZKTu/M0V3HvmkOFDVxVKDG04ScejSgW5'.
'V0q5JYFEghuDLHlTmToqDeGOCKIVtrW9hsdmXufEcNLPSXuPHa'.
'a+bvuh9df5AH/v5PDFmbWQC3Mx+TVvfGVTRB2CodNgT2JBX003'.
'aANZAYS/BxCv32TV/l2C03G7jgmfjGiT/qmeEmibEYm7XzAO2k'.
'A+pbgHhBgydqu54YO5eRiLCy7yDvPP6Xqf+5Z+Lu277OYuOpiw'.
'H15oBmlNOMcmK5RbP+PrEscGU+DSAxdg4CICIkxnLP8aNz63Og'.
'H3/rdvOb795GVhuaYo0oBc3GGrEsUPVTwO6a7LYd+X51x3Hu/t'.
'lP5tS65FN+6okn9U+n/sqb596dTvhOF+02myXTmkQNrOw7yD3H'.
'j14E+UDQjp24/0E9/eKrbA4HH3aMK1b2ccvXvswjv//1J/s5ud'.
'Due/hRPfP+OmfOrk7vrn7a48ihA3zh8CH+8Iuffiw/n4r9H1ZZ'.
'0zz7G56hAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bl_yellow.png
//==========================================================
$this->imgdata_large[2][0]= 1101 ;
$this->imgdata_large[2][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l'.
'BMVEX//////////+///+f//9b//8b//73//7X//63//6X//5T/'.
'/4z//4T//3P//2v//1r//0r//0L//zH//yn//yH//xj//xD//w'.
'j//wD/90L/9zn/9zH/9xj/9xD/9wj/9wD39yn37zn37zH37yH3'.
'7xD37wj37wDv70Lv50rv50Lv5znv5yHv5xjv5wjv5wDn51Ln5x'.
'Dn3jHn3iHn3hjn3hDn3gje3oze3nPe3lLe1oze1nPe1lLe1ine'.
'1iHe1hje1hDe1gje1gDW1qXW1mvWzqXWzkLWzhjWzhDWzgjWzg'.
'DOzrXOzq3OzpzOzgDOxkrOxinOxhjOxhDOxgjOxgDGxqXGxnvG'.
'xmvGvRjGvRDGvQjGvQDFxbnAvr6/v7+9vaW9vZS9vQi9vQC9tR'.
'C9tQi9tQC7u7W1tZS1tXu1tTG1tQi1rRC1rQi1rQCtrYytrSGt'.
'rQitrQCtpYStpSGtpQitpQClpYSlpXulpQClnBClnAilnACcnG'.
'ucnAicnACclAiclACUlFqUlCmUlAiUlACUjFKUjAiUjACMjFKM'.
'jEqMjACMhACEhACEewB7ezF7exB7ewB7cwBzcylzcwBzaxBzaw'.
'BraxhrawhrawBrYxBrYwBjYwBjWgBaWgBaUgCXBwRMAAAAAXRS'.
'TlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAd'.
'LdfvwAAAAHdElNRQfTAwkRFBKiJZ4hAAAB7ElEQVR4nI3S+1vS'.
'UBgHcB67WJmIMWAVdDHEDLBC6Go0slj3Ft0m9RRBWQEmFZFDEM'.
'Qgt0EMFBY7p/+198hj1kM/9N1+++x73rOd6XT/kStnTx4fPzd9'.
'uwfOjFhomj7smAhwj/6Cm2O0xUwy6g7cCL99uCW3jtBmE7lsdr'.
'fvejgpzP7uEDFRRoqy2k8xQPnypo2BUMP6waF9Vpf3ciiSzErL'.
'XTkPc0zDe3bsHDAcc00yoVgqL3UWN2iENpspff+2vn6D0+NnZ9'.
'6lC5K6RuSqBTZn1O/a3rd7v/MSez+WyIpVFX8GuuCA9SjD4N6B'.
'oRNTfo5PCAVR0fBXoIuOQzab1XjwwNHx00GOj8/nKtV1DdeArk'.
'24R+0ul9PjmbrHPYl+EipyU0OoQSjg8/m83kl/MMhx0fjCkqio'.
'SMOE7t4JMAzDsizH81AqSdW2hroLPg4/CEF4PhKNx98vlevrbY'.
'QQXgV6kXwVfjkTiSXmhYVcSa7DIE1DOENe7GM6lUym0l+EXKks'.
'K20VAeH2M0JvVgrZfL5Qqkiy0lRVaMBd7H7EZUmsiJJcrTdVja'.
'wGpdbTLj3/3qwrUOjAfGgg4LnNA5tdQx14Hm00QFBm65hfNzAm'.
'+yIFhFtzuj+z2MI/MQn6Uez5pz4Ua41G7VumB/6RX4zMr1TKBr'.
'SXAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bl_silver.png
//==========================================================
$this->imgdata_large[3][0]= 1481 ;
$this->imgdata_large[3][1]=
'iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAADAF'.
'BMVEUAAADOzs7Gxsa9vb21tbXOxsbOzsbGzsb3///O1ta1vb2c'.
'paVSWlpKWlpSY2ve5+97hIze7/9aY2vO5/9zhJRaa3tSY3PGzt'.
'aMlJxrc3tja3NKUlpCSlK1vcZze4RSWmPW5/+Upb3G3v9zhJxS'.
'Y3t7jKVaa4TO3veltc6ElK1re5Rjc4ycpbV7hJRaY3M5QlLn7/'.
'/Gzt6lrb2EjJzO3v9ja3vG1ve9zu+1xueltdacrc6UpcaMnL1C'.
'SlqElLV7jK1zhKVre5zW3u/O1ue1vc6ttcaMlKVze4xrc4RSWm'.
'tKUmPG1v+9zve1xu+tveeltd6crdbe5/+9xt6cpb17hJxaY3s5'.
'QlrW3vfO1u/Gzue1vdattc6lrcaUnLWMlK2EjKVze5Rrc4xja4'.
'RSWnNKUmtCSmO9xuecpcZ7hKVaY4TW3v/O1vfGzu+1vd6ttdal'.
'rc69xu+UnL2MlLWEjK1ze5xrc5R7hK1ja4zO1v+1veettd6lrd'.
'aMlL3Gzv/39//W1t7Gxs61tb29vcatrbWlpa2cnKWUlJyEhIx7'.
'e4TW1ufGxta1tcZSUlqcnK3W1u+UlKW9vda1tc57e4ytrcalpb'.
'1ra3vOzu9jY3OUlK29vd6MjKWEhJxaWmtSUmNzc4xKSlpjY3tK'.
'SmNCQlqUjJzOxs7///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
'AAAAAAAAAAAAAAAAAAAAAAAAD///9fnkWVAAAAAnRSTlP/AOW3'.
'MEoAAAABYktHRP+lB/LFAAAACXBIWXMAAABFAAAARQBP+QatAA'.
'AB/klEQVR42mNgxAsYqCdd3+lcb4hLmj8wMMvEu8DCMqYbU9op'.
'UEFB2MTb26eyysomFl06XEEhUCHLpAKo2z/fujikEUVaXUFBMB'.
'BouLePuV+VVWGRciIXknSEsImCQd3//xwmPr65llaFcSFJHkjS'.
'3iYmWUDZ//8NfCr989NjNUMSUyTg0jneSiaCINn/gmlVQM12qg'.
'lJnp5waTMTE5NAkCyHWZW/lXWNfUlikmdYK0zax7siS4EDKJtd'.
'mQeU1XRwLBdLkRGASucWmGVnZ4dnhZvn5lmm29iVOWpnJqcuko'.
'JKR1Wm5eTkRKYF5eblp9sU2ZeUJiV7zbfVg0pH56UFBQXNjIqK'.
'jgkujItX1koKTVmYajsdKu2qETVhwgSXiUDZ2Bn9xqUeoZ5e0t'.
'LzYYZ3B092ndjtOnmKTmycW1s7SHa+l5dtB8zlccE6RlN0dGbM'.
'mDVbd5KupNBcL6+F82XgHouLj5vRP2PWLGNdd4+ppnxe8tJec6'.
'XnNsKkm0uVQ5RDRHQTPTym68nPlZbvkfYCexsa5rpJ2qXa5Umm'.
'ocmec3m8vHjmSs+fgxyhC5JDQ8WSPT2lvbzm8vDIe0nbtiBLN8'.
'8BigNdu1B6Lsje+fPbUFMLi5TMfGmvHi/puUAv23q2YCTFNqH5'.
'MvPnSwPh3HasCbm3XUpv+nS5VtrkEkwAANSTpGHdye9PAAAASn'.
'RFWHRzaWduYXR1cmUANGJkODkyYmE4MWZhNTk4MTIyNDJjNjUx'.
'NzZhY2UxMDAzOGFhZjdhZWIyNzliNTM2ZGFmZDlkM2RiNDU3Zm'.
'NlNT9CliMAAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bl_purple.png
//==========================================================
$this->imgdata_large[4][0]= 1149 ;
$this->imgdata_large[4][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAACAV'.
'BMVEX/////////7///5///1v//xv//rf//pf//lP//jP//hP//'.
'c///a///Wv//Wvf/Uv//Sv//Qv//Qvf/Off/Mf//Kf//If//If'.
'f/GP//GPf/EP//EPf/CP//CPf/CO//AP//APf3Oe/3Kff3Ke/3'.
'Ie/3GO/3EO/3AO/vSu/vSufvOefvMefvIefvGOfvEOfvCOfvAO'.
'fnUufnSufnMd7nId7nGN7nGNbnEN7nCN7nAN7ejN7ejNbec97e'.
'c9beUtbeQtbeIdbeGNbeENbeCNbeANbWpdbWa9bWQs7WGM7WEM'.
'7WCM7WAM7Otc7Orc7OnM7OSsbOIb3OGMbOEMbOCMbOAM7OAMbG'.
'pcbGnMbGe8bGa8bGKbXGEL3GCL3GAL3FucXBu73AvsC/v7+9pb'.
'29Ka29GLW9ELW9CLW9AL29ALW5rrm1lLW1e7W1MbW1GKW1EK21'.
'CLW1CK21AK2tjK2thKWtMaWtIaWtGJytCK2tCKWtAK2tAKWlhK'.
'Wle6WlEJylCJylAKWlAJyca5ycGJScEJScCJScAJycAJSUWpSU'.
'UoyUKZSUEIyUCIyUAJSUAIyMUoyMSoyMIYSMEISMCISMAIyMAI'.
'SECHuEAISEAHt7MXt7EHt7CHt7AHt7AHNzKXNzEGtzAHNzAGtr'.
'GGtrEGNrCGtrAGtrAGNjCFpjAGNjAFpaAFpaAFIpZn4bAAAAAX'.
'RSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsS'.
'AdLdfvwAAAAHdElNRQfTAwkRFB0ymoOwAAAB9UlEQVR4nGNgIA'.
'K42hhqGtm5+WFIWClKycvLK6gbuARGoEj4aMjLSElISUir6Tt7'.
'x+aEIWR8leQlwEBSTc/CK7awLguuR0lGQkJMVFRUTFJVzwko1d'.
'oFk9OQl5IQE+Dh5hVR0TV3CkkvbJgyASJjDZIR5GBl5eRX0TH1'.
'DEqrbJ2ypBEspSgvJSXKw8bMxMavbOLoGZNf1TZlybw4oIyfLN'.
'BxotxsLEzsQiaOHkFpBQ2905esrAZK2SpIAaUEuDm5+LTNPAKj'.
'C+pbps1evrIDKGWnLictKSkuLKyoZQyUya9o7Z2+YMXKGUApew'.
'M9PTVdXR0TEwf3wOjUirruafOXL18xFyjl72Kpb25qaurg4REU'.
'EFVe2zJ5zpLlK1aCpbydnZ2dnDwDA6NTopLLeiZNXbB8BcTAyP'.
'TQ0JDg4KCY1NS83JKmiVOBepYvX9UPlAovzEiPSU/LLyior2vq'.
'mjZr3vLlIF01IC+XVhUWFlZW1Lc290ycOGfxohVATSsXx4Oksn'.
'vaWlsb2tq6J0+bM2/RohVA81asbIcEYueU3t7JU6ZNnwNyGkhm'.
'+cp5CRCppJnzZ8+ZM3/JUogECBbBIixr8Yqly8FCy8F6ltUgoj'.
'lz7sqVK2ByK+cVMSCDxoUrwWDVysXt8WhJKqG4Y8bcuTP6qrGk'.
'QwwAABiMu7T4HMi4AAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bl_gray.png
//==========================================================
$this->imgdata_large[5][0]= 905 ;
$this->imgdata_large[5][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAABO1'.
'BMVEX////////3///39/fv7+/e5+fW3t7Wzs7WxsbG1tbGzsbG'.
'xsbDxMS/v7++wMC+v7+9zsa9xsa9vb29tbW9ra29pa24uLi1xs'.
'a1vb21tbWxtrattbWmpqalra2cra2cpaWcnJycjIyUpaWUnJyU'.
'lJSUjIyMnJyMnJSMlJSMlIyMjJSMjIyElJSElIyEjIyEhIR7jI'.
'x7hIR7hHt7e3t7e3N7e2tzhIRze3tze3Nzc3Nre3trc3Nrc2tr'.
'a2tjc3Njc2tja3Nja2tjY2NjWlpaa2taY2taY2NaY1paWlpaUl'.
'JSY2NSY1pSWlpSWlJSUlJSUkpKWlpKWlJKUlpKUlJKUkpKSkpK'.
'SkJCUlJCUkJCSkpCSkJCQkI5Sko5QkI5Qjk5OUI5OTkxQkIxOT'.
'kxMTkxMTEpMTEhMTEhKSkYISEpy7AFAAAAAXRSTlMAQObYZgAA'.
'AAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdE'.
'lNRQfTAwkRFQfW40uLAAABx0lEQVR4nI3SbXfSMBQA4NV3nce5'.
'TecAHUywRMHSgFuBCFsQUqwBS1OsWQh0GTj//y8wZUzdwQ/efM'.
'tzcm/uuXdj4z9ic/PR9k4qk1qDnf0X2/uZzKt8GaRvSubg4LVp'.
'mkWzCGAT/i3Zsm2XNQHLsm2n2937LaaNnGoJFAEo27B50qN0ay'.
'Wg26lXsw8fP8nmzcJb2CbsnF5JmmCE8ncN404KvLfsYwd7/MdV'.
'Pdgl/VbKMIzbuwVgVZw2JlSKJTVJ3609vWUY957lgAUd1KNcqr'.
'yWnOcOPn8q7d5/8PywAqsOOiVDrn42NFk+HQ7dVuXNYeFdBTpN'.
'nY5JdZl8xI5Y+HXYaTVqEDp1hAnRohZM03EUjMdhn5wghOoNnD'.
'wSK7KiiDPqEtz+iD4ctdyAifNYzUnScBSxwPd6GLfRURW7Ay5i'.
'pS5bmrY8348C5vvUI+TLiIVSJrVA0heK/GDkJxYMRoyfCSmk4s'.
'uWc3yic/oBo4yF374LGQs5Xw0GyQljI8bYmEsxVUoKxa6HMpAT'.
'vgyhU2mR8uU1pXmsa8ezqb6U4mwWF/5MeY8uLtQ0nmmQ8UWYvb'.
'EcJaYWar7QhztrO5Wr4Q4hDbAG/4hfTAF2iCiWrCEAAAAASUVO'.
'RK5CYII=' ;
 
//==========================================================
// File: bl_brown.png
//==========================================================
$this->imgdata_large[6][0]= 1053 ;
$this->imgdata_large[6][1]=
'iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABoV'.
'BMVEX////Gzs7GvbXGrZTGpXu9nHO1nHO1nIy9taXGxs7GtaXO'.
'nHPGlFrGjEq9hEq1hEqte0Klczmcazmce1KtnIzGxsbGvb3OlF'.
'LOlFq9hFKte0qcc0KUYzGEWimMc1K9ta3OnGvOnGPWnGO9jFq9'.
'jFKlc0KUazmMYzl7UilzUjGtpZzGxr3GnGPWpWvepXO1hFJ7Wj'.
'FrSiFjUjG1ra3GnHPvxpT/5733zpythFKUa0KEYzlzUilaOSF7'.
'Wjm9jErvvYz/99b///f/78bnrYS1hFqle0p7UjFrSiljQiFCMR'.
'iMhHO9lGvGjFLWnGv/3q3////erXuthEqlc0paQiFKMRhSQin/'.
'1qX/997//++cc0pjSilaQilKORhCKRiclIy9pYzGlGPntYT33q'.
'3vvZSEWjlSOSE5KRB7c2O1lHutczmthFqte1JrWkqtjGtCKRBa'.
'SjmljGuca0KMYzGMaznOztaclISUYzmEWjFKOSF7a1qEYzFaSi'.
'GUjISEa0pKOSm9vb2llIxaQhg5IQiEc2tzY0paORilnJy1raVS'.
'OSljUkJjWkKTpvQWAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHU'.
'gAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkREiei'.
'zP2EAAAB9UlEQVR4nGWS/VfSUBjHL5QluhhBxtwyWcCus5Blpm'.
'wDC4ONaWXCyBi7RMZmpQ2Bypm9W/byV3cHHo/W88s95/s5z/d5'.
'uwCcCh/4L3zAf+bs0NC588On9QAYGSUuBINk6GI4cmnsBLk8Go'.
'1SFEGMkzRzZeLq5JE8FvDHouw1lqXiCZJOcnCKnx4AcP0GBqmZ'.
'mRgRT9MMB4Wbs7cGSXNRik3dnp9fiMUzNCNKgpzN9bsaWaQo9s'.
'7dfH7pXiFTZCBU1JK27LmtBO8TDx7mV1eXHqXXyiIUFLWiVzHx'.
'BxcJIvV4/cn6wkqmWOOwmVE3UQOAp6HxRKL5bGPj+VwhUhalFq'.
'8alm5vAt+LlySZTsebzcKrraIIW4JqZC3N3ga+1+EQTZKZta1M'.
'pCZCSeDViqVrThsEdsLJZLJYLpZrHVGScrKBvTQNtQHY6XIM02'.
'E6Ik7odRW1Dzy3N28n3kGuB3tQagm7UMBFXI/sATAs7L5vdbEs'.
'8Lycm923NB0j5wMe6KOsKIIyxcuqauxbrmlqyEWfPmPy5assY1'.
'U1SvWKZWom9nK/HfQ3+v2HYZSMStayTNN0PYKqg11P1nWsWq7u'.
'4gJeY8g9PLrddNXRdW8Iryv86I3ja/9s26gvukhDdvUQnIjlKr'.
'IdZCNH+3Xw779qbG63f//ZOzb6C4+ofdbzERrSAAAAAElFTkSu'.
'QmCC' ;
 
//==========================================================
// File: bl_darkgreen.png
//==========================================================
$this->imgdata_large[7][0]= 1113 ;
$this->imgdata_large[7][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAB2l'.
'BMVEX////////3///v///n/+/e99bW/+/W99bO786/v7++vr69'.
'/96999a7wb24vbu1/9a1zqW1u7itxrWosq6l772l1qWlxrWlxq'.
'2lva2cxpSU562U3q2UxqWUvaWUpZyM77WM57WMvYyMtZyMrZyM'.
'pZSMnJSEvZyEtYyErZSElIx7zpR7xpx7xpR7vZR7jIRz1pRzxp'.
'RzjIRrzpRrzoxrxoxrtYRrrYxrrXtrpYRrhHNjzoxjxoxjxoRj'.
'vYRjtYRjrXtjpXtjlGNje2tazoxazoRaxoxaxoRavYRatYRatX'.
'tarXtapXNanHNajFpae2tSzoRSxoRSvXtStXtSrXtSrXNSpXNS'.
'nHNSnGtSlGtSlGNSjGtSjGNKvXtKtXNKrXNKpWtKnGtKlGNKjG'.
'NKhGNKhFJKc1pKa1JCrWtCpWtCnGtClGNCjGNCjFpChFpCe1JC'.
'a1JCY1I5pWs5nGM5lGM5jFo5hFo5e1o5c0o5WkoxjFoxhFoxhF'.
'Ixe1Ixc1Ixc0oxa0ophFIpe0opc0opa0opa0IpY0IpWkIpWjkp'.
'UkIpUjkhc0oha0IhY0IhWjkhWjEhUjkhUjEhSjEhSikhQjEhQi'.
'kYWjkYSjEYSikYQjEYQikQSikQQikQQiEQOSExf8saAAAAAXRS'.
'TlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAd'.
'LdfvwAAAAHdElNRQfTAwkRFCaDkWqUAAAB+ElEQVR4nI3S+1vS'.
'UBgHcGZlPV0ks/vFrmQWFimJjiwiYUJWjFBWFhClyZCy5hLrwA'.
'x2EIwJC1w7zf2vnU0re+iHvs9++7x7zznvORbLf+TA6ct9fYMX'.
'jrfAUYefpp+/iM1ykxf/lmuhUZ/PTwXC8dml5Wcd23o5H5Mk6b'.
'5NUU8icXbhS67rNzn9JDnguOEYGQtEEtwC+Crs3RJ76P5A/znr'.
'vsNX7wQnEiwHCtK7TTkW8rvdZ9uJtvZTLkxpHhSrP66bNEj7/P'.
'3WNoLYeeSWQQCIpe9lQw7RNEU5rDsIYtcJ14Nocg7kRUlBNkxn'.
'YmGKcp7cv3vPwR7XOJPmc0VYU3Sv0e9NOBAYG7Hbz/cMjTMveZ'.
'CHkqxuTBv0PhYJB4N3XR6PJ5rMAPMnpGUxDX1IxSeMTEaZp1OZ'.
'nGAIQiYtsalUIhFlmGTy3sO3AizJCKn6DKYryxzHsWyaneMzr6'.
'cWxRVZVlFTe4SpE3zm+U/4+whyiwJcWVMQNr3XONirVWAklxcE'.
'EdbqchPhjhVzGpeqhUKhWBQhLElr9fo3pDaQPrw5xOl1CGG1JE'.
'k1uYEBIVkrb02+o6RItfq6rBhbw/tuINT96766KhuqYpY3UFPF'.
'BbY/19yZ1XF1U0UNBa9T7rZsz80K0jWk6bpWGW55UzbvTHZ+3t'.
'vbAv/IT+K1uCmhIrKJAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bl_green.png
//==========================================================
$this->imgdata_large[8][0]= 1484 ;
$this->imgdata_large[8][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABm'.
'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA'.
'B3RJTUUH0wMMFjM4kcoDJQAABVlJREFUeNq9ll2MJFUVx3/11V'.
'Vd/TE9vU0v4zLDwJIF16jBqLAPhsRXEiDqg0QTJiQSjcSNvCzw'.
'sBEDDxizhvAAxBgf1oR9QF9NiE9ESFZkQyZB5WtddmdnZ3qqqr'.
'uqbt367Cofqu3ZZpWVaDzJfbkf53//55z/PVdZXV3l/2H6f7Lp'.
'5VdOV/4Nb+GmHpUeA7AdBNxc3kafNb73jRPK9Xwon8ToxVefqU'.
'b91wibH5EkCQBCizFihTSviHUHR0hWws9xe3wvJ7/7nPKpgX5y'.
'9oFqt3eOgWniRBoAbUBGGqZUibSYaeoT2B5bnkdaSA6793Cv/S'.
'QPPbihXBfo5VdOV+8dfgnvwAU62YH5fCZ12sDujFkwyegCqTrB'.
'iUOKTOJKj8jr88jS8zy6cXwBTP048nuHX0I0nDlIp7RpTG7kM0'.
'sdyAYsTVukUuWGhlWHMq0ITL92lnUp9R1Obz/GmTNnqn9bDD8/'.
'+0D1oX0O0zQZZDYCsK2j3Gl9jQqDfHiei8GfiKVLlsZkJaBAN1'.
'0i6PgwUbB0GxG5/PrtE/xLRr959Znqw9452oVNI+jiJhnr1pe4'.
'k29zB1/nFr5Kj7tpt1YYhJ0FJ7nUYbcJQBgahN2MzeCP/OipR6'.
'prgN6Qr6ELFQFUWoRpNVjlKwxZB8DCpE+PtfEKqV1cUzxpVudu'.
'GTBHA5Y1g99e+dUio9O/P1Vpq+/WE5GGjDSMoAtAQjrf3C52IP'.
'QxpY4WK2hpReka9Gfrhqgz0bACRoCWjDh56kQ1z9FeuUUQxVhK'.
'B92sD1VahM+bAJgcoJhGjP/6Ln8rAgDiRCVRKiIzxMkkodBJ85'.
'im1IlEHbE4k1xyNveL4YP8HarmGJIOpqyjeQmfNHmTvnqZTWBt'.
'vIJXpPwlukJSuSTKGK3pEwtJmiX00ZlInTyNscImO6XBITvH1c'.
'8vVt2OucdKvIyeKRTNCivsEMgcpg6taYs30nfq0Gqg6hOSSFJ4'.
'BSnJPht0IqEjWmOGocEI6F0J94F0qaL6BntTF0MtUfweKQKAPU'.
'Wwp4OcVnQAmVb0p9DLOzjEhEKnGRmoRc7EzRGlwA6NujAKG4yP'.
'6Sjwc4aVznZ7DK0xXdkDoJf0kGmFBniFBOBGcZSCCSKd0IwN0k'.
'IS+QZWCGVZex4BnUxya3+Zt9iugQbcRFpIAtuHvAZulPUdLhUJ'.
'RqegI3WcqaSXddlT3idsWMSRRGkEtNwmyTifAwyBo7LP+11J0e'.
'7tM7pZOYblHkBLcqZ5LcYtw6Wbd4CM3SpE9foYZsIHoqDKCrbz'.
'mLSQtPwmuhXgtBLs0GBdbXOhFGB7WBKO2F8GXt9/VO97Ya3atF'.
'7nUHnwGjGGQqcPxFEdFqURkEidiZszAERoYIsGju1hq21kWee3'.
'bw15+8WpsvAy3K1+i3JkkhZyPpxxjjPOsfOYiZ+TFhLPzQnHOU'.
'tpzGB2dgA4tscIkKIx19Cxg/fPL7vQJu47eXt1VvsDK8pwPueZ'.
'PuZoQMOqhRoJHSs0kKLBWjvjYinmeQGw1TaX1RFdfZ3LMzYLjA'.
'C++dkn6AaH2Nobk6cxEzdnuG0TdC8zvdJkN0hqkFkO/jwL0fxa'.
'so8sBcuFzQ+/+MRC+BeAHnpwQzn++ee5KT9Eshuy46dcKAXm32'.
'0uzPQhS4GttkH2GQID2Wc0Y4LtAbDxhZ/x5A+e/uTG9+jGceXH'.
'9/ySnnIXnUzOxXe1038mW3ZynNmam4yYWkO+f9cv+Oljz16/lV'.
'9tDz/9nerc1hm8ZEScSRK7VvtYl1i1dklsOKyvc+zg/bzw1O8+'.
'/efkajt56kR1ydlEJBc5H46xzbrJ3dY9wrB7hGcff+6/+279L+'.
'0fHxyiE8XMLl4AAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bl_blue.png
//==========================================================
$this->imgdata_large[9][0]= 1169 ;
$this->imgdata_large[9][1]=
'iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAACEF'.
'BMVEX/////////7//35//v1v/exv/Wvf/Wrf/Wpf/Orf+/v7+9'.
'tc69jP+9hP+5ucW1tc6tlP+rq7Wlpdalpcalpb2cnM6cnMacc/'.
'+cWv+UlLWUjN6UjK2Uc/+Ma/+MUv+EhKWEa/+EQvd7e8Z7e7V7'.
'e6V7c957Wv9za9Zza8ZzSv9ra5xrSv9rOf9rMe9jUudjQv9jOe'.
'9aWpRaUt5aUpRaSu9aSudSUoxSSs5SSoxSMf9KQtZKOfdKMedK'.
'Kf9KKe9CKf9CKb1CKa1CIfdCIedCId45MXs5Kfc5If85Iec5Id'.
'Y5GP8xMbUxMXsxKc4xKZQxIf8xGP8xGO8xGN4xGNYxGL0xGK0p'.
'KXMpIYwpGP8pGO8pGOcpGNYpGM4pEP8pEPcpEOcpEN4pENYpEM'.
'YpEL0hGKUhEP8hEPchEO8hEOchEN4hENYhEM4hEMYhELUhCP8h'.
'CO8hCN4YGJwYGGsYEL0YEK0YEHMYCN4YCM4YCMYYCL0YCKUYAP'.
'8QEJQQEIwQEHsQEGsQCM4QCLUQCK0QCKUQCJwQCJQQCIwQCHMQ'.
'CGsQAP8QAPcQAO8QAOcQAN4QANYQAM4QAMYQAL0QALUQAKUQAJ'.
'QQAIQICGsICGMIAO8IANYIAL0IALUIAK0IAKUIAJwIAJQIAIwI'.
'AIQIAHsIAHMIAGsIAGMAAN4AAMYAAK0AAJQAAIwAAIQAAHMAAG'.
'sAAGMAAFrR1dDlAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgA'.
'AAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkRFRPMOZ'.
'/2AAAB+klEQVR4nGNgIAIIqeqZmBqpi2JISNml5lVXV3d198Yo'.
'oUjwm1SnxsbGRsSm5ZfNXO4tjCTjVh0ABhFx6QV9E1Y0S8JkuN'.
'3yAgLc7W3t/QPi4jPKJ8ye1yoIlTKpjvVy15eVUbN0i4zKLJ8w'.
'ae6qcKgLqmMj3PUFWFl5NJ0CExLLJzbNW7BWCyxlXR0ba6/Axs'.
'zELmfnkRBT0QiSKgXJCOflxUbYy3KyMHEoOrtEZ1c2TZ6/cMl6'.
'eaCUamdsbIC7tjgPr4SBS3BMMVDTwkXr1hsDpYy6UmMj/O0tdX'.
'QNbDxjknJLWqYsXLx0vStQynxGflpkZGCgs7Onp29SbtNkoMy6'.
'pevCgFJWy3oyMuKjgoKCPWNCvEuqWhcsWrJ06XqQlPnMvrKyrM'.
'TomJjkZAfHlNa2qdOWrlu63gcopbG8v7+hvLwip7g4JdSxsLZu'.
'8dKlS9ettwBKic2eNXHChIkTG5tKqgpr2uo6loLAehWQx0LnzJ'.
'49p6mpeXLLlNq6RUvqly6dvnR9Bx9ISnnlvLmT582bMr9t4aL2'.
'+vrp60GaDCGB6Ld6wfwFCxYCJZYsXQ+SmL6+FBryInVrFi1atH'.
'jJkqVQsH6pNCzCJNvXrQW6CmQJREYFEc2CYevXrwMLAyXXl0oz'.
'IAOt0vVQUGSIkabkDV3DwlzNVDAksAAAfUbNQRCwr88AAAAASU'.
'VORK5CYII=' ;
 
//==========================================================
// File: bs_red.png
//==========================================================
$this->imgdata_small[0][0]= 437 ;
$this->imgdata_small[0][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAk1'.
'BMVEX////////GxsbGra3/xsbOhITWhIT/hIT/e3v/c3P/a2vG'.
'UlK1SkrOUlL/Y2PWUlLGSkrnUlLeSkrnSkr/SkqEGBj/KSmlGB'.
'jeGBjvGBj3GBj/EBD/CAj/AAD3AADvAADnAADeAADWAADOAADG'.
'AAC9AAC1AACtAAClAACcAACUAACMAACEAAB7AABzAABrAABjAA'.
'BuukXBAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGDNEMgOYAAAAm0'.
'lEQVR4nI3Q3RKCIBAFYGZMy9RKzX7MVUAUlQTe/+kS0K49d3wD'.
'7JlFaG+CvIR3FvzPXgpLatxevVVS+Jzv0BDGk/UJwOkQ1ph2g/'.
'Ct5ACX4wNT1o/zzUoJUFUGBiGfVnDTYGJgmrWy8iKEtp0Bpd2d'.
'jLGu56MB7f4JOOfDJAwoNwslk/jOUi+Jts6RVNrC1hkhPy50Ef'.
'u79/ADQMQSGQ8bBywAAAAASUVORK5CYII=' ;
 
 
//==========================================================
// File: bs_lightblue.png
//==========================================================
$this->imgdata_small[1][0]= 657 ;
$this->imgdata_small[1][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAABVl'.
'BMVEX////////d///AwMC7wcS08P+y+P+xxdCwxM+uws2twMur'.
'vsinzNynytylzuKhyN6e5v6d5P+d1fOcwNWcu8ub4f+at8iZ3v'.
'+ZvdGY2/yW2f+VscGU1vuT1fqTr72Sx+SSxeKR0fWRz/GPz/OP'.
'rr+OyeqMy+6Myu2LyeyKxueJudSGw+SGorGDvt+Cvd6CvN2Aud'.
'p+uNd+t9Z9tdV8tdR8tNN6sc94r813rct2q8h0qcZ0qMVzp8Rx'.
'o8Bwor5tn7ptnrptnrlsnbhqmbRpmbNpi51ol7Flkqtkkqtkka'.
'pjj6hijaRhjaZgi6NfiqJfiaFdh55bhJtag5pZgphYgJZYf5VX'.
'cn9Ve5FSeI1RdopRdYlQdYlPc4dPcoZPcoVNcINLboBLbH9GZn'.
'hGZXdFZHZEY3RDYnJCXW4/W2s/WWg+Wmo7VmU7VGM7U2E6VGM6'.
'VGI5UV82T1wGxheQAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHU'.
'gAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGTok'.
'9Yp9AAAAtElEQVR4nGNgIBaw8wkpKghzwvksPAKiUsraprYiLF'.
'ARXkE2JiZ1PXMHXzGIAIekOFBE08TGLTCOCyzCLyvDxsZqZOnk'.
'E56kAhaRV9NQUjW2tPcMjs9wBYsY6Oobmlk7egRGpxZmgkW0zC'.
'2s7Jy9giKT8gohaiQcnVzc/UNjkrMLCyHmcHr7BYREJKTlFxbm'.
'QOxiEIuKTUzJKgQCaZibpdOzQfwCOZibGRi4dcJyw3S4iQ4HAL'.
'qvIlIAMH7YAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bs_gray.png
//==========================================================
$this->imgdata_small[2][0]= 550 ;
$this->imgdata_small[2][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAAQCAMAAADH72RtAAABI1'.
'BMVEX///8AAAD8EAD8IAD8NAD8RAD8VAAYGBi/v7+goKCCgoJk'.
'ZGRGRkb8yAD83AD87AD8/AD4+ADo+ADY+ADI+AC0+ACk+ACU+A'.
'CE+AB0/ABk/ABU/ABE/AAw/AAg/AAQ/AAA/AAA+AAA6BAA2CAA'.
'yDQAtEQApFQAlGQAhHQAdIgAZJgAVKgARLgAMMgAINwAEOwAAP'.
'wAAPgIAPAQAOgYAOAkANgsANA0AMg8AMBEALhMALBUAKhcAKBo'.
'AJhwAJB4AIiAAID////4+Pjy8vLs7Ozm5ubg4ODa2trT09PNzc'.
'3Hx8fBwcG7u7u1tbWurq6oqKiioqKcnJyWlpaQkJCJiYmDg4N9'.
'fX13d3dxcXFra2tkZGReXl5YWFhSUlJMTExGRkZAQEA1BLn4AA'.
'AAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIA'.
'AAsSAdLdfvwAAAAHdElNRQfTAwkUGiIctEHoAAAAfElEQVR4nI'.
'2N2xKDIAwF+bZ2kAa8cNFosBD//yvKWGh9dN+yk9kjxH28R7ze'.
'wzBOYSX6CaNB927Z9qZ66KTSNmBM7UU9Hx2c5qjmJaWCaV5j4t'.
'o1ANr40sn5a+x4biElrqHgrXMeac/c1nEpFHG0LSFoo/jO/BeF'.
'lJnFbT58ayUf0BpA8wAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bs_greenblue.png
//==========================================================
$this->imgdata_small[3][0]= 503 ;
$this->imgdata_small[3][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAxl'.
'BMVEX///////+/v79znJQhSkJ7raU5hHtjraVKnJRCjIRClIyU'.
'9++E595avbVaxr2/v7+ctbWcvb17nJxrjIx7paUxQkK9//+Mvb'.
'17ra2Evb17tbVCY2MQGBiU5+ec9/eM5+d71tZanJxjra1rvb1j'.
'tbVSnJxara1rzs5jxsZKlJRChIQpUlIhQkJatbVSpaU5c3MxY2'.
'MYMTEQISFavb1Sra1KnJxCjIw5e3sxa2spWlpClJQhSkoYOTkp'.
'Y2MhUlIQKSkIGBgQMTH+e30mAAAAAXRSTlMAQObYZgAAAAFiS0'.
'dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfT'.
'AwkUGTIqLgJPAAAAqklEQVR4nI2QVxOCMBCEM6Mi2OiCvSslJB'.
'CUoqjn//9TYgCfubf9Zu9uZxFqO+rscO7b6l/LljMZX29J2pNr'.
'YjmX4ZaIEs2NeiWO19NNacl8rHAyD4LR6jjw6PMRdTjZE0JOiU'.
'dDv2ALTlzRvSdCCfAHGCc7yRPSrAQRQOWxKc3C/IUjBlDdUcM8'.
'97vFGwBY9QsZGBc/A4DWZNbeXIPWZEZI0c2lqSute/gCO9MXGY'.
'4/IOkAAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bs_yellow.png
//==========================================================
$this->imgdata_small[4][0]= 507 ;
$this->imgdata_small[4][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAzF'.
'BMVEX///////+/v79zYwCMewDOxoTWzoTezkr/5wj/5wDnzgDe'.
'xgC1pQCtnACllACcjACUhABjWgDGvVK1rUrOxlLGvUqEexilnB'.
'jv3hj35xj/7wj/7wD35wDv3gDn1gDezgDWxgDOvQDGtQC9rQCE'.
'ewB7cwBzawBrYwDWzlLn3lLe1krn3kre1hi9tQC1rQCtpQClnA'.
'CclACUjACMhAD/9wC/v7///8bOzoT//4T//3v//3P//2v//2Pn'.
'50r//0r//yn39xj//xD//wBjYwDO8noaAAAAAXRSTlMAQObYZg'.
'AAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAH'.
'dElNRQfTAwkUGSDZl3MHAAAAqElEQVR4nI3QWRNDMBAA4My09E'.
'IF1SME0VT1okXvM/3//6kEfbZv+81eswA0DfHxRpOV+M+zkDGG'.
'rL63zCoJ2ef2RLZDIqNqYexyvFrY9ePkxGWdpvfzC7tEGtIRly'.
'nqzboFKMlizAXbNnZyiFUKAy4bZ+B6W0lRaQDLmg4h/k7eFwDL'.
'OWIky8qhXUBQ7gKGmsxpC+ah1TdriwByqG8GQNDNr6kLjf/wAx'.
'KgEq+FpPbfAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bs_darkgray.png
//==========================================================
$this->imgdata_small[5][0]= 611 ;
$this->imgdata_small[5][1]=
'iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAABJl'.
'BMVEX////////o8v/f6O7W4OnR3PXL1OTL0evEyLvCzePAwMC/'.
'v7a8wsq7t7C1xum1vtS1q6GzopmyxeKsrsOqvNWoq7anvN+nsb'.
'qhrcGgqbGfpq6cp7+bqMuVmJKRm7yPlKKMnL6FkKWFipOEkLSE'.
'j6qEhoqAiaB+jqd8haF7hZR4iJt4g5l3hZl2gIt2cod1hJVzeY'.
'VzboJvhp9sfJJsb41peY1pd5xpdoVod4xndI5lcHxka4BjcYVg'.
'Z3BfboFbb4lbZnZbYntaZ4laZYVZV3JYYWpXX3JWWm5VX4RVW2'.
'NUYX9SXHxPWn5OVFxNWWtNVXVMVWFKV3xHUGZGU3dGTldFSlxE'.
'Sk9ESXBCRlNBS3k/SGs/RU4+R1k9R2U6RFU2PUg0PEQxNU0ECL'.
'QWAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAA'.
'CxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGQmbJetrAAAAtklEQV'.
'R4nGNgwAK4JZTNNOWlYDxhMT4ZDTOzQE1uMF9CiJWVU0LbxDlS'.
'G8QVF+FnZ2KRNHAIiPUHaZGSlmZj5lH19A1KjLUA8lXU5MWllF'.
'yjo30TYr2BfG19G11b37CEeN84H38gX1HbwTUkOjo+zjfG3hLI'.
'l1exCvCNCwnxjfMz0gTyRdXNHXx9fUNCQu2MwU6SN3ZwD42LCH'.
'W30IK4T8vUJSAkNMhDiwPqYiktXWN9JZj7UQAAjWEfhlG+kScA'.
'AAAASUVORK5CYII=' ;
 
 
//==========================================================
// File: bs_darkgreen.png
//==========================================================
$this->imgdata_small[6][0]= 666 ;
$this->imgdata_small[6][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAABX1'.
'BMVEX////////l/+nAwMC86r+8wb28wby8wLy78sCzw7SywrSx'.
'wLKwvrGuvK+syK+ryq2rx62n36ym3aumxKmk2qij0Keh16ahva'.
'Og1aSguKKe06KeuaCetZ+d0KGdtZ+bz6Cay56ZyZ2Zwp2Zr5qZ'.
'rpqYwJuXyZuXrJmVw5mUxZiTxJeTw5eTq5WRwJWPtJKOvZKKuI'.
'6Kt42Kn4yJt42ItIuGsomFsYmEsIiEr4eDr4eBrIR/qoN+qIJ8'.
'poB7pH56o356on14nnt2nXl0mndzmnZzmXZymHVwlXNvlHJukn'.
'FtiHBqjm1qjW1oi2toiWpniWplh2hlhmdkhWdig2VggGNgf2Je'.
'fmFdfGBde19bbl1aeFxXdFpWclhVclhVcVdUcFZTb1VSbVRQal'.
'JPaVFKY0xKYkxJYUtIYEpHX0lEWkZCWERCV0NCVkM/U0A+U0A+'.
'UUA+UEA9Uj89UT48Tj45TDvewfrHAAAAAXRSTlMAQObYZgAAAA'.
'FiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElN'.
'RQfTAwkUGRjxlcuZAAAAtElEQVR4nGNgIBZw8osqqIpzw/msfI'.
'IiUmr6lo6SbFARASEOJiYtQ2uXADmIAJeEGFBE18LBMySBBywi'.
'LC/LwcFiZuvmH5WiAxZR0tRW1DC3dfYJS8zyAouYGBibWtm7+o'.
'TEpZfkgEX0rG3snNx9Q2NSCksgaqRd3Ty8gyLiU/NKSiDmcPsF'.
'BodHJ2UUlZTkQ+xikIlNSE7LLgECZagL2VQyc0H8YnV2uD94jS'.
'ILIo14iQ4HALarJBNwbJVNAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bs_purple.png
//==========================================================
$this->imgdata_small[7][0]= 447 ;
$this->imgdata_small[7][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAnF'.
'BMVEX///////+/v7/Gvca9rb3Grcb/xv+1hLWte629hL21e7XG'.
'hMbWhNbOe87We9b/hP//e/97OXv/c///a///Y/+cOZz/Sv/WOd'.
'bnOefvOe//Kf9jCGNrCGv/EP//CP/nCOf/AP/3APfvAO/nAOfe'.
'AN7WANbOAM7GAMa9AL21ALWtAK2lAKWcAJyUAJSMAIyEAIR7AH'.
'tzAHNrAGtjAGPP1sZnAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF'.
'HUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGS'.
'o5QpoZAAAAnElEQVR4nI3Q2xJDMBAG4MyQokWrZz3oSkJISJH3'.
'f7dK0Gv/Xb7J7vyzCK0NjtPsHuH/2wlhTE7LnTNLCO/TFQjjIp'.
'hHAA6bY06LSqppMAY47x+04HXTba2kAFlmQKr+YuVDCGUG2k6/'.
'rNwYK8rKwKCnPxHnVS0aA3rag4UQslUGhrlk0Kpv1+sx3tLZ6w'.
'dtYemMkOsnz8R3V9/hB87DEu2Wos5+AAAAAElFTkSuQmCC' ;
 
 
//==========================================================
// File: bs_brown.png
//==========================================================
$this->imgdata_small[8][0]= 677 ;
$this->imgdata_small[8][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAABaF'.
'BMVEX//////////8X/3oD/3nj/1HX/0Gr/xGP/rkv/gBf+iS/2'.
'bAL1agDxaQDuZwDrZwLpZQDmZQLlZADjcx7gZATeYQDdZgraXw'.
'DZXwHYXgDXiEvXZAvUjlfUXwXTjVfTbR7ShUvRbR7RWwDMWQDL'.
'WADKooLKWADJoYLJgkvHWATGoILFn4LFgEvFVgDEZx7EVQDDt6'.
'/DVQDCt6/CnoLChlfCVADAwMC+hFe+UgC8UgC6UQC4gVe4UAC3'.
'gVe3UAC1gFe1eUu1TwC1TgCzTgCwTQKuTACrSgCqSgCpSgCpSQ'.
'CodEulSACkRwCiRgCdRACcRACaQwCYQgCWQgKVQQCVQACUQACS'.
'UR6RPwCOPgCNPQCLPACKPACJOwCEOQCBOAB+NwB9NgB8NgB7NQ'.
'B6NwJ4NAB3RR52MwB0MgBuLwBtLwBsLwBqLgBpLQBkLQJiKgBh'.
'KgBgKwRcKABbKQJbJwBaKQRaJwBYKAJVJQDZvdIYAAAAAXRSTl'.
'MAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLd'.
'fvwAAAAHdElNRQfTAwkUGho0tvl2AAAAtklEQVR4nGNgIBaoSg'.
'mLKGpowfkGMty8AqJKpi4mRlAROR5ONg4JFUv3YHOIgDo/HwsT'.
'q6yps29EsjZYREFIkJ2ZS9/OMzA20wEsIi8uKSZtaOPmH5WSFw'.
'YW0VRW07Vw8vCLSMguLwCL6FlaObp6B0TGZxSXQ9TouHv6+IXG'.
'JGYWlpdDzNEKCgmPjkvLKS0vL4LYxWAen5SelV8OBNZQFxrZ5h'.
'aC+GX2MDczMBh7pZakehkTHQ4AA0Am/jsB5gkAAAAASUVORK5C'.
'YII=' ;
 
//==========================================================
// File: bs_blue.png
//==========================================================
$this->imgdata_small[9][0]= 436 ;
$this->imgdata_small[9][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAk1'.
'BMVEX///////+/v7+trcbGxv+EhM6EhNaEhP97e/9zc/9ra/9S'.
'UsZKSrVSUs5jY/9SUtZKSsZSUudKSt5KSudKSv8YGIQpKf8YGK'.
'UYGN4YGO8YGPcQEP8ICP8AAP8AAPcAAO8AAOcAAN4AANYAAM4A'.
'AMYAAL0AALUAAK0AAKUAAJwAAJQAAIwAAIQAAHsAAHMAAGsAAG'.
'ONFkFbAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGhNNakHSAAAAmk'.
'lEQVR4nI3P2xKCIBAGYGfM6SBWo1nauIqogaDA+z9dK9Lhrv47'.
'vtl/2A2CfxNlJRRp9IETYGraJeEb7ocLNKznia8A7Db7umWDUG'.
'sxAzhurxRHxok4KQGqCuEhlL45oU1D2w5BztY4KRhj/bCAsetM'.
'2uObjwvY8/oX50JItYDxSyZSTrO2mNhvGMbaWAevnbFIcpuTr7'.
't+5AkyfBIKSJHdSQAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bs_green.png
//==========================================================
$this->imgdata_small[10][0]= 452 ;
$this->imgdata_small[10][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAn1'.
'BMVEX///////+/v7+/v7/G/8aUxpSMvYyUzpSMzoyM1oxarVqE'.
'/4R7/3tavVpKnEpaxlpz/3Nr/2tKtUpj/2Na51pKzkpK1kpK50'.
'pK/0oYcxgp/ykYlBgY3hgY7xgY9xgQ/xAI/wgA/wAA9wAA7wAA'.
'5wAA3gAA1gAAzgAAxgAAvQAAtQAArQAApQAAnAAAlAAAjAAAhA'.
'AAewAAcwAAawAAYwA0tyxUAAAAAXRSTlMAQObYZgAAAAFiS0dE'.
'AIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAw'.
'kUGgW5vvSDAAAAnklEQVR4nI3QSxKCMAwA0M4gqCgoiiJ+kEAL'.
'LQUq0PufzX7ENdnlJZNkgtDS2CYZvK6bf+7EoKLA9cH5SQzv6A'.
'YloTywsAbYr44FrlgrXCMJwHl3xxVtuuFkJAPIcw2tGB9GcFli'.
'oqEf5GTkSUhVMw2TtD0XSlnDOw3SznE5520vNEi7CwW9+Ayjyq'.
'U/3+yPuq5gvhkhL0xlGnqL//AFf14UIh4mkEkAAAAASUVORK5C'.
'YII=' ;
 
 
//==========================================================
// File: bs_white.png
//==========================================================
$this->imgdata_small[11][0]= 480 ;
$this->imgdata_small[11][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAAQCAYAAADwMZRfAAAABm'.
'JLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsRAAALEQF/ZF+RAAAA'.
'B3RJTUUH0wMLFTsY/ewvBQAAAW1JREFUeJytkz2u4jAUhT/jic'.
'gfBUKiZhE0bIKeVbCWrIKenp6eDiGlCEEEBArIxvzGU4xeZjLk'.
'jWb05lRXuvbx+exr4bouX1Xjyw7Atz81F4uFBYjjGIDhcCjq1o'.
'k6nN1uZwFerxfP55Msy1itVmRZBsB4PK6YveHkeW5d18XzPIIg'.
'wPd9Wq0WnU6HMAxJkoQoiuynOIfDwUopkVIihKAoCgAcx6Hdbm'.
'OMIU1T5vN55eBKEikljUYDIX6kFUKU9e8aDAZlmjcca+1b7TgO'.
'1+uVy+VS9nzfr8e53++VzdZaiqIgz3OMMWitOZ/PaK0JgqDeRC'.
'mF53lIKYGfr3O73TDGoJQiTVO01nS73XqT4/FIs9kkCAIej0eZ'.
'brPZEMcxSZKgtQZgMpmIWpN+vy+m06n1PK9yTx8Gy+WS/X5Pr9'.
'er9GuHLYoiG4YhSilOpxPr9Zrtdlti/JriU5MPjUYjq7UuEWaz'.
'2d+P/b/qv/zi75oetJcv7QQXAAAAAElFTkSuQmCC' ;
 
 
//==========================================================
// File: bs_cyan.png
//==========================================================
$this->imgdata_small[12][0]= 633 ;
$this->imgdata_small[12][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAABPl'.
'BMVEX////////F///AwMCvxsaC1NSC0dGCz8+CzMyA//94//91'.
'//9q//9j//9X4uJX09NXz89Xx8dXxMRL//9L5uZL3d1L2NhLxs'.
'ZLt7cv//8e9fUe8fEe7u4e398epqYehoYX//8L+PgK//8F9fUE'.
'/v4E5+cEb28EZ2cC//8C/v4C/f0CzMwCrq4Cjo4CdXUCaWkCZW'.
'UB/PwA//8A/f0A+/sA8/MA7e0A7OwA6+sA5eUA5OQA4uIA4eEA'.
'3NwA2toA2NgA1dUA09MA0tIA0NAAysoAxsYAxcUAxMQAv78Avr'.
'4AvLwAtrYAtbUAs7MAsLAAra0Aq6sAqKgApaUApKQAoqIAoKAA'.
'n58AmpoAlZUAk5MAkpIAkJAAj48AjIwAiYkAh4cAf38AfX0Ae3'.
'sAenoAcnIAcHAAa2sAaWkAaGgAYmIUPEuTAAAAAXRSTlMAQObY'.
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA'.
'AHdElNRQfTAwkUGQDi+VPPAAAAtElEQVR4nGNgIBawikipyIiy'.
'wfksfJpGRkamNtr8LFARPiMFHmFDcztXfwGoFi0jLiZuZRtnry'.
'BddrCIiJEGL6eklYO7X3iCOFhE2thESdHawdUnJDZFDiyiamZh'.
'aevk5h0UlZSpBhaRtbN3dPHwDY5MSM+EqBFzc/f0DgiLTkjLzI'.
'SYw6bjHxgaEZeckZmpD7GLQSAqJj4xNRMIBGFuFtRLA/ENhGBu'.
'ZmDgkJBXl5fgIDocAAKcINaFePT4AAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bs_bluegreen.png
//==========================================================
$this->imgdata_small[13][0]= 493 ;
$this->imgdata_small[13][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAAvV'.
'BMVEX///////+/v79j//855/8x3v851v9Spb1C1v8AOUqEtcZK'.
'lK1StdYxzv8hxv8AY4QASmNSlK1KpcZKtd4YQlIYnM4YrecIvf'.
'8AtfcAre8AjL0AhLUAc5wAa5QAWnsAQloAKTkAGCFKhJxKrdYY'.
'jL0Ypd4Atf8ArfcApecAnN4AlM4AjMYAe60Ac6UAY4wAUnNSnL'.
'0AlNYAWoQASmsAOVIAITGEtc4YWnsAUnsAMUqtvcaErcYAKUIA'.
'GCkAECHUyVh/AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAA'.
'AJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGxNUcXCT'.
'AAAAqUlEQVR4nI2Q1xKCMBREM2NHLCCogAGCjd6SqLT8/2cZKT'.
'6zb3tm987OBWCsXoejp8rC35fi4+l6gXFZlD0Rz6fZ1tdDmKR9'.
'RdOmkzmP7DDpilfX3SzvRgQ/Vr1uiZplfsCBiVf03RJd140wgj'.
'kmNqMtuYXcxyYmNWJdRoYwzpM9qRvGujuCmSR7q7ARY00/MiWk'.
'sCnjkobNEm1+HknDZgAqR0GKU43+wxdu2hYzbsHU6AAAAABJRU'.
'5ErkJggg==' ;
 
//==========================================================
// File: bs_lightred.png
//==========================================================
$this->imgdata_small[14][0]= 532 ;
$this->imgdata_small[14][1]=
'iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAMAAAAMs7fIAAAA3l'.
'BMVEX///////+/v7/Gvb0hGBj/5///3v//zu//1u//xucpGCG9'.
'nK21lKVSQkp7Wms5KTExISlaOUpjQlIhEBj/tdbOhKXnrcbGjK'.
'Wla4TetcbGnK2EWmv/rc73pcZ7UmOcY3vOpbW1jJzenLW9e5Rz'.
'Slq1c4xrQlJSOULGhJz/pcb3nL2chIzOnK33rcbelK3WjKWMWm'.
'vGe5SEUmM5ISnOtb3GrbXerb3vpb2ca3v/rcaUY3POhJxCKTF7'.
'SlrWnK21e4ytc4TvnLXnlK2la3taOUK1lJxrSlLGhJRjQkpSMT'.
'lw+q2nAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxIAAAsSAdLdfvwAAAAHdElNRQfTAwkUGjoP2Nm+AAAAr0'.
'lEQVR4nGNgIBaYiOk62imYwPnMkiIyso76yhJSzFARMxkRNk49'.
'a3t5OW6oFk1LVkYOfWUHKxUXiEYzLS12DnN3VXkjIRtFsIiSk5'.
'6evqGqhYGKugAfWMRa1FpD2UHeQEXQRlgALCJur+rgbCUNFOAS'.
'hqjRkZe3MpBTcwEKCEPMMTGSs3Xz8OQHCnBBHckt6OJpIyAMBD'.
'wwN/MYc4H4LK4wNzMwmGrzcvFqmxIdDgDiHRT6VVQkrAAAAABJ'.
'RU5ErkJggg==' ;
 
//==========================================================
// File: bxs_lightred.png
//==========================================================
$this->imgdata_xsmall[0][0]= 432 ;
$this->imgdata_xsmall[0][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAA3l'.
'BMVEX///////+/v7/Gvb0hGBj/5///3v//zu//1u//xucpGCG9'.
'nK21lKVSQkp7Wms5KTExISlaOUpjQlIhEBj/tdbOhKXnrcbGjK'.
'Wla4TetcbGnK2EWmv/rc73pcZ7UmOcY3vOpbW1jJzenLW9e5Rz'.
'Slq1c4xrQlJSOULGhJz/pcb3nL2chIzOnK33rcbelK3WjKWMWm'.
'vGe5SEUmM5ISnOtb3GrbXerb3vpb2ca3v/rcaUY3POhJxCKTF7'.
'SlrWnK21e4ytc4TvnLXnlK2la3taOUK1lJxrSlLGhJRjQkpSMT'.
'lw+q2nAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUKBOgGhWjAAAAS0'.
'lEQVR4nGNgQAEmunYmEJaMCKe1vBxYzJKVQ9lKBSSupKdnaKGi'.
'zgdkiqs6WKnYcIGYJnK2HvzCwmCNgi42wsLCECNMeXlNUY0HAL'.
'DaB7Du8MiEAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bxs_bluegreen.png
//==========================================================
$this->imgdata_xsmall[1][0]= 397 ;
$this->imgdata_xsmall[1][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAvV'.
'BMVEX///////+/v79j//855/8x3v851v9Spb1C1v8AOUqEtcZK'.
'lK1StdYxzv8hxv8AY4QASmNSlK1KpcZKtd4YQlIYnM4YrecIvf'.
'8AtfcAre8AjL0AhLUAc5wAa5QAWnsAQloAKTkAGCFKhJxKrdYY'.
'jL0Ypd4Atf8ArfcApecAnN4AlM4AjMYAe60Ac6UAY4wAUnNSnL'.
'0AlNYAWoQASmsAOVIAITGEtc4YWnsAUnsAMUqtvcaErcYAKUIA'.
'GCkAECHUyVh/AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAA'.
'AJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUKDVyF5Be'.
'AAAASUlEQVR4nGNgQAFmYqJcEJaEOJ+UrD5YTJKFTZrfGCQuaq'.
'glLWvMaQ5kqujo6hnbKIKYXPr68gp2dmCNJiZAlh3ECGsREWtU'.
'4wF1kwdpAHfnSwAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bxs_navy.png
//==========================================================
$this->imgdata_xsmall[2][0]= 353 ;
$this->imgdata_xsmall[2][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAk1'.
'BMVEX///////+/v7+trcbGxv+EhM6EhNaEhP97e/9zc/9ra/9S'.
'UsZKSrVSUs5jY/9SUtZKSsZSUudKSt5KSudKSv8YGIQpKf8YGK'.
'UYGN4YGO8YGPcQEP8ICP8AAP8AAPcAAO8AAOcAAN4AANYAAM4A'.
'AMYAAL0AALUAAK0AAKUAAJwAAJQAAIwAAIQAAHsAAHMAAGsAAG'.
'ONFkFbAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUJxXO4axZAAAAR0'.
'lEQVR4nGNgQAGskhKsEJaslIi8ijpYTJaDU1FVAyQuKSujoKKh'.
'LQ5kSigpqWro6oOYrOoaWroGBmCNWiCWAdQwUVFWVOMBOp4GCJ'.
's5S60AAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bxs_gray.png
//==========================================================
$this->imgdata_xsmall[3][0]= 492 ;
$this->imgdata_xsmall[3][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABI1'.
'BMVEX///8AAAD8EAD8IAD8NAD8RAD8VAAYGBi/v7+goKCCgoJk'.
'ZGRGRkb8yAD83AD87AD8/AD4+ADo+ADY+ADI+AC0+ACk+ACU+A'.
'CE+AB0/ABk/ABU/ABE/AAw/AAg/AAQ/AAA/AAA+AAA6BAA2CAA'.
'yDQAtEQApFQAlGQAhHQAdIgAZJgAVKgARLgAMMgAINwAEOwAAP'.
'wAAPgIAPAQAOgYAOAkANgsANA0AMg8AMBEALhMALBUAKhcAKBo'.
'AJhwAJB4AIiAAID////4+Pjy8vLs7Ozm5ubg4ODa2trT09PNzc'.
'3Hx8fBwcG7u7u1tbWurq6oqKiioqKcnJyWlpaQkJCJiYmDg4N9'.
'fX13d3dxcXFra2tkZGReXl5YWFhSUlJMTExGRkZAQEA1BLn4AA'.
'AAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxEA'.
'AAsRAX9kX5EAAAAHdElNRQfTAwkUKC74clmyAAAAQklEQVR4nG'.
'NgQAVBYVCGt5dXYEQ0mOnp5h4QFgVmeri6+4dHxYMVeHoFRUTH'.
'gTUFBIZBWAwMkZEx8bFQM2Lj0UwHANc/DV6yq/BiAAAAAElFTk'.
'SuQmCC' ;
 
//==========================================================
// File: bxs_graypurple.png
//==========================================================
$this->imgdata_xsmall[4][0]= 542 ;
$this->imgdata_xsmall[4][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABSl'.
'BMVEX////////11P/MqdvKrNfAwMC+u7+9u7+4rr24lsi3rby3'.
'lMe1rLq1o720q7i0oL20ksSzoryyqbaykMGxlb2wkL+vnbiujb'.
'2sjLuri7qpl7GoirWoibenmK2mla6mjLKmhrSllauki7CjhrCj'.
'hLGihLChg6+ggq2fkqadkKOcfqqai6Gag6WYe6WXeqSWeaOTd6'.
'CTd5+Rdp6RdZ6RdZ2Qg5eOc5qMcpiLcZeJb5WIbpOHbZKGbJGE'.
'a4+CaY2AZ4t/Z4p/Zop/Zol+Zol7ZIZ6Y4V5YoR1ZH11X391Xn'.
'9zXX1yXXtxXHtvWnluWXhsV3VqVnNpVXJoVHFnU3BmUm9jUGth'.
'VGdgTmheTGZcS2RcSmRaSWJYR19XRl5SQllRQlhQQVdPQFZOP1'.
'VLPlFJO09IPE5IOk5FOEtEN0lDOEpDOElDNklCNkc/M0XhbrfD'.
'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx'.
'EAAAsRAX9kX5EAAAAHdElNRQfTAwkUKCgREfyHAAAATUlEQVR4'.
'nGNgQAEcIko8EBY3M5Ougy+IxSXMwmTsFsAHZMqrSRvZB0W7A5'.
'k6FlYugXEZICaPr394Um4uSAFDRFRCbm4uxAihsDAhVOMBHT0L'.
'hkeRpo8AAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bxs_red.png
//==========================================================
$this->imgdata_xsmall[5][0]= 357 ;
$this->imgdata_xsmall[5][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAk1'.
'BMVEX////////GxsbGra3/xsbOhITWhIT/hIT/e3v/c3P/a2vG'.
'UlK1SkrOUlL/Y2PWUlLGSkrnUlLeSkrnSkr/SkqEGBj/KSmlGB'.
'jeGBjvGBj3GBj/EBD/CAj/AAD3AADvAADnAADeAADWAADOAADG'.
'AAC9AAC1AACtAAClAACcAACUAACMAACEAAB7AABzAABrAABjAA'.
'BuukXBAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZ'.
'cwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUIyjy5SVMAAAAS0'.
'lEQVR4nGNgQAFsUpJsEJastIi8ijpYTJaDU0FVgxXIlJKVUVDR'.
'0BYHMiUUlVQ1dPVBTDZ1dS1dAwOQAgYtbSDLAGIEq6goK6rxAD'.
'yXBg73lwGUAAAAAElFTkSuQmCC' ;
 
//==========================================================
// File: bxs_yellow.png
//==========================================================
$this->imgdata_xsmall[6][0]= 414 ;
$this->imgdata_xsmall[6][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAzF'.
'BMVEX///////+/v79zYwCMewDOxoTWzoTezkr/5wj/5wDnzgDe'.
'xgC1pQCtnACllACcjACUhABjWgDGvVK1rUrOxlLGvUqEexilnB'.
'jv3hj35xj/7wj/7wD35wDv3gDn1gDezgDWxgDOvQDGtQC9rQCE'.
'ewB7cwBzawBrYwDWzlLn3lLe1krn3kre1hi9tQC1rQCtpQClnA'.
'CclACUjACMhAD/9wC/v7///8bOzoT//4T//3v//3P//2v//2Pn'.
'50r//0r//yn39xj//xD//wBjYwDO8noaAAAAAXRSTlMAQObYZg'.
'AAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAH'.
'dElNRQfTAwkUIzoBXFQEAAAAS0lEQVR4nGNgQAFsDhJsEJaTo5'.
'2skj5YzMnSSk7ZwBzIlOSUklPiMxYHMnW4FXT5VNVBTDZeXiNV'.
'QUGQAgYBYyBLEGIEq5gYK6rxAH4kBmHBaMQQAAAAAElFTkSuQm'.
'CC' ;
 
//==========================================================
// File: bxs_greenblue.png
//==========================================================
$this->imgdata_xsmall[7][0]= 410 ;
$this->imgdata_xsmall[7][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAxl'.
'BMVEX///////+/v79znJQhSkJ7raU5hHtjraVKnJRCjIRClIyU'.
'9++E595avbVaxr2/v7+ctbWcvb17nJxrjIx7paUxQkK9//+Mvb'.
'17ra2Evb17tbVCY2MQGBiU5+ec9/eM5+d71tZanJxjra1rvb1j'.
'tbVSnJxara1rzs5jxsZKlJRChIQpUlIhQkJatbVSpaU5c3MxY2'.
'MYMTEQISFavb1Sra1KnJxCjIw5e3sxa2spWlpClJQhSkoYOTkp'.
'Y2MhUlIQKSkIGBgQMTH+e30mAAAAAXRSTlMAQObYZgAAAAFiS0'.
'dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElNRQfT'.
'AwkUJy5/6kV9AAAATUlEQVR4nGNgQAGCyuyCEJaGugKHviVYzF'.
'hO3sxCWwDIVNLTM9PXtpEGMhW12Cy0DR1ATEFLSxZ7BweQAgYd'.
'HUMHBweIEQKiogKoxgMAo/4H5AfSehsAAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bxs_purple.png
//==========================================================
$this->imgdata_xsmall[8][0]= 364 ;
$this->imgdata_xsmall[8][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAnF'.
'BMVEX///////+/v7/Gvca9rb3Grcb/xv+1hLWte629hL21e7XG'.
'hMbWhNbOe87We9b/hP//e/97OXv/c///a///Y/+cOZz/Sv/WOd'.
'bnOefvOe//Kf9jCGNrCGv/EP//CP/nCOf/AP/3APfvAO/nAOfe'.
'AN7WANbOAM7GAMa9AL21ALWtAK2lAKWcAJyUAJSMAIyEAIR7AH'.
'tzAHNrAGtjAGPP1sZnAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF'.
'HUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUIj'.
'mBTjT/AAAASUlEQVR4nGNgQAGskhKsEJaCrJiSuhZYTEFASFlD'.
'GyQuqSCnrK6tJwpkiquoamgbGIGYrFpaugbGxmCNunpAljHECB'.
'ZBQRZU4wFSMAZsXeM71AAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bxs_green.png
//==========================================================
$this->imgdata_xsmall[9][0]= 370 ;
$this->imgdata_xsmall[9][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAn1'.
'BMVEX///////+/v7+/v7/G/8aUxpSMvYyUzpSMzoyM1oxarVqE'.
'/4R7/3tavVpKnEpaxlpz/3Nr/2tKtUpj/2Na51pKzkpK1kpK50'.
'pK/0oYcxgp/ykYlBgY3hgY7xgY9xgQ/xAI/wgA/wAA9wAA7wAA'.
'5wAA3gAA1gAAzgAAxgAAvQAAtQAArQAApQAAnAAAlAAAjAAAhA'.
'AAewAAcwAAawAAYwA0tyxUAAAAAXRSTlMAQObYZgAAAAFiS0dE'.
'AIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAw'.
'kUKBrZxq0HAAAATElEQVR4nGNgQAGccrIcEJaivISyhjaIxa7I'.
'I6CiqcMKZMopKqho6OhLA5kyqmqaOobGICartraeoYkJSAGDnj'.
'6QZQIxgk1Skg3VeABlVgbItqEBUwAAAABJRU5ErkJggg==' ;
 
//==========================================================
// File: bxs_darkgreen.png
//==========================================================
$this->imgdata_xsmall[10][0]= 563 ;
$this->imgdata_xsmall[10][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABX1'.
'BMVEX////////l/+nAwMC86r+8wb28wby8wLy78sCzw7SywrSx'.
'wLKwvrGuvK+syK+ryq2rx62n36ym3aumxKmk2qij0Keh16ahva'.
'Og1aSguKKe06KeuaCetZ+d0KGdtZ+bz6Cay56ZyZ2Zwp2Zr5qZ'.
'rpqYwJuXyZuXrJmVw5mUxZiTxJeTw5eTq5WRwJWPtJKOvZKKuI'.
'6Kt42Kn4yJt42ItIuGsomFsYmEsIiEr4eDr4eBrIR/qoN+qIJ8'.
'poB7pH56o356on14nnt2nXl0mndzmnZzmXZymHVwlXNvlHJukn'.
'FtiHBqjm1qjW1oi2toiWpniWplh2hlhmdkhWdig2VggGNgf2Je'.
'fmFdfGBde19bbl1aeFxXdFpWclhVclhVcVdUcFZTb1VSbVRQal'.
'JPaVFKY0xKYkxJYUtIYEpHX0lEWkZCWERCV0NCVkM/U0A+U0A+'.
'UUA+UEA9Uj89UT48Tj45TDvewfrHAAAAAXRSTlMAQObYZgAAAA'.
'FiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElN'.
'RQfTAwkUKCFozUQjAAAATUlEQVR4nGNgQAGcoqrcEJYQB5OhSw'.
'CIxSXGwWThGcIDZCppK5o7hyV6AZl6NnbuoSmFICZ3YHB0RkkJ'.
'SAFDbEJaSUkJxAjeyEheVOMBQj4MOEkWew4AAAAASUVORK5CYI'.
'I=' ;
 
//==========================================================
// File: bxs_cyan.png
//==========================================================
$this->imgdata_xsmall[11][0]= 530 ;
$this->imgdata_xsmall[11][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABPl'.
'BMVEX////////F///AwMCvxsaC1NSC0dGCz8+CzMyA//94//91'.
'//9q//9j//9X4uJX09NXz89Xx8dXxMRL//9L5uZL3d1L2NhLxs'.
'ZLt7cv//8e9fUe8fEe7u4e398epqYehoYX//8L+PgK//8F9fUE'.
'/v4E5+cEb28EZ2cC//8C/v4C/f0CzMwCrq4Cjo4CdXUCaWkCZW'.
'UB/PwA//8A/f0A+/sA8/MA7e0A7OwA6+sA5eUA5OQA4uIA4eEA'.
'3NwA2toA2NgA1dUA09MA0tIA0NAAysoAxsYAxcUAxMQAv78Avr'.
'4AvLwAtrYAtbUAs7MAsLAAra0Aq6sAqKgApaUApKQAoqIAoKAA'.
'n58AmpoAlZUAk5MAkpIAkJAAj48AjIwAiYkAh4cAf38AfX0Ae3'.
'sAenoAcnIAcHAAa2sAaWkAaGgAYmIUPEuTAAAAAXRSTlMAQObY'.
'ZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9kX5EAAA'.
'AHdElNRQfTAwkUKQFKuFWqAAAATUlEQVR4nGNgQAGsUjJsEJaR'.
'grC5qz9YzIiL28YriB3IlDZRsnYNiZUDMmXtHT2CE9JBTDb/wI'.
'jkzEyQAoaomMTMzEyIERzy8hyoxgMAN2MLVPW0f4gAAAAASUVO'.
'RK5CYII=' ;
 
//==========================================================
// File: bxs_orange.png
//==========================================================
$this->imgdata_xsmall[12][0]= 572 ;
$this->imgdata_xsmall[12][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABaF'.
'BMVEX//////////8X/3oD/3nj/1HX/0Gr/xGP/rkv/gBf+iS/2'.
'bAL1agDxaQDuZwDrZwLpZQDmZQLlZADjcx7gZATeYQDdZgraXw'.
'DZXwHYXgDXiEvXZAvUjlfUXwXTjVfTbR7ShUvRbR7RWwDMWQDL'.
'WADKooLKWADJoYLJgkvHWATGoILFn4LFgEvFVgDEZx7EVQDDt6'.
'/DVQDCt6/CnoLChlfCVADAwMC+hFe+UgC8UgC6UQC4gVe4UAC3'.
'gVe3UAC1gFe1eUu1TwC1TgCzTgCwTQKuTACrSgCqSgCpSgCpSQ'.
'CodEulSACkRwCiRgCdRACcRACaQwCYQgCWQgKVQQCVQACUQACS'.
'UR6RPwCOPgCNPQCLPACKPACJOwCEOQCBOAB+NwB9NgB8NgB7NQ'.
'B6NwJ4NAB3RR52MwB0MgBuLwBtLwBsLwBqLgBpLQBkLQJiKgBh'.
'KgBgKwRcKABbKQJbJwBaKQRaJwBYKAJVJQDZvdIYAAAAAXRSTl'.
'MAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxEAAAsRAX9k'.
'X5EAAAAHdElNRQfTAwkUJBSSy88MAAAATUlEQVR4nGNgQAGqwo'.
'paEBYPJ4eKezCIpc7HwmrqG6ENZMpLihm6RaWEAZl6Vo7ekRnF'.
'IKZWSHhcTnk5SAFDfFJWeXk5xAjj1FRjVOMBeFwNcWYSLjsAAA'.
'AASUVORK5CYII=' ;
 
//==========================================================
// File: bxs_lightblue.png
//==========================================================
$this->imgdata_xsmall[13][0]= 554 ;
$this->imgdata_xsmall[13][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAABVl'.
'BMVEX////////d///AwMC7wcS08P+y+P+xxdCwxM+uws2twMur'.
'vsinzNynytylzuKhyN6e5v6d5P+d1fOcwNWcu8ub4f+at8iZ3v'.
'+ZvdGY2/yW2f+VscGU1vuT1fqTr72Sx+SSxeKR0fWRz/GPz/OP'.
'rr+OyeqMy+6Myu2LyeyKxueJudSGw+SGorGDvt+Cvd6CvN2Aud'.
'p+uNd+t9Z9tdV8tdR8tNN6sc94r813rct2q8h0qcZ0qMVzp8Rx'.
'o8Bwor5tn7ptnrptnrlsnbhqmbRpmbNpi51ol7Flkqtkkqtkka'.
'pjj6hijaRhjaZgi6NfiqJfiaFdh55bhJtag5pZgphYgJZYf5VX'.
'cn9Ve5FSeI1RdopRdYlQdYlPc4dPcoZPcoVNcINLboBLbH9GZn'.
'hGZXdFZHZEY3RDYnJCXW4/W2s/WWg+Wmo7VmU7VGM7U2E6VGM6'.
'VGI5UV82T1wGxheQAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHU'.
'gAAAAJcEhZcwAACxEAAAsRAX9kX5EAAAAHdElNRQfTAwkUJziL'.
'PvAsAAAATUlEQVR4nGNgQAHsQgqcEJYgG5Oegy+IxSHOxmTiFs'.
'gFZMprKBnbB8e7AplaFlbOQUl5ICanX0BEWmEhSAFDVGxKYWEh'.
'xAjusDBuVOMBJO8LrFHRAykAAAAASUVORK5CYII=' ;
 
//==========================================================
// File: bxs_darkgray.png
//==========================================================
$this->imgdata_xsmall[14][0]= 574 ;
$this->imgdata_xsmall[14][1]=
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABm'.
'JLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsRAAALEQF/ZF+RAAAB'.
'iElEQVR42k3QPU8TYRwA8P//ebkXrgdIColXRAOEkJqbaExMut'.
'DBhE1GNjYHPg+DG6ODiU6QOLjVxITBcFKBYCstlAC2Bz17fe76'.
'vLD6+wg/1FpTRFR5lpaub/u1eGBGaAT4HneD4OlXx7avtDYUjT'.
'HQabd2Ti8e3vVSKzxrtHS32wIpFVldno22Nqvvg2Bhl0gp/aNm'.
'vJ3qqXAtLIva+ks1H0wqlSXi4+d6+OFTfRsAfHJx2d1od24rZP'.
'xP2HzopINr1mkesX7ccojqif0v9crxWXODZTno3+dNGA7uWLsd'.
'mUYU4fHJCViMG9umLBmM4L6fagZGg9QKfjZ+Qfy3C3G/B3mugF'.
'IHHNcDf64E3KJALApk2p8CSolUUqLjFkyxOGMsTtFyJ+Wz57NQ'.
'8DghS4sLB0svioeZZo7nPhFoUKZDIVFbglkTTnl5/rC8snjAkJ'.
'Bk/XV5LxHC/v7tR8jzTFPbg8LENK9WX0Vv31T2AEmCSmlKCCoh'.
'ROnP1U1tPFYjJBRcbtzSf+GPsFTAQBq1n4AAAABKdEVYdHNpZ2'.
'5hdHVyZQBiYzYyMDIyNjgwYThjODMyMmUxNjk0NWUzZjljOGFh'.
'N2VmZWFhMjA4OTE2ZjkwOTdhZWE1MzYyMjk0MWRkM2I5EqaPDA'.
'AAAABJRU5ErkJggg==' ;
}
}
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_log.php
New file
0,0 → 1,305
<?php
/*=======================================================================
// File: JPGRAPH_LOG.PHP
// Description: Log scale plot extension for JpGraph
// Created: 2001-01-08
// Ver: $Id: jpgraph_log.php 1106 2009-02-22 20:16:35Z 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 __construct($min,$max,$type="y") {
parent::__construct($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.');
}
if( is_numeric($this->autoscale_min) ) {
$smin = round($this->autoscale_min);
$smax = ceil(log10($max));
if( $min >= $max ) {
JpGraphError::RaiseL(25071);//('You have specified a min value with SetAutoMin() which is larger than the maximum value used for the scale. This is not possible.');
}
}
else {
$smin = floor(log10($min));
if( is_numeric($this->autoscale_max) ) {
$smax = round($this->autoscale_max);
if( $smin >= $smax ) {
JpGraphError::RaiseL(25072);//('You have specified a max value with SetAutoMax() which is smaller than the miminum value used for the scale. This is not possible.');
}
}
else
$smax = ceil(log10($max));
}
 
$this->Update($img,$smin,$smax);
}
//---------------
// PRIVATE METHODS
} // Class
 
//===================================================
// CLASS LogTicks
// Description:
//===================================================
class LogTicks extends Ticks{
private $label_logtype=LOGLABELS_MAGNITUDE;
private $ticklabels_pos = array();
//---------------
// 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 */
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_plotline.php
New file
0,0 → 1,138
<?php
/*=======================================================================
// File: JPGRAPH_PLOTLINE.PHP
// Description: PlotLine extension for JpGraph
// Created: 2009-03-24
// Ver: $Id: jpgraph_plotline.php 1881 2009-10-01 10:28:12Z ljp $
//
// CLASS PlotLine
// Data container class to hold properties for a static
// line that is drawn directly in the plot area.
// Useful to add static borders inside a plot to show for example set-values
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
*/
 
class PlotLine {
public $scaleposition, $direction=-1;
protected $weight=1;
protected $color = 'black';
private $legend='',$hidelegend=false, $legendcsimtarget='', $legendcsimalt='',$legendcsimwintarget='';
private $iLineStyle='solid';
public $numpoints=0; // Needed since the framework expects this property
 
function __construct($aDir=HORIZONTAL,$aPos=0,$aColor='black',$aWeight=1) {
$this->direction = $aDir;
$this->color=$aColor;
$this->weight=$aWeight;
$this->scaleposition=$aPos;
}
 
function SetLegend($aLegend,$aCSIM='',$aCSIMAlt='',$aCSIMWinTarget='') {
$this->legend = $aLegend;
$this->legendcsimtarget = $aCSIM;
$this->legendcsimwintarget = $aCSIMWinTarget;
$this->legendcsimalt = $aCSIMAlt;
}
 
function HideLegend($f=true) {
$this->hidelegend = $f;
}
 
function SetPosition($aScalePosition) {
$this->scaleposition=$aScalePosition;
}
 
function SetDirection($aDir) {
$this->direction = $aDir;
}
 
function SetColor($aColor) {
$this->color=$aColor;
}
 
function SetWeight($aWeight) {
$this->weight=$aWeight;
}
 
function SetLineStyle($aStyle) {
$this->iLineStyle = $aStyle;
}
 
//---------------
// PRIVATE METHODS
 
function DoLegend($graph) {
if( !$this->hidelegend ) $this->Legend($graph);
}
 
// Framework function the chance for each plot class to set a legend
function Legend($aGraph) {
if( $this->legend != '' ) {
$dummyPlotMark = new PlotMark();
$lineStyle = 1;
$aGraph->legend->Add($this->legend,$this->color,$dummyPlotMark,$lineStyle,
$this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget);
}
}
 
function PreStrokeAdjust($aGraph) {
// Nothing to do
}
 
// Called by framework to allow the object to draw
// optional information in the margin area
function StrokeMargin($aImg) {
// Nothing to do
}
 
// Framework function to allow the object to adjust the scale
function PrescaleSetup($aGraph) {
// Nothing to do
}
 
function Min() {
return array(null,null);
}
 
function Max() {
return array(null,null);
}
 
function _Stroke($aImg,$aMinX,$aMinY,$aMaxX,$aMaxY,$aXPos,$aYPos) {
$aImg->SetColor($this->color);
$aImg->SetLineWeight($this->weight);
$oldStyle = $aImg->SetLineStyle($this->iLineStyle);
if( $this->direction == VERTICAL ) {
$ymin_abs = $aMinY;
$ymax_abs = $aMaxY;
$xpos_abs = $aXPos;
$aImg->StyleLine($xpos_abs, $ymin_abs, $xpos_abs, $ymax_abs);
}
elseif( $this->direction == HORIZONTAL ) {
$xmin_abs = $aMinX;
$xmax_abs = $aMaxX;
$ypos_abs = $aYPos;
$aImg->StyleLine($xmin_abs, $ypos_abs, $xmax_abs, $ypos_abs);
}
else {
JpGraphError::RaiseL(25125);//(" Illegal direction for static line");
}
$aImg->SetLineStyle($oldStyle);
}
 
function Stroke($aImg,$aXScale,$aYScale) {
$this->_Stroke($aImg,
$aImg->left_margin,
$aYScale->Translate($aYScale->GetMinVal()),
$aImg->width-$aImg->right_margin,
$aYScale->Translate($aYScale->GetMaxVal()),
$aXScale->Translate($this->scaleposition),
$aYScale->Translate($this->scaleposition)
);
}
}
 
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_iconplot.php
New file
0,0 → 1,190
<?php
//=======================================================================
// File: JPGRAPH_ICONPLOT.PHP
// Description: Extension module to add icons to plots
// Created: 2004-02-18
// Ver: $Id: jpgraph_iconplot.php 1404 2009-06-28 15:25:41Z 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 __construct($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=null,$ayscale=null) {
$this->StrokeWithScale($aImg,$axscale,$ayscale);
}
 
function StrokeWithScale($aImg,$axscale,$ayscale) {
if( $this->iScalePosX === null || $this->iScalePosY === null ||
$axscale === null || $ayscale === 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);
}
}
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/gd_image.inc.php
New file
0,0 → 1,2021
<?php
//=======================================================================
// File: GD_IMAGE.INC.PHP
// Description: PHP Graph Plotting library. Low level image drawing routines
// Created: 2001-01-08, refactored 2008-03-29
// Ver: $Id: gd_image.inc.php 1922 2010-01-11 11:42:50Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
 
require_once 'jpgraph_rgb.inc.php';
require_once 'jpgraph_ttf.inc.php';
 
// Line styles
define('LINESTYLE_SOLID',1);
define('LINESTYLE_DOTTED',2);
define('LINESTYLE_DASHED',3);
define('LINESTYLE_LONGDASH',4);
 
// The DEFAULT_GFORMAT sets the default graphic encoding format, i.e.
// PNG, JPG or GIF depending on what is installed on the target system
// in that order.
if( !DEFINED("DEFAULT_GFORMAT") ) {
define("DEFAULT_GFORMAT","auto");
}
 
//========================================================================
// CLASS Image
// Description: The very coor image drawing class that encapsulates all
// calls to the GD library
// Note: The class used by the library is the decendant
// class RotImage which extends the Image class with transparent
// rotation.
//=========================================================================
class Image {
public $left_margin=30,$right_margin=30,$top_margin=20,$bottom_margin=30;
public $img=null;
public $plotwidth=0,$plotheight=0;
public $width=0, $height=0;
public $rgb=null;
public $current_color,$current_color_name;
public $line_weight=1, $line_style=LINESTYLE_SOLID;
public $img_format;
public $ttf=null;
protected $expired=true;
protected $lastx=0, $lasty=0;
protected $obs_list=array();
protected $font_size=12,$font_family=FF_FONT1, $font_style=FS_NORMAL;
protected $font_file='';
protected $text_halign="left",$text_valign="bottom";
protected $use_anti_aliasing=false;
protected $quality=null;
protected $colorstack=array(),$colorstackidx=0;
protected $canvascolor = 'white' ;
protected $langconv = null ;
protected $iInterlace=false;
protected $bbox_cache = array(); // STore the last found tetx bounding box
 
//---------------
// CONSTRUCTOR
function __construct($aWidth=0,$aHeight=0,$aFormat=DEFAULT_GFORMAT,$aSetAutoMargin=true) {
$this->CreateImgCanvas($aWidth,$aHeight);
 
if( $aSetAutoMargin ) {
$this->SetAutoMargin();
}
 
if( !$this->SetImgFormat($aFormat) ) {
JpGraphError::RaiseL(25081,$aFormat);//("JpGraph: Selected graphic format is either not supported or unknown [$aFormat]");
}
$this->ttf = new TTF();
$this->langconv = new LanguageConv();
}
 
// Enable interlacing in images
function SetInterlace($aFlg=true) {
$this->iInterlace=$aFlg;
}
 
// Should we use anti-aliasing. Note: This really slows down graphics!
function SetAntiAliasing($aFlg=true) {
$this->use_anti_aliasing = $aFlg;
if( function_exists('imageantialias') ) {
imageantialias($this->img,$aFlg);
}
else {
JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
}
}
 
function GetAntiAliasing() {
return $this->use_anti_aliasing ;
}
 
function CreateRawCanvas($aWidth=0,$aHeight=0) {
if( $aWidth <= 1 || $aHeight <= 1 ) {
JpGraphError::RaiseL(25082,$aWidth,$aHeight);//("Illegal sizes specified for width or height when creating an image, (width=$aWidth, height=$aHeight)");
}
 
$this->img = @imagecreatetruecolor($aWidth, $aHeight);
if( $this->img < 1 ) {
JpGraphError::RaiseL(25126);
//die("Can't create truecolor image. Check that you really have GD2 library installed.");
}
$this->SetAlphaBlending();
 
if( $this->iInterlace ) {
imageinterlace($this->img,1);
}
if( $this->rgb != null ) {
$this->rgb->img = $this->img ;
}
else {
$this->rgb = new RGB($this->img);
}
}
 
function CloneCanvasH() {
$oldimage = $this->img;
$this->CreateRawCanvas($this->width,$this->height);
imagecopy($this->img,$oldimage,0,0,0,0,$this->width,$this->height);
return $oldimage;
}
 
function CreateImgCanvas($aWidth=0,$aHeight=0) {
 
$old = array($this->img,$this->width,$this->height);
 
$aWidth = round($aWidth);
$aHeight = round($aHeight);
 
$this->width=$aWidth;
$this->height=$aHeight;
 
 
if( $aWidth==0 || $aHeight==0 ) {
// We will set the final size later.
// Note: The size must be specified before any other
// img routines that stroke anything are called.
$this->img = null;
$this->rgb = null;
return $old;
}
 
$this->CreateRawCanvas($aWidth,$aHeight);
// Set canvas color (will also be the background color for a
// a pallett image
$this->SetColor($this->canvascolor);
$this->FilledRectangle(0,0,$aWidth-1,$aHeight-1);
 
return $old ;
}
 
function CopyCanvasH($aToHdl,$aFromHdl,$aToX,$aToY,$aFromX,$aFromY,$aWidth,$aHeight,$aw=-1,$ah=-1) {
if( $aw === -1 ) {
$aw = $aWidth;
$ah = $aHeight;
$f = 'imagecopyresized';
}
else {
$f = 'imagecopyresampled';
}
$f($aToHdl,$aFromHdl,$aToX,$aToY,$aFromX,$aFromY, $aWidth,$aHeight,$aw,$ah);
}
 
function Copy($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth=-1,$fromHeight=-1) {
$this->CopyCanvasH($this->img,$fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth,$fromHeight);
}
 
function CopyMerge($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth=-1,$fromHeight=-1,$aMix=100) {
if( $aMix == 100 ) {
$this->CopyCanvasH($this->img,$fromImg,
$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth,$fromHeight);
}
else {
if( ($fromWidth != -1 && ($fromWidth != $toWidth)) || ($fromHeight != -1 && ($fromHeight != $fromHeight)) ) {
// Create a new canvas that will hold the re-scaled original from image
if( $toWidth <= 1 || $toHeight <= 1 ) {
JpGraphError::RaiseL(25083);//('Illegal image size when copying image. Size for copied to image is 1 pixel or less.');
}
 
$tmpimg = @imagecreatetruecolor($toWidth, $toHeight);
 
if( $tmpimg < 1 ) {
JpGraphError::RaiseL(25084);//('Failed to create temporary GD canvas. Out of memory ?');
}
$this->CopyCanvasH($tmpimg,$fromImg,0,0,0,0,
$toWidth,$toHeight,$fromWidth,$fromHeight);
$fromImg = $tmpimg;
}
imagecopymerge($this->img,$fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$aMix);
}
}
 
static function GetWidth($aImg=null) {
if( $aImg === null ) {
$aImg = $this->img;
}
return imagesx($aImg);
}
 
static function GetHeight($aImg=null) {
if( $aImg === null ) {
$aImg = $this->img;
}
return imagesy($aImg);
}
 
static function CreateFromString($aStr) {
$img = imagecreatefromstring($aStr);
if( $img === false ) {
JpGraphError::RaiseL(25085);
//('An image can not be created from the supplied string. It is either in a format not supported or the string is representing an corrupt image.');
}
return $img;
}
 
function SetCanvasH($aHdl) {
$this->img = $aHdl;
$this->rgb->img = $aHdl;
}
 
function SetCanvasColor($aColor) {
$this->canvascolor = $aColor ;
}
 
function SetAlphaBlending($aFlg=true) {
ImageAlphaBlending($this->img,$aFlg);
}
 
function SetAutoMargin() {
$min_bm=5;
$lm = min(40,$this->width/7);
$rm = min(20,$this->width/10);
$tm = max(5,$this->height/7);
$bm = max($min_bm,$this->height/6);
$this->SetMargin($lm,$rm,$tm,$bm);
}
 
//---------------
// PUBLIC METHODS
 
function SetFont($family,$style=FS_NORMAL,$size=10) {
$this->font_family=$family;
$this->font_style=$style;
$this->font_size=$size;
$this->font_file='';
if( ($this->font_family==FF_FONT1 || $this->font_family==FF_FONT2) && $this->font_style==FS_BOLD ){
++$this->font_family;
}
if( $this->font_family > FF_FONT2+1 ) { // A TTF font so get the font file
 
// Check that this PHP has support for TTF fonts
if( !function_exists('imagettfbbox') ) {
JpGraphError::RaiseL(25087);//('This PHP build has not been configured with TTF support. You need to recompile your PHP installation with FreeType support.');
}
$this->font_file = $this->ttf->File($this->font_family,$this->font_style);
}
}
 
// Get the specific height for a text string
function GetTextHeight($txt="",$angle=0) {
$tmp = preg_split('/\n/',$txt);
$n = count($tmp);
$m=0;
for($i=0; $i< $n; ++$i) {
$m = max($m,strlen($tmp[$i]));
}
 
if( $this->font_family <= FF_FONT2+1 ) {
if( $angle==0 ) {
$h = imagefontheight($this->font_family);
if( $h === false ) {
JpGraphError::RaiseL(25088);//('You have a misconfigured GD font support. The call to imagefontwidth() fails.');
}
 
return $n*$h;
}
else {
$w = @imagefontwidth($this->font_family);
if( $w === false ) {
JpGraphError::RaiseL(25088);//('You have a misconfigured GD font support. The call to imagefontwidth() fails.');
}
 
return $m*$w;
}
}
else {
$bbox = $this->GetTTFBBox($txt,$angle);
return $bbox[1]-$bbox[5]+1;
}
}
 
// Estimate font height
function GetFontHeight($angle=0) {
$txt = "XOMg";
return $this->GetTextHeight($txt,$angle);
}
 
// Approximate font width with width of letter "O"
function GetFontWidth($angle=0) {
$txt = 'O';
return $this->GetTextWidth($txt,$angle);
}
 
// Get actual width of text in absolute pixels. Note that the width is the
// texts projected with onto the x-axis. Call with angle=0 to get the true
// etxt width.
function GetTextWidth($txt,$angle=0) {
 
$tmp = preg_split('/\n/',$txt);
$n = count($tmp);
if( $this->font_family <= FF_FONT2+1 ) {
 
$m=0;
for($i=0; $i < $n; ++$i) {
$l=strlen($tmp[$i]);
if( $l > $m ) {
$m = $l;
}
}
 
if( $angle==0 ) {
$w = @imagefontwidth($this->font_family);
if( $w === false ) {
JpGraphError::RaiseL(25088);//('You have a misconfigured GD font support. The call to imagefontwidth() fails.');
}
return $m*$w;
}
else {
// 90 degrees internal so height becomes width
$h = @imagefontheight($this->font_family);
if( $h === false ) {
JpGraphError::RaiseL(25089);//('You have a misconfigured GD font support. The call to imagefontheight() fails.');
}
return $n*$h;
}
}
else {
// For TTF fonts we must walk through a lines and find the
// widest one which we use as the width of the multi-line
// paragraph
$m=0;
for( $i=0; $i < $n; ++$i ) {
$bbox = $this->GetTTFBBox($tmp[$i],$angle);
$mm = $bbox[2] - $bbox[0];
if( $mm > $m )
$m = $mm;
}
return $m;
}
}
 
 
// Draw text with a box around it
function StrokeBoxedText($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
$shadowcolor=false,$paragraph_align="left",
$xmarg=6,$ymarg=4,$cornerradius=0,$dropwidth=3) {
 
$oldx = $this->lastx;
$oldy = $this->lasty;
 
if( !is_numeric($dir) ) {
if( $dir=="h" ) $dir=0;
elseif( $dir=="v" ) $dir=90;
else JpGraphError::RaiseL(25090,$dir);//(" Unknown direction specified in call to StrokeBoxedText() [$dir]");
}
 
if( $this->font_family >= FF_FONT0 && $this->font_family <= FF_FONT2+1) {
$width=$this->GetTextWidth($txt,$dir) ;
$height=$this->GetTextHeight($txt,$dir) ;
}
else {
$width=$this->GetBBoxWidth($txt,$dir) ;
$height=$this->GetBBoxHeight($txt,$dir) ;
}
 
$height += 2*$ymarg;
$width += 2*$xmarg;
 
if( $this->text_halign=="right" ) $x -= $width;
elseif( $this->text_halign=="center" ) $x -= $width/2;
 
if( $this->text_valign=="bottom" ) $y -= $height;
elseif( $this->text_valign=="center" ) $y -= $height/2;
 
$olda = $this->SetAngle(0);
 
if( $shadowcolor ) {
$this->PushColor($shadowcolor);
$this->FilledRoundedRectangle($x-$xmarg+$dropwidth,$y-$ymarg+$dropwidth,
$x+$width+$dropwidth,$y+$height-$ymarg+$dropwidth,
$cornerradius);
$this->PopColor();
$this->PushColor($fcolor);
$this->FilledRoundedRectangle($x-$xmarg,$y-$ymarg,
$x+$width,$y+$height-$ymarg,
$cornerradius);
$this->PopColor();
$this->PushColor($bcolor);
$this->RoundedRectangle($x-$xmarg,$y-$ymarg,
$x+$width,$y+$height-$ymarg,$cornerradius);
$this->PopColor();
}
else {
if( $fcolor ) {
$oc=$this->current_color;
$this->SetColor($fcolor);
$this->FilledRoundedRectangle($x-$xmarg,$y-$ymarg,$x+$width,$y+$height-$ymarg,$cornerradius);
$this->current_color=$oc;
}
if( $bcolor ) {
$oc=$this->current_color;
$this->SetColor($bcolor);
$this->RoundedRectangle($x-$xmarg,$y-$ymarg,$x+$width,$y+$height-$ymarg,$cornerradius);
$this->current_color=$oc;
}
}
 
$h=$this->text_halign;
$v=$this->text_valign;
$this->SetTextAlign("left","top");
 
$debug=false;
$this->StrokeText($x, $y, $txt, $dir, $paragraph_align,$debug);
 
$bb = array($x-$xmarg,$y+$height-$ymarg,$x+$width,$y+$height-$ymarg,
$x+$width,$y-$ymarg,$x-$xmarg,$y-$ymarg);
$this->SetTextAlign($h,$v);
 
$this->SetAngle($olda);
$this->lastx = $oldx;
$this->lasty = $oldy;
 
return $bb;
}
 
// Draw text with a box around it. This time the box will be rotated
// with the text. The previous method will just make a larger enough non-rotated
// box to hold the text inside.
function StrokeBoxedText2($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
$shadowcolor=false,$paragraph_align="left",
$xmarg=6,$ymarg=4,$cornerradius=0,$dropwidth=3) {
 
// This version of boxed text will stroke a rotated box round the text
// thta will follow the angle of the text.
// This has two implications:
// 1) This methos will only support TTF fonts
// 2) The only two alignment that makes sense are centered or baselined
 
if( $this->font_family <= FF_FONT2+1 ) {
JpGraphError::RaiseL(25131);//StrokeBoxedText2() Only support TTF fonts and not built in bitmap fonts
}
 
$oldx = $this->lastx;
$oldy = $this->lasty;
$dir = $this->NormAngle($dir);
 
if( !is_numeric($dir) ) {
if( $dir=="h" ) $dir=0;
elseif( $dir=="v" ) $dir=90;
else JpGraphError::RaiseL(25090,$dir);//(" Unknown direction specified in call to StrokeBoxedText() [$dir]");
}
 
$width=$this->GetTextWidth($txt,0) + 2*$xmarg;
$height=$this->GetTextHeight($txt,0) + 2*$ymarg ;
$rect_width=$this->GetBBoxWidth($txt,$dir) ;
$rect_height=$this->GetBBoxHeight($txt,$dir) ;
 
$baseline_offset = $this->bbox_cache[1]-1;
 
if( $this->text_halign=="center" ) {
if( $dir >= 0 && $dir <= 90 ) {
 
$x -= $rect_width/2;
$x += sin($dir*M_PI/180)*$height;
$y += $rect_height/2;
 
} elseif( $dir >= 270 && $dir <= 360 ) {
 
$x -= $rect_width/2;
$y -= $rect_height/2;
$y += cos($dir*M_PI/180)*$height;
 
} elseif( $dir >= 90 && $dir <= 180 ) {
 
$x += $rect_width/2;
$y += $rect_height/2;
$y += cos($dir*M_PI/180)*$height;
 
}
else {
// $dir > 180 && $dir < 270
$x += $rect_width/2;
$x += sin($dir*M_PI/180)*$height;
$y -= $rect_height/2;
}
}
 
// Rotate the box around this point
$this->SetCenter($x,$y);
$olda = $this->SetAngle(-$dir);
 
// We need to use adjusted coordinats for the box to be able
// to draw the box below the baseline. This cannot be done before since
// the rotating point must be the original x,y since that is arounbf the
// point where the text will rotate and we cannot change this since
// that is where the GD/GreeType will rotate the text
 
 
// For smaller <14pt font we need to do some additional
// adjustments to make it look good
if( $this->font_size < 14 ) {
$x -= 2;
$y += 2;
}
else {
// $y += $baseline_offset;
}
 
if( $shadowcolor ) {
$this->PushColor($shadowcolor);
$this->FilledRectangle($x-$xmarg+$dropwidth,$y+$ymarg+$dropwidth-$height,
$x+$width+$dropwidth,$y+$ymarg+$dropwidth);
//$cornerradius);
$this->PopColor();
$this->PushColor($fcolor);
$this->FilledRectangle($x-$xmarg, $y+$ymarg-$height,
$x+$width, $y+$ymarg);
//$cornerradius);
$this->PopColor();
$this->PushColor($bcolor);
$this->Rectangle($x-$xmarg,$y+$ymarg-$height,
$x+$width,$y+$ymarg);
//$cornerradius);
$this->PopColor();
}
else {
if( $fcolor ) {
$oc=$this->current_color;
$this->SetColor($fcolor);
$this->FilledRectangle($x-$xmarg,$y+$ymarg-$height,$x+$width,$y+$ymarg);//,$cornerradius);
$this->current_color=$oc;
}
if( $bcolor ) {
$oc=$this->current_color;
$this->SetColor($bcolor);
$this->Rectangle($x-$xmarg,$y+$ymarg-$height,$x+$width,$y+$ymarg);//,$cornerradius);
$this->current_color=$oc;
}
}
 
if( $this->font_size < 14 ) {
$x += 2;
$y -= 2;
}
else {
 
// Restore the original y before we stroke the text
// $y -= $baseline_offset;
 
}
 
$this->SetCenter(0,0);
$this->SetAngle($olda);
 
$h=$this->text_halign;
$v=$this->text_valign;
if( $this->text_halign == 'center') {
$this->SetTextAlign('center','basepoint');
}
else {
$this->SetTextAlign('basepoint','basepoint');
}
 
$debug=false;
$this->StrokeText($x, $y, $txt, $dir, $paragraph_align,$debug);
 
$bb = array($x-$xmarg, $y+$height-$ymarg,
$x+$width, $y+$height-$ymarg,
$x+$width, $y-$ymarg,
$x-$xmarg, $y-$ymarg);
 
$this->SetTextAlign($h,$v);
$this->SetAngle($olda);
 
$this->lastx = $oldx;
$this->lasty = $oldy;
 
return $bb;
}
 
// Set text alignment
function SetTextAlign($halign,$valign="bottom") {
$this->text_halign=$halign;
$this->text_valign=$valign;
}
 
function _StrokeBuiltinFont($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$aDebug=false) {
 
if( is_numeric($dir) && $dir!=90 && $dir!=0)
JpGraphError::RaiseL(25091);//(" Internal font does not support drawing text at arbitrary angle. Use TTF fonts instead.");
 
$h=$this->GetTextHeight($txt);
$fh=$this->GetFontHeight();
$w=$this->GetTextWidth($txt);
 
if( $this->text_halign=="right") {
$x -= $dir==0 ? $w : $h;
}
elseif( $this->text_halign=="center" ) {
// For center we subtract 1 pixel since this makes the middle
// be prefectly in the middle
$x -= $dir==0 ? $w/2-1 : $h/2;
}
if( $this->text_valign=="top" ) {
$y += $dir==0 ? $h : $w;
}
elseif( $this->text_valign=="center" ) {
$y += $dir==0 ? $h/2 : $w/2;
}
 
if( $dir==90 ) {
imagestringup($this->img,$this->font_family,$x,$y,$txt,$this->current_color);
$aBoundingBox = array(round($x),round($y),round($x),round($y-$w),round($x+$h),round($y-$w),round($x+$h),round($y));
if( $aDebug ) {
// Draw bounding box
$this->PushColor('green');
$this->Polygon($aBoundingBox,true);
$this->PopColor();
}
}
else {
if( preg_match('/\n/',$txt) ) {
$tmp = preg_split('/\n/',$txt);
for($i=0; $i < count($tmp); ++$i) {
$w1 = $this->GetTextWidth($tmp[$i]);
if( $paragraph_align=="left" ) {
imagestring($this->img,$this->font_family,$x,$y-$h+1+$i*$fh,$tmp[$i],$this->current_color);
}
elseif( $paragraph_align=="right" ) {
imagestring($this->img,$this->font_family,$x+($w-$w1),$y-$h+1+$i*$fh,$tmp[$i],$this->current_color);
}
else {
imagestring($this->img,$this->font_family,$x+$w/2-$w1/2,$y-$h+1+$i*$fh,$tmp[$i],$this->current_color);
}
}
}
else {
//Put the text
imagestring($this->img,$this->font_family,$x,$y-$h+1,$txt,$this->current_color);
}
if( $aDebug ) {
// Draw the bounding rectangle and the bounding box
$p1 = array(round($x),round($y),round($x),round($y-$h),round($x+$w),round($y-$h),round($x+$w),round($y));
 
// Draw bounding box
$this->PushColor('green');
$this->Polygon($p1,true);
$this->PopColor();
 
}
$aBoundingBox=array(round($x),round($y),round($x),round($y-$h),round($x+$w),round($y-$h),round($x+$w),round($y));
}
}
 
function AddTxtCR($aTxt) {
// If the user has just specified a '\n'
// instead of '\n\t' we have to add '\r' since
// the width will be too muchy otherwise since when
// we print we stroke the individually lines by hand.
$e = explode("\n",$aTxt);
$n = count($e);
for($i=0; $i<$n; ++$i) {
$e[$i]=str_replace("\r","",$e[$i]);
}
return implode("\n\r",$e);
}
 
function NormAngle($a) {
// Normalize angle in degrees
// Normalize angle to be between 0-360
while( $a > 360 )
$a -= 360;
while( $a < -360 )
$a += 360;
if( $a < 0 )
$a = 360 + $a;
return $a;
}
 
function imagettfbbox_fixed($size, $angle, $fontfile, $text) {
 
 
if( ! USE_LIBRARY_IMAGETTFBBOX ) {
 
$bbox = @imagettfbbox($size, $angle, $fontfile, $text);
if( $bbox === false ) {
JpGraphError::RaiseL(25092,$this->font_file);
//("There is either a configuration problem with TrueType or a problem reading font file (".$this->font_file."). Make sure file exists and is in a readable place for the HTTP process. (If 'basedir' restriction is enabled in PHP then the font file must be located in the document root.). It might also be a wrongly installed FreeType library. Try uppgrading to at least FreeType 2.1.13 and recompile GD with the correct setup so it can find the new FT library.");
}
$this->bbox_cache = $bbox;
return $bbox;
}
 
// The built in imagettfbbox is buggy for angles != 0 so
// we calculate this manually by getting the bounding box at
// angle = 0 and then rotate the bounding box manually
$bbox = @imagettfbbox($size, 0, $fontfile, $text);
if( $bbox === false ) {
JpGraphError::RaiseL(25092,$this->font_file);
//("There is either a configuration problem with TrueType or a problem reading font file (".$this->font_file."). Make sure file exists and is in a readable place for the HTTP process. (If 'basedir' restriction is enabled in PHP then the font file must be located in the document root.). It might also be a wrongly installed FreeType library. Try uppgrading to at least FreeType 2.1.13 and recompile GD with the correct setup so it can find the new FT library.");
}
 
$angle = $this->NormAngle($angle);
 
$a = $angle*M_PI/180;
$ca = cos($a);
$sa = sin($a);
$ret = array();
 
// We always add 1 pixel to the left since the left edge of the bounding
// box is sometimes coinciding with the first pixel of the text
//$bbox[0] -= 1;
//$bbox[6] -= 1;
// For roatated text we need to add extra width for rotated
// text since the kerning and stroking of the TTF is not the same as for
// text at a 0 degree angle
 
if( $angle > 0.001 && abs($angle-360) > 0.001 ) {
$h = abs($bbox[7]-$bbox[1]);
$w = abs($bbox[2]-$bbox[0]);
 
$bbox[0] -= 2;
$bbox[6] -= 2;
// The width is underestimated so compensate for that
$bbox[2] += round($w*0.06);
$bbox[4] += round($w*0.06);
 
// and we also need to compensate with increased height
$bbox[5] -= round($h*0.1);
$bbox[7] -= round($h*0.1);
 
if( $angle > 90 ) {
// For angles > 90 we also need to extend the height further down
// by the baseline since that is also one more problem
$bbox[1] += round($h*0.15);
$bbox[3] += round($h*0.15);
 
// and also make it slighty less height
$bbox[7] += round($h*0.05);
$bbox[5] += round($h*0.05);
 
// And we need to move the box slightly top the rright (from a tetx perspective)
$bbox[0] += round($w*0.02);
$bbox[6] += round($w*0.02);
 
if( $angle > 180 ) {
// And we need to move the box slightly to the left (from a text perspective)
$bbox[0] -= round($w*0.02);
$bbox[6] -= round($w*0.02);
$bbox[2] -= round($w*0.02);
$bbox[4] -= round($w*0.02);
 
}
 
}
for($i = 0; $i < 7; $i += 2) {
$ret[$i] = round($bbox[$i] * $ca + $bbox[$i+1] * $sa);
$ret[$i+1] = round($bbox[$i+1] * $ca - $bbox[$i] * $sa);
}
$this->bbox_cache = $ret;
return $ret;
}
else {
$this->bbox_cache = $bbox;
return $bbox;
}
}
 
// Deprecated
function GetTTFBBox($aTxt,$aAngle=0) {
$bbox = $this->imagettfbbox_fixed($this->font_size,$aAngle,$this->font_file,$aTxt);
return $bbox;
}
 
function GetBBoxTTF($aTxt,$aAngle=0) {
// Normalize the bounding box to become a minimum
// enscribing rectangle
 
$aTxt = $this->AddTxtCR($aTxt);
 
if( !is_readable($this->font_file) ) {
JpGraphError::RaiseL(25093,$this->font_file);
//('Can not read font file ('.$this->font_file.') in call to Image::GetBBoxTTF. Please make sure that you have set a font before calling this method and that the font is installed in the TTF directory.');
}
$bbox = $this->imagettfbbox_fixed($this->font_size,$aAngle,$this->font_file,$aTxt);
 
if( $aAngle==0 ) return $bbox;
 
if( $aAngle >= 0 ) {
if( $aAngle <= 90 ) { //<=0
$bbox = array($bbox[6],$bbox[1],$bbox[2],$bbox[1],
$bbox[2],$bbox[5],$bbox[6],$bbox[5]);
}
elseif( $aAngle <= 180 ) { //<= 2
$bbox = array($bbox[4],$bbox[7],$bbox[0],$bbox[7],
$bbox[0],$bbox[3],$bbox[4],$bbox[3]);
}
elseif( $aAngle <= 270 ) { //<= 3
$bbox = array($bbox[2],$bbox[5],$bbox[6],$bbox[5],
$bbox[6],$bbox[1],$bbox[2],$bbox[1]);
}
else {
$bbox = array($bbox[0],$bbox[3],$bbox[4],$bbox[3],
$bbox[4],$bbox[7],$bbox[0],$bbox[7]);
}
}
elseif( $aAngle < 0 ) {
if( $aAngle <= -270 ) { // <= -3
$bbox = array($bbox[6],$bbox[1],$bbox[2],$bbox[1],
$bbox[2],$bbox[5],$bbox[6],$bbox[5]);
}
elseif( $aAngle <= -180 ) { // <= -2
$bbox = array($bbox[0],$bbox[3],$bbox[4],$bbox[3],
$bbox[4],$bbox[7],$bbox[0],$bbox[7]);
}
elseif( $aAngle <= -90 ) { // <= -1
$bbox = array($bbox[2],$bbox[5],$bbox[6],$bbox[5],
$bbox[6],$bbox[1],$bbox[2],$bbox[1]);
}
else {
$bbox = array($bbox[0],$bbox[3],$bbox[4],$bbox[3],
$bbox[4],$bbox[7],$bbox[0],$bbox[7]);
}
}
return $bbox;
}
 
function GetBBoxHeight($aTxt,$aAngle=0) {
$box = $this->GetBBoxTTF($aTxt,$aAngle);
return abs($box[7]-$box[1]);
}
 
function GetBBoxWidth($aTxt,$aAngle=0) {
$box = $this->GetBBoxTTF($aTxt,$aAngle);
return $box[2]-$box[0]+1;
}
 
 
function _StrokeTTF($x,$y,$txt,$dir,$paragraph_align,&$aBoundingBox,$debug=false) {
 
// Setup default inter line margin for paragraphs to be
// 3% of the font height.
$ConstLineSpacing = 0.03 ;
 
// Remember the anchor point before adjustment
if( $debug ) {
$ox=$x;
$oy=$y;
}
 
if( !preg_match('/\n/',$txt) || ($dir>0 && preg_match('/\n/',$txt)) ) {
// Format a single line
 
$txt = $this->AddTxtCR($txt);
$bbox=$this->GetBBoxTTF($txt,$dir);
$width = $this->GetBBoxWidth($txt,$dir);
$height = $this->GetBBoxHeight($txt,$dir);
 
// The special alignment "basepoint" is mostly used internally
// in the library. This will put the anchor position at the left
// basepoint of the tetx. This is the default anchor point for
// TTF text.
 
if( $this->text_valign != 'basepoint' ) {
// Align x,y ot lower left corner of bbox
 
if( $this->text_halign=='right' ) {
$x -= $width;
$x -= $bbox[0];
}
elseif( $this->text_halign=='center' ) {
$x -= $width/2;
$x -= $bbox[0];
}
elseif( $this->text_halign=='baseline' ) {
// This is only support for text at 90 degree !!
// Do nothing the text is drawn at baseline by default
}
 
if( $this->text_valign=='top' ) {
$y -= $bbox[1]; // Adjust to bottom of text
$y += $height;
}
elseif( $this->text_valign=='center' ) {
$y -= $bbox[1]; // Adjust to bottom of text
$y += $height/2;
}
elseif( $this->text_valign=='baseline' ) {
// This is only support for text at 0 degree !!
// Do nothing the text is drawn at baseline by default
}
}
ImageTTFText ($this->img, $this->font_size, $dir, $x, $y,
$this->current_color,$this->font_file,$txt);
 
// Calculate and return the co-ordinates for the bounding box
$box = $this->imagettfbbox_fixed($this->font_size,$dir,$this->font_file,$txt);
$p1 = array();
 
for($i=0; $i < 4; ++$i) {
$p1[] = round($box[$i*2]+$x);
$p1[] = round($box[$i*2+1]+$y);
}
$aBoundingBox = $p1;
 
// Debugging code to highlight the bonding box and bounding rectangle
// For text at 0 degrees the bounding box and bounding rectangle are the
// same
if( $debug ) {
// Draw the bounding rectangle and the bounding box
 
$p = array();
$p1 = array();
 
for($i=0; $i < 4; ++$i) {
$p[] = $bbox[$i*2]+$x ;
$p[] = $bbox[$i*2+1]+$y;
$p1[] = $box[$i*2]+$x ;
$p1[] = $box[$i*2+1]+$y ;
}
 
// Draw bounding box
$this->PushColor('green');
$this->Polygon($p1,true);
$this->PopColor();
 
// Draw bounding rectangle
$this->PushColor('darkgreen');
$this->Polygon($p,true);
$this->PopColor();
 
// Draw a cross at the anchor point
$this->PushColor('red');
$this->Line($ox-15,$oy,$ox+15,$oy);
$this->Line($ox,$oy-15,$ox,$oy+15);
$this->PopColor();
}
}
else {
// Format a text paragraph
$fh=$this->GetFontHeight();
 
// Line margin is 25% of font height
$linemargin=round($fh*$ConstLineSpacing);
$fh += $linemargin;
$w=$this->GetTextWidth($txt);
 
$y -= $linemargin/2;
$tmp = preg_split('/\n/',$txt);
$nl = count($tmp);
$h = $nl * $fh;
 
if( $this->text_halign=='right') {
$x -= $dir==0 ? $w : $h;
}
elseif( $this->text_halign=='center' ) {
$x -= $dir==0 ? $w/2 : $h/2;
}
 
if( $this->text_valign=='top' ) {
$y += $dir==0 ? $h : $w;
}
elseif( $this->text_valign=='center' ) {
$y += $dir==0 ? $h/2 : $w/2;
}
 
// Here comes a tricky bit.
// Since we have to give the position for the string at the
// baseline this means thaht text will move slightly up
// and down depending on any of it's character descend below
// the baseline, for example a 'g'. To adjust the Y-position
// we therefore adjust the text with the baseline Y-offset
// as used for the current font and size. This will keep the
// baseline at a fixed positoned disregarding the actual
// characters in the string.
$standardbox = $this->GetTTFBBox('Gg',$dir);
$yadj = $standardbox[1];
$xadj = $standardbox[0];
$aBoundingBox = array();
for($i=0; $i < $nl; ++$i) {
$wl = $this->GetTextWidth($tmp[$i]);
$bbox = $this->GetTTFBBox($tmp[$i],$dir);
if( $paragraph_align=='left' ) {
$xl = $x;
}
elseif( $paragraph_align=='right' ) {
$xl = $x + ($w-$wl);
}
else {
// Center
$xl = $x + $w/2 - $wl/2 ;
}
 
// In theory we should adjust with full pre-lead to get the lines
// lined up but this doesn't look good so therfore we only adjust with
// half th pre-lead
$xl -= $bbox[0]/2;
$yl = $y - $yadj;
//$xl = $xl- $xadj;
ImageTTFText($this->img, $this->font_size, $dir, $xl, $yl-($h-$fh)+$fh*$i,
$this->current_color,$this->font_file,$tmp[$i]);
 
// echo "xl=$xl,".$tmp[$i]." <br>";
if( $debug ) {
// Draw the bounding rectangle around each line
$box=@ImageTTFBBox($this->font_size,$dir,$this->font_file,$tmp[$i]);
$p = array();
for($j=0; $j < 4; ++$j) {
$p[] = $bbox[$j*2]+$xl;
$p[] = $bbox[$j*2+1]+$yl-($h-$fh)+$fh*$i;
}
 
// Draw bounding rectangle
$this->PushColor('darkgreen');
$this->Polygon($p,true);
$this->PopColor();
}
}
 
// Get the bounding box
$bbox = $this->GetBBoxTTF($txt,$dir);
for($j=0; $j < 4; ++$j) {
$bbox[$j*2]+= round($x);
$bbox[$j*2+1]+= round($y - ($h-$fh) - $yadj);
}
$aBoundingBox = $bbox;
 
if( $debug ) {
// Draw a cross at the anchor point
$this->PushColor('red');
$this->Line($ox-25,$oy,$ox+25,$oy);
$this->Line($ox,$oy-25,$ox,$oy+25);
$this->PopColor();
}
 
}
}
 
function StrokeText($x,$y,$txt,$dir=0,$paragraph_align="left",$debug=false) {
 
$x = round($x);
$y = round($y);
 
// Do special language encoding
$txt = $this->langconv->Convert($txt,$this->font_family);
 
if( !is_numeric($dir) ) {
JpGraphError::RaiseL(25094);//(" Direction for text most be given as an angle between 0 and 90.");
}
 
if( $this->font_family >= FF_FONT0 && $this->font_family <= FF_FONT2+1) {
$this->_StrokeBuiltinFont($x,$y,$txt,$dir,$paragraph_align,$boundingbox,$debug);
}
elseif( $this->font_family >= _FIRST_FONT && $this->font_family <= _LAST_FONT) {
$this->_StrokeTTF($x,$y,$txt,$dir,$paragraph_align,$boundingbox,$debug);
}
else {
JpGraphError::RaiseL(25095);//(" Unknown font font family specification. ");
}
return $boundingbox;
}
 
function SetMargin($lm,$rm,$tm,$bm) {
$this->left_margin=$lm;
$this->right_margin=$rm;
$this->top_margin=$tm;
$this->bottom_margin=$bm;
$this->plotwidth=$this->width - $this->left_margin-$this->right_margin ;
$this->plotheight=$this->height - $this->top_margin-$this->bottom_margin ;
if( $this->width > 0 && $this->height > 0 ) {
if( $this->plotwidth < 0 || $this->plotheight < 0 ) {
JpGraphError::RaiseL(25130, $this->plotwidth, $this->plotheight);
//JpGraphError::raise("To small plot area. ($lm,$rm,$tm,$bm : $this->plotwidth x $this->plotheight). With the given image size and margins there is to little space left for the plot. Increase the plot size or reduce the margins.");
}
}
}
 
function SetTransparent($color) {
imagecolortransparent ($this->img,$this->rgb->allocate($color));
}
 
function SetColor($color,$aAlpha=0) {
$this->current_color_name = $color;
$this->current_color=$this->rgb->allocate($color,$aAlpha);
if( $this->current_color == -1 ) {
$tc=imagecolorstotal($this->img);
JpGraphError::RaiseL(25096);
//("Can't allocate any more colors. Image has already allocated maximum of <b>$tc colors</b>. This might happen if you have anti-aliasing turned on together with a background image or perhaps gradient fill since this requires many, many colors. Try to turn off anti-aliasing. If there is still a problem try downgrading the quality of the background image to use a smaller pallete to leave some entries for your graphs. You should try to limit the number of colors in your background image to 64. If there is still problem set the constant DEFINE(\"USE_APPROX_COLORS\",true); in jpgraph.php This will use approximative colors when the palette is full. Unfortunately there is not much JpGraph can do about this since the palette size is a limitation of current graphic format and what the underlying GD library suppports.");
}
return $this->current_color;
}
 
function PushColor($color) {
if( $color != "" ) {
$this->colorstack[$this->colorstackidx]=$this->current_color_name;
$this->colorstack[$this->colorstackidx+1]=$this->current_color;
$this->colorstackidx+=2;
$this->SetColor($color);
}
else {
JpGraphError::RaiseL(25097);//("Color specified as empty string in PushColor().");
}
}
 
function PopColor() {
if( $this->colorstackidx < 1 ) {
JpGraphError::RaiseL(25098);//(" Negative Color stack index. Unmatched call to PopColor()");
}
$this->current_color=$this->colorstack[--$this->colorstackidx];
$this->current_color_name=$this->colorstack[--$this->colorstackidx];
}
 
 
function SetLineWeight($weight) {
$old = $this->line_weight;
imagesetthickness($this->img,$weight);
$this->line_weight = $weight;
return $old;
}
 
function SetStartPoint($x,$y) {
$this->lastx=round($x);
$this->lasty=round($y);
}
 
function Arc($cx,$cy,$w,$h,$s,$e) {
// GD Arc doesn't like negative angles
while( $s < 0) $s += 360;
while( $e < 0) $e += 360;
imagearc($this->img,round($cx),round($cy),round($w),round($h),$s,$e,$this->current_color);
}
 
function FilledArc($xc,$yc,$w,$h,$s,$e,$style='') {
$s = round($s);
$e = round($e);
while( $s < 0 ) $s += 360;
while( $e < 0 ) $e += 360;
if( $style=='' )
$style=IMG_ARC_PIE;
if( abs($s-$e) > 0 ) {
imagefilledarc($this->img,round($xc),round($yc),round($w),round($h),$s,$e,$this->current_color,$style);
}
}
 
function FilledCakeSlice($cx,$cy,$w,$h,$s,$e) {
$this->CakeSlice($cx,$cy,$w,$h,$s,$e,$this->current_color_name);
}
 
function CakeSlice($xc,$yc,$w,$h,$s,$e,$fillcolor="",$arccolor="") {
$s = round($s); $e = round($e);
$w = round($w); $h = round($h);
$xc = round($xc); $yc = round($yc);
if( $s == $e ) {
// A full circle. We draw this a plain circle
$this->PushColor($fillcolor);
imagefilledellipse($this->img,$xc,$yc,2*$w,2*$h,$this->current_color);
 
// If antialiasing is used then we often don't have any color no the surrounding
// arc. So, we need to check for this special case so we don't send an empty
// color to the push function. In this case we use the fill color for the arc as well
if( $arccolor != '' ) {
$this->PopColor();
$this->PushColor($arccolor);
}
imageellipse($this->img,$xc,$yc,2*$w,2*$h,$this->current_color);
$this->Line($xc,$yc,cos($s*M_PI/180)*$w+$xc,$yc+sin($s*M_PI/180)*$h);
$this->PopColor();
}
else {
$this->PushColor($fillcolor);
$this->FilledArc($xc,$yc,2*$w,2*$h,$s,$e);
$this->PopColor();
if( $arccolor != "" ) {
$this->PushColor($arccolor);
// We add 2 pixels to make the Arc() better aligned with
// the filled arc.
imagefilledarc($this->img,$xc,$yc,2*$w,2*$h,$s,$e,$this->current_color,IMG_ARC_NOFILL | IMG_ARC_EDGED ) ;
$this->PopColor();
}
}
}
 
function Ellipse($xc,$yc,$w,$h) {
$this->Arc($xc,$yc,$w,$h,0,360);
}
 
function Circle($xc,$yc,$r) {
imageellipse($this->img,round($xc),round($yc),$r*2,$r*2,$this->current_color);
}
 
function FilledCircle($xc,$yc,$r) {
imagefilledellipse($this->img,round($xc),round($yc),2*$r,2*$r,$this->current_color);
}
 
// Linear Color InterPolation
function lip($f,$t,$p) {
$p = round($p,1);
$r = $f[0] + ($t[0]-$f[0])*$p;
$g = $f[1] + ($t[1]-$f[1])*$p;
$b = $f[2] + ($t[2]-$f[2])*$p;
return array($r,$g,$b);
}
 
// Set line style dashed, dotted etc
function SetLineStyle($s) {
if( is_numeric($s) ) {
if( $s<1 || $s>4 ) {
JpGraphError::RaiseL(25101,$s);//(" Illegal numeric argument to SetLineStyle(): ($s)");
}
}
elseif( is_string($s) ) {
if( $s == "solid" ) $s=1;
elseif( $s == "dotted" ) $s=2;
elseif( $s == "dashed" ) $s=3;
elseif( $s == "longdashed" ) $s=4;
else {
JpGraphError::RaiseL(25102,$s);//(" Illegal string argument to SetLineStyle(): $s");
}
}
else {
JpGraphError::RaiseL(25103,$s);//(" Illegal argument to SetLineStyle $s");
}
$old = $this->line_style;
$this->line_style=$s;
return $old;
}
 
// Same as Line but take the line_style into account
function StyleLine($x1,$y1,$x2,$y2,$aStyle='') {
if( $this->line_weight <= 0 ) return;
 
if( $aStyle === '' ) {
$aStyle = $this->line_style;
}
 
// Add error check since dashed line will only work if anti-alias is disabled
// this is a limitation in GD
 
if( $aStyle == 1 ) {
// Solid style. We can handle anti-aliasing for this
$this->Line($x1,$y1,$x2,$y2);
}
else {
// Since the GD routines doesn't handle AA for styled line
// we have no option than to turn it off to get any lines at
// all if the weight > 1
$oldaa = $this->GetAntiAliasing();
if( $oldaa && $this->line_weight > 1 ) {
$this->SetAntiAliasing(false);
}
 
switch( $aStyle ) {
case 2: // Dotted
$this->DashedLine($x1,$y1,$x2,$y2,2,6);
break;
case 3: // Dashed
$this->DashedLine($x1,$y1,$x2,$y2,5,9);
break;
case 4: // Longdashes
$this->DashedLine($x1,$y1,$x2,$y2,9,13);
break;
default:
JpGraphError::RaiseL(25104,$this->line_style);//(" Unknown line style: $this->line_style ");
break;
}
if( $oldaa ) {
$this->SetAntiAliasing(true);
}
}
}
 
function DashedLine($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) {
 
if( $this->line_weight <= 0 ) return;
 
// Add error check to make sure anti-alias is not enabled.
// Dashed line does not work with anti-alias enabled. This
// is a limitation in GD.
if( $this->use_anti_aliasing ) {
JpGraphError::RaiseL(25129); // Anti-alias can not be used with dashed lines. Please disable anti-alias or use solid lines.
}
 
 
$x1 = round($x1);
$x2 = round($x2);
$y1 = round($y1);
$y2 = round($y2);
 
$style = array_fill(0,$dash_length,$this->current_color);
$style = array_pad($style,$dash_space,IMG_COLOR_TRANSPARENT);
imagesetstyle($this->img, $style);
imageline($this->img, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
$this->lastx = $x2;
$this->lasty = $y2;
}
 
function Line($x1,$y1,$x2,$y2) {
 
if( $this->line_weight <= 0 ) return;
 
$x1 = round($x1);
$x2 = round($x2);
$y1 = round($y1);
$y2 = round($y2);
 
imageline($this->img,$x1,$y1,$x2,$y2,$this->current_color);
$this->lastx=$x2;
$this->lasty=$y2;
}
 
function Polygon($p,$closed=FALSE,$fast=FALSE) {
 
if( $this->line_weight <= 0 ) return;
 
$n=count($p);
$oldx = $p[0];
$oldy = $p[1];
if( $fast ) {
for( $i=2; $i < $n; $i+=2 ) {
imageline($this->img,$oldx,$oldy,$p[$i],$p[$i+1],$this->current_color);
$oldx = $p[$i];
$oldy = $p[$i+1];
}
if( $closed ) {
imageline($this->img,$p[$n*2-2],$p[$n*2-1],$p[0],$p[1],$this->current_color);
}
}
else {
for( $i=2; $i < $n; $i+=2 ) {
$this->StyleLine($oldx,$oldy,$p[$i],$p[$i+1]);
$oldx = $p[$i];
$oldy = $p[$i+1];
}
if( $closed ) {
$this->StyleLine($oldx,$oldy,$p[0],$p[1]);
}
}
}
 
function FilledPolygon($pts) {
$n=count($pts);
if( $n == 0 ) {
JpGraphError::RaiseL(25105);//('NULL data specified for a filled polygon. Check that your data is not NULL.');
}
for($i=0; $i < $n; ++$i) {
$pts[$i] = round($pts[$i]);
}
$old = $this->line_weight;
imagesetthickness($this->img,1);
imagefilledpolygon($this->img,$pts,count($pts)/2,$this->current_color);
$this->line_weight = $old;
imagesetthickness($this->img,$old);
}
 
function Rectangle($xl,$yu,$xr,$yl) {
$this->Polygon(array($xl,$yu,$xr,$yu,$xr,$yl,$xl,$yl,$xl,$yu));
}
 
function FilledRectangle($xl,$yu,$xr,$yl) {
$this->FilledPolygon(array($xl,$yu,$xr,$yu,$xr,$yl,$xl,$yl));
}
 
function FilledRectangle2($xl,$yu,$xr,$yl,$color1,$color2,$style=1) {
// Fill a rectangle with lines of two colors
if( $style===1 ) {
// Horizontal stripe
if( $yl < $yu ) {
$t = $yl; $yl=$yu; $yu=$t;
}
for( $y=$yu; $y <= $yl; ++$y) {
$this->SetColor($color1);
$this->Line($xl,$y,$xr,$y);
++$y;
$this->SetColor($color2);
$this->Line($xl,$y,$xr,$y);
}
}
else {
if( $xl < $xl ) {
$t = $xl; $xl=$xr; $xr=$t;
}
for( $x=$xl; $x <= $xr; ++$x) {
$this->SetColor($color1);
$this->Line($x,$yu,$x,$yl);
++$x;
$this->SetColor($color2);
$this->Line($x,$yu,$x,$yl);
}
}
}
 
function ShadowRectangle($xl,$yu,$xr,$yl,$fcolor=false,$shadow_width=4,$shadow_color='darkgray',$useAlpha=true) {
// This is complicated by the fact that we must also handle the case where
// the reactangle has no fill color
$xl = floor($xl);
$yu = floor($yu);
$xr = floor($xr);
$yl = floor($yl);
$this->PushColor($shadow_color);
$shadowAlpha=0;
$this->SetLineWeight(1);
$this->SetLineStyle('solid');
$basecolor = $this->rgb->Color($shadow_color);
$shadow_color = array($basecolor[0],$basecolor[1],$basecolor[2],);
for( $i=0; $i < $shadow_width; ++$i ) {
$this->SetColor($shadow_color,$shadowAlpha);
$this->Line($xr-$shadow_width+$i, $yu+$shadow_width,
$xr-$shadow_width+$i, $yl-$shadow_width-1+$i);
$this->Line($xl+$shadow_width, $yl-$shadow_width+$i,
$xr-$shadow_width+$i, $yl-$shadow_width+$i);
if( $useAlpha ) $shadowAlpha += 1.0/$shadow_width;
}
 
$this->PopColor();
if( $fcolor==false ) {
$this->Rectangle($xl,$yu,$xr-$shadow_width-1,$yl-$shadow_width-1);
}
else {
$this->PushColor($fcolor);
$this->FilledRectangle($xl,$yu,$xr-$shadow_width-1,$yl-$shadow_width-1);
$this->PopColor();
$this->Rectangle($xl,$yu,$xr-$shadow_width-1,$yl-$shadow_width-1);
}
}
 
function FilledRoundedRectangle($xt,$yt,$xr,$yl,$r=5) {
if( $r==0 ) {
$this->FilledRectangle($xt,$yt,$xr,$yl);
return;
}
 
// To avoid overlapping fillings (which will look strange
// when alphablending is enabled) we have no choice but
// to fill the five distinct areas one by one.
 
// Center square
$this->FilledRectangle($xt+$r,$yt+$r,$xr-$r,$yl-$r);
// Top band
$this->FilledRectangle($xt+$r,$yt,$xr-$r,$yt+$r);
// Bottom band
$this->FilledRectangle($xt+$r,$yl-$r,$xr-$r,$yl);
// Left band
$this->FilledRectangle($xt,$yt+$r,$xt+$r,$yl-$r);
// Right band
$this->FilledRectangle($xr-$r,$yt+$r,$xr,$yl-$r);
 
// Topleft & Topright arc
$this->FilledArc($xt+$r,$yt+$r,$r*2,$r*2,180,270);
$this->FilledArc($xr-$r,$yt+$r,$r*2,$r*2,270,360);
 
// Bottomleft & Bottom right arc
$this->FilledArc($xt+$r,$yl-$r,$r*2,$r*2,90,180);
$this->FilledArc($xr-$r,$yl-$r,$r*2,$r*2,0,90);
 
}
 
function RoundedRectangle($xt,$yt,$xr,$yl,$r=5) {
 
if( $r==0 ) {
$this->Rectangle($xt,$yt,$xr,$yl);
return;
}
 
// Top & Bottom line
$this->Line($xt+$r,$yt,$xr-$r,$yt);
$this->Line($xt+$r,$yl,$xr-$r,$yl);
 
// Left & Right line
$this->Line($xt,$yt+$r,$xt,$yl-$r);
$this->Line($xr,$yt+$r,$xr,$yl-$r);
 
// Topleft & Topright arc
$this->Arc($xt+$r,$yt+$r,$r*2,$r*2,180,270);
$this->Arc($xr-$r,$yt+$r,$r*2,$r*2,270,360);
 
// Bottomleft & Bottomright arc
$this->Arc($xt+$r,$yl-$r,$r*2,$r*2,90,180);
$this->Arc($xr-$r,$yl-$r,$r*2,$r*2,0,90);
}
 
function FilledBevel($x1,$y1,$x2,$y2,$depth=2,$color1='white@0.4',$color2='darkgray@0.4') {
$this->FilledRectangle($x1,$y1,$x2,$y2);
$this->Bevel($x1,$y1,$x2,$y2,$depth,$color1,$color2);
}
 
function Bevel($x1,$y1,$x2,$y2,$depth=2,$color1='white@0.4',$color2='black@0.5') {
$this->PushColor($color1);
for( $i=0; $i < $depth; ++$i ) {
$this->Line($x1+$i,$y1+$i,$x1+$i,$y2-$i);
$this->Line($x1+$i,$y1+$i,$x2-$i,$y1+$i);
}
$this->PopColor();
 
$this->PushColor($color2);
for( $i=0; $i < $depth; ++$i ) {
$this->Line($x1+$i,$y2-$i,$x2-$i,$y2-$i);
$this->Line($x2-$i,$y1+$i,$x2-$i,$y2-$i-1);
}
$this->PopColor();
}
 
function StyleLineTo($x,$y) {
$this->StyleLine($this->lastx,$this->lasty,$x,$y);
$this->lastx=$x;
$this->lasty=$y;
}
 
function LineTo($x,$y) {
$this->Line($this->lastx,$this->lasty,$x,$y);
$this->lastx=$x;
$this->lasty=$y;
}
 
function Point($x,$y) {
imagesetpixel($this->img,round($x),round($y),$this->current_color);
}
 
function Fill($x,$y) {
imagefill($this->img,round($x),round($y),$this->current_color);
}
 
function FillToBorder($x,$y,$aBordColor) {
$bc = $this->rgb->allocate($aBordColor);
if( $bc == -1 ) {
JpGraphError::RaiseL(25106);//('Image::FillToBorder : Can not allocate more colors');
}
imagefilltoborder($this->img,round($x),round($y),$bc,$this->current_color);
}
 
function SetExpired($aFlg=true) {
$this->expired = $aFlg;
}
 
// Generate image header
function Headers() {
 
// In case we are running from the command line with the client version of
// PHP we can't send any headers.
$sapi = php_sapi_name();
if( $sapi == 'cli' ) return;
 
// These parameters are set by headers_sent() but they might cause
// an undefined variable error unless they are initilized
$file='';
$lineno='';
if( headers_sent($file,$lineno) ) {
$file=basename($file);
$t = new ErrMsgText();
$msg = $t->Get(10,$file,$lineno);
die($msg);
}
 
if ($this->expired) {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
header("Content-type: image/$this->img_format");
}
 
// Adjust image quality for formats that allow this
function SetQuality($q) {
$this->quality = $q;
}
 
// Stream image to browser or to file
function Stream($aFile="") {
$func="image".$this->img_format;
if( $this->img_format=="jpeg" && $this->quality != null ) {
$res = @$func($this->img,$aFile,$this->quality);
}
else {
if( $aFile != "" ) {
$res = @$func($this->img,$aFile);
if( !$res ) {
JpGraphError::RaiseL(25107,$aFile);//("Can't write to file '$aFile'. Check that the process running PHP has enough permission.");
}
}
else {
$res = @$func($this->img);
if( !$res ) {
JpGraphError::RaiseL(25108);//("Can't stream image. This is most likely due to a faulty PHP/GD setup. Try to recompile PHP and use the built-in GD library that comes with PHP.");
}
 
}
}
}
 
// Clear resources used by image (this is normally not used since all resources are/should be
// returned when the script terminates
function Destroy() {
imagedestroy($this->img);
}
 
// Specify image format. Note depending on your installation
// of PHP not all formats may be supported.
function SetImgFormat($aFormat,$aQuality=75) {
$this->quality = $aQuality;
$aFormat = strtolower($aFormat);
$tst = true;
$supported = imagetypes();
if( $aFormat=="auto" ) {
if( $supported & IMG_PNG ) $this->img_format="png";
elseif( $supported & IMG_JPG ) $this->img_format="jpeg";
elseif( $supported & IMG_GIF ) $this->img_format="gif";
elseif( $supported & IMG_WBMP ) $this->img_format="wbmp";
elseif( $supported & IMG_XPM ) $this->img_format="xpm";
else {
JpGraphError::RaiseL(25109);//("Your PHP (and GD-lib) installation does not appear to support any known graphic formats. You need to first make sure GD is compiled as a module to PHP. If you also want to use JPEG images you must get the JPEG library. Please see the PHP docs for details.");
}
return true;
}
else {
if( $aFormat=="jpeg" || $aFormat=="png" || $aFormat=="gif" ) {
if( $aFormat=="jpeg" && !($supported & IMG_JPG) ) $tst=false;
elseif( $aFormat=="png" && !($supported & IMG_PNG) ) $tst=false;
elseif( $aFormat=="gif" && !($supported & IMG_GIF) ) $tst=false;
elseif( $aFormat=="wbmp" && !($supported & IMG_WBMP) ) $tst=false;
elseif( $aFormat=="xpm" && !($supported & IMG_XPM) ) $tst=false;
else {
$this->img_format=$aFormat;
return true;
}
}
else {
$tst=false;
}
if( !$tst ) {
JpGraphError::RaiseL(25110,$aFormat);//(" Your PHP installation does not support the chosen graphic format: $aFormat");
}
}
}
} // CLASS
 
//===================================================
// CLASS RotImage
// Description: Exactly as Image but draws the image at
// a specified angle around a specified rotation point.
//===================================================
class RotImage extends Image {
public $a=0;
public $dx=0,$dy=0,$transx=0,$transy=0;
private $m=array();
 
function __construct($aWidth,$aHeight,$a=0,$aFormat=DEFAULT_GFORMAT,$aSetAutoMargin=true) {
parent::__construct($aWidth,$aHeight,$aFormat,$aSetAutoMargin);
$this->dx=$this->left_margin+$this->plotwidth/2;
$this->dy=$this->top_margin+$this->plotheight/2;
$this->SetAngle($a);
}
 
function SetCenter($dx,$dy) {
$old_dx = $this->dx;
$old_dy = $this->dy;
$this->dx=$dx;
$this->dy=$dy;
$this->SetAngle($this->a);
return array($old_dx,$old_dy);
}
 
function SetTranslation($dx,$dy) {
$old = array($this->transx,$this->transy);
$this->transx = $dx;
$this->transy = $dy;
return $old;
}
 
function UpdateRotMatrice() {
$a = $this->a;
$a *= M_PI/180;
$sa=sin($a); $ca=cos($a);
// Create the rotation matrix
$this->m[0][0] = $ca;
$this->m[0][1] = -$sa;
$this->m[0][2] = $this->dx*(1-$ca) + $sa*$this->dy ;
$this->m[1][0] = $sa;
$this->m[1][1] = $ca;
$this->m[1][2] = $this->dy*(1-$ca) - $sa*$this->dx ;
}
 
function SetAngle($a) {
$tmp = $this->a;
$this->a = $a;
$this->UpdateRotMatrice();
return $tmp;
}
 
function Circle($xc,$yc,$r) {
list($xc,$yc) = $this->Rotate($xc,$yc);
parent::Circle($xc,$yc,$r);
}
 
function FilledCircle($xc,$yc,$r) {
list($xc,$yc) = $this->Rotate($xc,$yc);
parent::FilledCircle($xc,$yc,$r);
}
 
 
function Arc($xc,$yc,$w,$h,$s,$e) {
list($xc,$yc) = $this->Rotate($xc,$yc);
$s += $this->a;
$e += $this->a;
parent::Arc($xc,$yc,$w,$h,$s,$e);
}
 
function FilledArc($xc,$yc,$w,$h,$s,$e,$style='') {
list($xc,$yc) = $this->Rotate($xc,$yc);
$s += $this->a;
$e += $this->a;
parent::FilledArc($xc,$yc,$w,$h,$s,$e);
}
 
function SetMargin($lm,$rm,$tm,$bm) {
parent::SetMargin($lm,$rm,$tm,$bm);
$this->dx=$this->left_margin+$this->plotwidth/2;
$this->dy=$this->top_margin+$this->plotheight/2;
$this->UpdateRotMatrice();
}
 
function Rotate($x,$y) {
// Optimization. Ignore rotation if Angle==0 || Angle==360
if( $this->a == 0 || $this->a == 360 ) {
return array($x + $this->transx, $y + $this->transy );
}
else {
$x1=round($this->m[0][0]*$x + $this->m[0][1]*$y,1) + $this->m[0][2] + $this->transx;
$y1=round($this->m[1][0]*$x + $this->m[1][1]*$y,1) + $this->m[1][2] + $this->transy;
return array($x1,$y1);
}
}
 
function CopyMerge($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth=-1,$fromHeight=-1,$aMix=100) {
list($toX,$toY) = $this->Rotate($toX,$toY);
parent::CopyMerge($fromImg,$toX,$toY,$fromX,$fromY,$toWidth,$toHeight,$fromWidth,$fromHeight,$aMix);
 
}
 
function ArrRotate($pnts) {
$n = count($pnts)-1;
for($i=0; $i < $n; $i+=2) {
list ($x,$y) = $this->Rotate($pnts[$i],$pnts[$i+1]);
$pnts[$i] = $x; $pnts[$i+1] = $y;
}
return $pnts;
}
 
function DashedLine($x1,$y1,$x2,$y2,$dash_length=1,$dash_space=4) {
list($x1,$y1) = $this->Rotate($x1,$y1);
list($x2,$y2) = $this->Rotate($x2,$y2);
parent::DashedLine($x1,$y1,$x2,$y2,$dash_length,$dash_space);
}
 
function Line($x1,$y1,$x2,$y2) {
list($x1,$y1) = $this->Rotate($x1,$y1);
list($x2,$y2) = $this->Rotate($x2,$y2);
parent::Line($x1,$y1,$x2,$y2);
}
 
function Rectangle($x1,$y1,$x2,$y2) {
// Rectangle uses Line() so it will be rotated through that call
parent::Rectangle($x1,$y1,$x2,$y2);
}
 
function FilledRectangle($x1,$y1,$x2,$y2) {
if( $y1==$y2 || $x1==$x2 )
$this->Line($x1,$y1,$x2,$y2);
else
$this->FilledPolygon(array($x1,$y1,$x2,$y1,$x2,$y2,$x1,$y2));
}
 
function Polygon($pnts,$closed=FALSE,$fast=FALSE) {
// Polygon uses Line() so it will be rotated through that call unless
// fast drawing routines are used in which case a rotate is needed
if( $fast ) {
parent::Polygon($this->ArrRotate($pnts));
}
else {
parent::Polygon($pnts,$closed,$fast);
}
}
 
function FilledPolygon($pnts) {
parent::FilledPolygon($this->ArrRotate($pnts));
}
 
function Point($x,$y) {
list($xp,$yp) = $this->Rotate($x,$y);
parent::Point($xp,$yp);
}
 
function StrokeText($x,$y,$txt,$dir=0,$paragraph_align="left",$debug=false) {
list($xp,$yp) = $this->Rotate($x,$y);
return parent::StrokeText($xp,$yp,$txt,$dir,$paragraph_align,$debug);
}
}
 
//=======================================================================
// CLASS ImgStreamCache
// Description: Handle caching of graphs to files. All image output goes
// through this class
//=======================================================================
class ImgStreamCache {
private $cache_dir, $timeout=0; // Infinite timeout
//---------------
// CONSTRUCTOR
function __construct($aCacheDir=CACHE_DIR) {
$this->cache_dir = $aCacheDir;
}
 
//---------------
// PUBLIC METHODS
 
// Specify a timeout (in minutes) for the file. If the file is older then the
// timeout value it will be overwritten with a newer version.
// If timeout is set to 0 this is the same as infinite large timeout and if
// timeout is set to -1 this is the same as infinite small timeout
function SetTimeout($aTimeout) {
$this->timeout=$aTimeout;
}
 
// Output image to browser and also write it to the cache
function PutAndStream($aImage,$aCacheFileName,$aInline,$aStrokeFileName) {
 
// Check if we should always stroke the image to a file
if( _FORCE_IMGTOFILE ) {
$aStrokeFileName = _FORCE_IMGDIR.GenImgName();
}
 
if( $aStrokeFileName != '' ) {
 
if( $aStrokeFileName == 'auto' ) {
$aStrokeFileName = GenImgName();
}
 
if( file_exists($aStrokeFileName) ) {
 
// Wait for lock (to make sure no readers are trying to access the image)
$fd = fopen($aStrokeFileName,'w');
$lock = flock($fd, LOCK_EX);
 
// Since the image write routines only accepts a filename which must not
// exist we need to delete the old file first
if( !@unlink($aStrokeFileName) ) {
$lock = flock($fd, LOCK_UN);
JpGraphError::RaiseL(25111,$aStrokeFileName);
//(" Can't delete cached image $aStrokeFileName. Permission problem?");
}
$aImage->Stream($aStrokeFileName);
$lock = flock($fd, LOCK_UN);
fclose($fd);
 
}
else {
$aImage->Stream($aStrokeFileName);
}
 
return;
}
 
if( $aCacheFileName != '' && USE_CACHE) {
 
$aCacheFileName = $this->cache_dir . $aCacheFileName;
if( file_exists($aCacheFileName) ) {
if( !$aInline ) {
// If we are generating image off-line (just writing to the cache)
// and the file exists and is still valid (no timeout)
// then do nothing, just return.
$diff=time()-filemtime($aCacheFileName);
if( $diff < 0 ) {
JpGraphError::RaiseL(25112,$aCacheFileName);
//(" Cached imagefile ($aCacheFileName) has file date in the future!!");
}
if( $this->timeout>0 && ($diff <= $this->timeout*60) ) return;
}
 
// Wait for lock (to make sure no readers are trying to access the image)
$fd = fopen($aCacheFileName,'w');
$lock = flock($fd, LOCK_EX);
 
if( !@unlink($aCacheFileName) ) {
$lock = flock($fd, LOCK_UN);
JpGraphError::RaiseL(25113,$aStrokeFileName);
//(" Can't delete cached image $aStrokeFileName. Permission problem?");
}
$aImage->Stream($aCacheFileName);
$lock = flock($fd, LOCK_UN);
fclose($fd);
 
}
else {
$this->MakeDirs(dirname($aCacheFileName));
if( !is_writeable(dirname($aCacheFileName)) ) {
JpGraphError::RaiseL(25114,$aCacheFileName);
//('PHP has not enough permissions to write to the cache file '.$aCacheFileName.'. Please make sure that the user running PHP has write permission for this file if you wan to use the cache system with JpGraph.');
}
$aImage->Stream($aCacheFileName);
}
 
$res=true;
// Set group to specified
if( CACHE_FILE_GROUP != '' ) {
$res = @chgrp($aCacheFileName,CACHE_FILE_GROUP);
}
if( CACHE_FILE_MOD != '' ) {
$res = @chmod($aCacheFileName,CACHE_FILE_MOD);
}
if( !$res ) {
JpGraphError::RaiseL(25115,$aStrokeFileName);
//(" Can't set permission for cached image $aStrokeFileName. Permission problem?");
}
 
$aImage->Destroy();
if( $aInline ) {
if ($fh = @fopen($aCacheFileName, "rb") ) {
$aImage->Headers();
fpassthru($fh);
return;
}
else {
JpGraphError::RaiseL(25116,$aFile);//(" Cant open file from cache [$aFile]");
}
}
}
elseif( $aInline ) {
$aImage->Headers();
$aImage->Stream();
return;
}
}
 
function IsValid($aCacheFileName) {
$aCacheFileName = $this->cache_dir.$aCacheFileName;
if ( USE_CACHE && file_exists($aCacheFileName) ) {
$diff=time()-filemtime($aCacheFileName);
if( $this->timeout>0 && ($diff > $this->timeout*60) ) {
return false;
}
else {
return true;
}
}
else {
return false;
}
}
 
function StreamImgFile($aImage,$aCacheFileName) {
$aCacheFileName = $this->cache_dir.$aCacheFileName;
if ( $fh = @fopen($aCacheFileName, 'rb') ) {
$lock = flock($fh, LOCK_SH);
$aImage->Headers();
fpassthru($fh);
$lock = flock($fh, LOCK_UN);
fclose($fh);
return true;
}
else {
JpGraphError::RaiseL(25117,$aCacheFileName);//(" Can't open cached image \"$aCacheFileName\" for reading.");
}
}
 
// Check if a given image is in cache and in that case
// pass it directly on to web browser. Return false if the
// image file doesn't exist or exists but is to old
function GetAndStream($aImage,$aCacheFileName) {
if( $this->Isvalid($aCacheFileName) ) {
$this->StreamImgFile($aImage,$aCacheFileName);
}
else {
return false;
}
}
 
//---------------
// PRIVATE METHODS
// Create all necessary directories in a path
function MakeDirs($aFile) {
$dirs = array();
// In order to better work when open_basedir is enabled
// we do not create directories in the root path
while ( $aFile != '/' && !(file_exists($aFile)) ) {
$dirs[] = $aFile.'/';
$aFile = dirname($aFile);
}
for ($i = sizeof($dirs)-1; $i>=0; $i--) {
if(! @mkdir($dirs[$i],0777) ) {
JpGraphError::RaiseL(25118,$aFile);//(" Can't create directory $aFile. Make sure PHP has write permission to this directory.");
}
// We also specify mode here after we have changed group.
// This is necessary if Apache user doesn't belong the
// default group and hence can't specify group permission
// in the previous mkdir() call
if( CACHE_FILE_GROUP != "" ) {
$res=true;
$res =@chgrp($dirs[$i],CACHE_FILE_GROUP);
$res = @chmod($dirs[$i],0777);
if( !$res ) {
JpGraphError::RaiseL(25119,$aFile);//(" Can't set permissions for $aFile. Permission problems?");
}
}
}
return true;
}
} // CLASS Cache
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_flags.php
New file
0,0 → 1,376
<?php
//=======================================================================
// File: JPGRAPH_FLAGS.PHP
// Description: Class Jpfile. Handles plotmarks
// Created: 2003-06-28
// Ver: $Id: jpgraph_flags.php 1106 2009-02-22 20:16:35Z 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 {
 
public $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',
'Bangladesh' => 'bngl',
'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',
'Romania' => 'rmna',
'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 Serbia' => 'serb',
'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\".");
}
}
}
 
 
 
 
?>
/tags/v1.0-aigle/composants/statistiques/lib/jpgraph_antispam-digits.php
New file
0,0 → 1,205
<?php
//=======================================================================
// File: JPGRAPH_ANTISPAM.PHP
// Description: Genarate anti-spam challenge
// Created: 2004-10-07
// Ver: $Id: jpgraph_antispam-digits.php 1106 2009-02-22 20:16:35Z ljp $
//
// Copyright (c) Aditus Consulting. All rights reserved.
//========================================================================
 
class HandDigits {
public $digits = array();
public $iHeight=30, $iWidth=30;
 
function __construct() {
//==========================================================
// 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'.
'Edls9QKKnOVLyk7UgcbzzrdBthqE