Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 7 → Rev 8

/trunk/controleur/gtt_controleur_editer_preferences.php
61,7 → 61,7
*/
function editerPref($user)
{
$r =& Preference::supprimerPreferences($user);
$r =& Preference::supprimer($user);
$nb = $_POST['champ_nb_total_proj']; //NB TOTAL DE PROJET
for($i = 0; $i < $nb; $i++) {
if (isset($_POST['champ_check'.$i])) {
/trunk/classes/BOG_debogage.inc.php
39,7 → 39,7
$retour_erreur .= '<span style="color: red; font-weight: 600" > Fichier : </span> ';
$retour_erreur .= '<span style="color: black; font-weight: normal;" > '.$nom_fichier_courant.'</span><br />'."\n";
$retour_erreur .= '<span style="color: red; font-weight: 600" > Ligne n? : </span> ';
$retour_erreur .= '<span style="color: red; font-weight: 600" > Ligne n° : </span> ';
$retour_erreur .= '<span style="color: black; font-weight: normal;" > '.$numero_ligne_courante.'</span><br />'."\n";
$retour_erreur .= '<span style="color: red; font-weight: 600" > Message erreur : </span> ';
/trunk/classes_metier/gtt_preference.class.php
1,5 → 1,4
<?php
 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
24,8 → 23,7
// |@version 3 |
 
 
class Preference
{
class Preference {
private $table = 'gestion_preferences';
private $id_utilisateur = null;
private $id_projet = null;
33,8 → 31,8
/*** Constructeur */
function Preference($u, $p)
{
$this->_utilisateur = $u;
$this->_projet = $p;
$this->id_utilisateur = $u;
$this->id_projet = $p;
}
/**
47,9 → 45,8
'VALUES ('.$this->id_utilisateur.', '.$this->id_projet.')';
$resultat = $GLOBALS['db']->query($requete);
if (DB::isError($resultat)) {
die($resultat->getMessage());
}
(DB::isError($resultat)) ? die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
$nbre_enregistrement_ajoute = $GLOBALS['db']->affectedRows();
if ($nbre_enregistrement_ajoute == 1) {
58,8 → 55,21
return false;
}
}
 
/**
*supprimer liste de preferences
*pour un utilisateur donne
*@param identifiant d'un utilisateur
*/
function supprimer($id)
{
$requete = 'DELETE FROM '.GEST_PREFERENCES.' '.
'WHERE '.GEST_CHAMPS_ID_UTILISATEUR.' = '.$id;
$resultat = $GLOBALS['db']->query($requete);
return $GLOBALS['db']->affectedRows();
}
/**
* Récupérer la liste de préférences d'un utilisateur.
*@param identifiant utilisateur.
*/
68,7 → 78,7
$table = array();
$requete = 'SELECT P.gp_id_projet, P.gp_nom_projet , C.gc_id_categorie, C.gc_libelle_categorie '.
'FROM gestion_preferences F, gestion_projet P, gestion_categorie C '.
'WHERE gp_id_utilisateur = '.$this->_utilisateur.' '.
'WHERE gp_id_utilisateur = '.$this->id_utilisateur.' '.
'AND F.gp_id_projet = P.gp_id_projet '.
'AND P.gc_id_categorie = C.gc_id_categorie '.
'ORDER BY gc_libelle_categorie ';
76,25 → 86,12
(DB::isError($resultat)) ? die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
while ( $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$case = array('id_proj' => $ligne[GEST_CHAMPS_ID_PROJET], 'nom_proj' => $ligne[GEST_CHAMPS_NOM_PROJET],'id_cat' => $ligne[GEST_CHAMPS_ID_CATEGORIE], 'libelle_cat' => $ligne[GEST_CHAMPS_LIBELLE_CATEGORIE]);
array_push($table, $case);
}
return $table;
}
/**
*supprimer liste de preferences
*pour un utilisateur donne
*@param identifiant d'un utilisateur
*/
function supprimerPreferences($id)
{
$requete = 'DELETE FROM '.GEST_PREFERENCES.' '.
'WHERE '.GEST_CHAMPS_ID_UTILISATEUR.' = '.$id;
$resultat = $GLOBALS['db']->query($requete);
return $GLOBALS['db']->affectedRows();
}
/**
* Méthode renvoyant vrai si un projet est dans la liste de préférence d'un utilisateur.
105,14 → 102,13
function isInPreferences($id)
{
$tab = $this->recupererTableauPreferences();
$res = false;
for ($r = 0; $r < count($tab); $r++) {
$t = $tab[$r];
for ($i = 0; $i < count($tab); $i++) {
$t = $tab[$i];
if ($t['id_proj'] == $id) {
$res = true;
return true;
}
}
return $res;
return false;
}
/**
120,13 → 116,7
*/
function afficherPreference()
{
echo "<br /> preferences <br />";
$u= array($this->_utilisateur,$this->_projet);
foreach ($u as $p) {
echo "$p , ";
}
echo "<br /> ";
echo '<pre>'.print_r($this, true).'</pre>';
}
}
?>
/trunk/menu/gtt_menu_editer_preferences.php
33,8 → 33,6
// +------------------------------------------------------------------------------------------------------+
// | INCLUSION DE FICHIERS |
// +------------------------------------------------------------------------------------------------------+
// Inclusion des paquets de la librairie pear
include_once 'HTML/QuickForm.php';
// Fichier langues
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
// Classes metier