download print.php
Language: PHP
License: GPL
Copyright: (C) 2001, 2002 Bertand Pallie, Loc Dayot
LOC: 192
Project Info
epnadmin
Server: Savannah NonGNU
Type: cvs
...epnadmin\epnadmin\epnadmin\
   6cartes.inc.php
   add_message.sh
   add_message_file.sh
   animateur.php
   ...eurs-disponibilites.php
   animateurs-horaires.php
   animateurs.inc.php
   autoeval.js
   barcode.inc.php
   basdepage.inc.php
   camembert.inc.php
   cartes.inc.php
   common.initial.sql
   config.php
   configuration.php
   constantes.inc.php
   courriel.php
   dateheure.inc.php
   debug.inc.php
   domaines.php
   en.lang.inc.php
   entete.inc.php
   epnadmin.css
   epnadminv.css
   exemple.sql
   fonctions.inc.php
   footer.inc.php
   fr.initial.sql
   fr.lang.inc.php
   header.inc.php
   horaires.php
   i25object.inc.php
   image.inc.php
   index.php
   initial.sql
   initiations.inc.php
   initiations.php
   inscription_session.php
   localisations.php
   logiciels.php
   materiels.php
   menu2.js
   mysql.inc.php
   parcours.inc.php
   parcours.php
   positionnement.php
   prets.php
   print.php
   questions.php
   remove_message.sh
   reservations.inc.php
   reservations.php
   session.php
   sessions.inc.php
   siteweb.inc.php
   siteweb.php
   stats.php
   structure.sql
   structures.inc.php
   structures.php
   table_horaire.php
   table_horaire_session.php
   tableaux.inc.php
   tarifs.php
   themes.php
   usagers.inc.php
   usagers.php
   usages.php

<?php
/*
    Copyright (C) 2001, 2002 Bertand Pallie, Loc Dayot

    EPNadmin - Version 0.6

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    http://epnadmin.pierrefitte93.fr/
*/

require_once("header.inc.php");
if (!defined("FCT_USAGERS"))
{
  echo $fctnonactive;
  exit;
}

require_once("constantes.inc.php");             // dfinition des constantes
//require_once("fonctions.inc.php");              // concernant des fonctions transversales inclassables
require_once("mysql.inc.php");                  // concernant mysql
//require_once("sessions.inc.php");             // concernant les sessions et initiations
require_once("usagers.inc.php");              // concernant la gestion des usagers
//require_once("reservations.inc.php");         // concernant les rservations des postes en accs individuel par des usagers
//require_once("tableaux.inc.php");             // Concernant l'affichage transpos d'un tableau
//require_once("siteweb.inc.php");              // concernant les pages perso des usagers et les sites web des structures
//require_once("dateheure.inc.php");            // concernant la manipulation des heures et des dates, formulaire, conversion...
//require_once("structures.inc.php");           // concernant les structures
//require_once("initiations.inc.php");          // concernant les initiations et les thmes
//require_once("parcours.inc.php");             // concernant les parcours des usagers et leur positionnement

require_once("barcode.inc.php");
require_once("i25object.inc.php");

$ptitr=$stprint;
$titr = $titreprint;
define("COULEUR", COULEUR_USAGERS);
$datemaj="9 mars 2003";
require("entete.inc.php");



