Commit d9a2c534 authored by mbriand's avatar mbriand

Masquage des clubs

parent ff6a2210
......@@ -105,9 +105,9 @@ else if ( isset($_REQUEST["id_asso"]) )
$asso_parent->load_by_id($_REQUEST['asso_parent']);
if ( $GLOBALS["is_using_ssl"] )
$asso->update_asso($_REQUEST['nom'],$_REQUEST['nom_unix'],$asso_parent->id,$_REQUEST["adresse"],$_REQUEST['email'],$_REQUEST['siteweb'],$_REQUEST['login_email'],$_REQUEST['passwd_email'],isset($_REQUEST['distinct_benevole']));
$asso->update_asso($_REQUEST['nom'],$_REQUEST['nom_unix'],$asso_parent->id,$_REQUEST["adresse"],$_REQUEST['email'],$_REQUEST['siteweb'],$_REQUEST['login_email'],$_REQUEST['passwd_email'],isset($_REQUEST['distinct_benevole']), isset($_REQUEST['hidden']));
else
$asso->update_asso($_REQUEST['nom'],$_REQUEST['nom_unix'],$asso_parent->id,$_REQUEST["adresse"],$_REQUEST['email'],$_REQUEST['siteweb'],null,null,isset($_REQUEST['distinct_benevole']));
$asso->update_asso($_REQUEST['nom'],$_REQUEST['nom_unix'],$asso_parent->id,$_REQUEST["adresse"],$_REQUEST['email'],$_REQUEST['siteweb'],null,null,isset($_REQUEST['distinct_benevole']), isset($_REQUEST['hidden']));
}
elseif ( $GLOBALS["is_using_ssl"] )
$asso->update_asso($asso->nom,$asso->nom_unix,$asso_parent->id,$_REQUEST["adresse"],$_REQUEST['email'],$_REQUEST['siteweb'],$_REQUEST['login_email'],$_REQUEST['passwd_email'],isset($_REQUEST['distinct_benevole']));
......@@ -171,6 +171,9 @@ else if ( isset($_REQUEST["id_asso"]) )
$frm->add_checkbox("distinct_benevole","Activer la mailing liste bénévoles",$asso->distinct_benevole);
if ( $site->user->is_in_group("root") )
$frm->add_checkbox("hidden","Masquer le club (club fermé)",$asso->hidden);
if ( $GLOBALS["is_using_ssl"] )
{
$frm->add_text_field("login_email","Login mail utbm",$asso->login_email);
......@@ -232,6 +235,15 @@ else if ( isset($_REQUEST["id_asso"]) )
$page = new page($site->db);
$page->load_by_pagename("activites:".$asso->nom_unix);
if ($asso->hidden)
{
$cts->add(new error("Club supprimé"));
if (!$site->user->is_in_group("root"))
$site->add_contents($cts);
$site->end_page();
exit();
}
if ( $page->id > 0 )
{
$cts->add_title(2,"Présentation");
......@@ -244,6 +256,7 @@ else if ( isset($_REQUEST["id_asso"]) )
$req = new requete($site->db,
"SELECT `id_asso`, `nom_asso`, `nom_unix_asso` " .
"FROM `asso` WHERE `id_asso_parent`='".$asso->id."' " .
"AND `hidden`='0' ".
"ORDER BY `nom_asso`");
if ( $req->lines > 0 )
{
......
......@@ -217,7 +217,7 @@ class fsearch extends stdcontents
}
// Clubs et associations
$req = new requete($site->db,"SELECT * FROM `asso` WHERE nom_asso REGEXP '".$sqlpattern."' LIMIT 3");
$req = new requete($site->db,"SELECT * FROM `asso` WHERE nom_asso REGEXP '".$sqlpattern."' AND `hidden`=0 LIMIT 3");
if ( $req->lines )
{
......
......@@ -94,6 +94,8 @@ class asso extends stdentity
* que le stockage ne se fasse pas en clair...
*/
var $hidden;
public $distinct_benevole=false;
......@@ -147,6 +149,8 @@ class asso extends stdentity
$this->passwd_email = $row['passwd_email'];
$this->distinct_benevole = $row['distinct_benevole_asso'];
$this->hidden = $row['hidden_asso'];
}
/** Crée une nouvelle association
......@@ -154,7 +158,7 @@ class asso extends stdentity
* @param $nom_unix Nom UNIX de l'association
* @param $id_parent ID de l'association parent, false si non applicable
*/
function add_asso ( $nom, $nom_unix, $id_parent = null, $adresse_postale="", $email="", $siteweb="", $login_email="", $passwd_email="", $distinct_benevole=false )
function add_asso ( $nom, $nom_unix, $id_parent = null, $adresse_postale="", $email="", $siteweb="", $login_email="", $passwd_email="", $distinct_benevole=false, $hidden=0 )
{
if ( is_null($this->dbrw) ) return; // "Read Only" mode
......@@ -167,6 +171,7 @@ class asso extends stdentity
$this->siteweb = $siteweb;
$this->login_email = $login_email;
$this->passwd_email = $passwd_email;
$this->hidden = $hidden;
$sql = new insert ($this->dbrw,
"asso",
......@@ -181,7 +186,9 @@ class asso extends stdentity
"login_email"=>$this->login_email,
"passwd_email"=>$this->passwd_email,
"distinct_benevole_asso" => $this->distinct_benevole
"distinct_benevole_asso" => $this->distinct_benevole,
"hidden"=>$this->hidden,
)
);
......@@ -208,7 +215,7 @@ class asso extends stdentity
* @param $nom_unix Nom UNIX de l'association
* @param $id_parent ID de l'association parent, false si non applicable
*/
function update_asso ( $nom, $nom_unix, $id_parent = null, $adresse_postale="", $email=null, $siteweb=null, $login_email=null, $passwd_email=null, $distinct_benevole=false )
function update_asso ( $nom, $nom_unix, $id_parent = null, $adresse_postale="", $email=null, $siteweb=null, $login_email=null, $passwd_email=null, $distinct_benevole=false, $hidden=0 )
{
if ( is_null($this->dbrw) ) return; // "Read Only" mode
......@@ -258,6 +265,7 @@ class asso extends stdentity
$this->passwd_email = $passwd_email;
$this->distinct_benevole = $distinct_benevole;
$this->hidden = $hidden;
$sql = new update ($this->dbrw,
"asso",
......@@ -270,7 +278,8 @@ class asso extends stdentity
"siteweb_asso"=>$this->siteweb,
"login_email"=>$this->login_email,
"passwd_email"=>$this->passwd_email,
"distinct_benevole_asso" => $this->distinct_benevole
"distinct_benevole_asso" => $this->distinct_benevole,
"hidden_asso" => $this->hidden,
),
array ( "id_asso" => $this->id )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment