";
$btn_action = "";
$form_communication=str_replace('!!btn_action!!',$btn_action,$form_communication);
$form_communication=str_replace('!!form_title!!',$msg['demandes_action_com'],$form_communication);
$form_communication=str_replace('!!liste_comm!!',$list,$form_communication);
$form_communication=str_replace('!!action!!','demandes.php?categ=action&sub=com',$form_communication);
print $form_communication;
}
/*
* Liste des RDV planifiés
*/
function show_planning_form(){
global $form_communication, $dbh, $charset, $msg;
$req_dmde = "select id_demande, titre_demande from demandes
join demandes_actions on num_demande=id_demande
join demandes_users du on du.num_demande=id_demande
and type_action=4
and statut_action=1
and num_user='".SESSuserid."' group by id_demande";
$res_dmde=pmb_mysql_query($req_dmde,$dbh);
if(pmb_mysql_num_rows($res_dmde)){
while(($dmde=pmb_mysql_fetch_object($res_dmde))){
$dmde_action = "onclick=document.location='./demandes.php?categ=gestion&act=see_dmde&iddemande=".$dmde->id_demande."'";
$list .= "
";
$btn_action = "";
$form_communication=str_replace('!!btn_action!!',$btn_action,$form_communication);
$form_communication=str_replace('!!form_title!!',$msg['demandes_menu_rdv_planning'],$form_communication);
$form_communication=str_replace('!!liste_comm!!',$list,$form_communication);
$form_communication=str_replace('!!action!!','demandes.php?categ=action&sub=rdv_plan',$form_communication);
print $form_communication;
}
/*
* Formulaire qui gère l'affichage des actions
*/
function show_rdv_val_form(){
global $form_communication, $dbh, $charset, $msg;
$req_dmde = "select id_demande, titre_demande from demandes
join demandes_actions on num_demande=id_demande
join demandes_users du on du.num_demande=id_demande
and type_action=4
and statut_action=2
and num_user='".SESSuserid."' group by id_demande";
$res_dmde=pmb_mysql_query($req_dmde,$dbh);
if(pmb_mysql_num_rows($res_dmde)){
while(($dmde=pmb_mysql_fetch_object($res_dmde))){
$dmde_action = "onclick=document.location='./demandes.php?categ=gestion&act=see_dmde&iddemande=".$dmde->id_demande."'";
$list .= "
";
$btn_action = "";
$form_communication=str_replace('!!btn_action!!',$btn_action,$form_communication);
$form_communication=str_replace('!!form_title!!',$msg['demandes_menu_rdv_a_valide'],$form_communication);
$form_communication=str_replace('!!liste_comm!!',$list,$form_communication);
$form_communication=str_replace('!!action!!','demandes.php?categ=action&sub=rdv_val',$form_communication);
print $form_communication;
}
/*
* Ferme toutes les discussions en cours
*/
function close_fil(){
global $chk, $dbh;
for($i=0;$inom) ? $createur->nom : $createur->username );
}
return "";
}
/*
* fonction qui renvoie un booléen indiquant si une action a été lue ou pas
*/
static function read($action,$side="_opac"){
global $dbh;
$read = false;
$query = "SELECT actions_read".$side." FROM demandes_actions WHERE id_action=".$action->id_action;
$result = pmb_mysql_query($query,$dbh);
if($result){
$tmp = pmb_mysql_result($result,0,0);
if($tmp == 0){
$read = true;
}
}
return $read;
}
/*
* Change l'alerte de l'action : si elle est lue, elle passe en non lue et inversement
*/
static function change_read($action,$side="_opac"){
global $dbh;
$read = demandes_actions::read($action,$side);
$value = "";
if($read){
$value = 1;
} else {
$value = 0;
}
$query = "UPDATE demandes_actions SET actions_read".$side."=".$value." WHERE id_action=".$action->id_action;
if(pmb_mysql_query($query,$dbh)){
return true;
} else {
return false;
}
}
/*
* changement forcé de la mention "lue" ou "pas lue" de l'action
*/
static function action_read($id_action,$booleen=true, $side="_opac"){
global $dbh;
$value = "";
if($booleen){
$value = 0;
} else {
$value = 1;
}
$query = "UPDATE demandes_actions SET actions_read".$side."=".$value." WHERE id_action=".$id_action;
pmb_mysql_query($query,$dbh);
}
/*
* Met à jour les alertes sur l'action et la demande dont dépend la note
*/
static function action_majParentEnfant($id_action,$id_demande,$side="_opac"){
global $dbh;
$ok = false;
if($id_action){
$select = "SELECT actions_read".$side." FROM demandes_actions WHERE id_action=".$id_action;
$result = pmb_mysql_query($select,$dbh);
$read = pmb_mysql_result($result,0,0);
if($read == 1){
if(demandes::demande_read($id_demande,false,$side)){
$ok = true;
}
} else {
// maj notes : si l'action est lue, on met à 0 toutes les notes
$query = "UPDATE demandes_notes SET notes_read".$side." = 0 WHERE num_action=".$id_action;
if(pmb_mysql_query($query,$dbh)){
// maj demande : controle s'il existe des actions non lues pour la demande en cours
$query = "SELECT actions_read".$side." FROM demandes_actions WHERE num_demande=".$id_demande." AND id_action != ".$id_action." AND actions_read".$side."=1";
$result = pmb_mysql_query($query,$dbh);
if(pmb_mysql_num_rows($result)){
$ok = demandes::demande_read($id_demande,false,$side);
} else {
$ok = demandes::demande_read($id_demande,true,$side);
}
}
}
}
return $ok;
}
}
?>