function uneCarte($ii, $nom, $prenom, $mail, $login, $motdepasse, $code, $tarif)
{
global $tarifs, $couleurtarif, $dir_fontes_ttf, $dir_tmp_images, $imagepourcarte,
  $sNom, $sPrenom, $sMoncourriel, $sMonidentifiant, $sMonmotdepasse;
  $width    = "80";
  $height   = "80";
  $xres     = "1";
  $font     = "1";
  $drawtext = "on";
  $style = BCS_DRAW_TEXT;

  define (__TRACE_ENABLED__, true);
  define (__DEBUG_ENABLED__, true);

  $obj = new I25Object($width, $height, $style, $code);

  if ($obj)
  {
    $obj->SetFont($font);
    $obj->DrawObject($xres);
    $im = @ImageCreate (480, 460) or die ("Cannot Initialize new GD image stream");

    $background_color = ImageColorAllocate ($im, 255, 255, 255);
    $imgperso=ImageCreateFromPNG($imagepourcarte);

    if (defined("FCT_TARIFS"))
    {
      $r=hexdec(substr($couleurtarif[$tarif],0,2));
      $b=hexdec(substr($couleurtarif[$tarif],2,2));
      $v=hexdec(substr($couleurtarif[$tarif],4,2));
      $tarifpierre = ImageColorAllocate ($im, $r, $b, $v);
      imagefilledrectangle($im,0,80,480,130, $tarifpierre);
    }
    $noir = ImageColorAllocate ($im, 0, 0, 0);
    $rouge = ImageColorAllocate ($im, 255, 0, 0);

    ImageColorTransparent($imgperso, imagecolorAt($imgperso, 10,10));
    ImageCopy($im, $imgperso, 0,0, 0,0, 240,222);

    imagettftext ($im,14,0,160,200,$noir,$dir_fontes_ttf."ARIALBD.TTF","$sNom : ");
    imagettftext ($im,14,0,220,200,$rouge,$dir_fontes_ttf."ARIALBD.TTF",$nom);

    imagettftext ($im,14,0,160,245,$noir,$dir_fontes_ttf."ARIALBD.TTF","$sPrenom : ");
    imagettftext ($im,14,0,250,245,$rouge,$dir_fontes_ttf."ARIALBD.TTF",$prenom);

    imagettftext ($im,12,0,190,330,$noir,$dir_fontes_ttf."LUCON.TTF",$code);

    ImageLine($im,0,340,480,340,$noir);

    imagettftext ($im,12,0,20,380,$noir,$dir_fontes_ttf."ARIAL.TTF","$sMoncourriel : ");
    imagettftext ($im,12,0,130,380,$rouge,$dir_fontes_ttf."ARIAL.TTF",$mail);

    imagettftext ($im,12,0,20,410,$noir,$dir_fontes_ttf."ARIAL.TTF","$sMonidentifiant : ");
    imagettftext ($im,12,0,145,410,$rouge,$dir_fontes_ttf."ARIAL.TTF",$login);

    imagettftext ($im,12,0,20,440,$noir,$dir_fontes_ttf."ARIAL.TTF","$sMonmotdepasse : ");
    if (strlen($motdepasse)!=32)
      imagettftext ($im,12,0,175,440,$rouge,$dir_fontes_ttf."ARIAL.TTF",$motdepasse);

    ImageCopyResized($im, $obj->mImg, 160,280,0,30,160,32,80,16);
    //debug($ii);   // $i a ne fonctionnait pas...
    ImagePNG($im, $dir_tmp_images.$ii.'.png');
    //$obj->DestroyObject(); Pourquoi a ne fonctionne pas ? Mystre...
    unset($obj);  // clean
    ImageDestroy ($imgperso);
  }
  ImageDestroy ($im);
}

