From 3c35a039bb1956334c5ae88bd1981c9676bdc08b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 4 Mar 2005 16:41:55 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/lolix/cv/cv.class.php | 107 +++++++++++++++++++++++++++++++ htdocs/lolix/cv/liste.php | 118 +++++++++++++++++++++++++++++++++++ htdocs/lolix/cv/pre.inc.php | 62 ++++++++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 htdocs/lolix/cv/cv.class.php create mode 100644 htdocs/lolix/cv/liste.php create mode 100644 htdocs/lolix/cv/pre.inc.php diff --git a/htdocs/lolix/cv/cv.class.php b/htdocs/lolix/cv/cv.class.php new file mode 100644 index 00000000000..3b585273090 --- /dev/null +++ b/htdocs/lolix/cv/cv.class.php @@ -0,0 +1,107 @@ + + * + * 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. + * + * $Id$ + * $Source$ + * + */ + +class Cv { + var $db; + var $id; + + Function Cv($DB, $id=0) + { + $this->db = $DB; + $this->id = $id; + + return 1; + } + + /* + * + * + */ + Function fetch() + { + $sql = "SELECT c.idp, c.nom, c.prenom, c.email"; + $sql .= " FROM lolixfr.candidat as c"; + $sql .= " WHERE c.idp = ".$this->id; + + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object(0); + + $this->id = $obj->idp; + $this->active = $obj->active; + $this->date_activation = $obj->da; + $this->nom = stripslashes($obj->nom); + $this->prenom = stripslashes($obj->prenom); + $this->email = stripslashes($obj->email); + + return 1; + + } + $this->db->free(); + } + else + { + print $this->db->error(); + } + } + + + Function deactivate() + { + $sql = "UPDATE lolixfr.candidat SET active=0,deacmeth='b',pubkey='$digest' WHERE idp=" . $this->id; + $result = $this->db->query($sql); + + $sql = "INSERT INTO lolixfr.res_statutlog (datel, fk_cand, fk_statut,author)"; + $sql .= " VALUES (now(),$this->id,0,'bots')"; + $result = $this->db->query($sql); + + $header = "From: webmaster@lolix.org\r\nReply-To: webmaster@lolix.org\r\nX-Mailer: Dolibarr"; + + $email = $this->email; + + $message = ' Bonjour, + + Le CV que vous avez déposé sur http://fr.lolix.org est arrivé à expiration, +celui-ci n\'est plus consultable en ligne, nous vous invitons à le réactiver si +vous êtes toujours à la recherche d\'un emploi. + + +Cordialement, + +--- +L\'équipe Lolix - http://fr.lolix.org/ +Le guide des prestataires logiciels libres - http://www.support-libre.com +'; + + + mail($email, "Desactivation de votre CV sur Lolix", $message, $header); + + print "mail sent to : $email"; + + } +} + +?> diff --git a/htdocs/lolix/cv/liste.php b/htdocs/lolix/cv/liste.php new file mode 100644 index 00000000000..f612c0def9d --- /dev/null +++ b/htdocs/lolix/cv/liste.php @@ -0,0 +1,118 @@ + + * + * 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. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); + +llxHeader("","","Lolix, liste des candidats"); + +if ($_GET["action"] == 'deac') +{ + $cv = new Cv($db); + $cv->id = $_GET["id"]; + $cv->fetch(); + $cv->deactivate(); +} + + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} + +if ($page == -1) { $page = 0 ; } + +$offset = $conf->liste_limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +$sql = "SELECT c.idp, c.nom, c.prenom"; +$sql .= ",".$db->pdate("c.datea")." as da"; +$sql .= " FROM lolixfr.candidat as c"; +$sql .= " WHERE c.active = 1"; + +$sortfield = "c.datea"; +$sortorder = "ASC"; + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset); + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + + + print_barre_liste("Liste des CV", $page, $PHP_SELF,"",$sortfield,$sortorder,'',$num); + + $i = 0; + + if ($sortorder == "DESC") + { + $sortorder="ASC"; + } + else + { + $sortorder="DESC"; + } + print ''; + print ''; + print ""; + print ""; + print "\n"; + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print "'; + print '\n"; print "\n"; + + print '\n"; + print ''; + print "\n"; + $i++; + } + print "
id"; + print_liste_field_titre("Nom",$PHP_SELF,"c.nom"); + print ""; + print_liste_field_titre("Prénom",$PHP_SELF,"c.prenom"); + print ""; + print_liste_field_titre("Activé le",$PHP_SELF,"s.fk_departement"); + print "
".($i+1).''; + print img_file(); + print " idp\">$obj->nom".$obj->prenom." '.strftime("%d/%m/%Y",$obj->da)."Deac
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/lolix/cv/pre.inc.php b/htdocs/lolix/cv/pre.inc.php new file mode 100644 index 00000000000..384be95d31d --- /dev/null +++ b/htdocs/lolix/cv/pre.inc.php @@ -0,0 +1,62 @@ + + * + * 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. + * + * $Id$ + * $Source$ + * + */ +require("../../main.inc.php"); +require("./cv.class.php"); + +function llxHeader($head = "", $urlp = "", $title="") +{ + global $user, $conf, $db; + + /* + * + * + */ + top_menu($head, $title); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/lolix/index.php", "Lolix"); + + $menu->add_submenu(DOL_URL_ROOT."/lolix/cv/liste.php", "Liste des CV"); + left_menu($menu->liste); +} + +Function fiche_header($id) +{ + $h = 0; + $head[0][0] = DOL_URL_ROOT.'/lolix/offre.php?id='.$id; + $head[0][1] = "Offre"; + $h++; + + for($i = 0 ; $i < sizeof($head) ; $i++) + { + if (strstr($head[$i][0], $GLOBALS["SCRIPT_URL"]) ) + { + $a = $i; + // sort de la boucle + $i = sizeof($head); + } + } + + dolibarr_fiche_head($head, $a); +} +?>