annonce.inc.php 16.2 KB
Newer Older
Ayolo's avatar
Ayolo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?
/* Copyright 2007
 * - Manuel Vonthron < manuel DOT vonthron AT acadis DOT org >
 *
 * Ce fichier fait partie du site de l'Association des étudiants de
 * l'UTBM, http://ae.utbm.fr.
 *
 * 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
Ayolo's avatar
Ayolo committed
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Ayolo's avatar
Ayolo committed
16 17 18 19 20 21 22 23
 * 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.
 */

gliss's avatar
wip  
gliss committed
24
require_once("jobuser_etu.inc.php");
25
require_once($topdir . "include/taiste.inc.php");
Ayolo's avatar
Ayolo committed
26

27 28 29
/**
 * @todo conformer cette classe à stdentity
 */
Ayolo's avatar
Ayolo committed
30
class annonce extends stdentity
31
{
Ayolo's avatar
Ayolo committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
  var $id;
  var $id_client;
  var $nom_client;
  var $winner;
  var $date_depot;
  var $titre;
  var $id_type;
  var $nom_type;
  var $nom_main_cat;
  var $desc;
  var $profil;
  var $divers;
  var $start_date;
  var $duree;
  var $nb_postes;
  var $indemnite;
  var $lieu;
  var $type_contrat;
  var $allow_diff;
  var $tel_client;
  var $closed;
53

Ayolo's avatar
Ayolo committed
54 55
  var $applicants;
  var $applicants_fullobj;
56

Ayolo's avatar
Ayolo committed
57 58
  function load_by_id($id)
  {
59
    $sql = new requete($this->db, "SELECT `job_annonces`.*,
Ayolo's avatar
Ayolo committed
60 61 62 63
                                    DATE_FORMAT(`job_annonces`.`start_date`, '%e/%c/%Y') as `s_date`,
                                    CONCAT(`utilisateurs`.`prenom_utl`,' ',`utilisateurs`.`nom_utl`) AS `nom_client`,
                                    IFNULL(`utilisateurs`.`tel_portable_utl`, `utilisateurs`.`tel_maison_utl`) AS num_client,
                                    `job_types`.`nom` as `nom_type`
64
                                    FROM `job_annonces`
Ayolo's avatar
Ayolo committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
                                    LEFT JOIN `utilisateurs`
                                    ON `job_annonces`.`id_client` = `utilisateurs`.`id_utilisateur`
                                    LEFT JOIN `job_types`
                                    ON `job_types`.`id_type` = `job_annonces`.`job_type`
                                    WHERE `id_annonce` = $id LIMIT 1");
    $line = $sql->get_row();
    $this->id = $id;
    $this->id_client = $line['id_client'];
    $this->nom_client = $line['nom_client'];
    $this->date_depot = $line['date'];
    $this->titre = $line['titre'];
    $this->id_type = $line['job_type'];
    $this->nom_type = $line['nom_type'];
    $this->desc = $line['desc'];
    $this->profil = $line['profil'];
    $this->divers = $line['divers'];
    if($line['s_date'] == '0/0/0000' || $line['s_date'] == '01/01/1970')
      $this->start_date = null;
    else
      $this->start_date = $line['s_date'];
    $this->duree = $line['duree'];
    $this->nb_postes = $line['nb_postes'];
    $this->indemnite = $line['indemnite'];
    $this->lieu = $line['lieu'];
    $this->type_contrat = $line['type_contrat'];
    $this->allow_diff = $line['allow_diff'];
    $this->tel_client = $line['num_client'];
    $this->closed = $line['closed'];
93 94 95

    $this->load_winner();

Ayolo's avatar
Ayolo committed
96 97 98 99
    /* C'est pas beau mais j'arrive pas à le faire en une requete */
    $sql = new requete($this->db, "SELECT `job_types`.`nom` FROM `job_annonces` LEFT JOIN `job_types` ON `job_types`.`id_type` = ". ($this->id_type - $this->id_type%100) ."");
    $line = $sql->get_row();
    $this->nom_main_cat = $line['nom'];
100

Ayolo's avatar
Ayolo committed
101
    $this->load_applicants();
Ayolo's avatar
Ayolo committed
102 103
  }

104
  /**
105
   * @todo à implémenter
106 107 108
   */
  function _load($row)
  {
109

110 111
  }

gliss's avatar
wip  
gliss committed
112 113
  function load_applicants()
  {
Ayolo's avatar
Ayolo committed
114
    $this->applicants = array();
115

Ayolo's avatar
Ayolo committed
116 117 118
    $sql = new requete($this->db, "SELECT `id_etu`, `comment` FROM `job_annonces_etu` WHERE `id_annonce` = $this->id AND `relation` = 'apply'");
    while($line = $sql->get_row())
      $this->applicants[] = $line;
119 120

    return count($this->applicants);
gliss's avatar
wip  
gliss committed
121
  }
122

gliss's avatar
fix  
gliss committed
123 124
  function load_winner()
  {
Ayolo's avatar
Ayolo committed
125 126 127 128 129 130 131 132 133 134 135
    $sql = new requete($this->db, "SELECT id_etu FROM `job_annonces_etu` WHERE id_annonce='$this->id' AND relation='selected'");
    if($sql->lines > 0)
    {
      $this->winner = array();
      while($row = $sql->get_row())
      {
        $this->winner[] = $row[0];
      }
    }
    else
      $this->winner = NULL;
gliss's avatar
fix  
gliss committed
136
  }
137

gliss's avatar
wip  
gliss committed
138 139
  function load_applicants_fullobj()
  {
Ayolo's avatar
Ayolo committed
140
    $this->applicants = array();
141

Ayolo's avatar
Ayolo committed
142 143 144 145
    $sql = new requete($this->db, "SELECT `id_etu`, `comment` FROM `job_annonces_etu` WHERE `id_annonce` = $this->id AND `relation` = 'apply'");
    while($line = $sql->get_row())
    {
      $this->applicants[] = $line;
146

Ayolo's avatar
Ayolo committed
147 148 149 150 151 152
      $etu = new jobuser_etu($this->db);
      $etu->load_by_id($line['id_etu']);
      $this->applicants_fullobj[] = $etu;
    }

    return count($this->applicants);
gliss's avatar
wip  
gliss committed
153 154
  }

Ayolo's avatar
Ayolo committed
155 156
  function is_provided()
  {
Ayolo's avatar
Ayolo committed
157 158
    if( $this->winner != NULL && count($this->winner) >= $this->nb_postes )
      return true;
159
    else
Ayolo's avatar
Ayolo committed
160
      return false;
Ayolo's avatar
Ayolo committed
161
  }
162

gliss's avatar
gliss committed
163 164
  function remaining_positions()
  {
Ayolo's avatar
Ayolo committed
165
    return ($this->nb_postes - count($this->winner));
gliss's avatar
gliss committed
166
  }
167

gliss's avatar
wip  
gliss committed
168
  function set_winner($winner, $client)
gliss's avatar
wip  
gliss committed
169
  {
Ayolo's avatar
Ayolo committed
170 171 172 173
    if( $this->is_provided() )
      return false;
    else
      $sql = new update($this->dbrw, "job_annonces_etu", array("relation" => "selected"), array("id_annonce" => $this->id, "id_etu" => $winner->id, "relation" => "apply"));
174

Ayolo's avatar
Ayolo committed
175 176 177
    $this->load_winner(); /* maj des gens sélectionnés */
    if( $this->is_provided() )
      $sql = new update($this->dbrw, "job_annonces", array("provided" => "true"), array("id_annonce" => $this->id));
178

Ayolo's avatar
Ayolo committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
    /**
     * Envois de mails
     */
    $genre_client;
    switch( $client->sexe )
    {
      case 1:
        $genre_client = "M."; break;
      case 2:
        $genre_client = "Mme"; break;
    }
    $genre_etu;
    switch( $etu->sexe )
    {
      case 1:
        $genre_etu = "M."; break;
      case 2:
        $genre_etu = "Mlle"; break;
    }
198

Ayolo's avatar
Ayolo committed
199 200
    $tel = telephone_display($this->tel_client);
    $text_etu = <<<EOF
gliss's avatar
bwip  
gliss committed
201
Bonjour,
gliss's avatar
wip  
gliss committed
202

gliss's avatar
wip  
gliss committed
203
Nous avons le plaisir de vous annoncer que vous avez été sélectionné par $genre_client $client->prenom $client->nom, client de AE Job Etu, pour son annonce "$this->titre" (numéro $this->id).
204
Cette personne à été incitée à vous contacter, mais si cela devait tarder anormalement, n'hésitez pas à prendre les devants.
gliss's avatar
wip  
gliss committed
205 206
N° de téléphone : $tel
Pour plus de renseignements, consultez sa fiche Matmatronch : http://ae.utbm.fr/user.php?id_utilisateur=$this->id_client
207

gliss's avatar
wip  
gliss committed
208 209
Nous vous remerçions d'utiliser AE Job Etu et vous souhaitons bon courage pour cette nouvelle mission !

210
L'équipe AE et les responsables d'AE Job Etu
gliss's avatar
gniak  
gliss committed
211 212 213 214 215

--
AE JobEtu est un service de l'Association des Etudiants de l'UTBM.
http://ae.utbm.fr/

gliss's avatar
wip  
gliss committed
216 217
EOF;

218

Ayolo's avatar
Ayolo committed
219 220
    $tel = telephone_display($winner->tel_portable);
    $text_client = <<<EOF
gliss's avatar
bwip  
gliss committed
221
Bonjour,
gliss's avatar
wip  
gliss committed
222

gliss's avatar
wip  
gliss committed
223 224 225 226
Vous venez de sélectionner $genre_etu $winner->prenom $winner->nom afin de répondre à votre annonce "$this->titre" (numéro $this->id).
Nous vous incitons à le contacter si cela n'a pas déjà été fait au $tel afin de convenir des modalités d'exécution du contrat.

Lorsque la prestation sera terminée, n'oubliez pas ne clore l'annonce depuis votre tableau de bord : http://ae.utbm.fr/jobetu/board_client.php
gliss's avatar
wip  
gliss committed
227

gliss's avatar
wip  
gliss committed
228
Nous vous remerçions de votre confiance et espérons que votre satisfaction sera totale.
gliss's avatar
wip  
gliss committed
229

gliss's avatar
wip  
gliss committed
230
L'équipe AE et les responsables d'AE Job Etu
gliss's avatar
gliss committed
231

gliss's avatar
gniak  
gliss committed
232 233 234 235
--
AE JobEtu est un service de l'Association des Etudiants de l'UTBM.
http://ae.utbm.fr/

gliss's avatar
wip  
gliss committed
236
EOF;
gliss's avatar
gliss committed
237

Ayolo's avatar
Ayolo committed
238 239
    if(!$this->is_provided())
      $text_client .= "PS: il reste désormais ".$this->remaining_positions()." place(s) disponibles pour votre offre.";
240

Ayolo's avatar
Ayolo committed
241 242
    $mail_etu = mail($winner->email, utf8_decode("[AE JobEtu] Sélection pour l'annonce n°".$this->id), utf8_decode($text_etu), "From: \"AE Job Etu\" <ae-jobetu@utbm.fr>");
    $mail_client = mail($client->email, utf8_decode("[AE JobEtu] Sélection de $winner->prenom $winner->nom pour l'annonce n°".$this->id), utf8_decode($text_client), "From: \"AE JobEtu\" <ae-jobetu@utbm.fr>");
243

Ayolo's avatar
Ayolo committed
244 245
    if($mail_etu && $mail_client)
      return true;
246
    else
Ayolo's avatar
Ayolo committed
247
      return false;
gliss's avatar
wip  
gliss committed
248
  }
249

gliss's avatar
wip  
gliss committed
250 251
  function is_closed()
  {
Ayolo's avatar
Ayolo committed
252
    return $this->closed;
gliss's avatar
wip  
gliss committed
253
  }
Ayolo's avatar
Ayolo committed
254 255 256

  function get_client()
  {
Ayolo's avatar
Ayolo committed
257
    return $id_client;
Ayolo's avatar
Ayolo committed
258
  }
259

gliss's avatar
wip  
gliss committed
260
  function set_closed($eval = NULL, $comment = NULL)
gliss's avatar
wip  
gliss committed
261
  {
Ayolo's avatar
Ayolo committed
262 263
    $val = "";
    $comment = mysql_real_escape_string($comment);
264

Ayolo's avatar
Ayolo committed
265 266 267 268 269 270 271 272 273
    switch( mysql_real_escape_string($eval) ) //vu qu'on peut pas mettre de '0' dans les radiobox ...
    {
      case "bof":
        $val = -1; break;
      case "bleh":
        $val = 0; break;
      case "yeah":
        $val = +1; break;
    }
274

Ayolo's avatar
Ayolo committed
275
    $sql = new update($this->dbrw, "job_annonces", array("closed" => true), array("id_annonce" => $this->id) );
276

Ayolo's avatar
Ayolo committed
277 278
    if( $val != NULL || $comment != NULL )
      $sql2 = new insert($this->dbrw, "job_feedback", array("id_annonce" => $this->id, "note_client" => $val, "avis_client" => $comment) );
gliss's avatar
wip  
gliss committed
279
  }
Ayolo's avatar
Ayolo committed
280

gliss's avatar
wip  
gliss committed
281
  function apply_to($etu, $comment = null)
Ayolo's avatar
Ayolo committed
282
  {
Ayolo's avatar
Ayolo committed
283
    if( !($etu instanceof jobuser_etu) ) exit("NIET !");
284 285

    $sql = new insert($this->dbrw,
Ayolo's avatar
Ayolo committed
286 287 288 289 290
                      "job_annonces_etu",
                      array(
                        "id_annonce" => $this->id,
                        "id_etu" => $etu->id,
                        "relation" => "apply",
291
                        "comment" => $comment
Ayolo's avatar
Ayolo committed
292 293
                        )
                      );
294

Ayolo's avatar
Ayolo committed
295 296 297 298
    if($sql)
      return $sql->get_id();
    else
      return false;
Ayolo's avatar
Ayolo committed
299
  }
300

gliss's avatar
gliss committed
301 302 303 304
  function delete_relation($id_relation)
  {
    $sql = new delete($this->dbrw, "job_annonces_etu", array("id_relation" => $id_relation));
  }
305

gliss's avatar
wip  
gliss committed
306 307
  function reject($etu)
  {
Ayolo's avatar
Ayolo committed
308
    if( !($etu instanceof jobuser_etu) ) exit("NIET !");
309 310

    $sql = new insert($this->dbrw,
Ayolo's avatar
Ayolo committed
311 312 313 314 315 316 317 318
                      "job_annonces_etu",
                      array(
                        "id_annonce" => $this->id,
                        "id_etu" => $etu->id,
                        "relation" => "reject",
                        "comment" => null
                        )
                      );
319

Ayolo's avatar
Ayolo committed
320 321 322 323
    if($sql)
      return true;
    else
      return false;
gliss's avatar
wip  
gliss committed
324
  }
325

gliss's avatar
wip  
gliss committed
326 327
  function is_applicant($id_etu)
  {
Ayolo's avatar
Ayolo committed
328
    $val = false;
329

Ayolo's avatar
Ayolo committed
330 331
    if(empty($this->applicants))
      return false;
332

Ayolo's avatar
Ayolo committed
333 334 335
    foreach($this->applicants as $tmp)
      if($tmp['id_etu'] == $id_etu)
        $val = true;
336

Ayolo's avatar
Ayolo committed
337
    return $val;
gliss's avatar
wip  
gliss committed
338
  }
339

gliss's avatar
wip  
gliss committed
340 341 342 343 344
  /**
   *  Détruit une annonce et les candidatures associées a condition qu'il n'y ait pas eu d'étudiants sélectionnés
   */
  function destroy()
  {
gliss's avatar
bwip  
gliss committed
345
    if( !empty($this->winner) ) return false;
346

gliss's avatar
bwip  
gliss committed
347
    $sql_mail = new requete($this->db, "SELECT email_utl FROM `utilisateurs` NATURAL JOIN `job_annonces_etu` NATURAL JOIN `job_prefs` WHERE id_annonce = $this->id AND mail_prefs = 'full'");
348

349 350
    $sql = new delete($this->dbrw, "job_annonces", array("id_annonce" => $this->id) ); // suppression annonce
    $sql2 = new delete($this->dbrw, "job_annonces_etu", array("id_annonce" => $this->id) ); // suppression relations
351

352
    if( $sql->is_success() && $sql2->is_success() )
gliss's avatar
bwip  
gliss committed
353
    {
354 355 356
      if($sql_mail->lines > 0)
        while( list($email) = $sql_mail->get_row() )
         {
gliss's avatar
bwip  
gliss committed
357 358 359
$text = <<<EOF
Bonjour,

gliss's avatar
gliss committed
360
Nous sommes au regret de vous annoncer que l'annonce "$this->titre" à laquelle vous avez postulé vient d'être annulée et supprimée de notre base de donnée.
gliss's avatar
bwip  
gliss committed
361 362 363 364 365 366 367 368 369 370 371 372
Pour plus de renseignement, vous pouvez écrire en réponse à ce mail.

Cordialement,

L'équipe AE et les responsables d'AE Job Etu

--
AE JobEtu est un service de l'Association des Etudiants de l'UTBM.
http://ae.utbm.fr/


EOF;
373 374
          mail($email, utf8_decode("[AE JobEtu] Annulation de l'annonce n°".$this->id), utf8_decode($text), "From: \"AE Job Etu\" <ae-jobetu@utbm.fr>");
        }
375 376
      // mails envoyés
      return true;
gliss's avatar
bwip  
gliss committed
377 378 379
    }
    else
      return false;
380

gliss's avatar
wip  
gliss committed
381
  }
Ayolo's avatar
Ayolo committed
382 383 384 385 386

  /**
   * Ajoute une nouvelle annonce
   * @return l'id de l'annonce (+ chargement des infos dans l'objet courant)
   * @param $client objet jobuser_client
387
   * @param $titre titre de l'annonce
Ayolo's avatar
Ayolo committed
388
   */
gliss's avatar
gliss committed
389
  function add($client, $titre, $job_type, $desc, $profil, $divers = null, $start_date = null, $duree = null, $nb_postes = 1, $indemnite = null, $lieu = null, $type_contrat = null, $allow_diff = 0 )
Ayolo's avatar
Ayolo committed
390
  {
Ayolo's avatar
Ayolo committed
391
    if(!($client instanceof jobuser_client))  return -1;
392

Ayolo's avatar
Ayolo committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
    $this->id_client = $client->id;
    $this->titre = $titre;
    $this->job_type  = $job_type;
    $this->desc = $desc;
    $this->divers = $divers;
    $this->profil = $profil;
    $this->start_date = $start_date;
    $this->duree = $duree;
    $this->nb_postes = $nb_postes;
    $this->indemnite = $indemnite;
    $this->lieu = $lieu;
    $this->type_contrat = $type_contrat;
    $this->allow_diff = $allow_diff;

    $sql = new insert($this->dbrw,
                      "job_annonces",
                      array(
                            "id_client" => $this->id_client,
                            "titre" => $this->titre,
                            "date" => date("Y-m-d"),
                            "job_type" => $this->job_type,
                            "desc" => $this->desc,
                            "divers" => $this->divers,
                            "profil" => $this->profil,
                            "start_date" => $this->start_date,
                            "duree" => $this->duree,
                            "nb_postes" => $this->nb_postes,
                            "indemnite" => $this->indemnite,
                            "lieu" => $this->lieu,
                            "type_contrat" => $this->type_contrat,
                            "allow_diff" => $this->allow_diff,
424
                            "closed" => 0
Ayolo's avatar
Ayolo committed
425 426 427 428 429 430
                      )
                      );
    if($sql)
      $this->id = $sql->get_id();
    else
      $this->id = false;
Ayolo's avatar
Ayolo committed
431

gliss's avatar
gniak  
gliss committed
432 433
    /**
     * Envoi des mails
434
     */
gliss's avatar
gniak  
gliss committed
435
      $sql = new requete($this->db, "SELECT email_utl, nom FROM `utilisateurs` NATURAL JOIN `job_types_etu` NATURAL JOIN `job_types` NATURAL JOIN `job_prefs` WHERE id_type = $this->job_type AND mail_prefs = 'full'", false);
436

gliss's avatar
gniak  
gliss committed
437
      if($sql->lines > 0)
gliss's avatar
go !  
gliss committed
438
      {
gliss's avatar
gniak  
gliss committed
439 440
        while( $row = $sql->get_row() )
        {
gliss's avatar
gliss committed
441
          $nom_cat = $row['nom'];
gliss's avatar
gniak  
gliss committed
442 443 444
          $text = <<<EOF
Bonjour,

gliss's avatar
gliss committed
445
Une nouvelle annonce à été postée dans la catégorie $nom_cat que vous surveillez : "$this->titre".
gliss's avatar
gniak  
gliss committed
446 447 448 449 450 451 452
Pour plus de détails concernant cette annonce : http://ae.utbm.fr/jobetu/board_etu.php?view=general&action=detail&id_annonce=$this->id

Cordialement,

L'équipe AE et les responsables d'AE Job Etu.

--
gliss's avatar
gliss committed
453
Pour ne plus recevoir ces mails : http://ae.utbm.fr/jobetu/board_etu.php?view=preferences
gliss's avatar
gniak  
gliss committed
454 455 456 457
AE JobEtu est un service de l'Association des Etudiants de l'UTBM
http://ae.utbm.fr/

EOF;
gliss's avatar
gliss committed
458
          $mail = mail($row['email_utl'], utf8_decode("[AE JobEtu] Nouvelle annonce dans la catégorie ". $row['nom']), utf8_decode($text), "From: \"AE JobEtu\" <ae-jobetu@utbm.fr>");
gliss's avatar
gniak  
gliss committed
459
        }
gliss's avatar
go !  
gliss committed
460
      }
461

Ayolo's avatar
Ayolo committed
462
    return $this->id;
Ayolo's avatar
Ayolo committed
463
  }
464

gliss's avatar
gliss committed
465 466 467
  /**
   * Edition d'une annonce
   */
gliss's avatar
gliss committed
468
  function save($client, $titre, $job_type, $desc, $profil = null, $divers = null, $start_date = null, $duree = null, $nb_postes = 1, $indemnite = null, $lieu = null, $type_contrat = null, $allow_diff = 0 )
gliss's avatar
gliss committed
469
  {
Ayolo's avatar
Ayolo committed
470
    if(!($client instanceof jobuser_client))  return -1;
471

Ayolo's avatar
Ayolo committed
472 473 474 475 476 477 478 479 480 481 482
    $this->titre = $titre;
    $this->job_type  = $job_type;
    $this->desc = $desc;
    $this->divers = $divers;
    $this->profil = $profil;
    $this->start_date = $start_date;
    $this->duree = $duree;
    $this->nb_postes = $nb_postes;
    $this->indemnite = $indemnite;
    $this->lieu = $lieu;
    $this->type_contrat = $type_contrat;
483 484
    $this->allow_diff = $allow_diff;

Ayolo's avatar
Ayolo committed
485 486 487 488 489 490 491 492 493 494 495 496 497 498
    $sql = new update($this->dbrw,
                      "job_annonces",
                      array(
                            "titre" => $this->titre,
                            "job_type" => $this->job_type,
                            "desc" => $this->desc,
                            "divers" => $this->divers,
                            "profil" => $this->profil,
                            "start_date" => $this->start_date,
                            "duree" => $this->duree,
                            "nb_postes" => $this->nb_postes,
                            "indemnite" => $this->indemnite,
                            "lieu" => $this->lieu,
                            "type_contrat" => $this->type_contrat,
499
                            "allow_diff" => $this->allow_diff
Ayolo's avatar
Ayolo committed
500 501 502
                      ),
                      array("id_annonce" => $this->id)
                      );
503

Ayolo's avatar
Ayolo committed
504 505
    if($sql)
      return $this->id;
506
    else
Ayolo's avatar
Ayolo committed
507
      return false;
gliss's avatar
gliss committed
508
  }
Ayolo's avatar
Ayolo committed
509 510 511 512

}

?>