| Line 17... |
Line 17... |
| 17 |
// | |
|
17 |
// | |
|
| 18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
| 19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
| 20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
| 22 |
// CVS : $Id: bazar.fonct.php,v 1.69 2007-09-18 07:39:42 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.php,v 1.70 2007-10-10 13:26:36 alexandre_tb Exp $
|
| 23 |
/**
|
23 |
/**
|
| 24 |
*
|
24 |
*
|
| 25 |
* Fonctions du module bazar
|
25 |
* Fonctions du module bazar
|
| 26 |
*
|
26 |
*
|
| 27 |
*
|
27 |
*
|
| Line 29... |
Line 29... |
| 29 |
//Auteur original :
|
29 |
//Auteur original :
|
| 30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
| 31 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
31 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
| 32 |
//Autres auteurs :
|
32 |
//Autres auteurs :
|
| 33 |
*@copyright Tela-Botanica 2000-2004
|
33 |
*@copyright Tela-Botanica 2000-2004
|
| 34 |
*@version $Revision: 1.69 $ $Date: 2007-09-18 07:39:42 $
|
34 |
*@version $Revision: 1.70 $ $Date: 2007-10-10 13:26:36 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 43... |
Line 43... |
| 43 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php' ;
|
43 |
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php' ;
|
| 44 |
require_once PAP_CHEMIN_API_PEAR.'HTML/Table.php' ;
|
44 |
require_once PAP_CHEMIN_API_PEAR.'HTML/Table.php' ;
|
| 45 |
require_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.inc.php';
|
45 |
require_once GEN_CHEMIN_API.'formulaire/formulaire.fonct.inc.php';
|
| 46 |
require_once 'bazar.fonct.rss.php';
|
46 |
require_once 'bazar.fonct.rss.php';
|
| Line 47... |
Line -... |
| 47 |
|
- |
|
| 48 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 49 |
// | LISTE de FONCTIONS |
|
- |
|
| Line 50... |
Line -... |
| 50 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 51 |
|
- |
|
| 52 |
/** niveau_droit() - Retourne le niveau de droit de l'utilisateur
|
- |
|
| 53 |
*
|
- |
|
| 54 |
* @param integer Id de la nature d'offre pour connaitre les droits sur une rubrique
|
- |
|
| 55 |
* @param integer Id de la personne (par défaut la personne loguée)
|
- |
|
| 56 |
*
|
- |
|
| 57 |
* @return string Retourne 'redacteur', 'administrateur', 'superadministrateur', ou 'aucun'
|
- |
|
| 58 |
*/
|
- |
|
| 59 |
function niveau_droit($id_nature_offre='0', $personne) {
|
- |
|
| 60 |
$requete = 'SELECT bd_niveau_droit FROM bazar_droits WHERE bd_id_utilisateur='.$personne.
|
- |
|
| 61 |
' AND (bd_id_nature_offre="'.$id_nature_offre.'" OR bd_id_nature_offre=0)';
|
- |
|
| 62 |
$resultat = $GLOBALS['_BAZAR_']['db']->query ($requete) ;
|
- |
|
| 63 |
if (DB::isError($resultat)) {
|
- |
|
| 64 |
die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
|
- |
|
| 65 |
}
|
- |
|
| 66 |
if ($resultat->numRows() != 0) {
|
- |
|
| 67 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
- |
|
| 68 |
if ($ligne['bd_niveau_droit']==0) return 'superadministrateur';
|
- |
|
| 69 |
if ($ligne['bd_niveau_droit']==1) return 'redacteur';
|
- |
|
| 70 |
if ($ligne['bd_niveau_droit']==2) return 'administrateur';
|
- |
|
| 71 |
}
|
- |
|
| 72 |
}
|
- |
|
| 73 |
else return 'aucun';
|
- |
|
| 74 |
}
|
- |
|
| 75 |
|
47 |
|
| 76 |
|
48 |
|
| 77 |
/** fiches_a_valider () - Renvoie les annonces restant à valider par un administrateur
|
49 |
/** fiches_a_valider () - Renvoie les annonces restant a valider par un administrateur
|
| 78 |
*
|
50 |
*
|
| 79 |
* @return string HTML
|
51 |
* @return string HTML
|
| 80 |
*/
|
52 |
*/
|
| Line 473... |
Line 445... |
| 473 |
'<strong>'.BAZ_PASSER_EN.'</strong>',
|
445 |
'<strong>'.BAZ_PASSER_EN.'</strong>',
|
| 474 |
'<strong>'.BAZ_OU_PASSER_EN.'</strong>')) ;
|
446 |
'<strong>'.BAZ_OU_PASSER_EN.'</strong>')) ;
|
| 475 |
$table->setRowType (0, 'th') ;
|
447 |
$table->setRowType (0, 'th') ;
|
| Line 476... |
Line 448... |
| 476 |
|
448 |
|
| 477 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
- |
|
| 478 |
$droits = niveau_droit($ligne['bn_id_nature'],$personne);
|
- |
|
| 479 |
|
449 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
| 480 |
$lien_aucun_droit=$GLOBALS['_BAZAR_']['url'];
|
450 |
$lien_aucun_droit=$GLOBALS['_BAZAR_']['url'];
|
| 481 |
$lien_aucun_droit->addQueryString('action', BAZ_GERER_DROITS);
|
451 |
$lien_aucun_droit->addQueryString('action', BAZ_GERER_DROITS);
|
| 482 |
$lien_aucun_droit->addQueryString('pers', $personne);
|
452 |
$lien_aucun_droit->addQueryString('pers', $personne);
|
| 483 |
$lien_aucun_droit->addQueryString('droits', 'aucun');
|
453 |
$lien_aucun_droit->addQueryString('droits', 'aucun');
|
| Line 607... |
Line 577... |
| 607 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
577 |
return ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
| 608 |
}
|
578 |
}
|
| 609 |
//$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
579 |
//$res.='<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
|
| 610 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
580 |
include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php';
|
| 611 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
581 |
$modele = new bazarTemplate($GLOBALS['_BAZAR_']['db']);
|
| 612 |
$res .= $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE_ACCUEIL, $GLOBALS['_BAZAR_']['langue']);
|
582 |
$res .= $modele->getTemplate(BAZ_TEMPLATE_FORMULAIRE_ACCUEIL, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
|
| 613 |
if ($resultat->numRows()==1) {
|
583 |
if ($resultat->numRows()==1) {
|
| 614 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
584 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC);
|
| 615 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
585 |
$GLOBALS['_BAZAR_']['id_typeannonce']=$ligne['bn_id_nature'];
|
| 616 |
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
|
586 |
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
|
| 617 |
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
|
587 |
$GLOBALS['_BAZAR_']['condition']=$ligne['bn_condition'];
|
| Line 622... |
Line 592... |
| 622 |
$GLOBALS['_BAZAR_']['image_logo']=$ligne['bn_image_logo'];
|
592 |
$GLOBALS['_BAZAR_']['image_logo']=$ligne['bn_image_logo'];
|
| 623 |
$mode = BAZ_ACTION_NOUVEAU;
|
593 |
$mode = BAZ_ACTION_NOUVEAU;
|
| 624 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
|
594 |
$lien_formulaire->addQueryString('action', BAZ_ACTION_NOUVEAU_V);
|
| Line 625... |
Line 595... |
| 625 |
|
595 |
|
| 626 |
} else {
|
596 |
} else {
|
| 627 |
$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
|
597 |
//$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
|
| 628 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
|
598 |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
|
| 629 |
$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
|
599 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']);
|
| 630 |
if (($droitspers=='redacteur') or ($droitspers=='administrateur')
|
600 |
if (($utilisateur->isRedacteur($ligne['bn_id_nature'])) || ($utilisateur->isAdmin($ligne['bn_id_nature']))
|
| 631 |
or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
|
601 |
|| ($utilisateur->isSuperAdmin() || !BAZ_RESTREINDRE_DEPOT)) {
|
| 632 |
if ($ligne['bn_image_titre']!='') {
|
602 |
if ($ligne['bn_image_titre']!='') {
|
| 633 |
$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.
|
603 |
$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.
|
| 634 |
$ligne['bn_label_nature'].'" />'.'<br />'."\n";
|
604 |
$ligne['bn_label_nature'].'" />'.'<br />'."\n";
|
| 635 |
} else {
|
605 |
} else {
|
| Line 833... |
Line 803... |
| 833 |
* @return void
|
803 |
* @return void
|
| 834 |
*/
|
804 |
*/
|
| 835 |
function requete_bazar_fiche($valeur) {
|
805 |
function requete_bazar_fiche($valeur) {
|
| 836 |
$requete=NULL;
|
806 |
$requete=NULL;
|
| 837 |
//l'annonce est directement publiée pour les admins
|
807 |
//l'annonce est directement publiée pour les admins
|
| 838 |
if ((niveau_droit($GLOBALS['_BAZAR_']['id_typeannonce'],$GLOBALS['id_user'])=='administrateur') or
|
808 |
$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']);
|
| - |
|
809 |
|
| 839 |
(niveau_droit($GLOBALS['_BAZAR_']['id_typeannonce'],$GLOBALS['id_user'])=='superadministrateur')) {
|
810 |
if ($utilisateur->isAdmin($GLOBALS['_BAZAR_']['id_typeannonce']) ||
|
| - |
|
811 |
$utilisateur->isSuperAdmin()) {
|
| 840 |
$requete.='bf_statut_fiche=1, ';
|
812 |
$requete.='bf_statut_fiche=1, ';
|
| 841 |
}
|
813 |
}
|
| 842 |
else {
|
814 |
else {
|
| 843 |
$requete.='bf_statut_fiche="'.BAZ_ETAT_VALIDATION.'", ';
|
815 |
$requete.='bf_statut_fiche="'.BAZ_ETAT_VALIDATION.'", ';
|
| 844 |
}
|
816 |
}
|
| Line 1421... |
Line 1393... |
| 1421 |
}
|
1393 |
}
|
| Line 1422... |
Line 1394... |
| 1422 |
|
1394 |
|
| 1423 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1395 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 1424 |
*
|
1396 |
*
|
| - |
|
1397 |
* $Log: not supported by cvs2svn $
|
| - |
|
1398 |
* Revision 1.69 2007-09-18 07:39:42 alexandre_tb
|
| - |
|
1399 |
* correction d un bug lors d une insertion
|
| 1425 |
* $Log: not supported by cvs2svn $
|
1400 |
*
|
| 1426 |
* Revision 1.68 2007-08-27 12:31:31 alexandre_tb
|
1401 |
* Revision 1.68 2007-08-27 12:31:31 alexandre_tb
|
| 1427 |
* mise en place de modele
|
1402 |
* mise en place de modele
|
| 1428 |
*
|
1403 |
*
|
| 1429 |
* Revision 1.67 2007-07-04 10:01:30 alexandre_tb
|
1404 |
* Revision 1.67 2007-07-04 10:01:30 alexandre_tb
|