switch ($operation)
{
case 1 : // impression de cartes
  echo cadre_debut($sprintimpression);
  if (USAGERS_AUTRES<"w")
  {
    echo $pasledroit;
    echo cadre_fin();
    break;
  }
  echo $sprintavertissements;

  $query = "SELECT * FROM usagers LEFT JOIN credits ON credits.id_usager=usagers.id
            WHERE carte='prte' LIMIT 6";
  if($result = executeRequete($query))
  {
    $i=0;
    while($usager = fetch_object($result))
    {
        $i++;
        $code = sprintf("%04d", $usager->id) . date("dmy"); //date("dmy",strtotime($usager->date));
        //$parimg="nom=".$tab["nom"]."&prenom=".$tab["prenom"]."&mail=".$tab["courriel"].
        //        "&login=".$tab["login"]."&motdepasse=".$tab["motdepasse"]."&code=".$code."&tarif=".$tab["tarif"];
        uneCarte($i, $usager->nom, $usager->prenom, $usager->courriel, $usager->login, $usager->motdepasse, $code, $usager->id_tarif);
    }
    echo("<center><a href=\"6cartes.inc.php\"><IMG SRC='6cartes.inc.php' WIDTH=480 HEIGHT=690></a></center>\n");
  }
  echo cadre_fin();
  echo "<hr>";

case 2 : // demande de confirmation de l'impression des cartes
  echo cadre_debut($sprintconfirmerimpressions);
  if (USAGERS_AUTRES<"w")
  {
    echo $pasledroit;
    echo cadre_fin();
    break;
  }
    echo "<a name=\"c\"></a>";
    $query = "SELECT * FROM usagers LEFT JOIN credits ON credits.id_usager=usagers.id WHERE carte='prte' LIMIT 6";
    $res = executeRequete($query);
    echo "<form name=\"form\" method=\"post\">
          <input type=\"hidden\" name=\"id_usager\" value=\"$id_usager\">
          <input type=\"hidden\" name=\"operation\" value=\"3\">\n";
    echo "<table align=center border=1>\n";
    while ($usager = fetch_object($res))
    {
      echo "<tr><td>$usager->prenom $usager->nom ($usager->login)</td><td>
            <input type=\"radio\" name=\"id$usager->id\" value=\"attente\">en attente
            <input type=\"radio\" name=\"id$usager->id\" value=\"prte\">prte  l'impression
            <input type=\"radio\" name=\"id$usager->id\" value=\"imprime\" checked>imprime</td>
            </tr>\n";
    }
    echo "<tr><td colspan=2 align=center><input type=\"submit\" name=\"bouton\" value=\"$sconfirmer\"></td></tr>
          </table></form>\n";
  echo cadre_fin();
  break;

case 3 : // confirmation de l'impression des cartes
  echo cadre_debut($sprintconfirmerimpressions);
  if (USAGERS_AUTRES<"w")
  {
    echo $pasledroit;
    echo cadre_fin();
    break;
  }
    for ($i=0;$i<10000;$i++)  // On regarde tous les usagers possibles
    {
      $nom = "id".$i;
      if (isset($$nom))        // l'usager est concern
      {
          $req = "SELECT * FROM usagers WHERE id='$i'";
          if ($res = executeRequete($req))
          {
            $usa = fetch_object($res);
            echo "<br>$i $usa->login ($usa->prenom $usa->nom) : ".$$nom."\n";
            $motdepasse = $usa->motdepasse;
            if (strlen($motdepasse)!=32) $motdepasse=md5($motdepasse);
            if ($$nom == "imprime")
            {
                $req = "UPDATE credits SET carte='imprime' WHERE id_usager='$i'";
                $res = executeRequete($req);
                $req = "UPDATE usagers SET motdepasse='$motdepasse' WHERE id='$i'";
                $res = executeRequete($req);
            }
            else
                $req = "UPDATE credits SET carte='".$$nom."' WHERE id_usager='$i'";
            $res = executeRequete($req);
          }
      } // if
    } // for
  printf($sprintoksuite, $PHP_SELF);
  echo cadre_fin();
  break;

default : // affichage du nombre de cartes  imprimer
  echo cadre_debut($sprintconfirmerimpressions);
  if (USAGERS_AUTRES<"w")
  {
    echo $pasledroit;
    echo cadre_fin();
    break;
  }
  $req = "SELECT carte, count(*) AS somme
                FROM usagers
                LEFT JOIN credits ON credits.id_usager=usagers.id
                GROUP BY carte";
  $res = executeRequete($req);
  echo("<table align=center border=1>\n");
  while ($usager = fetch_object($res))
  {
    echo "<tr><td>$sprintnbcarte ".$usager->carte."s</td><td>$usager->somme</td></tr>\n";
    if ($usager->carte=="prte") $nbcarteprete=$usager->somme;
  }
  echo("</table>\n");
  if (! $nbcarteprete)
    echo "<p align=center>$sprintpasdecartespretes</p>
          <p align=center><a href=\"usagers.php?operation=5\">$susagerliste</a>.</p>\n";
  elseif ($nbcarteprete<6)
    printf($sprintpasbcpdecartespretes, $nbcarteprete,"$PHP_SELF?operation=1");
  else
    echo "<p align=center><a href=\"$PHP_SELF?operation=1\">$sprintimpression</a>.</p>\n";
  echo cadre_fin();
  break;
}

require("basdepage.inc.php");
echo "</body></html>\n";
require("footer.inc.php");
?>

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us