Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2005-03-04 16:41:55 +00:00
parent 3677dd2f07
commit 3c35a039bb
3 changed files with 287 additions and 0 deletions

View File

@ -0,0 +1,107 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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";
}
}
?>

118
htdocs/lolix/cv/liste.php Normal file
View File

@ -0,0 +1,118 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">';
print "<td>id</td><TD valign=\"center\">";
print_liste_field_titre("Nom",$PHP_SELF,"c.nom");
print "</td><td>";
print_liste_field_titre("Prénom",$PHP_SELF,"c.prenom");
print "</td>";
print "<td align=\"center\">";
print_liste_field_titre("Activé le",$PHP_SELF,"s.fk_departement");
print "</td>";
print "</TR>\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object( $i);
$var=!$var;
print "<tr $bc[$var]><td>".($i+1).'</td>';
print '<td><a href="offre.php?id='.$obj->idp.'">';
print img_file();
print "</a>&nbsp;<a href=\"offre.php?id=$obj->idp\">$obj->nom</A></td>\n"; print "<TD>".$obj->prenom."&nbsp;</TD>\n";
print '<td align="center">'.strftime("%d/%m/%Y",$obj->da)."</td>\n";
print '<td align="center"><a href="liste.php?id='.$obj->idp.'&amp;action=deac">Deac</a></td>';
print "</TR>\n";
$i++;
}
print "</TABLE>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,62 @@
<?PHP
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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);
}
?>