/[openfoncier]/trunk/obj/utils.class.php
ViewVC logotype

Annotation of /trunk/obj/utils.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10968 - (hide annotations)
Wed Dec 15 00:06:28 2021 UTC (3 years, 1 month ago) by softime
File size: 204995 byte(s)
* Fusion de la branche d'intégration 5.4.0-develop dans le trunk

1 mbroquet 3730 <?php
2     /**
3     * Ce fichier est destine a permettre la surcharge de certaines methodes de
4     * la classe om_application pour des besoins specifiques de l'application
5     *
6     * @package openmairie_exemple
7     * @version SVN : $Id: utils.class.php 6132 2016-03-09 09:18:18Z stimezouaght $
8     */
9    
10     /**
11     *
12     */
13 softime 8329 if (file_exists("../dyn/locales.inc.php") === true) {
14     require_once "../dyn/locales.inc.php";
15     }
16 mbroquet 3730
17     /**
18     *
19     */
20 softime 8329 if (file_exists("../dyn/include.inc.php") === true) {
21     require_once "../dyn/include.inc.php";
22     } else {
23     /**
24     * Définition de la constante représentant le chemin d'accès au framework
25     */
26     define("PATH_OPENMAIRIE", getcwd()."/../core/");
27    
28     /**
29 softime 9282 * TCPDF specific config
30     */
31     define('K_TCPDF_EXTERNAL_CONFIG', true);
32     define('K_TCPDF_CALLS_IN_HTML', true);
33    
34     /**
35 softime 8329 * Dépendances PHP du framework
36     * On modifie la valeur de la directive de configuration include_path en
37     * fonction pour y ajouter les chemins vers les librairies dont le framework
38     * dépend.
39     */
40     set_include_path(
41     get_include_path().PATH_SEPARATOR.implode(
42     PATH_SEPARATOR,
43     array(
44 softime 9282 getcwd()."/../php/pear",
45     getcwd()."/../php/db",
46 softime 8329 getcwd()."/../php/fpdf",
47     getcwd()."/../php/phpmailer",
48     getcwd()."/../php/tcpdf",
49     )
50     )
51     );
52 mbroquet 3730
53 softime 8329 /**
54     * Retourne l'URL de la racine d'openADS.
55     * Exemple : http://localhost/openads/
56     */
57     if (!function_exists("get_base_url")) {
58     function get_base_url() {
59     // Récupération du protocole
60     $protocol = 'http';
61     if (isset($_SERVER['HTTPS'])) {
62     $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
63     }
64     // Récupération du domaine
65     $domain = $_SERVER['HTTP_HOST'];
66     // Récupération du port
67     $port = $_SERVER['SERVER_PORT'];
68     $disp_port = ($protocol == 'http' && $port == 80 || $protocol == 'https' && $port == 443) ? '' : ":$port";
69     // Construction du chemin restant
70     $base_url = str_replace('app', '', rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
71     //
72     return $protocol."://".$domain.$disp_port.$base_url;
73     }
74     }
75     define("PATH_BASE_URL", get_base_url());
76     }
77    
78 mbroquet 3730 /**
79     *
80     */
81 softime 8329 if (file_exists("../dyn/debug.inc.php") === true) {
82     require_once "../dyn/debug.inc.php";
83     }
84 mbroquet 3730
85     /**
86     *
87     */
88     (defined("PATH_OPENMAIRIE") ? "" : define("PATH_OPENMAIRIE", ""));
89    
90     /**
91     *
92     */
93     require_once PATH_OPENMAIRIE."om_application.class.php";
94    
95     /**
96     *
97     */
98     class utils extends application {
99    
100 fmichon 4471 /**
101 softime 8329 * Gestion du nom de l'application.
102     *
103     * @var mixed Configuration niveau application.
104     */
105     protected $_application_name = "openADS";
106    
107     /**
108     * Titre HTML.
109     *
110     * @var mixed Configuration niveau application.
111     */
112     protected $html_head_title = ":: openMairie :: openADS";
113    
114     /**
115     * Gestion du nom de la session.
116     *
117     * @var mixed Configuration niveau application.
118     */
119     protected $_session_name = "openads";
120    
121     /**
122 fmichon 4471 * Gestion du favicon de l'application.
123     *
124     * @var mixed Configuration niveau application.
125     */
126     var $html_head_favicon = '../app/img/favicon.ico';
127    
128 softime 8329 /**
129     * Gestion du mode de gestion des permissions.
130     *
131     * @var mixed Configuration niveau application.
132     */
133     protected $config__permission_by_hierarchical_profile = false;
134    
135 mbroquet 3730 // {{{
136    
137     /**
138     * SURCHARGE DE LA CLASSE OM_APPLICATION.
139     *
140     * @see Documentation sur la méthode parent 'om_application:getCollectivite'.
141     */
142     function getCollectivite($om_collectivite_idx = null) {
143     // On vérifie si une valeur a été passée en paramètre ou non.
144     if ($om_collectivite_idx === null) {
145     // Cas d'utilisation n°1 : nous sommes dans le cas où on
146     // veut récupérer les informations de la collectivité de
147     // l'utilisateur et on stocke l'info dans un flag.
148     $is_get_collectivite_from_user = true;
149     // On initialise l'identifiant de la collectivité
150     // à partir de la variable de session de l'utilisateur.
151     $om_collectivite_idx = $_SESSION['collectivite'];
152     } else {
153     // Cas d'utilisation n°2 : nous sommes dans le cas où on
154     // veut récupérer les informations de la collectivité
155     // passée en paramètre et on stocke l'info dans le flag.
156     $is_get_collectivite_from_user = false;
157     }
158     //
159     $collectivite_parameters = parent::getCollectivite($om_collectivite_idx);
160    
161     //// BEGIN - SURCHARGE OPENADS
162    
163     // Ajout du paramétrage du sig pour la collectivité
164     if (file_exists("../dyn/var.inc")) {
165     include "../dyn/var.inc";
166     }
167     if (file_exists("../dyn/sig.inc.php")) {
168     include "../dyn/sig.inc.php";
169     }
170 softime 4760 if (!isset($sig_externe)) {
171     $sig_externe = "sig-default";
172     }
173 mbroquet 3730 $idx_multi = $this->get_idx_collectivite_multi();
174    
175 softime 4749 if (isset($collectivite_parameters['om_collectivite_idx'])
176     && isset($conf[$sig_externe][$collectivite_parameters['om_collectivite_idx']])
177     && isset($conf[$sig_externe]["sig_treatment_mod"])
178     && isset($collectivite_parameters["option_sig"])
179     && $collectivite_parameters["option_sig"] == "sig_externe"
180 mbroquet 3730 ) {
181    
182     // Cas numéro 1 : conf sig définie sur la collectivité et option sig active
183     $collectivite_parameters["sig"] = $conf[$sig_externe][$collectivite_parameters['om_collectivite_idx']];
184 nhaye 4099 $collectivite_parameters["sig"]["sig_treatment_mod"] = $conf[$sig_externe]["sig_treatment_mod"];
185 mbroquet 3730
186 softime 4749 } elseif($idx_multi != ''
187     && isset($conf[$sig_externe][$idx_multi])
188     && isset($conf[$sig_externe]["sig_treatment_mod"])
189     && isset($collectivite_parameters["option_sig"])
190     && $collectivite_parameters["option_sig"] == "sig_externe") {
191 mbroquet 3730 // Cas numéro : conf sig définie sur la collectivité multi et
192     // option_sig activé pour la collectivité mono
193     $collectivite_parameters["sig"] = $conf[$sig_externe][$idx_multi];
194 nhaye 4099 $collectivite_parameters["sig"]["sig_treatment_mod"] = $conf[$sig_externe]["sig_treatment_mod"];
195 mbroquet 3730 }
196    
197     //// END - SURCHARGE OPENADS
198    
199     // Si on se trouve dans le cas d'utilisation n°1
200     if ($is_get_collectivite_from_user === true) {
201     // Alors on stocke dans l'attribut collectivite le tableau de
202     // paramètres pour utilisation depuis la méthode 'getParameter'.
203     $this->collectivite = $collectivite_parameters;
204     }
205     // On retourne le tableau de paramètres.
206     return $collectivite_parameters;
207     }
208    
209     /**
210 softime 10573 * Affiche un bloc d'information.
211     *
212     * @param string $class Classe CSS.
213     * @param string $message Message à afficher.
214     *
215     * @return void
216     */
217     function display_panel_information($class = "", $message = "", $tableau=null, $legend=null, $id_suffixe='') {
218     if (!defined('REST_REQUEST')) {
219     if ($tableau !== null) {
220     $message .= '<fieldset id="fieldset-message-tab_'.$id_suffixe.'" class="cadre ui-corner-all ui-widget-content startClosed collapsed">';
221     $message .= '<legend class="ui-corner-all ui-widget-content ui-state-active">'.$legend.'</legend>';
222     $message .= '<div id="fieldset-message-tab-content" class="fieldsetContent" style="display: none;">';
223     $message .= '<ul>';
224     foreach ($tableau as $value) {
225     $message .= "<li>".$value."</li>";
226     }
227     $message .= '</ul>';
228     $message .= '</div>';
229     $message .= '</fieldset>';
230     }
231     //
232     if ($class == "ok") {
233     $class = "valid";
234     }
235     //
236     echo "\n<div class=\"panel_information ui-widget ui-corner-all ui-state-highlight ui-state-".$class."\">\n";
237     echo "<p>\n";
238     echo "\t<span class=\"ui-icon ui-icon-info\"><!-- --></span> \n\t";
239     echo "<span class=\"text\">";
240     echo $message;
241     echo "</span>";
242     echo "\n</p>\n";
243     echo "</div>\n";
244     }
245     }
246    
247     /**
248 mbroquet 3730 * Retourne l'identifiant de la collectivité multi ou l'identifiant de la
249     * seule collectivité dans le cas d'une installation mono.
250     *
251     * @return integer Identifiant de la collectivité multi.
252     */
253     public function get_idx_collectivite_multi() {
254     // Récupère l'identifiant de la collectivité de niveau 2
255     $sql = "SELECT om_collectivite FROM ".DB_PREFIXE."om_collectivite WHERE niveau = '2'";
256     $idx = $this->db->getOne($sql);
257     $this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE);
258     $this->isDatabaseError($idx);
259    
260     // S'il n'y a pas de collectivité de niveau 2
261     if ($idx == null || $idx == '') {
262    
263     // Compte le nombre de collectivité
264     $sql = "SELECT count(om_collectivite) FROM ".DB_PREFIXE."om_collectivite";
265     $count = $this->db->getOne($sql);
266     $this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE);
267     $this->isDatabaseError($count);
268    
269     // S'il y qu'une collectivité
270     if ($count == 1) {
271    
272     // Récupère l'identifiant de la seule collectivité
273     $sql = "SELECT om_collectivite FROM ".DB_PREFIXE."om_collectivite WHERE niveau = '1'";
274     $idx = $this->db->getOne($sql);
275     $this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE);
276     $this->isDatabaseError($idx);
277     }
278    
279     }
280    
281     // Retourne l'identifiant
282     return $idx;
283     }
284    
285    
286     /**
287     * Retourne l'identifiant de la collectivité de l'element de la table passée
288     * en paramètre.
289     *
290     * @param string $table Table de l'element.
291     * @param mixed $id Identifiant de l'element.
292     *
293     * @return string identifiant de la collectivite ou false si l'element n'existe pas.
294     */
295     public function get_collectivite_of_element($table, $id) {
296 softime 7996 $instance = $this->get_inst__om_dbform(array(
297     "obj" => $table,
298     "idx" => $id,
299     ));
300 mbroquet 3730 if($instance->getVal($instance->clePrimaire) != '') {
301     return $instance->getVal('om_collectivite');
302     }
303     return false;
304     }
305    
306    
307     /**
308 softime 6929 * Retourne vrai si la collectivité passée en paramètre ou la collectivité
309     * de l'utilisateur connecté est mono.
310     *
311     * @param string $id Identifiant de la collectivité.
312     *
313     * @return boolean
314 mbroquet 3730 */
315 softime 6929 public function isCollectiviteMono($id = null) {
316     // Si on ne passe pas de collectivité en argument
317     if ($id == null) {
318     // On vérifie la collectivité stockée en session de l'utilisateur
319     // connecté
320     $res = false;
321     if ($_SESSION['niveau'] === '1') {
322     //
323     $res = true;
324     }
325     //
326     return $res;
327     }
328    
329     // Requête SQL
330 mbroquet 3730 $sql = "SELECT niveau FROM ".DB_PREFIXE."om_collectivite WHERE om_collectivite = ".$id;
331     $niveau = $this->db->getOne($sql);
332     $this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE);
333     $this->isDatabaseError($niveau);
334 softime 6929
335     //
336     if ($niveau === '1') {
337     //
338 mbroquet 3730 return true;
339     }
340 softime 6929 //
341 mbroquet 3730 return false;
342     }
343    
344     // }}}
345    
346     // {{{
347    
348     var $om_utilisateur = array();
349     var $user_is_instr = NULL;
350     var $user_is_service = NULL;
351     var $user_is_admin = NULL;
352     var $user_is_service_ext = NULL;
353     var $user_is_qualificateur = NULL;
354     var $user_is_chef = NULL;
355     var $user_is_divisionnaire = NULL;
356     var $user_is_service_int = NULL;
357    
358     /**
359     * Méthode de récupération des informations de l'utilisateur connecté.
360     */
361     function getUserInfos() {
362    
363     // Si l'utilisateur est loggé $_SESSION existe
364     if(isset($_SESSION['login']) AND !empty($_SESSION['login'])) {
365    
366     // Récupération des infos utilisateur
367     $sqlUser = "SELECT om_utilisateur, nom, email, login, om_collectivite, om_profil ".
368     "FROM ".DB_PREFIXE."om_utilisateur WHERE login = '".$_SESSION['login']."'";
369     $resUser=$this->db->query($sqlUser);
370     $this->addToLog("getUserInfos(): db->query(\"".$sqlUser."\");", VERBOSE_MODE);
371     if ( database::isError($resUser)){
372     die();
373     }
374     $this->om_utilisateur=&$resUser->fetchRow(DB_FETCHMODE_ASSOC);
375    
376     // Récupère le profil et test si c'est un
377     $sqlProfil = "SELECT libelle FROM ".DB_PREFIXE."om_profil WHERE om_profil = ".$this->om_utilisateur['om_profil'];
378     $resProfil=$this->db->getOne($sqlProfil);
379     $this->addToLog("getUserInfos(): db->getOne(\"".$sqlProfil."\");", VERBOSE_MODE);
380     if (database::isError($resProfil)){
381     die();
382     }
383     // Sauvegarde le libelle du profil
384     $this->om_utilisateur["libelle_profil"] = $resProfil;
385    
386     // si c'est un administrateur technique
387     // XXX Mauvaise méthode, il faut utiliser isAccredited
388     if ($resProfil == "ADMINISTRATEUR TECHNIQUE"
389     || $resProfil == "ADMINISTRATEUR FONCTIONNEL") {
390     $this->user_is_admin = true;
391     } else {
392     $this->user_is_admin = false;
393     }
394    
395     //si c'est un service externe
396     if ($resProfil == "SERVICE CONSULTÉ") {
397     $this->user_is_service_ext = true;
398     } else {
399     $this->user_is_service_ext = false;
400     }
401    
402     //si c'est un service interne
403     if ($resProfil == "SERVICE CONSULTÉ INTERNE") {
404     $this->user_is_service_int = true;
405     } else {
406     $this->user_is_service_int = false;
407     }
408    
409     // si c'est un qualificateur
410     if ($resProfil == "QUALIFICATEUR") {
411     $this->user_is_qualificateur = true;
412     } else {
413     $this->user_is_qualificateur = false;
414     }
415    
416     // si c'est un chef de service
417     if ($resProfil == "CHEF DE SERVICE") {
418     $this->user_is_chef = true;
419     } else {
420     $this->user_is_chef = false;
421     }
422    
423     // si c'est un divisionnaire
424     if ($resProfil == "DIVISIONNAIRE") {
425     $this->user_is_divisionnaire = true;
426     } else {
427     $this->user_is_divisionnaire = false;
428     }
429    
430     // Récupération des infos instructeur
431     $sqlInstr = "SELECT instructeur.instructeur, instructeur.nom, instructeur.telephone,
432     division.division, division.code, division.libelle ".
433     "FROM ".DB_PREFIXE."instructeur INNER JOIN ".DB_PREFIXE."division ON division.division=instructeur.division ".
434     "WHERE instructeur.om_utilisateur = ".$this->om_utilisateur['om_utilisateur'];
435     $resInstr=$this->db->query($sqlInstr);
436     $this->addToLog("getUserInfos(): db->query(\"".$sqlInstr."\");", VERBOSE_MODE);
437     if ( database::isError($resInstr)){
438     die();
439     }
440     $tempInstr=&$resInstr->fetchRow(DB_FETCHMODE_ASSOC);
441     // Si il y a un resultat c'est un instructeur
442 softime 9245 if (is_array($tempInstr) === true && count($tempInstr) > 0) {
443 mbroquet 3730 $this->user_is_instr=true;
444     $this->om_utilisateur = array_merge($this->om_utilisateur,$tempInstr);
445     } else {
446     $this->user_is_instr=false;
447     }
448    
449     // Récupération des infos de services consultés
450     $sqlServ = "SELECT service.service, service.abrege, service.libelle ".
451     "FROM ".DB_PREFIXE."service ".
452     "INNER JOIN ".DB_PREFIXE."lien_service_om_utilisateur ON lien_service_om_utilisateur.service=service.service ".
453     "WHERE lien_service_om_utilisateur.om_utilisateur = ".$this->om_utilisateur['om_utilisateur'];
454     $resServ=$this->db->query($sqlServ);
455     $this->addToLog("getUserInfos(): db->query(\"".$sqlServ."\");", VERBOSE_MODE);
456     if ( database::isError($resServ)){
457     die();
458     }
459    
460     while ($tempServ=&$resServ->fetchRow(DB_FETCHMODE_ASSOC)) {
461     $this->om_utilisateur['service'][]=$tempServ;
462     }
463     // Si il y a un resultat c'est un utilisateur de service
464     if(isset($this->om_utilisateur['service'])) {
465     $this->user_is_service=true;
466     } else {
467     $this->user_is_service=false;
468     }
469     }
470     }
471    
472     /**
473     * getter user_is_service
474     */
475     function isUserService() {
476     //
477     if (is_null($this->user_is_service)) {
478     //
479     $this->getUserInfos();
480     }
481     //
482     return $this->user_is_service;
483     }
484    
485     /**
486     * getter user_is_instr
487     */
488     function isUserInstructeur() {
489     //
490     if (is_null($this->user_is_instr)) {
491     //
492     $this->getUserInfos();
493     }
494     //
495     return $this->user_is_instr;
496     }
497    
498     function isUserAdministrateur() {
499     //
500     if (is_null($this->user_is_admin)) {
501     //
502     $this->getUserInfos();
503     }
504     //
505     return $this->user_is_admin;
506     }
507    
508     /**
509     * getter user_is_service_ext
510     */
511     function isUserServiceExt() {
512     //
513     if (is_null($this->user_is_service_ext)) {
514     //
515     $this->getUserInfos();
516     }
517     //
518     return $this->user_is_service_ext;
519     }
520    
521     /**
522     * getter user_is_service_int
523     */
524     function isUserServiceInt() {
525     //
526     if (is_null($this->user_is_service_int)) {
527     //
528     $this->getUserInfos();
529     }
530     //
531     return $this->user_is_service_int;
532     }
533    
534     /**
535     * getter user_is_qualificateur
536     */
537     function isUserQualificateur() {
538     //
539     if (is_null($this->user_is_qualificateur)) {
540     //
541     $this->getUserInfos();
542     }
543     //
544     return $this->user_is_qualificateur;
545     }
546    
547     /**
548     * getter user_is_chef
549     */
550     function isUserChef() {
551     //
552     if (is_null($this->user_is_chef)) {
553     //
554     $this->getUserInfos();
555     }
556     //
557     return $this->user_is_chef;
558     }
559    
560     /**
561     * getter user_is_divisionnaire
562     */
563     function isUserDivisionnaire() {
564     //
565     if (is_null($this->user_is_divisionnaire)) {
566     //
567     $this->getUserInfos();
568     }
569     //
570     return $this->user_is_divisionnaire;
571     }
572    
573     /**
574     * Méthode permettant de définir si l'utilisateur connecté peut ajouter un
575     * événement d'instruction
576     *
577     * @param integer $idx identifiant du dossier
578     * @param string $obj objet
579     *
580     * @return boolean true si il peut false sinon
581     */
582     function isUserCanAddObj($idx, $obj) {
583     // Si il à le droit "bypass" il peut ajouter
584     if($this->isAccredited($obj."_ajouter_bypass") === true) {
585     return true;
586     }
587     if($this->isAccredited(array($obj."_ajouter", $obj), "OR") === false) {
588     return false;
589     }
590 softime 6565 $return = false;
591    
592 softime 7996 $object_instance = $this->get_inst__om_dbform(array(
593     "obj" => $obj,
594     "idx" => "]",
595     ));
596 mbroquet 3730 // Si il n'est pas dans la même division on défini le retour comme faux
597     // à moins qu'il ai un droit de changement de decision
598 softime 6565 if($this->isUserInstructeur() === true &&
599     ($object_instance->getDivisionFromDossier($idx) == $_SESSION["division"] or
600     ($obj == "instruction" &&
601     $object_instance->isInstrCanChangeDecision($idx) === true))) {
602 mbroquet 3730
603 softime 6565 $return = true;
604 mbroquet 3730 }
605    
606     return $return;
607     }
608    
609 softime 6565
610 mbroquet 3730 /**
611 softime 6565 * Ajout de variables de session contenant la division pour permettre une
612     * utilisation plus efficace dans les requetes.
613 mbroquet 3730 *
614 softime 6565 * @param array $utilisateur Tableau d'informations de l'utilisateur.
615 mbroquet 3730 */
616 softime 6929 function triggerAfterLogin($utilisateur = NULL) {
617 softime 6565 // Récupération de la division de l'utilisateur.
618 mbroquet 3730 $sql = "SELECT instructeur.division, division.code
619 softime 6565 FROM ".DB_PREFIXE."instructeur
620     LEFT JOIN ".DB_PREFIXE."division
621     ON instructeur.division = division.division
622     WHERE instructeur.om_utilisateur='".$utilisateur["om_utilisateur"]."'";
623 mbroquet 3730 $res = $this->db->query($sql);
624 softime 6565 $this->addToLog(
625 softime 8989 __METHOD__."(): db->query(\"".$sql."\");",
626 softime 6565 VERBOSE_MODE
627     );
628     if (database::isError($res)) {
629 mbroquet 3730 die();
630     }
631     $row = $res->fetchrow(DB_FETCHMODE_ASSOC);
632 softime 6565 // Enregistrement de la division en session
633 mbroquet 3730 if (isset($row["division"]) && $row["division"] != NULL) {
634     $_SESSION["division"] = $row["division"];
635     $_SESSION["division_code"] = $row["code"];
636     } else {
637     $_SESSION["division"] = "0";
638     $_SESSION["division_code"] = "";
639     }
640 softime 6565 // Récupération du paramétrage des groupes de l'utilisateur.
641     $sqlGroupes = "SELECT groupe.code, lien_om_utilisateur_groupe.confidentiel, lien_om_utilisateur_groupe.enregistrement_demande, groupe.libelle
642     FROM ".DB_PREFIXE."groupe
643     RIGHT JOIN ".DB_PREFIXE."lien_om_utilisateur_groupe ON
644     lien_om_utilisateur_groupe.groupe = groupe.groupe
645 softime 6674 WHERE lien_om_utilisateur_groupe.login = '".$utilisateur["login"] ."'
646 softime 6565 ORDER BY libelle";
647     $resGroupes = $this->db->query($sqlGroupes);
648     $this->addToLog(
649 softime 8989 __METHOD__."(): db->query(\"".$sqlGroupes."\");",
650 softime 6565 VERBOSE_MODE
651     );
652     if (database::isError($resGroupes)) {
653     die();
654     }
655     // Si aucun résultat alors récupération du paramétrage des groupes du profil
656     if ($resGroupes->numRows() === 0) {
657     $sqlGroupes = "SELECT groupe.code, lien_om_profil_groupe.confidentiel, lien_om_profil_groupe.enregistrement_demande, groupe.libelle
658     FROM ".DB_PREFIXE."groupe
659     RIGHT JOIN ".DB_PREFIXE."lien_om_profil_groupe ON
660     lien_om_profil_groupe.groupe = groupe.groupe
661     AND om_profil = ".$utilisateur["om_profil"] ."
662     ORDER BY libelle";
663     $resGroupes = $this->db->query($sqlGroupes);
664     $this->addToLog(
665 softime 8989 __METHOD__."(): db->query(\"".$sqlGroupes."\");",
666 softime 6565 VERBOSE_MODE
667     );
668     if (database::isError($resGroupes)) {
669     die();
670     }
671     }
672     $_SESSION["groupe"] = array();
673     // Enregistrement des groupe en session
674     while ($row = $resGroupes->fetchrow(DB_FETCHMODE_ASSOC)) {
675     if ($row["confidentiel"] === 't') {
676     $row["confidentiel"] = true;
677     } else {
678     $row["confidentiel"] = false;
679     }
680     if ($row["enregistrement_demande"] === 't') {
681     $row["enregistrement_demande"] = true;
682     } else {
683     $row["enregistrement_demande"] = false;
684     }
685     $_SESSION["groupe"][$row["code"]] = array(
686     "confidentiel" => $row["confidentiel"],
687     "enregistrement_demande" => $row["enregistrement_demande"],
688     "libelle" => $row["libelle"],
689     );
690     }
691     }
692 mbroquet 3730
693     // Affichage des actions supplémentaires
694     function displayActionExtras() {
695     // Affichage de la division si l'utilisateur en possède une
696     if ($_SESSION["division"] != 0) {
697     echo "\t\t\t<li class=\"action-division\">";
698     echo "(".$_SESSION['division_code'].")";
699     echo "</li>\n";
700     }
701     }
702    
703     // }}}
704    
705    
706     // {{{ GESTION DES FICHIERS
707    
708     /**
709     *
710     */
711     function notExistsError ($explanation = NULL) {
712     // message
713     $message_class = "error";
714     $message = _("Cette page n'existe pas.");
715     $this->addToMessage ($message_class, $message);
716     //
717     $this->setFlag(NULL);
718     $this->display();
719    
720     //
721     die();
722     }
723    
724     // }}}
725     /**
726     * Retourne le statut du dossier d'instruction
727     * @param string $idx Identifiant du dossier d'instruction
728     * @return string Le statut du dossier d'instruction
729     */
730     function getStatutDossier($idx){
731    
732     $statut = '';
733    
734     //Si l'identifiant du dossier d'instruction fourni est correct
735     if ( $idx != '' ){
736    
737     //On récupère le statut de l'état du dossier à partir de l'identifiant du
738     //dossier d'instruction
739     $sql = "SELECT etat.statut
740     FROM ".DB_PREFIXE."dossier
741     LEFT JOIN
742     ".DB_PREFIXE."etat
743     ON
744     dossier.etat = etat.etat
745     WHERE dossier ='".$idx."'";
746     $statut = $this->db->getOne($sql);
747     $this->addToLog("getStatutDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE);
748     if ( database::isError($statut)){
749     die();
750     }
751     }
752     return $statut;
753     }
754    
755     /**
756     * Formate le champ pour le type Timestamp
757 softime 8989 * @param date $date_str Date
758     * @param boolean $show Format pour l'affichage
759     * @return mixed False si le traitement échoue ou la date formatée
760 mbroquet 3730 */
761     function formatTimestamp ($date_str, $show = true) {
762    
763     // Sépare la date et l'heure
764     $date = explode(" ", $date_str);
765     if (count($date) != 2) {
766     return false;
767     }
768    
769     // Date en BDD
770     $date_db = explode ('-', $date[0]);
771 softime 8989 // Date en affichage
772 mbroquet 3730 $date_show = explode ('/', $date[0]);
773    
774     // Contrôle la composition de la date
775     if (count ($date_db) != 3 and count ($date_show) != 3) {
776     return false;
777     }
778    
779     if (count ($date_db) == 3) {
780     // Vérifie que c'est une date valide
781     if (!checkdate($date_db[1], $date_db[2], $date_db[0])) {
782     return false;
783     }
784     // Si c'est pour l'affichage de la date
785     if ($show == true) {
786     return $date_db [2]."/".$date_db [1]."/".$date_db [0]." ".$date[1];
787     } else {
788     return $date[0];
789     }
790     }
791    
792     //
793     if (count ($date_show) == 3) {
794     // Vérifie que c'est une date valide
795     if (!checkdate($date_show[1], $date_show[0], $date_show[2])) {
796     return false;
797     }
798     // Si c'est pour l'affichage de la date
799     if ($show == true) {
800     return $date[0];
801     } else {
802     return $date_show [2]."-".$date_show [1]."-".$date_show [0]." ".$date[1];
803     }
804    
805     }
806     return false;
807    
808     }
809    
810     /**
811     * Permet de calculer la liste des parcelles à partir de la chaîne passée en paramètre
812     * et la retourner sous forme d'un tableau associatif
813     *
814     * @param string $strParcelles Chaîne de la parcelles.
815     * @param string $collectivite_idx Collectivite de la parcelle.
816     *
817     * @return array (array(prefixe, quartier, section, parcelle), ...)
818     */
819     function parseParcelles($strParcelles, $collectivite_idx = null) {
820    
821     // Séparation des lignes
822     $references = explode(";", $strParcelles);
823     $liste_parcelles = array();
824    
825     // On boucle sur chaque ligne pour ajouter la liste des parcelles de chaque ligne
826     foreach ($references as $parcelles) {
827 softime 10573 // Si le contenu de la parcelle est vide on passe à la suite
828     if ($parcelles == ""){
829     break;
830     }
831 mbroquet 3730 // Tableau des champs de la ligne de références cadastrales
832     $reference_tab = array();
833 softime 10573 // On récupère le quartier
834     preg_match('/^[0-9]{3}/', $parcelles, $matches);
835     if (empty($matches) === false) {
836     $reference_tab[] = $matches[0];
837 mbroquet 3730 }
838 softime 10573
839     // Le dernier chiffre de la parcelle est soit au caractère 9 soit au caractère 8
840     // Ceci nous permet de savoir si il y a une ou deux lettres dans la section
841     if (substr($parcelles, 8, 1) == ''
842     || substr($parcelles, 8, 1) == "A"
843     || substr($parcelles, 8, 1) == "/" ) {
844     //
845     $only_one_letter = true;
846     $regex_for_section = '/^[a-zA-Z]{1}/';
847    
848     } else if ( preg_match('/^[0-9]+$/', substr($parcelles, 8, 1)) == 1 ) {
849     $only_one_letter = false;
850     $regex_for_section = '/^[0-9a-zA-Z]{2}/';
851     }
852    
853     // On récupère la section
854     preg_match($regex_for_section, substr($parcelles, 3), $matches);
855     if (empty($matches) === false) {
856     $reference_tab[] = $matches[0];
857     }
858    
859     // On récupère la parcelle
860     preg_match('/^[0-9]{4}/', substr($parcelles, $only_one_letter === true ? 4 : 5 ), $matches);
861     if (empty($matches) === false) {
862     $reference_tab[] = $matches[0];
863     }
864    
865     // On vérifie que la référence cadastrale possède au moins un séparateur
866     if ( substr($parcelles, $only_one_letter === true ? 8 : 9 ) !== false ) {
867     // Initialisation du tableau qui va contenir les séparateurs et les parcelles non triés
868     $sep_parc_tab = array();
869    
870     // On récupère les séparateurs et les parcelles dans un tableau
871     $sep_parc_tab = preg_split('/(A)|(\/)/', substr($parcelles, $only_one_letter === true ? 8 : 9 ), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
872    
873     // Si le tableau est rempli on boucle sur les séparateurs + parcelles pour les ajouter dans le tableau
874     if ( empty($sep_parc_tab) === false ) {
875     foreach ($sep_parc_tab as $value) {
876     $reference_tab[] = $value;
877     }
878     }
879     }
880    
881 mbroquet 3730 // Calcul des parcelles
882     $quartier = $reference_tab[0];
883     $sect = $reference_tab[1];
884    
885     $ancien_ref_parc = "";
886     for ($i=2; $i < count($reference_tab); $i+=2) {
887     if($collectivite_idx != null) {
888     // Récupération du code impot de l'arrondissement
889     $collectivite = $this->getCollectivite($collectivite_idx);
890     $parc["prefixe"] = $this->get_arrondissement_code_impot($quartier);
891     }
892     $parc["quartier"] = $quartier;
893     // Met en majuscule si besoin
894     $parc["section"] = strtoupper($sect);
895     if( $ancien_ref_parc == "" OR $reference_tab[$i-1] == "/") {
896     // 1ere parcelle ou parcelle individuelle
897     // Compléte par des "0" le début de la chaîne si besoin
898     $parc["parcelle"] = str_pad($reference_tab[$i], 4, "0", STR_PAD_LEFT);
899     // Ajout d'une parcelle à la liste
900     $liste_parcelles[] = $parc;
901     } elseif ($reference_tab[$i-1] == "A") {
902     // Interval de parcelles
903     for ($j=$ancien_ref_parc+1; $j <= $reference_tab[$i]; $j++) {
904     // Compléte par des "0" le début de la chaîne si besoin
905     $parc["parcelle"] = str_pad($j, 4, "0", STR_PAD_LEFT);
906     // Ajout d'une parcelle à la liste
907     $liste_parcelles[] = $parc;
908     }
909     }
910     //Gestion des erreurs
911     else{
912    
913     echo _("Une erreur de formattage a ete detecte dans la reference cadastrale du dossier ").$this->row['dossier'];
914     }
915     // Sauvegarde de la référence courante de parcelle
916     $ancien_ref_parc = $reference_tab[$i];
917     }
918     }
919    
920     return $liste_parcelles;
921     }
922    
923    
924     /**
925     * Récupère le code impôt par rapport au quartier.
926     *
927     * @param string $quartier Numéro de quartier.
928     * @return string Code impôts.
929     */
930     protected function get_arrondissement_code_impot($quartier) {
931     // Initialisation
932     $code_impots = "";
933     // Si le quartier fournis est correct
934     if ($quartier != "") {
935     // Requête SQL
936     $sql = "SELECT
937     arrondissement.code_impots
938     FROM
939     ".DB_PREFIXE."arrondissement
940     LEFT JOIN
941     ".DB_PREFIXE."quartier
942     ON
943     quartier.arrondissement = arrondissement.arrondissement
944     WHERE
945     quartier.code_impots = '".$quartier."'";
946    
947     }
948     $code_impots = $this->db->getOne($sql);
949     if ($code_impots === null) {
950     $code_impots = "";
951     }
952     $this->isDatabaseError($code_impots);
953     // Retour
954     return $code_impots;
955     }
956    
957    
958     /**
959     * Formate les parcelles en ajoutant le code impôt
960     * @param array $liste_parcelles Tableau des parcelles
961     * @return string Liste des parcelles formatées
962     */
963     function formatParcelleToSend($liste_parcelles) {
964    
965     //
966     $wParcelle = array();
967    
968     //Formatage des références cadastrales pour l'envoi
969     foreach ($liste_parcelles as $value) {
970    
971     // On ajoute les données dans le tableau que si quartier + section + parcelle
972     // a été fourni
973     if ($value["quartier"] !== ""
974     && $value["section"] !== ""
975     && $value["parcelle"] !== ""){
976    
977     //On récupère le code impôt de l'arrondissement
978     $arrondissement = $this->getCodeImpotByQuartier($value["quartier"]);
979    
980     //On ajoute la parcelle, si un arrondissement a été trouvé
981     if ($arrondissement!=="") {
982     //
983     $wParcelle[] = $arrondissement.$value["quartier"].
984     str_pad($value["section"], 2, " ", STR_PAD_LEFT).
985     $value["parcelle"];
986     }
987     }
988     }
989    
990     //
991     return $wParcelle;
992     }
993    
994     /**
995     * Récupère le code impôt par rapport au quartier
996     * @param string $quartier Numéro de quartier
997     * @return string Code impôt
998     */
999     function getCodeImpotByQuartier($quartier) {
1000    
1001     $arrondissement = "";
1002    
1003     // Si le quartier fournis est correct
1004     if ($quartier != "") {
1005    
1006     // Requête SQL
1007     $sql = "SELECT
1008     arrondissement.code_impots
1009     FROM
1010     ".DB_PREFIXE."arrondissement
1011     LEFT JOIN
1012     ".DB_PREFIXE."quartier
1013     ON
1014     quartier.arrondissement = arrondissement.arrondissement
1015     WHERE
1016     quartier.code_impots = '".$quartier."'";
1017     $this->addToLog("getCodeImpotByQuartier() : db->getOne(\"".$sql."\")", VERBOSE_MODE);
1018     $arrondissement = $this->db->getOne($sql);
1019     $this->isDatabaseError($arrondissement);
1020     }
1021    
1022     // Retour
1023     return $arrondissement;
1024     }
1025    
1026    
1027     /**
1028     * Retourne true si tous les paramètres du SIG externe ont bien été définis
1029     * @return bool true/false
1030     */
1031     public function issetSIGParameter($idx) {
1032     $collectivite_idx = $this->get_collectivite_of_element("dossier", $idx);
1033     $collectivite = $this->getCollectivite($collectivite_idx);
1034     if(isset($collectivite["sig"])) {
1035     return true;
1036     } else {
1037     return false;
1038     }
1039     }
1040    
1041     /**
1042     * Permet de vérifier que des champs existe dans une table
1043     * @param array $list_fields Liste des champs à tester
1044     * @param string $table Table où les champs doivent exister
1045     * @return mixed Retourne les champs qui n'existent pas
1046     * ou true
1047     */
1048     public function check_field_exist($list_fields, $table) {
1049    
1050     // Instance de la classe en paramètre
1051 softime 7996 $object = $this->get_inst__om_dbform(array(
1052     "obj" => $table,
1053     "idx" => "]",
1054     ));
1055 mbroquet 3730
1056     // Récupère les champs de la table
1057     foreach ($object->champs as $champ) {
1058     $list_column[] = $champ;
1059     }
1060    
1061     // Tableau des champs en erreur
1062     $error_fields = array();
1063    
1064     // Pour chaque champ à tester
1065     foreach ($list_fields as $value) {
1066    
1067     // S'il n'apparaît pas dans la liste des champs possible
1068     if (!in_array($value, $list_column)) {
1069    
1070     // Alors le champ est ajouté au tableau des erreurs
1071     $error_fields[] = $value;
1072     }
1073     }
1074    
1075     // Si le tableau des erreurs n'est pas vide on le retourne
1076     if (count($error_fields) > 0) {
1077     return $error_fields;
1078     }
1079    
1080     // Sinon on retourne le booléen true
1081     return true;
1082    
1083     }
1084    
1085     /*
1086     *
1087     */
1088     /**
1089     * Récupère la lettre type lié à un événement
1090     * @param integer $evenement L'identifiant de l'événement
1091     * @return integer Retourne l'idenfiant de la lettre-type ou true
1092     */
1093     function getLettreType($evenement){
1094    
1095     $lettretype = NULL;
1096    
1097     $sql =
1098     "SELECT
1099     lettretype
1100     FROM
1101     ".DB_PREFIXE."evenement
1102     WHERE
1103     evenement = $evenement";
1104    
1105     $this->addToLog("getLettreType() : db->query(\"".$sql."\")", VERBOSE_MODE);
1106     $res = $this->db->query($sql);
1107     if ( database::isError($res)){
1108     die();
1109     }
1110    
1111     if ( $res->numrows() > 0 ){
1112    
1113     $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
1114     $lettretype = $row['lettretype'];
1115     }
1116    
1117     return $lettretype;
1118     }
1119    
1120     /**
1121     * Retourne le type de dossier d'autorisation du dossier courant :
1122     * @param $idxDossier Le numéro du dossier d'instruction
1123     * @return le code du type détaillée de dossier d'autorisation
1124     **/
1125     function getDATDCode($idxDossier) {
1126     $sql = "SELECT dossier_autorisation_type_detaille.code
1127     FROM ".DB_PREFIXE."dossier_autorisation_type_detaille
1128     INNER JOIN ".DB_PREFIXE."dossier_autorisation
1129     ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille =
1130     dossier_autorisation.dossier_autorisation_type_detaille
1131     INNER JOIN ".DB_PREFIXE."dossier ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation
1132     WHERE dossier.dossier = '".$idxDossier."'";
1133     $res = $this->db->getOne($sql);
1134     $this->addToLog("getDATDCode() : db->getOne(\"".$sql."\")", VERBOSE_MODE);
1135     if ( database::isError($res)){
1136     die();
1137     }
1138     return $res;
1139     }
1140    
1141     /**
1142 fmichon 4708 * Retourne le type de dossier d'autorisation du dossier courant :
1143     * @param $idxDossier Le numéro du dossier d'instruction
1144     * @return le code du type de dossier d'autorisation
1145     **/
1146     function getDATCode($idxDossier) {
1147     $sql = "
1148     SELECT
1149     dossier_autorisation_type.code
1150     FROM
1151     ".DB_PREFIXE."dossier_autorisation_type
1152     INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille
1153     ON dossier_autorisation_type.dossier_autorisation_type=dossier_autorisation_type_detaille.dossier_autorisation_type
1154     INNER JOIN ".DB_PREFIXE."dossier_autorisation
1155     ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille=dossier_autorisation.dossier_autorisation_type_detaille
1156     INNER JOIN ".DB_PREFIXE."dossier
1157     ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation
1158     WHERE
1159     dossier.dossier = '".$idxDossier."'
1160     ";
1161     $res = $this->db->getOne($sql);
1162     $this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE);
1163     if ( database::isError($res)){
1164     die();
1165     }
1166     return $res;
1167     }
1168    
1169     /**
1170 mbroquet 3730 * Permet de copier un enregistrement
1171     * @param mixed $idx Identifiant de l'enregistrment
1172     * @param string $obj Objet de l'enregistrment
1173     * @param string $objsf Objets associés
1174     * @return array Tableau des nouveaux id et du message
1175     */
1176     function copier($idx, $obj, $objsf) {
1177    
1178     // Tableau de résultat
1179     $resArray = array();
1180     // Message retourné à l'utilisateur
1181     $message = "";
1182     // Type du message (valid ou error)
1183     $message_type = "valid";
1184    
1185     // Requête SQL permettant de récupérer les informations sur l'objet métier
1186     $sql = "SELECT *
1187     FROM ".DB_PREFIXE.$obj."
1188     WHERE ".$obj." = ".$idx;
1189     $res = $this->db->query($sql);
1190     $this->isDatabaseError($res);
1191    
1192     // Valeurs clonées
1193     $valF = array();
1194     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
1195     // Recupère la valeur
1196     $valF = $row;
1197     }
1198    
1199     // Valeurs non clonées
1200     // Identifiant modifié pour que ça soit un ajout
1201     $valF[$obj] = "]";
1202     // Instance de l'objet métier
1203 softime 7996 $clone_obj = $this->get_inst__om_dbform(array(
1204     "obj" => $obj,
1205     "idx" => "]",
1206     ));
1207 mbroquet 3730 // Si dans l'objet métier la fonction "copier" existe
1208     if (method_exists($clone_obj, "update_for_copy")) {
1209     // Traitement sur les valeurs du duplicata
1210     $valF = $clone_obj->update_for_copy($valF, $objsf, DEBUG);
1211     // Recupère les messages retourné par la fonction
1212     $message .= $valF['message'];
1213     // Supprime les messages de la liste des valeurs
1214     unset($valF['message']);
1215     }
1216     // Ajoute le duplicata
1217 softime 8989 $clone_obj->ajouter($valF);
1218 mbroquet 3730 // Si aucune erreur se produit dans la classe instanciée
1219     if ($clone_obj->correct === true) {
1220     // Récupère l'identifiant de l'objet créé
1221     $clone_obj_id = $clone_obj->valF[$obj];
1222    
1223     // Message
1224     $message .= sprintf(_("La copie de l'enregistrement %s avec l'identifiant %s s'est effectuee avec succes"), "<span class='bold'>"._($obj)."</span>", "<span class='bold'>".$idx."</span>")."<br />";
1225 softime 7996 $message .= sprintf(
1226     '<a class="om-prev-icon" id="action-link--copy-of-%s-%s" href="%s">%s</a><br/><br/>',
1227     $obj,
1228     $idx,
1229     sprintf(
1230     '%s&obj=%s&action=3&idx=%s',
1231     OM_ROUTE_FORM,
1232     $obj,
1233     $clone_obj_id
1234     ),
1235     ("Cliquer ici pour accéder à la copie")
1236     );
1237 mbroquet 3730 // Ajout de l'identifant au tableau des résultat
1238     $resArray[$obj.'_'.$idx] = $clone_obj_id;
1239    
1240     // S'il y a au moins un objet metier associé
1241     if ($objsf != "") {
1242     // Liste des objet métier associés
1243     $list_objsf = explode(",", $objsf);
1244     // Pour chaque objet associé
1245     foreach ($list_objsf as $key => $objsf) {
1246     // Requête SQL permettant de récupérer les informations sur
1247     // l'objet métier associé
1248     $sql = "SELECT *
1249     FROM ".DB_PREFIXE.$objsf."
1250     WHERE ".$obj." = ".$idx;
1251     $res = $this->db->query($sql);
1252     $this->isDatabaseError($res);
1253    
1254     // Pour chaque élément associé
1255     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
1256     // Identifiant de l'objet associé à copier
1257     $idxsf = $row[$objsf];
1258    
1259     // Valeurs clonées
1260     $valF = $row;
1261     // Valeurs non clonées
1262     $valF[$obj] = $clone_obj_id;
1263     // Identifiant modifié pour que ça soit un ajout
1264     $valF[$objsf] = "]";
1265     // Instance de l'objet métier associé
1266 softime 7996 $clone_objsf = $this->get_inst__om_dbform(array(
1267     "obj" => $objsf,
1268     "idx" => "]",
1269     ));
1270 mbroquet 3730 // Si dans l'objet métier associé
1271     // la fonction "copier" existe
1272     if (method_exists($clone_objsf, "update_for_copy")) {
1273     // Traitement sur les valeurs du duplicata
1274     $valF = $clone_objsf->update_for_copy($valF, $objsf, DEBUG);
1275     // Recupère les messages retourné par la fonction
1276     $message .= $valF['message'];
1277     // Supprime les messages de la liste des valeurs
1278     unset($valF['message']);
1279     }
1280     // Ajoute le duplicata
1281 softime 8989 $clone_objsf->ajouter($valF);
1282 mbroquet 3730 // Si aucune erreur se produit dans la classe instanciée
1283     if ($clone_objsf->correct === true) {
1284     // Récupère l'identifiant de l'objet créé
1285     $clone_objsf_id = $clone_objsf->valF[$objsf];
1286    
1287     // Message
1288 softime 7996 $message .= sprintf(
1289     _("La copie de l'enregistrement %s avec l'identifiant %s s'est effectuee avec succes"),
1290     "<span class='bold'>"._($objsf)."</span>",
1291     "<span class='bold'>".$idxsf."</span>"
1292     )."<br />";
1293 mbroquet 3730
1294     // Ajout de l'identifant au tableau des résultat
1295     $resArray[$objsf.'_'.$row[$objsf]] = $clone_objsf_id;
1296     } else {
1297    
1298     // Message d'erreur récupéré depuis la classe
1299     $message .= $clone_objsf->msg;
1300     // Type du message
1301     $message_type = "error";
1302     }
1303     }
1304     }
1305     }
1306     //
1307     } else {
1308    
1309     // Message d'erreur récupéré depuis la classe
1310     $message .= $clone_obj->msg;
1311     // Type du message
1312     $message_type = "error";
1313     }
1314    
1315     // Ajout du message au tableau des résultats
1316     $resArray['message'] = $message;
1317     // Ajout du type de message au tableau des résultats
1318     $resArray['message_type'] = $message_type;
1319    
1320     // Retourne le tableau des résultats
1321     return $resArray;
1322     }
1323    
1324     /**
1325     * Cette fonction prend en entrée le ou les paramètres du &contrainte qui sont entre
1326     * parenthèses (un ensemble de paramètres séparés par des points-virgules). Elle
1327     * sépare les paramètres et leurs valeurs puis construit et retourne un tableau
1328     * associatif qui contient pour les groupes et sous-groupes :
1329     * - un tableau de valeurs, avec un nom de groupe ou sous-groupe par ligne
1330     * pour les autres options :
1331     * - la valeur de l'option
1332     *
1333     * @param string $contraintes_param Chaîne contenant tous les paramètres
1334     *
1335     * @return array Tableau associatif avec paramètres et valeurs séparés
1336     */
1337     function explodeConditionContrainte($contraintes_param) {
1338    
1339     // Initialisation des variables
1340     $return = array();
1341     $listGroupes = "";
1342     $listSousgroupes = "";
1343     $service_consulte = "";
1344     $affichage_sans_arborescence = "";
1345    
1346     // Sépare toutes les conditions avec leurs valeurs et les met dans un tableau
1347     $contraintes_params = explode(";", $contraintes_param);
1348    
1349     // Pour chaque paramètre de &contraintes
1350     foreach ($contraintes_params as $value) {
1351     // Récupère le mot-clé "liste_groupe" et les valeurs du paramètre
1352     if (strstr($value, "liste_groupe=")) {
1353     // On enlève le mots-clé "liste_groupe=", on garde les valeurs
1354     $listGroupes = str_replace("liste_groupe=", "", $value);
1355     }
1356     // Récupère le mot-clé "liste_ssgroupe" et les valeurs du paramètre
1357     if (strstr($value, "liste_ssgroupe=")) {
1358     // On enlève le mots-clé "liste_ssgroupe=", on garde les valeurs
1359     $listSousgroupes = str_replace("liste_ssgroupe=", "", $value);
1360     }
1361     // Récupère le mot-clé "service_consulte" et la valeur du paramètre
1362     if (strstr($value, "service_consulte=")) {
1363     // On enlève le mots-clé "service_consulte=", on garde sa valeur
1364     $service_consulte = str_replace("service_consulte=", "", $value);
1365     }
1366     // Récupère le mot-clé "affichage_sans_arborescence" et la valeur du
1367     // paramètre
1368     if (strstr($value, "affichage_sans_arborescence=")) {
1369     // On enlève le mots-clé "affichage_sans_arborescence=", on garde la valeur
1370     $affichage_sans_arborescence = str_replace("affichage_sans_arborescence=", "", $value);
1371     }
1372     }
1373    
1374     // Récupère dans des tableaux la liste des groupes et sous-groupes qui
1375     // doivent être utilisés lors du traitement de la condition
1376     if ($listGroupes != "") {
1377     $listGroupes = array_map('trim', explode(",", $listGroupes));
1378     }
1379     if ($listSousgroupes != "") {
1380     $listSousgroupes = array_map('trim', explode(",", $listSousgroupes));
1381     }
1382    
1383     // Tableau à retourner
1384     $return['groupes'] = $listGroupes;
1385     $return['sousgroupes'] = $listSousgroupes;
1386     $return['service_consulte'] = $service_consulte;
1387     $return['affichage_sans_arborescence'] = $affichage_sans_arborescence;
1388     return $return;
1389     }
1390    
1391     /**
1392     * Méthode qui complète la clause WHERE de la requête SQL de récupération des
1393     * contraintes, selon les paramètres fournis. Elle permet d'ajouter une condition sur
1394     * les groupes, sous-groupes et les services consultés.
1395     *
1396     * @param $string $part Contient tous les paramètres fournis à &contraintes séparés
1397     * par des points-virgules, tel que définis dans l'état.
1398     * array[] $conditions Paramètre optionnel, contient les conditions déjà explosées
1399     * par la fonction explodeConditionContrainte()
1400     *
1401     * @return string Contient les clauses WHERE à ajouter à la requête SQL principale.
1402     */
1403     function traitement_condition_contrainte($part, $conditions = NULL) {
1404    
1405     // Initialisation de la condition
1406     $whereContraintes = "";
1407     // Lorsqu'on a déjà les conditions explosées dans le paramètre $conditions, on
1408     // utilise ces données. Sinon, on appelle la méthode qui explose la chaîne de
1409     // caractères contenant l'ensemble des paramètres.
1410     if (is_array($conditions)){
1411     $explodeConditionContrainte = $conditions;
1412     }
1413     else {
1414     $explodeConditionContrainte = $this->explodeConditionContrainte($part);
1415     }
1416     // Récupère les groupes, sous-groupes et service_consulte pour la condition
1417     $groupes = $explodeConditionContrainte['groupes'];
1418     $sousgroupes = $explodeConditionContrainte['sousgroupes'];
1419     $service_consulte = $explodeConditionContrainte['service_consulte'];
1420    
1421     // Pour chaque groupe
1422     if ($groupes != "") {
1423     foreach ($groupes as $key => $groupe) {
1424     // Si le groupe n'est pas vide
1425     if (!empty($groupe)) {
1426     // Choisit l'opérateur logique
1427     $op_logique = $key > 0 ? 'OR' : 'AND (';
1428     // Ajoute la condition
1429     $whereContraintes .= " ".$op_logique." lower(trim(both E'\n\r\t' from contrainte.groupe)) = lower('"
1430     .pg_escape_string($groupe)."')";
1431     }
1432     }
1433     // S'il y a des valeurs dans groupe
1434 softime 9282 if (count($groupes) > 0) {
1435 mbroquet 3730 // Ferme la parenthèse
1436     $whereContraintes .= " ) ";
1437     }
1438     }
1439    
1440     // Pour chaque sous-groupe
1441     if ($sousgroupes != "") {
1442     foreach ($sousgroupes as $key => $sousgroupe) {
1443     // Si le sous-groupe n'est pas vide
1444     if (!empty($sousgroupe)) {
1445     // Choisit l'opérateur logique
1446     $op_logique = $key > 0 ? 'OR' : 'AND (';
1447     // Ajoute la condition
1448     $whereContraintes .= " ".$op_logique." lower(trim(both E'\n\r\t' from contrainte.sousgroupe)) = lower('"
1449     .pg_escape_string($sousgroupe)."')";
1450     }
1451     }
1452     // S'il y a des valeurs dans sous-groupe
1453     if (count($sousgroupes) > 0) {
1454     // Ferme la parenthèse
1455     $whereContraintes .= " ) ";
1456     }
1457     }
1458    
1459     // Si l'option service_consulte n'est pas vide
1460     if ($service_consulte != "") {
1461     // Ajoute la condition
1462     $whereContraintes .= " AND service_consulte = cast(lower('".$service_consulte."') as boolean) ";
1463     }
1464    
1465     // Condition retournée
1466     return $whereContraintes;
1467     }
1468    
1469     /**
1470     * Calcule une date par l'ajout ou la soustraction de mois ou de jours.
1471     *
1472     * @param date $date Date de base (format dd-mm-yyyy)
1473     * @param integer $delay Délais à ajouter
1474     * @param string $operator Opérateur pour le calcul ("-" ou "+")
1475     * @param string $type Type de calcul (mois ou jour)
1476     *
1477     * @return date Date calculée
1478     */
1479     function mois_date($date, $delay, $operator = "+", $type = "mois") {
1480 softime 9245 // On force le type du paramètre $delay
1481     $delay = intval($delay);
1482 mbroquet 3730
1483     // Si un type n'est pas définit
1484     if ($type != "mois" && $type != "jour") {
1485     //
1486     return null;
1487     }
1488    
1489     // Si aucune date n'a été fournie ou si ce n'est pas une date correctement
1490     // formatée
1491     if ( is_null($date) || $date == "" ||
1492     preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date) == 0 ){
1493     return null;
1494     }
1495    
1496     // Si l'opérateur n'est pas définit
1497     if ($operator != "+" && $operator != "-") {
1498     //
1499     return null;
1500     }
1501    
1502     // Découpage de la date
1503     $temp = explode("-", $date);
1504     $day = (int) $temp[2];
1505     $month = (int) $temp[1];
1506     $year = (int) $temp[0];
1507    
1508     // Si c'est un calcul sur des mois
1509     // Le calcul par mois ne se fait pas comme le calcul par jour car
1510     // les fonctions PHP ne réalisent pas les calculs réglementaires
1511     if ($type == "mois") {
1512    
1513     // Si c'est une addition
1514     if ($operator == '+') {
1515     // Année à ajouter
1516     $year += floor($delay / 12);
1517     // Mois restant
1518     $nb_month = ($delay % 12);
1519     // S'il y a des mois restant
1520     if ($nb_month != 0) {
1521     // Ajout des mois restant
1522     $month += $nb_month;
1523     // Si ça dépasse le mois 12 (décembre)
1524     if ($month > 12) {
1525     // Soustrait 12 au mois
1526     $month -= 12;
1527     // Ajoute 1 à l'année
1528     $year += 1;
1529     }
1530     }
1531     }
1532    
1533     // Si c'est une soustraction
1534     if ($operator == "-") {
1535     // Année à soustraire
1536     $year -= floor($delay / 12);
1537     // Mois restant
1538     $nb_month = ($delay % 12);
1539     // S'il y a des mois restant
1540     if ($nb_month != 0) {
1541     // Soustrait le délais
1542     $month -= $nb_month;
1543     // Si ça dépasse le mois 1 (janvier)
1544     if ($month < 1) {
1545     // Soustrait 12 au mois
1546     $month += 12;
1547     // Ajoute 1 à l'année
1548     $year -= 1;
1549     }
1550     }
1551     }
1552    
1553     // Calcul du nombre de jours dans le mois sélectionné
1554     switch($month) {
1555     // Mois de février
1556     case "2":
1557     if ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0) {
1558     $day_max = 29;
1559     } else {
1560     $day_max = 28;
1561     }
1562     break;
1563     // Mois d'avril, juin, septembre et novembre
1564     case "4":
1565     case "6":
1566     case "9":
1567     case "11":
1568     $day_max = 30;
1569     break;
1570     // Mois de janvier, mars, mai, juillet, août, octobre et décembre
1571     default:
1572     $day_max = 31;
1573     }
1574    
1575     // Si le jour est supérieur au jour maximum du mois
1576     if ($day > $day_max) {
1577     // Le jour devient le jour maximum
1578     $day = $day_max;
1579     }
1580    
1581     // Compléte le mois et le jour par un 0 à gauche si c'est un chiffre
1582     $month = str_pad($month, 2, "0", STR_PAD_LEFT);
1583     $day = str_pad($day, 2, "0", STR_PAD_LEFT);
1584    
1585     // Résultat du calcul
1586     $date_result = $year."-".$month."-".$day;
1587     }
1588    
1589     // Si c'est un calcul sur des jours
1590     if ($type == "jour") {
1591     //
1592     $datetime = new DateTime($date);
1593     // Si le délai est un numérique
1594     if (is_numeric($delay)) {
1595     // Modifie la date
1596     $datetime->modify($operator.$delay.' days');
1597     }
1598     // Résultat du calcul
1599     $date_result = $datetime->format('Y-m-d');
1600     }
1601    
1602     // Retourne la date calculée
1603     return $date_result;
1604     }
1605    
1606     /**
1607     * Vérifie la valididité d'une date.
1608     *
1609     * @param string $pDate Date à vérifier
1610     *
1611     * @return boolean
1612     */
1613     function check_date($pDate) {
1614    
1615     // Vérifie si c'est une date valide
1616     if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $pDate, $date)
1617     && checkdate($date[2], $date[3], $date[1])
1618     && $date[1] >= 1900) {
1619     //
1620     return true;
1621     }
1622    
1623     //
1624     return false;
1625     }
1626    
1627     /**
1628     * Permet de tester le bypass
1629     *
1630     * @param string $obj le nom de l'objet
1631     * @param string $permission_suffix
1632     * @return boolean
1633     */
1634     function can_bypass($obj="", $permission_suffix=""){
1635     //On teste le droit bypass
1636     if ($permission_suffix!=""&&$obj!=""&&
1637     $this->isAccredited($obj."_".$permission_suffix."_bypass")){
1638     return true;
1639     }
1640     return false;
1641     }
1642    
1643    
1644     /**
1645     * Vérifie l'option de numérisation.
1646     *
1647     * @return boolean
1648     */
1649     public function is_option_digitalization_folder_enabled() {
1650     //
1651     if ($this->getParameter("option_digitalization_folder") !== true) {
1652     //
1653     return false;
1654     }
1655     //
1656     return true;
1657     }
1658    
1659 softime 10713
1660 softime 8477 /**
1661     * Vérifie l'option de suppression d'un dossier d'instruction.
1662     *
1663     * @return boolean
1664     */
1665     public function is_option_suppression_dossier_instruction_enabled($om_collectivite=null) {
1666     //
1667     $parameters = $this->getCollectivite($om_collectivite);
1668     //
1669     if (isset($parameters['option_suppression_dossier_instruction']) === true
1670     && $parameters['option_suppression_dossier_instruction'] === 'true') {
1671     //
1672     return true;
1673     }
1674 mbroquet 3730
1675 softime 8477 //
1676     return false;
1677     }
1678    
1679    
1680    
1681 mbroquet 3730 /**
1682     * Vérifie que l'option d'accès au portail citoyen est activée.
1683     *
1684 softime 7366 * @param integer $om_collectivite Identifiant de la collectivité.
1685     *
1686 mbroquet 3730 * @return boolean
1687     */
1688 softime 7366 public function is_option_citizen_access_portal_enabled($om_collectivite=null) {
1689 mbroquet 3730 //
1690 softime 7366 $parameters = $this->getCollectivite($om_collectivite);
1691 mbroquet 3730 //
1692 softime 7366 if (isset($parameters['option_portail_acces_citoyen']) === true
1693     && $parameters['option_portail_acces_citoyen'] === 'true') {
1694 mbroquet 3730 //
1695 softime 7366 return true;
1696 mbroquet 3730 }
1697    
1698     //
1699 softime 7366 return false;
1700 mbroquet 3730 }
1701    
1702 softime 7366
1703 nmeucci 4108 /**
1704 softime 4626 * Vérifie que l'option du SIG est activée.
1705     *
1706     * @return boolean
1707     */
1708 softime 7996 public function is_option_sig_enabled($om_collectivite=null) {
1709 softime 4626 //
1710 softime 7996 $parameters = $this->getCollectivite($om_collectivite);
1711 softime 4626 //
1712 softime 7996 if (isset($parameters['option_sig']) === true
1713     && $parameters['option_sig'] === 'sig_externe') {
1714 softime 4626 //
1715 softime 7996 return true;
1716 softime 4626 }
1717 softime 7996 //
1718     return false;
1719     }
1720 softime 4626
1721 softime 7996 /**
1722     * Vérifie que l'option du SIG est activée.
1723     *
1724     * @return boolean
1725     */
1726     public function is_option_ws_synchro_contrainte_enabled($om_collectivite=null) {
1727 softime 4626 //
1728 softime 7996 $parameters = $this->getCollectivite($om_collectivite);
1729     //
1730     if (isset($parameters['option_ws_synchro_contrainte']) === true
1731     && $parameters['option_ws_synchro_contrainte'] === 'true') {
1732     //
1733     return true;
1734     }
1735     //
1736     return false;
1737 softime 4626 }
1738    
1739 softime 6929
1740 softime 4626 /**
1741 softime 6929 * Vérifie que l'option de simulation des taxes est activée.
1742     *
1743     * @param integer $om_collectivite Identifiant de la collectivité.
1744     *
1745     * @return boolean
1746     */
1747     public function is_option_simulation_taxes_enabled($om_collectivite=null) {
1748     //
1749     $parameters = $this->getCollectivite($om_collectivite);
1750     //
1751     if (isset($parameters['option_simulation_taxes']) === true
1752     && $parameters['option_simulation_taxes'] === 'true') {
1753     //
1754     return true;
1755     }
1756    
1757     //
1758     return false;
1759     }
1760    
1761 softime 7521 /**
1762     * Vérifie que l'option de prévisualisation de l'édition est activée.
1763     *
1764     * @param integer $om_collectivite Identifiant de la collectivité.
1765     *
1766     * @return boolean
1767     */
1768     public function is_option_preview_pdf_enabled($om_collectivite=null) {
1769     //
1770     $parameters = $this->getCollectivite($om_collectivite);
1771     //
1772     if (isset($parameters['option_previsualisation_edition']) === true
1773     && $parameters['option_previsualisation_edition'] === 'true') {
1774     //
1775     return true;
1776     }
1777 softime 6929
1778 softime 7521 //
1779     return false;
1780     }
1781    
1782 softime 8593 /**
1783     * Vérifie que l'option de rédaction libre de l'édition est activée.
1784     *
1785     * @param integer $om_collectivite Identifiant de la collectivité.
1786     *
1787     * @return boolean
1788     */
1789     public function is_option_redaction_libre_enabled($om_collectivite=null) {
1790     //
1791     $parameters = $this->getCollectivite($om_collectivite);
1792     //
1793     if (isset($parameters['option_redaction_libre']) === true
1794     && $parameters['option_redaction_libre'] === 'true') {
1795     //
1796     return true;
1797     }
1798 softime 7685
1799 softime 8593 //
1800     return false;
1801     }
1802    
1803    
1804 softime 6929 /**
1805 softime 7685 * Vérifie que l'option de finalisation automatique des instructions tacites
1806     * et retours est activée..
1807     *
1808     * @param integer $om_collectivite Identifiant de la collectivité.
1809     *
1810     * @return boolean
1811     */
1812     public function is_option_finalisation_auto_enabled($om_collectivite = null) {
1813     //
1814     $parameters = $this->getCollectivite($om_collectivite);
1815     //
1816     if (isset($parameters['option_final_auto_instr_tacite_retour']) === true
1817     && $parameters['option_final_auto_instr_tacite_retour'] === 'true') {
1818     //
1819     return true;
1820     }
1821    
1822     //
1823     return false;
1824     }
1825    
1826 softime 8329 /**
1827     * Vérifie que l'option de trouillotage numérique automatique des
1828     * pièces est activée.
1829     *
1830     * @param integer $om_collectivite Identifiant de la collectivité.
1831     *
1832     * @return boolean
1833     */
1834     public function is_option_trouillotage_numerique_enabled($om_collectivite = null) {
1835     //
1836     $parameters = $this->getCollectivite($om_collectivite);
1837     //
1838     if (isset($parameters['option_trouillotage_numerique']) === true
1839     && $parameters['option_trouillotage_numerique'] === 'true') {
1840     //
1841     return true;
1842     }
1843     //
1844     return false;
1845     }
1846 softime 7685
1847     /**
1848 softime 8989 * Vérifie que l'option de saisie du numéro de dossier est activée.
1849     *
1850     * @param integer $om_collectivite Identifiant de la collectivité.
1851     *
1852     * @return boolean
1853     */
1854     public function is_option_dossier_saisie_numero_enabled($om_collectivite=null) {
1855     //
1856     $parameters = $this->getCollectivite($om_collectivite);
1857     //
1858     if (isset($parameters['option_dossier_saisie_numero']) === true
1859     && $parameters['option_dossier_saisie_numero'] === 'true') {
1860     //
1861     return true;
1862     }
1863    
1864     //
1865     return false;
1866     }
1867    
1868     /**
1869 softime 10573 * Vérifie que l'option de saisie du numéro de dossier est activée.
1870     *
1871     * @param integer $om_collectivite Identifiant de la collectivité.
1872     *
1873     * @return boolean
1874     */
1875     public function is_option_dossier_saisie_numero_complet_enabled($om_collectivite=null) {
1876     //
1877     $parameters = $this->getCollectivite($om_collectivite);
1878     //
1879     if (isset($parameters['option_dossier_saisie_numero_complet']) === true
1880     && $parameters['option_dossier_saisie_numero_complet'] === 'true') {
1881     //
1882     return true;
1883     }
1884    
1885     //
1886     return false;
1887     }
1888    
1889     /**
1890     * Vérifie que l'option de la commune associée à un dossier est activée.
1891     *
1892     * @param integer $om_collectivite Identifiant de la collectivité.
1893     *
1894     * @return boolean
1895     */
1896     public function is_option_dossier_commune_enabled($om_collectivite=null) {
1897     $parameters = $this->getCollectivite($om_collectivite);
1898     return (
1899     isset($parameters['option_dossier_commune']) &&
1900     $parameters['option_dossier_commune'] === 'true');
1901     }
1902    
1903     /**
1904 softime 8989 * Vérifie que l'option de récupération de la division de l'instructeur
1905     * affecté pour la numérotation des dossiers est activée.
1906     *
1907     * @param integer $om_collectivite Identifiant de la collectivité.
1908     *
1909     * @return boolean
1910     */
1911     public function is_option_instructeur_division_numero_dossier_enabled($om_collectivite=null) {
1912     //
1913     $parameters = $this->getCollectivite($om_collectivite);
1914     //
1915     if (isset($parameters['option_instructeur_division_numero_dossier']) === true
1916     && $parameters['option_instructeur_division_numero_dossier'] === 'true') {
1917     //
1918     return true;
1919     }
1920    
1921     //
1922     return false;
1923     }
1924    
1925     /**
1926 softime 9245 * Vérifie que l'option du suivi de numérisation est activée.
1927     * Les utilisateurs de la collectivité de niveau 2 peuvent accéder aux
1928     * fonctionnalités du suivi de numérisation même si l'option est activée seulement
1929     * sur une collectivité de niveau 1.
1930     *
1931     * @param integer $om_collectivite Identifiant de la collectivité.
1932     *
1933     * @return boolean
1934     */
1935     public function is_option_suivi_numerisation_enabled($om_collectivite=null) {
1936     //
1937     $parameters = $this->getCollectivite($om_collectivite);
1938     //
1939     if (isset($parameters['option_suivi_numerisation']) === true
1940     && $parameters['option_suivi_numerisation'] === 'true') {
1941     //
1942     return true;
1943     }
1944    
1945     // Si l'utilisateur fait partie de la collectivité de niveau 2
1946     // et qu'au moins une des communes à l'option de numérisation activée
1947     if ($this->has_collectivite_multi() === true) {
1948     $query = sprintf('
1949     SELECT valeur
1950     FROM %1$som_parametre
1951     WHERE libelle = \'%2$s\'
1952     ',
1953     DB_PREFIXE,
1954     'option_suivi_numerisation'
1955     );
1956     $res = $this->get_one_result_from_db_query(
1957     $query,
1958     true
1959     );
1960     if ($res['code'] === 'OK'
1961     && $res['result'] === 'true') {
1962     //
1963     return true;
1964     }
1965     }
1966    
1967     //
1968     return false;
1969     }
1970    
1971 softime 10573 // Mode MC
1972     public function is_option_om_collectivite_entity_enabled($om_collectivite=null) {
1973     //
1974     $parameters = $this->getCollectivite($om_collectivite);
1975     //
1976     if (isset($parameters['option_om_collectivite_entity']) === true
1977     && $parameters['option_om_collectivite_entity'] === 'true') {
1978     //
1979     return true;
1980     }
1981    
1982     //
1983     return false;
1984     }
1985    
1986     public function is_option_date_depot_mairie_enabled($om_collectivite=null) {
1987     //
1988     $parameters = $this->getCollectivite($om_collectivite);
1989     //
1990     if (isset($parameters['option_date_depot_mairie']) === true
1991     && $parameters['option_date_depot_mairie'] === 'true') {
1992     //
1993     return true;
1994     }
1995    
1996     //
1997     return false;
1998     }
1999    
2000 softime 9245 /**
2001 softime 10573 * [is_option_date_depot_mairie_enabled description]
2002     * @param [type] $om_collectivite [description]
2003     * @return boolean [description]
2004     */
2005     public function is_option_renommer_collectivite_enabled($om_collectivite=null) {
2006     //
2007     $parameters = $this->getCollectivite($om_collectivite);
2008     //
2009     if (isset($parameters['option_renommer_collectivite']) === true
2010     && $parameters['option_renommer_collectivite'] === 'true') {
2011     //
2012     return true;
2013     }
2014    
2015     //
2016     return false;
2017     }
2018    
2019     /**
2020     * [is_option_mode_service_consulte_enabled description]
2021     * @param [type] $om_collectivite [description]
2022     * @return boolean [description]
2023     */
2024     public function is_option_mode_service_consulte_enabled($om_collectivite=null) {
2025     //
2026     $parameters = $this->getCollectivite($om_collectivite);
2027     //
2028     if (isset($parameters['option_mode_service_consulte']) === true
2029     && $parameters['option_mode_service_consulte'] === 'true') {
2030     //
2031     return true;
2032     }
2033    
2034     //
2035     return false;
2036     }
2037    
2038 softime 10808 /**
2039     * Méthode permettant de récupérer le paramètrage de l'option
2040     * option_notification
2041     *
2042     * @return boolean
2043     */
2044     public function get_param_option_notification($om_collectivite=null) {
2045     //
2046     $parameters = $this->getCollectivite($om_collectivite);
2047     //
2048     if (isset($parameters['option_notification']) === true) {
2049     return $parameters['option_notification'];
2050     }
2051     //
2052     return null;
2053     }
2054 softime 10573
2055 softime 10808 /**
2056 softime 10968 * Méthode permettant de récupérer le paramètrage de l'option
2057     * option_notification
2058     *
2059     * @return boolean
2060     */
2061     public function get_parametre_notification_url_acces($om_collectivite=null) {
2062     //
2063     $parameters = $this->getCollectivite($om_collectivite);
2064     //
2065     if (isset($parameters['parametre_notification_url_acces']) === true) {
2066     return $parameters['parametre_notification_url_acces'];
2067     }
2068     //
2069     return null;
2070     }
2071    
2072     /**
2073 softime 10808 * Permet de récupérer les phrases types composant la notification aux pétitionnaires.
2074     *
2075     * @param integer $om_collectivite Identifiant de la collectivité.
2076     *
2077     * @return array Tableau contenant les phrases types.
2078     */
2079     public function get_notification_parametre_courriel_type($om_collectivite = null) {
2080     // Phrases types par défaut
2081     $result = array(
2082     'parametre_courriel_type_titre' => __("Nouveau document disponible."),
2083     'parametre_courriel_type_message' => __("Un nouveau document concernant votre demande d'urbanisme est à votre disposition."),
2084     );
2085     // Récupération des paramètres
2086     $parameters = $this->getCollectivite($om_collectivite);
2087     // Vérification de l'existance des paramètres titre et message
2088     if (isset($parameters['parametre_courriel_type_message']) === true
2089     && $parameters['parametre_courriel_type_message'] !== null
2090     && $parameters['parametre_courriel_type_message'] !== '') {
2091     //
2092     $result['parametre_courriel_type_message'] = $parameters['parametre_courriel_type_message'];
2093     }
2094     if (isset($parameters['parametre_courriel_type_titre']) === true
2095     && $parameters['parametre_courriel_type_titre'] !== null
2096     && $parameters['parametre_courriel_type_titre'] !== '') {
2097     //
2098     $result['parametre_courriel_type_titre'] = $parameters['parametre_courriel_type_titre'];
2099     }
2100     //
2101     return $result;
2102     }
2103    
2104 softime 10573 function is_type_dossier_platau($dossier_autorisation) {
2105     $inst_da = $this->get_inst__om_dbform(array(
2106     "obj" => "dossier_autorisation",
2107     "idx" => $dossier_autorisation,
2108     ));
2109    
2110     $inst_datd = $inst_da->get_inst_dossier_autorisation_type_detaille();
2111    
2112     if ($inst_datd->getVal('dossier_platau') === true || $inst_datd->getVal('dossier_platau') === 't'){
2113     return true;
2114     }
2115    
2116     return false;
2117     }
2118    
2119    
2120    
2121    
2122     /**
2123     * Vérifie que l'option du lien Google Street View est activée.
2124     *
2125     * @param integer $om_collectivite Identifiant de la collectivité.
2126     *
2127     * @return boolean
2128     */
2129     public function is_option_streetview_enabled($om_collectivite=null) {
2130     //
2131     $parameters = $this->getCollectivite($om_collectivite);
2132     //
2133     if (isset($parameters['option_streetview']) === true
2134     && $parameters['option_streetview'] === 'true') {
2135     //
2136     return true;
2137     }
2138    
2139     //
2140     return false;
2141     }
2142    
2143     /**
2144     * Vérifie que l'option d'affichage en lecture seule de la date
2145     * de l'événement d'instruction est activée.
2146     *
2147     * @param integer $om_collectivite Identifiant de la collectivité.
2148     *
2149     * @return boolean
2150     */
2151     public function is_option_date_evenement_instruction_lecture_seule($om_collectivite=null) {
2152     //
2153     $parameters = $this->getCollectivite($om_collectivite);
2154     //
2155     if (isset($parameters['option_date_evenement_instruction_lecture_seule']) === true
2156     && $parameters['option_date_evenement_instruction_lecture_seule'] === 'true') {
2157     //
2158     return true;
2159     }
2160    
2161     //
2162     return false;
2163     }
2164    
2165     /**
2166 softime 10713 * Vérifie que l'option référentiel ERP est activée.
2167     *
2168     * @param integer $om_collectivite Identifiant de la collectivité.
2169     *
2170     * @return boolean
2171     */
2172     public function is_option_geolocalisation_auto_contrainte_enabled($om_collectivite=null) {
2173     //
2174     $parameters = $this->getCollectivite($om_collectivite);
2175     //
2176     if (isset($parameters['option_geolocalisation_auto_contrainte']) === true
2177     && $parameters['option_geolocalisation_auto_contrainte'] === 'true') {
2178     //
2179     return true;
2180     }
2181    
2182     //
2183     return false;
2184     }
2185    
2186     /**
2187 nmeucci 4108 * Vérifie le niveau de la collectivité de l'utilisateur connecté
2188     *
2189     * @return boolean
2190     */
2191     function has_collectivite_multi() {
2192     $idx_multi = $this->get_idx_collectivite_multi();
2193     if (intval($_SESSION['collectivite']) === intval($idx_multi)) {
2194     return true;
2195     }
2196     return false;
2197     }
2198 mbroquet 3730
2199 nmeucci 4108
2200 softime 3976 /**
2201     * Pour un path absolu donné, retourne le relatif à la racine de
2202     * l'application.
2203     *
2204     * @param string $absolute Chemin absolu.
2205     *
2206     * @return mixed Faux si échec sinon chemin relatif.
2207     */
2208     public function get_relative_path($absolute) {
2209     if ($this->get_path_app() === false) {
2210     return false;
2211     }
2212     $path_app = $this->get_path_app();
2213     return str_replace($path_app, '', $absolute);
2214     }
2215    
2216    
2217     /**
2218     * Retourne le path absolu de la racine de l'application
2219     *
2220     * @return mixed Faux si échec sinon chemin absolu
2221     */
2222     public function get_path_app() {
2223     $match = array();
2224     preg_match( '/(.*)\/[a-zA-Z0-9]+\/\.\.\/core\/$/', PATH_OPENMAIRIE, $match);
2225     // On vérifie qu'il n'y a pas d'erreur
2226     if (isset($match[1]) === false) {
2227     return false;
2228     }
2229     return $match[1];
2230     }
2231    
2232 nmeucci 3981 /**
2233     * Compose un tableau et retourne son code HTML
2234     *
2235     * @param string $id ID CSS du conteneur
2236     * @param array $headers entêtes de colonnes
2237     * @param array $rows lignes
2238     * @return string code HTML
2239     */
2240 nmeucci 3980 public function compose_generate_table($id, $headers, $rows) {
2241 nmeucci 3981 //
2242     $html = '';
2243 nmeucci 3980 // Début conteneur
2244 nmeucci 3981 $html .= '<div id="'.$id.'">';
2245 nmeucci 3980 // Début tableau
2246 nmeucci 3981 $html .= '<table class="tab-tab">';
2247 nmeucci 3980 // Début entête
2248 nmeucci 3981 $html .= '<thead>';
2249     $html .= '<tr class="ui-tabs-nav ui-accordion ui-state-default tab-title">';
2250 nmeucci 3980 // Colonnes
2251     $nb_colonnes = count($headers);
2252     $index_last_col = $nb_colonnes - 1;
2253     foreach ($headers as $i => $header) {
2254     if ($i === 0) {
2255     $col = ' firstcol';
2256     }
2257     if ($i === $index_last_col) {
2258     $col = ' lastcol';
2259     }
2260 nmeucci 3981 $html .= '<th class="title col-'.$i.$col.'">';
2261     $html .= '<span class="name">';
2262     $html .= $header;
2263     $html .= '</span>';
2264     $html .= '</th>';
2265 nmeucci 3980 }
2266     // Fin entête
2267 nmeucci 3981 $html .= '</tr>';
2268     $html .= '</thead>';
2269 nmeucci 3980 // Début corps
2270 nmeucci 3981 $html .= '<tbody>';
2271 nmeucci 3980 // Lignes
2272     foreach ($rows as $cells) {
2273     // Début ligne
2274 nmeucci 3981 $html .= '<tr class="tab-data">';
2275 nmeucci 3980 // Cellules
2276     foreach ($cells as $j => $cell) {
2277     if ($j === 0) {
2278     $col = ' firstcol';
2279     }
2280     if ($j === $index_last_col) {
2281     $col = ' lastcol';
2282     }
2283 nmeucci 3981 $html .= '<td class="title col-'.$j.$col.'">';
2284     $html .= '<span class="name">';
2285     $html .= $cell;
2286     $html .= '</span>';
2287     $html .= '</td>';
2288 nmeucci 3980 }
2289     // Fin ligne
2290 nmeucci 3981 $html .= "</tr>";
2291 nmeucci 3980 }
2292     // Fin corps
2293 nmeucci 3981 $html .= '</tbody>';
2294 nmeucci 3980 // Fin tableau
2295 nmeucci 3981 $html .= '</table>';
2296 nmeucci 3980 // Fin conteneur
2297 nmeucci 3981 $html .= '</div>';
2298     //
2299     return $html;
2300 nmeucci 3980 }
2301 nmeucci 4156
2302     /**
2303     * Retourne le login de l'utilisateur connecté + entre parenthèses son nom
2304     * s'il en a un.
2305     *
2306     * @return string myLogin OU myLogin (myName)
2307     */
2308     public function get_connected_user_login_name() {
2309     // Requête et stockage des informations de l'user connecté
2310     $this->getUserInfos();
2311     // Si le nom existe et est défini on le récupère
2312     $nom = "";
2313     if (isset($this->om_utilisateur["nom"])
2314     && !empty($this->om_utilisateur["nom"])) {
2315     $nom = trim($this->om_utilisateur["nom"]);
2316     }
2317     // Définition de l'émetteur : obligatoirement son login
2318     $emetteur = $_SESSION['login'];
2319     // Définition de l'émetteur : + éventuellement son nom
2320     if ($nom != "") {
2321     $emetteur .= " (".$nom.")";
2322     }
2323     // Retour
2324     return $emetteur;
2325     }
2326 nhaye 4218
2327     /**
2328 fmichon 4708 * Cette méthode permet d'interfacer le module 'Settings'.
2329     */
2330     function view_module_settings() {
2331     //
2332     require_once "../obj/settings.class.php";
2333     $settings = new settings();
2334     $settings->view_main();
2335     }
2336    
2337 softime 7366
2338 fmichon 4708 /**
2339 softime 7366 * Vérifie que l'option référentiel ERP est activée.
2340 fmichon 4708 *
2341 softime 7366 * @param integer $om_collectivite Identifiant de la collectivité.
2342 fmichon 4708 *
2343     * @return boolean
2344     */
2345 softime 7366 public function is_option_referentiel_erp_enabled($om_collectivite=null) {
2346 fmichon 4708 //
2347 softime 7366 $parameters = $this->getCollectivite($om_collectivite);
2348     //
2349     if (isset($parameters['option_referentiel_erp']) === true
2350     && $parameters['option_referentiel_erp'] === 'true') {
2351     //
2352     return true;
2353 fmichon 4708 }
2354 softime 7366
2355 fmichon 4708 //
2356 softime 7366 return false;
2357 fmichon 4708 }
2358 softime 10713
2359     /**
2360     * Vérifie que l'option d'affichage de la miniature des fichiers est activée.
2361     *
2362     * @param integer $om_collectivite Identifiant de la collectivité.
2363     *
2364     * @return boolean
2365     */
2366     public function is_option_miniature_fichier_enabled($om_collectivite=null) {
2367     //
2368     $parameters = $this->getCollectivite($om_collectivite);
2369     //
2370     if (isset($parameters['option_miniature_fichier']) === true
2371     && $parameters['option_miniature_fichier'] === 'true') {
2372     //
2373     return true;
2374     }
2375 fmichon 4708
2376 softime 10713 //
2377     return false;
2378     }
2379 softime 7366
2380 softime 10713
2381 fmichon 4708 /**
2382     * Interface avec le référentiel ERP.
2383     */
2384     function send_message_to_referentiel_erp($code, $infos) {
2385     //
2386     require_once "../obj/interface_referentiel_erp.class.php";
2387     $interface_referentiel_erp = new interface_referentiel_erp();
2388     $ret = $interface_referentiel_erp->send_message_to_referentiel_erp($code, $infos);
2389     return $ret;
2390     }
2391    
2392     /**
2393 nhaye 4218 * Récupère la liste des identifiants des collectivités
2394     *
2395     * @param string $return_type 'string' ou 'array' selon que l'on retourne
2396     * respectivement une chaîne ou un tableau
2397     * @param string $separator caractère(s) séparateur(s) employé(s) lorsque
2398     * l'on retourne une chaîne, inutilisé si tableau
2399     * @return mixed possibilité de boolean/string/array :
2400     * false si erreur BDD sinon résultat
2401     */
2402     public function get_list_id_collectivites($return_type = 'string', $separator = ',') {
2403     $sql = "
2404     SELECT
2405     array_to_string(
2406     array_agg(om_collectivite),
2407     '".$separator."'
2408     ) as list_id_collectivites
2409     FROM ".DB_PREFIXE."om_collectivite";
2410     $list = $this->db->getone($sql);
2411     $this->addTolog(
2412     __FILE__." - ".__METHOD__." : db->getone(\"".$sql."\");",
2413     VERBOSE_MODE
2414     );
2415     if ($this->isDatabaseError($list, true)) {
2416     return false;
2417     }
2418     if ($return_type === 'array') {
2419     return explode($separator, $list);
2420     }
2421     return $list;
2422     }
2423 nhaye 5254
2424 softime 6565 /**
2425     * Teste si l'utilisateur connecté appartient au groupe indiqué en paramètre
2426     * ou s'il a le goupe bypass.
2427     *
2428     * @param string $groupe Code du groupe : ADS / CTX / CU / RU / ERP.
2429     * @return boolean vrai si utilisateur appartient au groupe fourni
2430     */
2431     public function is_user_in_group($groupe) {
2432     if (isset($_SESSION['groupe']) === true
2433     && (array_key_exists($groupe, $_SESSION['groupe']) === true
2434     || array_key_exists("bypass", $_SESSION['groupe']) === true)) {
2435     return true;
2436     }
2437     return false;
2438     }
2439    
2440     /**
2441     * CONDITION - can_user_access_dossiers_confidentiels_from_groupe
2442     *
2443     * Permet de savoir si le type de dossier d'autorisation du dossier courant est
2444     * considéré comme confidentiel ou si l'utilisateur a le groupe bypass.
2445     *
2446     * @param string $groupe Code du groupe : ADS / CTX / CU / RU / ERP.
2447     * @return boolean true si l'utilisateur à accès aux dossiers confidentiels du groupe
2448     * passé en paramètre, sinon false.
2449     *
2450     */
2451     public function can_user_access_dossiers_confidentiels_from_groupe($groupe) {
2452     if ((isset($_SESSION['groupe'][$groupe]['confidentiel']) === true
2453     AND $_SESSION['groupe'][$groupe]['confidentiel'] === true)
2454     || array_key_exists("bypass", $_SESSION['groupe']) === true) {
2455     return true;
2456     }
2457     return false;
2458     }
2459    
2460     public function starts_with($haystack, $needle) {
2461     $length = strlen($needle);
2462     return (substr($haystack, 0, $length) === $needle);
2463     }
2464    
2465     public function ends_with($haystack, $needle) {
2466     $length = strlen($needle);
2467     if ($length == 0) {
2468     return true;
2469     }
2470     return (substr($haystack, -$length) === $needle);
2471     }
2472    
2473     /**
2474     * Récupère le type définit dans la base de données des champs d'une table
2475     * entière ou d'un champs si celui-ci est précisé.
2476     *
2477     * Liste des types BDD :
2478     * - int4
2479     * - varchar
2480     * - bool
2481     * - numeric
2482     * - text
2483     *
2484     * @param string $table Nom de la table.
2485     * @param string $column Nom de la colonne (facultatif).
2486     *
2487     * @return array
2488     */
2489     public function get_type_from_db($table, $column = null) {
2490     // Composition de la requête
2491     $sql_select = ' SELECT column_name, udt_name ';
2492     $sql_from = ' FROM information_schema.columns ';
2493     $sql_where = ' WHERE table_schema = \''.str_replace('.', '', DB_PREFIXE).'\' AND table_name = \''.$table.'\' ';
2494     $sql_order = ' ORDER BY ordinal_position ';
2495    
2496     // Si une colonne est précisé
2497     if ($column !== null || $column !== '') {
2498     //
2499     $sql_where .= ' AND column_name = \''.$column.'\' ';
2500     }
2501    
2502     // Requête SQL
2503     $sql = $sql_select.$sql_from.$sql_where.$sql_order;
2504     // Exécution de la requête
2505     $res = $this->db->query($sql);
2506     // Log
2507     $this->addToLog(__METHOD__."() : db->query(\"".$sql."\");", VERBOSE_MODE);
2508     // Erreur BDD
2509     $this->isDatabaseError($res);
2510     //
2511     $list_type = array();
2512     while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
2513     $list_type[$row['column_name']] = $row['udt_name'];
2514     }
2515    
2516     // Retourne la liste des codes
2517     return $list_type;
2518     }
2519    
2520 softime 7366
2521     /**
2522     * Cette méthode permet de récupérer le code de division correspondant
2523     * au dossier sur lequel on se trouve.
2524     *
2525     * Méthode identique à la méthode getDivisionFromDossier() de la classe
2526     * om_dbform à l'exception d'un cas de récupération du numéro de dossier par
2527     * la méthode getVal(). Cette exception permet d'utiliser cette méthode dans
2528     * les scripts instanciant seulement la classe utils tel que les *.inc.php.
2529     *
2530     * @param string $dossier Identifiant du dossier d'instruction.
2531     *
2532     * @return string Code de la division du dossier en cours
2533     */
2534     public function get_division_from_dossier_without_inst($dossier = null) {
2535    
2536     // Cette méthode peut être appelée plusieurs fois lors d'une requête.
2537     // Pour éviter de refaire le traitement de recherche de la division
2538     // alors on vérifie si nous ne l'avons pas déjà calculé.
2539     if (isset($this->_division_from_dossier) === true
2540     && $this->_division_from_dossier !== null) {
2541     // Log
2542     $this->addToLog(__METHOD__."() : retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE);
2543     // On retourne la valeur déjà calculée
2544     return $this->_division_from_dossier;
2545     }
2546    
2547     // Récupère le paramétre retourformulaire présent dans l'URL
2548     $retourformulaire = $this->getParameter("retourformulaire");
2549     // Récupère le paramétre idxformulaire présent dans l'URL
2550     $idxformulaire = $this->getParameter("idxformulaire");
2551    
2552     // Si le dossier n'est pas passé en paramètre de la méthode
2553     if ($dossier === null) {
2554    
2555     // La méthode de récupération du dossier diffère selon le contexte
2556     // du formulaire
2557     if ($retourformulaire === "dossier"
2558     || $retourformulaire === "dossier_instruction"
2559     || $retourformulaire === "dossier_instruction_mes_encours"
2560     || $retourformulaire === "dossier_instruction_tous_encours"
2561     || $retourformulaire === "dossier_instruction_mes_clotures"
2562     || $retourformulaire === "dossier_instruction_tous_clotures"
2563     || $retourformulaire === "dossier_contentieux_mes_infractions"
2564     || $retourformulaire === "dossier_contentieux_toutes_infractions"
2565     || $retourformulaire === "dossier_contentieux_mes_recours"
2566     || $retourformulaire === "dossier_contentieux_tous_recours") {
2567    
2568     // Récupère le numéro du dossier depuis le paramètre
2569     // idxformulaire présent dans l'URL
2570     $dossier = $idxformulaire;
2571     }
2572     //
2573     if ($retourformulaire === "lot") {
2574    
2575     // Requête SQL
2576     $sql = sprintf("SELECT dossier FROM ".DB_PREFIXE."lot WHERE lot = %s", $idxformulaire);
2577     // Récupère l'identifiant du dossier
2578     $dossier = $this->db->getone($sql);
2579     // Log
2580     $this->addToLog(__METHOD__."() : db->query(\"".$dossier."\");", VERBOSE_MODE);
2581     // Erreur BDD
2582     $this->isDatabaseError($dossier);
2583     }
2584     }
2585    
2586     // À cette étape si le dossier n'est toujours pas récupéré alors la
2587     // division ne pourra pas être récupérée
2588     if ($dossier === null) {
2589     //
2590     return null;
2591     }
2592    
2593     // Requête SQL
2594     $sql = sprintf("SELECT division FROM ".DB_PREFIXE."dossier WHERE dossier = '%s'", $dossier);
2595     // Récupère l'identifiant de la division du dossier
2596     $this->_division_from_dossier = $this->db->getOne($sql);
2597     // Log
2598     $this->addToLog(__METHOD__."(): db->getone(\"".$sql."\")", VERBOSE_MODE);
2599     // Erreur BDD
2600     $this->isDatabaseError($this->_division_from_dossier);
2601    
2602     //
2603     return $this->_division_from_dossier;
2604    
2605     }
2606    
2607 softime 8329 /**
2608 softime 8593 *
2609     */
2610     function setDefaultValues() {
2611     $this->addHTMLHeadCss(
2612     array(
2613     "../app/lib/chosen/chosen.min.css",
2614     ),
2615     21
2616     );
2617     $this->addHTMLHeadJs(
2618     array(
2619     "../app/lib/chosen/chosen.jquery.min.js",
2620     ),
2621     21
2622     );
2623 softime 10573
2624     $this->addHTMLHeadCss(
2625     array(
2626     "../app/lib/gridjs/mermaid.min.css",
2627     ),
2628     22
2629     );
2630     $this->addHTMLHeadJs(
2631     array(
2632     "../app/lib/gridjs/gridjs.min.js",
2633     ),
2634     22
2635     );
2636 softime 8593 }
2637    
2638     /**
2639 softime 8329 * Permet de définir la configuration des liens du footer.
2640     *
2641     * @return void
2642     */
2643     protected function set_config__footer() {
2644     $footer = array();
2645     // Documentation du site
2646     $footer[] = array(
2647     "title" => __("Documentation"),
2648     "description" => __("Acceder a l'espace documentation de l'application"),
2649 softime 10968 "href" => "http://docs.openmairie.org/?project=openads&version=5.4&format=html&path=manuel_utilisateur",
2650 softime 8329 "target" => "_blank",
2651     "class" => "footer-documentation",
2652     );
2653 softime 7366
2654 softime 8329 // Forum openMairie
2655     $footer[] = array(
2656     "title" => __("Forum"),
2657     "description" => __("Espace d'échange ouvert du projet openMairie"),
2658     "href" => "https://communaute.openmairie.org/c/openads",
2659     "target" => "_blank",
2660     "class" => "footer-forum",
2661     );
2662    
2663     // Portail openMairie
2664     $footer[] = array(
2665     "title" => __("openMairie.org"),
2666     "description" => __("Site officiel du projet openMairie"),
2667     "href" => "http://www.openmairie.org/catalogue/openads",
2668     "target" => "_blank",
2669     "class" => "footer-openmairie",
2670     );
2671     //
2672     $this->config__footer = $footer;
2673     }
2674    
2675     /**
2676     * Surcharge - set_config__menu().
2677     *
2678     * @return void
2679     */
2680     protected function set_config__menu() {
2681     //
2682     $menu = array();
2683    
2684     // {{{ Rubrique AUTORISATION
2685     //
2686     $rubrik = array(
2687     "title" => _("Autorisation"),
2688     "class" => "autorisation",
2689     "right" => "menu_autorisation",
2690     );
2691     //
2692     $links = array();
2693    
2694     $links[] = array(
2695     "href" => "".OM_ROUTE_TAB."&obj=dossier_autorisation",
2696     "class" => "dossier_autorisation",
2697     "title" => _("Dossiers d'autorisation"),
2698     "right" => array("dossier_autorisation", "dossier_autorisation_tab", ),
2699     "open" => array("index.php|dossier_autorisation[module=tab]", "index.php|dossier_autorisation[module=form]", ),
2700     );
2701    
2702     // Lien vers les dossiers d'autorisations qui ont une demande d'avis
2703     $links[] = array(
2704     "href" => "".OM_ROUTE_TAB."&obj=dossier_autorisation_avis",
2705     "class" => "dossier_autorisation",
2706     "title" => _("Dossiers d'autorisation"),
2707     "right" => array(
2708     "dossier_autorisation_avis",
2709     "dossier_autorisation_avis_tab",
2710     ),
2711     "open" => array("index.php|dossier_autorisation_avis[module=tab]", "index.php|dossier_autorisation[module=form]", ),
2712     );
2713    
2714     //
2715     $rubrik['links'] = $links;
2716     //
2717     $menu[] = $rubrik;
2718     // }}}
2719    
2720     // {{{ Rubrique GUICHET UNIQUE
2721     //
2722     $rubrik = array(
2723     "title" => _("Guichet Unique"),
2724     "class" => "guichet_unique",
2725     "right" => "menu_guichet_unique",
2726     );
2727     //
2728     $links = array();
2729     //
2730     $links[] = array(
2731     "href" => OM_ROUTE_DASHBOARD,
2732     "class" => "tableau-de-bord",
2733     "title" => _("tableau de bord"),
2734     "right" => "menu_guichet_unique_dashboard",
2735     "open" => array("index.php|[module=dashboard]",),
2736     );
2737     //
2738     $links[] = array(
2739     "class" => "category",
2740     "title" => _("nouvelle demande"),
2741     "right" => array(
2742     "demande",
2743     "demande_nouveau_dossier_ajouter",
2744     "demande_dossier_encours_ajouter", "demande_dossier_encours_tab",
2745     "demande_autre_dossier_ajouter", "demande_autre_dossier_tab",
2746     "demande_consulter","demande_tab",
2747     ),
2748     );
2749     $links[] = array(
2750     "title" => "<hr/>",
2751     "right" => array(
2752     "demande",
2753     "demande_dossier_encours_ajouter",
2754     "demande_dossier_encours_ajouter", "demande_dossier_encours_tab",
2755     ),
2756     );
2757     $links[] = array(
2758     "href" => "".OM_ROUTE_FORM."&obj=demande_nouveau_dossier&amp;action=0&amp;advs_id=&amp;tricol=&amp;valide=&amp;retour=tab&amp;new=",
2759     "class" => "nouveau-dossier",
2760     "title" => _("nouveau dossier"),
2761     "right" => array(
2762     "demande",
2763     "demande_nouveau_dossier_ajouter",
2764     ),
2765     "open" => array("index.php|demande_nouveau_dossier[module=form]",),
2766     );
2767     $links[] = array(
2768     "href" => "".OM_ROUTE_TAB."&obj=demande_dossier_encours",
2769     "class" => "dossier-existant",
2770     "title" => _("dossier en cours"),
2771     "right" => array(
2772     "demande",
2773     "demande_dossier_encours_ajouter",
2774     "demande_dossier_encours_tab",
2775     ),
2776     "open" => array("index.php|demande_dossier_encours[module=tab]", "index.php|demande_dossier_encours[module=form]"),
2777     );
2778     $links[] = array(
2779     "href" => "".OM_ROUTE_TAB."&obj=demande_autre_dossier",
2780     "class" => "autre-dossier",
2781     "title" => _("autre dossier"),
2782     "right" => array(
2783     "demande",
2784     "demande_autre_dossier_ajouter",
2785     "demande_autre_dossier_tab",
2786     ),
2787     "open" => array("index.php|demande_autre_dossier[module=tab]", "index.php|demande_autre_dossier[module=form]"),
2788     );
2789     $links[] = array(
2790     "title" => "<hr/>",
2791     "right" => array(
2792     "demande",
2793     "demande_consulter",
2794     "demande_tab"
2795     ),
2796     );
2797     $links[] = array(
2798     "href" => "".OM_ROUTE_TAB."&obj=demande",
2799     "class" => "pdf",
2800     "title" => _("recepisse"),
2801     "right" => array(
2802     "demande",
2803     "demande_consulter",
2804     "demande_tab"
2805     ),
2806     "open" => array("index.php|demande[module=tab]","index.php|demande[module=form]"),
2807     );
2808     $links[] = array(
2809     "title" => "<hr/>",
2810     "right" => array(
2811     "petitionnaire_frequent",
2812     "petitionnaire_frequent_consulter",
2813     "petitionnaire_frequent_tab"
2814     ),
2815     );
2816     $links[] = array(
2817     "href" => "".OM_ROUTE_TAB."&obj=petitionnaire_frequent",
2818     "class" => "petitionnaire_frequent",
2819     "title" => _("petitionnaire_frequent"),
2820     "right" => array(
2821     "petitionnaire_frequent",
2822     "petitionnaire_frequent_consulter",
2823     "petitionnaire_frequent_tab"
2824     ),
2825     "open" => array("index.php|petitionnaire_frequent[module=tab]","index.php|petitionnaire_frequent[module=form]"),
2826     );
2827     //
2828     $links[] = array(
2829     "class" => "category",
2830     "title" => _("affichage reglementaire"),
2831     "right" => array(
2832     "affichage_reglementaire_registre",
2833     "affichage_reglementaire_attestation",
2834     ),
2835     );
2836     $links[] = array(
2837     "title" => "<hr/>",
2838     "right" => array(
2839     "affichage_reglementaire_registre",
2840     "affichage_reglementaire_attestation",
2841     ),
2842     );
2843     $links[] = array(
2844     "href" => "".OM_ROUTE_FORM."&obj=demande_affichage_reglementaire_registre&action=110&idx=0",
2845     "class" => "affichage_reglementaire_registre",
2846     "title" => _("registre"),
2847     "right" => array(
2848     "affichage_reglementaire_registre",
2849     ),
2850     "open" => array("index.php|demande_affichage_reglementaire_registre[module=tab]", "index.php|demande_affichage_reglementaire_registre[module=form]"),
2851     );
2852     $links[] = array(
2853     "href" => "".OM_ROUTE_FORM."&obj=demande_affichage_reglementaire_attestation&action=120&idx=0",
2854     "class" => "affichage_reglementaire_attestation",
2855     "title" => _("attestation"),
2856     "right" => array(
2857     "affichage_reglementaire_attestation",
2858     ),
2859     "open" => array("index.php|demande_affichage_reglementaire_attestation[module=tab]", "index.php|demande_affichage_reglementaire_attestation[module=form]"),
2860     );
2861     //
2862     $rubrik['links'] = $links;
2863     //
2864     $menu[] = $rubrik;
2865     // }}}
2866    
2867     // {{{ Rubrique QUALIFICATION
2868     //
2869     $rubrik = array(
2870     "title" => _("Qualification"),
2871     "class" => "qualification",
2872     "right" => "qualification_menu",
2873     );
2874     //
2875     $links = array();
2876     //
2877     $links[] = array(
2878     "href" => OM_ROUTE_DASHBOARD,
2879     "class" => "tableau-de-bord",
2880     "title" => _("tableau de bord"),
2881     "right" => "menu_qualification_dashboard",
2882     "open" => array("index.php|[module=dashboard]",),
2883     );
2884    
2885     //
2886     $links[] = array(
2887     "href" => "".OM_ROUTE_TAB."&obj=dossier_qualifier_qualificateur",
2888     "class" => "dossier_qualifier_qualificateur",
2889     "title" => _("dossiers a qualifier"),
2890     "right" => array(
2891     "dossier_qualifier_qualificateur",
2892     "dossier_qualifier_qualificateur_tab",
2893     ),
2894     "open" => array("index.php|dossier_qualifier_qualificateur[module=tab]", "index.php|dossier_instruction[module=form]", ),
2895     );
2896    
2897     //
2898     $rubrik['links'] = $links;
2899     //
2900     $menu[] = $rubrik;
2901     // }}}
2902    
2903     // {{{ Rubrique INSTRUCTION
2904     //
2905     $rubrik = array(
2906     "title" => _("instruction"),
2907     "class" => "instruction",
2908     "right" => "menu_instruction",
2909     );
2910     //
2911     $links = array();
2912     //
2913     $links[] = array(
2914     "href" => OM_ROUTE_DASHBOARD,
2915     "class" => "tableau-de-bord",
2916     "title" => _("tableau de bord"),
2917     "right" => "menu_instruction_dashboard",
2918     "open" => array("index.php|[module=dashboard]",),
2919     );
2920     // Catégorie DOSSIERS D'INSTRUCTION
2921     $links[] = array(
2922     "class" => "category",
2923     "title" => _("dossiers d'instruction"),
2924     "right" => array(
2925     "dossier_instruction_mes_encours", "dossier_instruction_mes_encours_tab",
2926     "dossier_instruction_tous_encours", "dossier_instruction_tous_encours_tab",
2927     "dossier_instruction_mes_clotures", "dossier_instruction_mes_clotures_tab",
2928     "dossier_instruction_tous_clotures", "dossier_instruction_tous_clotures_tab",
2929     "dossier_instruction", "dossier_instruction_tab",
2930     "PC_modificatif", "PC_modificatif_tab",
2931     ),
2932     );
2933     $links[] = array(
2934     "title" => "<hr/>",
2935     "right" => array(
2936     "dossier_instruction_mes_encours", "dossier_instruction_mes_encours_tab",
2937     "dossier_instruction_tous_encours", "dossier_instruction_tous_encours_tab",
2938     ),
2939     );
2940     //
2941     $links[] = array(
2942     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction_mes_encours",
2943     "class" => "dossier_instruction_mes_encours",
2944     "title" => _("mes encours"),
2945     "right" => array("dossier_instruction_mes_encours", "dossier_instruction_mes_encours_tab", ),
2946     "open" => array("index.php|dossier_instruction_mes_encours[module=tab]", "index.php|dossier_instruction_mes_encours[module=form]", ),
2947     );
2948     //
2949     $links[] = array(
2950     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction_tous_encours",
2951     "class" => "dossier_instruction_tous_encours",
2952     "title" => _("tous les encours"),
2953     "right" => array("dossier_instruction_tous_encours", "dossier_instruction_tous_encours_tab", ),
2954     "open" => array("index.php|dossier_instruction_tous_encours[module=tab]", "index.php|dossier_instruction_tous_encours[module=form]", ),
2955     );
2956     //
2957     $links[] = array(
2958     "title" => "<hr/>",
2959     "right" => array(
2960     "dossier_instruction_mes_clotures", "dossier_instruction_mes_clotures_tab",
2961     "dossier_instruction_tous_clotures", "dossier_instruction_tous_clotures_tab",
2962     ),
2963     );
2964     //
2965     $links[] = array(
2966     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction_mes_clotures",
2967     "class" => "dossier_instruction_mes_clotures",
2968     "title" => _("mes clotures"),
2969     "right" => array("dossier_instruction_mes_clotures", "dossier_instruction_mes_clotures_tab", ),
2970     "open" => array("index.php|dossier_instruction_mes_clotures[module=tab]", "index.php|dossier_instruction_mes_clotures[module=form]", ),
2971     );
2972     //
2973     $links[] = array(
2974     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction_tous_clotures",
2975     "class" => "dossier_instruction_tous_clotures",
2976     "title" => _("tous les clotures"),
2977     "right" => array("dossier_instruction_tous_clotures", "dossier_instruction_tous_clotures_tab", ),
2978     "open" => array("index.php|dossier_instruction_tous_clotures[module=tab]", "index.php|dossier_instruction_tous_clotures[module=form]", ),
2979     );
2980     //
2981     $links[] = array(
2982     "title" => "<hr/>",
2983     "right" => array(
2984     "dossier_instruction", "dossier_instruction_tab",
2985     ),
2986     );
2987     //
2988     $links[] = array(
2989     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction",
2990     "class" => "dossier_instruction_recherche",
2991     "title" => _("recherche"),
2992     "right" => array("dossier_instruction", "dossier_instruction_tab", ),
2993     "open" => array("index.php|dossier_instruction[module=tab]", "index.php|dossier_instruction[module=form]", ),
2994     );
2995    
2996     // Catégorier Qualification
2997     $links[] = array(
2998     "class" => "category",
2999     "title" => _("qualification"),
3000     "right" => array("dossier_qualifier", "architecte_frequent",),
3001     );
3002     //
3003     $links[] = array(
3004     "title" => "<hr/>",
3005     "right" => array("dossier_qualifier", "architecte_frequent", ),
3006     );
3007     //
3008     $links[] = array(
3009     "href" => "".OM_ROUTE_TAB."&obj=dossier_qualifier",
3010     "class" => "dossier_qualifier",
3011     "title" => _("dossiers a qualifier"),
3012     "right" => array("dossier_qualifier", "dossier_qualifier_tab", ),
3013     "open" => array("index.php|dossier_qualifier[module=tab]", "index.php|dossier_qualifier[module=form]", ),
3014     );
3015     //
3016     $links[] = array(
3017     "href" => "".OM_ROUTE_TAB."&obj=architecte_frequent",
3018     "class" => "architecte_frequent",
3019     "title" => _("architecte_frequent"),
3020     "right" => array("architecte_frequent", "architecte_frequent_tab", ),
3021     "open" => array("index.php|architecte_frequent[module=tab]", "index.php|architecte_frequent[module=form]", ),
3022     );
3023     // Catégorie CONSULTATIONS
3024     $links[] = array(
3025     "class" => "category",
3026     "title" => _("consultations"),
3027     "right" => array(
3028     "consultation",
3029     "consultation_mes_retours",
3030     "consultation_retours_ma_division",
3031     "consultation_tous_retours",
3032     ),
3033     );
3034     $links[] = array(
3035     "title" => "<hr/>",
3036     "right" => array(
3037     "consultation",
3038     "consultation_mes_retours",
3039     "consultation_retours_ma_division",
3040     "consultation_tous_retours",
3041     ),
3042     );
3043     $links[] = array(
3044     "href" => "".OM_ROUTE_TAB."&obj=consultation_mes_retours",
3045     "class" => "consultation_mes_retours",
3046     "title" => _("Mes retours"),
3047     "right" => array(
3048     "consultation",
3049     "consultation_mes_retours",
3050     "consultation_mes_retours_tab",
3051     ),
3052     "open" => array("index.php|consultation_mes_retours[module=tab]", "index.php|consultation_mes_retours[module=form]", ),
3053     );
3054     $links[] = array(
3055     "href" => "".OM_ROUTE_TAB."&obj=consultation_retours_ma_division",
3056     "class" => "consultation_retours_ma_division",
3057     "title" => _("Retours de ma division"),
3058     "right" => array(
3059     "consultation",
3060     "consultation_retours_ma_division",
3061     "consultation_retours_ma_division_tab",
3062     ),
3063     "open" => array("index.php|consultation_retours_ma_division[module=tab]", "index.php|consultation_retours_ma_division[module=form]", ),
3064     );
3065     $links[] = array(
3066     "href" => "".OM_ROUTE_TAB."&obj=consultation_tous_retours",
3067     "class" => "consultation_tous_retours",
3068     "title" => _("Tous les retours"),
3069     "right" => array(
3070     "consultation_tous_retours",
3071     "consultation_tous_retours_tab",
3072     ),
3073     "open" => array("index.php|consultation_tous_retours[module=tab]", "index.php|consultation_tous_retours[module=form]", ),
3074     );
3075     // Catégorie MESSAGES
3076     $links[] = array(
3077     "class" => "category",
3078     "title" => _("Messages"),
3079     "right" => array(
3080     "messages",
3081     "messages_mes_retours",
3082     "messages_retours_ma_division",
3083     "messages_tous_retours",
3084     ),
3085     );
3086     //
3087     $links[] = array(
3088     "title" => "<hr/>",
3089     "right" => array(
3090     "messages",
3091     "messages_mes_retours",
3092     "messages_retours_ma_division",
3093     "messages_tous_retours",
3094     ),
3095     );
3096     //
3097     $links[] = array(
3098     "href" => "".OM_ROUTE_TAB."&obj=messages_mes_retours",
3099     "class" => "messages_mes_retours",
3100     "title" => _("Mes messages"),
3101     "right" => array(
3102     "messages",
3103     "messages_mes_retours",
3104     "messages_mes_retours_tab",
3105     ),
3106     "open" => array("index.php|messages_mes_retours[module=tab]", "index.php|messages_mes_retours[module=form]", ),
3107     );
3108     //
3109     $links[] = array(
3110     "href" => "".OM_ROUTE_TAB."&obj=messages_retours_ma_division",
3111     "class" => "messages_retours_ma_division",
3112     "title" => _("Messages de ma division"),
3113     "right" => array(
3114     "messages",
3115     "messages_retours_ma_division",
3116     "messages_retours_ma_division_tab",
3117     ),
3118     "open" => array("index.php|messages_retours_ma_division[module=tab]", "index.php|messages_retours_ma_division[module=form]", ),
3119     );
3120     //
3121     $links[] = array(
3122     "href" => "".OM_ROUTE_TAB."&obj=messages_tous_retours",
3123     "class" => "messages_tous_retours",
3124     "title" => _("Tous les messages"),
3125     "right" => array(
3126     "messages",
3127     "messages_tous_retours",
3128     "messages_tous_retours_tab",
3129     ),
3130     "open" => array("index.php|messages_tous_retours[module=tab]", "index.php|messages_tous_retours[module=form]", ),
3131     );
3132     // Catégorie COMMISSIONS
3133     $links[] = array(
3134     "class" => "category",
3135     "title" => _("commissions"),
3136     "right" => array(
3137     "commission_mes_retours",
3138     "commission_mes_retours_tab",
3139     "commission_retours_ma_division",
3140     "commission_retours_ma_division_tab",
3141     "commission_tous_retours",
3142     "commission_tous_retours_tab",
3143     ),
3144     );
3145     $links[] = array(
3146     "title" => "<hr/>",
3147     "right" => array(
3148     "commission_mes_retours",
3149     "commission_mes_retours_tab",
3150     "commission_retours_ma_division",
3151     "commission_retours_ma_division_tab",
3152     "commission_tous_retours",
3153     "commission_tous_retours_tab",
3154     ),
3155     );
3156     $links[] = array(
3157     "href" => "".OM_ROUTE_TAB."&obj=commission_mes_retours",
3158     "class" => "commission_mes_retours",
3159     "title" => _("Mes retours"),
3160     "right" => array(
3161     "commission_mes_retours",
3162     "commission_mes_retours_tab",
3163     ),
3164     "open" => array("index.php|commission_mes_retours[module=tab]", "index.php|commission_mes_retours[module=form]", ),
3165     );
3166     $links[] = array(
3167     "href" => "".OM_ROUTE_TAB."&obj=commission_retours_ma_division",
3168     "class" => "commission_retours_ma_division",
3169     "title" => _("Retours de ma division"),
3170     "right" => array(
3171     "commission_retours_ma_division",
3172     "commission_retours_ma_division_tab",
3173     ),
3174     "open" => array("index.php|commission_retours_ma_division[module=tab]", "index.php|commission_retours_ma_division[module=form]", ),
3175     );
3176     $links[] = array(
3177     "href" => "".OM_ROUTE_TAB."&obj=commission_tous_retours",
3178     "class" => "commission_tous_retours",
3179     "title" => _("Tous les retours"),
3180     "right" => array(
3181     "commission_tous_retours",
3182     "commission_tous_retours_tab",
3183     ),
3184     "open" => array("index.php|commission_tous_retours[module=tab]", "index.php|commission_tous_retours[module=form]", ),
3185     );
3186    
3187     //
3188     $rubrik['links'] = $links;
3189     //
3190     $menu[] = $rubrik;
3191     // }}}
3192    
3193     // {{{ Rubrique Contentieux
3194     //
3195     $rubrik = array(
3196     "title" => _("Contentieux"),
3197     "class" => "contentieux",
3198     "right" => "menu_contentieux",
3199     );
3200     //
3201     $links = array();
3202     //
3203     $links[] = array(
3204     "href" => OM_ROUTE_DASHBOARD,
3205     "class" => "tableau-de-bord",
3206     "title" => _("tableau de bord"),
3207     "right" => "menu_contentieux_dashboard",
3208     "open" => array("index.php|[module=dashboard]", "index.php|dossier_contentieux_contradictoire[module=tab]", "index.php|dossier_contentieux_ait[module=tab]", "index.php|dossier_contentieux_audience[module=tab]", "index.php|dossier_contentieux_clotures[module=tab]", "index.php|dossier_contentieux_inaffectes[module=tab]", "index.php|dossier_contentieux_alerte_visite[module=tab]", "index.php|dossier_contentieux_alerte_parquet[module=tab]", ),
3209     );
3210     // Catégorie Nouvelle demande
3211     $links[] = array(
3212     "class" => "category",
3213     "title" => _("Nouvelle demande"),
3214     "right" => array(
3215     "demande_nouveau_dossier_contentieux_ajouter",
3216     ),
3217     );
3218     $links[] = array(
3219     "href" => "".OM_ROUTE_FORM."&obj=demande_nouveau_dossier_contentieux&amp;action=0&amp;advs_id=&amp;tricol=&amp;valide=&amp;retour=tab&amp;new=",
3220     "class" => "nouveau-dossier",
3221     "title" => _("nouveau dossier"),
3222     "right" => array(
3223     "demande_nouveau_dossier_contentieux_ajouter",
3224     ),
3225     "open" => array("index.php|demande_nouveau_dossier_contentieux[module=form]",),
3226     );
3227     // Catégorie Recours
3228     $links[] = array(
3229     "class" => "category",
3230     "title" => _("Recours"),
3231     "right" => array(
3232     "dossier_contentieux_mes_recours", "dossier_contentieux_mes_recours_tab",
3233     "dossier_contentieux_tous_recours", "dossier_contentieux_tous_recours_tab",
3234     ),
3235     );
3236     //
3237     $links[] = array(
3238     "href" => "".OM_ROUTE_TAB."&obj=dossier_contentieux_mes_recours",
3239     "class" => "dossier_contentieux_mes_recours",
3240     "title" => _("Mes recours"),
3241     "right" => array("dossier_contentieux_mes_recours", "dossier_contentieux_mes_recours_tab", ),
3242     "open" => array("index.php|dossier_contentieux_mes_recours[module=tab]", "index.php|dossier_contentieux_mes_recours[module=form]", ),
3243     );
3244     $links[] = array(
3245     "href" => "".OM_ROUTE_TAB."&obj=dossier_contentieux_tous_recours",
3246     "class" => "dossier_contentieux_tous_recours",
3247     "title" => _("Tous les recours"),
3248     "right" => array("dossier_contentieux_tous_recours", "dossier_contentieux_tous_recours_tab", ),
3249     "open" => array("index.php|dossier_contentieux_tous_recours[module=tab]", "index.php|dossier_contentieux_tous_recours[module=form]", ),
3250     );
3251     // Catégorie Infractions
3252     $links[] = array(
3253     "class" => "category",
3254     "title" => _("Infractions"),
3255     "right" => array(
3256     "dossier_contentieux_mes_infractions", "dossier_contentieux_mes_infractions_tab",
3257     "dossier_contentieux_toutes_infractions", "dossier_contentieux_toutes_infractions_tab",
3258     ),
3259     );
3260     //
3261     $links[] = array(
3262     "href" => "".OM_ROUTE_TAB."&obj=dossier_contentieux_mes_infractions",
3263     "class" => "dossier_contentieux_mes_infractions",
3264     "title" => _("Mes infractions"),
3265     "right" => array("dossier_contentieux_mes_infractions", "dossier_contentieux_mes_infractions_tab", ),
3266     "open" => array("index.php|dossier_contentieux_mes_infractions[module=tab]", "index.php|dossier_contentieux_mes_infractions[module=form]", ),
3267     );
3268     //
3269     $links[] = array(
3270     "href" => "".OM_ROUTE_TAB."&obj=dossier_contentieux_toutes_infractions",
3271     "class" => "dossier_contentieux_toutes_infractions",
3272     "title" => _("Toutes les infractions"),
3273     "right" => array("dossier_contentieux_toutes_infractions", "dossier_contentieux_toutes_infractions_tab", ),
3274     "open" => array("index.php|dossier_contentieux_toutes_infractions[module=tab]", "index.php|dossier_contentieux_toutes_infractions[module=form]", ),
3275     );
3276     // Catégorie MESSAGES
3277     $links[] = array(
3278     "class" => "category",
3279     "title" => _("Messages"),
3280     "right" => array(
3281     "messages_contentieux",
3282     "messages_contentieux_mes_retours",
3283     "messages_contentieux_retours_ma_division",
3284     "messages_contentieux_tous_retours",
3285     ),
3286     );
3287     //
3288     $links[] = array(
3289     "title" => "<hr/>",
3290     "right" => array(
3291     "messages_contentieux",
3292     "messages_contentieux_mes_retours",
3293     "messages_contentieux_retours_ma_division",
3294     "messages_contentieux_tous_retours",
3295     ),
3296     );
3297     //
3298     $links[] = array(
3299     "href" => "".OM_ROUTE_TAB."&obj=messages_contentieux_mes_retours",
3300     "class" => "messages_contentieux_mes_retours",
3301     "title" => _("Mes messages"),
3302     "right" => array(
3303     "messages_contentieux",
3304     "messages_contentieux_mes_retours",
3305     "messages_contentieux_mes_retours_tab",
3306     ),
3307     "open" => array("index.php|messages_contentieux_mes_retours[module=tab]", "index.php|messages_contentieux_mes_retours[module=form]", ),
3308     );
3309     //
3310     $links[] = array(
3311     "href" => "".OM_ROUTE_TAB."&obj=messages_contentieux_retours_ma_division",
3312     "class" => "messages_contentieux_retours_ma_division",
3313     "title" => _("Messages de ma division"),
3314     "right" => array(
3315     "messages_contentieux",
3316     "messages_contentieux_retours_ma_division",
3317     "messages_contentieux_retours_ma_division_tab",
3318     ),
3319     "open" => array("index.php|messages_contentieux_retours_ma_division[module=tab]", "index.php|messages_contentieux_retours_ma_division[module=form]", ),
3320     );
3321     //
3322     $links[] = array(
3323     "href" => "".OM_ROUTE_TAB."&obj=messages_contentieux_tous_retours",
3324     "class" => "messages_contentieux_tous_retours",
3325     "title" => _("Tous les messages"),
3326     "right" => array(
3327     "messages_contentieux",
3328     "messages_contentieux_tous_retours",
3329     "messages_contentieux_tous_retours_tab",
3330     ),
3331     "open" => array("index.php|messages_contentieux_tous_retours[module=tab]", "index.php|messages_contentieux_tous_retours[module=form]", ),
3332     );
3333    
3334    
3335     //
3336     $rubrik['links'] = $links;
3337     //
3338     $menu[] = $rubrik;
3339     // }}}
3340    
3341     // {{{ Rubrique SUIVI
3342     //
3343     $rubrik = array(
3344     "title" => _("Suivi"),
3345     "class" => "suivi",
3346     "right" => "menu_suivi",
3347     );
3348     //
3349     $links = array();
3350     //
3351     $links[] = array(
3352     "href" => OM_ROUTE_DASHBOARD,
3353     "class" => "tableau-de-bord",
3354     "title" => _("tableau de bord"),
3355     "right" => "menu_suivi_dashboard",
3356     "open" => array("index.php|[module=dashboard]",),
3357     );
3358     $links[] = array(
3359     "class" => "category",
3360     "title" => _("suivi des pieces"),
3361     "right" => array(
3362     "instruction_suivi_retours_de_consultation", "instruction_suivi_mise_a_jour_des_dates",
3363     "instruction_suivi_envoi_lettre_rar", "instruction_suivi_bordereaux",
3364     "instruction_suivi_retours_de_consultation_consulter", "instruction_suivi_mise_a_jour_des_dates_consulter",
3365     "instruction_suivi_envoi_lettre_rar_consulter", "instruction_suivi_bordereaux_consulter",
3366     ),
3367     );
3368     //
3369     $links[] = array(
3370     "title" => "<hr/>",
3371     "right" => array(
3372     "instruction_suivi_retours_de_consultation", "instruction_suivi_mise_a_jour_des_dates",
3373     "instruction_suivi_envoi_lettre_rar", "instruction_suivi_bordereaux",
3374     "instruction_suivi_retours_de_consultation_consulter", "instruction_suivi_mise_a_jour_des_dates_consulter",
3375     "instruction_suivi_envoi_lettre_rar_consulter", "instruction_suivi_bordereaux_consulter",
3376     ),
3377     );
3378     //
3379     $links[] = array(
3380     "title" => "<hr/>",
3381     "right" => array(
3382     "instruction_suivi_mise_a_jour_des_dates", "instruction_suivi_mise_a_jour_des_dates_consulter",
3383     ),
3384     );
3385     //
3386     $links[] = array(
3387     "href" => "".OM_ROUTE_FORM."&obj=instruction_suivi_mise_a_jour_des_dates&action=170&idx=0",
3388     "class" => "suivi_mise_a_jour_des_dates",
3389     "title" => _("Mise a jour des dates"),
3390     "right" => array("instruction_suivi_mise_a_jour_des_dates", "instruction_suivi_mise_a_jour_des_dates_consulter", ),
3391     "open" => array("index.php|instruction_suivi_mise_a_jour_des_dates[module=tab]", "index.php|instruction_suivi_mise_a_jour_des_dates[module=form]"),
3392     );
3393     //
3394     $links[] = array(
3395     "title" => "<hr/>",
3396     "right" => array(
3397     "instruction_suivi_envoi_lettre_rar", "instruction_suivi_envoi_lettre_rar_consulter",
3398     ),
3399     );
3400     //
3401     $links[] = array(
3402     "href" => "".OM_ROUTE_FORM."&obj=instruction_suivi_envoi_lettre_rar&action=160&idx=0",
3403     "class" => "envoi_lettre_rar",
3404 softime 8989 "title" => _("envoi lettre AR"),
3405 softime 8329 "right" => array("instruction_suivi_envoi_lettre_rar", "instruction_suivi_envoi_lettre_rar_consulter", ),
3406     "open" => array("index.php|instruction_suivi_envoi_lettre_rar[module=tab]", "index.php|instruction_suivi_envoi_lettre_rar[module=form]"),
3407     );
3408     //
3409     $links[] = array(
3410     "title" => "<hr/>",
3411     "right" => array(
3412     "instruction_suivi_bordereaux", "instruction_suivi_bordereaux_consulter",
3413     ),
3414     );
3415     //
3416     $links[] = array(
3417     "href" => "".OM_ROUTE_FORM."&obj=instruction_suivi_bordereaux&action=150&idx=0",
3418     "class" => "bordereaux",
3419     "title" => _("Bordereaux"),
3420     "right" => array("instruction_suivi_bordereaux", "instruction_suivi_bordereaux_consulter", ),
3421     "open" => array("index.php|instruction_suivi_bordereaux[module=tab]", "index.php|instruction_suivi_bordereaux[module=form]"),
3422     );
3423     //
3424     $links[] = array(
3425     "href" => "".OM_ROUTE_FORM."&obj=bordereau_envoi_maire&action=190&idx=0",
3426     "class" => "bordereau_envoi_maire",
3427     "title" => _("Bordereau d'envoi au maire"),
3428     "right" => array("instruction_bordereau_envoi_maire","bordereau_envoi_maire"),
3429     "open" => array("index.php|bordereau_envoi_maire[module=form]",),
3430     );
3431     //
3432     $links[] = array(
3433     "class" => "category",
3434     "title" => _("Demandes d'avis"),
3435     "right" => array(
3436     "consultation_suivi_mise_a_jour_des_dates",
3437     "consultation_suivi_retours_de_consultation",
3438     ),
3439     );
3440     //
3441     $links[] = array(
3442     "href" => "".OM_ROUTE_FORM."&obj=consultation&idx=0&action=110",
3443     "class" => "demandes_avis_mise_a_jour_des_dates",
3444     "title" => _("Mise a jour des dates"),
3445     "right" => array("consultation_suivi_mise_a_jour_des_dates", ),
3446     "open" => array("index.php|consultation[module=form][action=110]"),
3447     );
3448     //
3449     $links[] = array(
3450     "href" => "".OM_ROUTE_FORM."&obj=consultation&idx=0&action=120",
3451     "class" => "consultation-retour",
3452     "title" => _("retours de consultation"),
3453     "right" => array("consultation_suivi_retours_de_consultation", ),
3454     "open" => array("index.php|consultation[module=form][action=120]", "index.php|consultation[module=form][action=100]", ),
3455     );
3456     // Catégorie COMMISSIONS
3457     $links[] = array(
3458     "class" => "category",
3459     "title" => _("commissions"),
3460     "right" => array(
3461     "commission",
3462     "commission_tab",
3463     "commission_demandes_passage",
3464     "commission_demandes_passage_tab",
3465     ),
3466     );
3467     //
3468     $links[] = array(
3469     "title" => "<hr/>",
3470     "right" => array(
3471     "commission",
3472     "commission_tab",
3473     "commission_demandes_passage",
3474     "commission_demandes_passage_tab",
3475     ),
3476     );
3477     //
3478     $links[] = array(
3479     "href" => "".OM_ROUTE_TAB."&obj=commission",
3480     "class" => "commissions",
3481     "title" => _("gestion"),
3482     "right" => array(
3483     "commission",
3484     ),
3485     "open" => array("index.php|commission[module=tab]", "index.php|commission[module=form]", ),
3486     );
3487     //
3488     $links[] = array(
3489     "href" => "".OM_ROUTE_TAB."&obj=commission_demandes_passage",
3490     "class" => "commissions-demande-passage",
3491     "title" => _("demandes"),
3492     "right" => array(
3493     "commission",
3494     "commission_demandes_passage",
3495     ),
3496     "open" => array("index.php|commission_demandes_passage[module=tab]", "index.php|commission_demandes_passage[module=form]", ),
3497     );
3498     //
3499     $rubrik['links'] = $links;
3500     //
3501     $menu[] = $rubrik;
3502     // }}}
3503    
3504     // {{{ Rubrique DEMANDES D'AVIS
3505     //
3506     $rubrik = array(
3507     "title" => _("Demandes d'avis"),
3508     "class" => "demande_avis",
3509     "right" => "menu_demande_avis",
3510     );
3511     //
3512     $links = array();
3513     //
3514     $links[] = array(
3515     "href" => OM_ROUTE_DASHBOARD,
3516     "class" => "tableau-de-bord",
3517     "title" => _("tableau de bord"),
3518     "right" => "menu_demande_avis_dashboard",
3519     "open" => array("index.php|[module=dashboard]",),
3520     );
3521     //
3522     $links[] = array(
3523     "title" => "<hr/>",
3524     "right" => array(
3525     "demande_avis_encours", "demande_avis_encours_tab",
3526     "demande_avis_passee", "demande_avis_passee_tab",
3527     "demande_avis", "demande_avis_tab",
3528     ),
3529     );
3530     //
3531     $links[] = array(
3532     "href" => "".OM_ROUTE_TAB."&obj=demande_avis_encours",
3533     "class" => "demande_avis_encours",
3534     "title" => _("Demandes en cours"),
3535     "right" => array("demande_avis_encours", "demande_avis_encours_tab", ),
3536     "open" => array("index.php|demande_avis_encours[module=tab]", "index.php|demande_avis_encours[module=form]", ),
3537     );
3538    
3539     $links[] = array(
3540     "href" => "".OM_ROUTE_TAB."&obj=demande_avis_passee",
3541     "class" => "demande_avis_passee",
3542     "title" => _("Demandes passees"),
3543     "right" => array("demande_avis_passee", "demande_avis_passee_tab", ),
3544     "open" => array("index.php|demande_avis_passee[module=tab]", "index.php|demande_avis_passee[module=form]", ),
3545     );
3546    
3547     $links[] = array(
3548     "href" => "".OM_ROUTE_TAB."&obj=demande_avis",
3549     "class" => "demande_avis",
3550     "title" => _("Exports"),
3551     "right" => array("demande_avis", "demande_avis_tab", ),
3552     "open" => array("index.php|demande_avis[module=tab]", "index.php|demande_avis[module=form]", ),
3553     );
3554    
3555     //
3556     $rubrik['links'] = $links;
3557     //
3558     $menu[] = $rubrik;
3559     // }}}
3560    
3561    
3562 softime 9245 // {{{ Rubrique NUMERISATION
3563     // Condition d'affichage de la rubrique
3564     if (isset($_SESSION['collectivite']) === true
3565     && $this->is_option_suivi_numerisation_enabled() === true) {
3566     //
3567     $rubrik = array(
3568     "title" => __("numerisation"),
3569     "class" => "numerisation",
3570     );
3571     //
3572     $links = array();
3573     //
3574     // --->
3575     $links[] = array(
3576     "class" => "category",
3577     "title" => __("traitement d'un lot"),
3578     "right" => array("num_dossier", "num_dossier_recuperation",
3579     "num_bordereau", "num_bordereau_tab", ) ,
3580     );
3581     //
3582     $links[] = array(
3583     "title" => "<hr/>",
3584     "right" => array("num_dossier_recuperation",
3585     "num_bordereau", "num_bordereau_tab", ) ,
3586     );
3587     //
3588     $links[] = array(
3589     "href" => OM_ROUTE_FORM."&obj=num_dossier_recuperation&idx=0&action=4",
3590     "class" => "num_dossier_recuperation",
3591     "title" => __("récupération du suivi des dossiers"),
3592     "right" => array( "num_dossier_recuperation", ) ,
3593     "open" => array( "index.php|num_dossier_recuperation[module=form]", ),
3594     );
3595     //
3596     $links[] = array(
3597     "title" => "<hr/>",
3598     "right" => array( "num_bordereau", "num_bordereau_tab", ) ,
3599     );
3600     //
3601     $links[] = array(
3602     "href" => OM_ROUTE_TAB."&obj=num_bordereau",
3603     "class" => "num_bordereau",
3604     "title" => __("tous les bordereaux"),
3605     "right" => array( "num_bordereau", "num_bordereau_tab", ),
3606     "open" => array("index.php|num_bordereau[module=tab]", "index.php|num_bordereau[module=form]", ),
3607     );
3608    
3609     //
3610     // --->
3611     $links[] = array(
3612     "class" => "category",
3613     "title" => __("suivi dossier"),
3614     "right" => array("num_dossier_recuperation",
3615     "num_dossier", "num_dossier_tab",
3616     "num_dossier_a_attribuer", "num_dossier_a_attribuer_tab",
3617     "num_dossier_a_numeriser", "num_dossier_a_numeriser_tab",
3618     "num_dossier_traite", "num_dossier_traite_tab",
3619     ) ,
3620     );
3621     //
3622     $links[] = array(
3623     "title" => "<hr/>",
3624     "right" => array("num_dossier_recuperation",
3625     "num_dossier", "num_dossier_tab",
3626     "num_dossier_a_attribuer", "num_dossier_a_attribuer_tab",
3627     "num_dossier_a_numeriser", "num_dossier_a_numeriser_tab",
3628     "num_dossier_traite", "num_dossier_traite_tab",
3629     ) ,
3630     );
3631     //
3632     $links[] = array(
3633     "href" => OM_ROUTE_TAB."&obj=num_dossier_a_attribuer",
3634     "class" => "num_dossier_a_attribuer",
3635     "title" => __("num_dossier_a_attribuer"),
3636     "right" => array("num_dossier", "num_dossier_a_attribuer", "num_dossier_a_attribuer_tab",),
3637     "open" => array("index.php|num_dossier_a_attribuer[module=tab]","index.php|num_dossier_a_attribuer[module=form]", ),
3638     );
3639     //
3640     $links[] = array(
3641     "href" => OM_ROUTE_TAB."&obj=num_dossier_a_numeriser",
3642     "class" => "num_dossier_a_numeriser",
3643     "title" => __("num_dossier_a_numeriser"),
3644     "right" => array("num_dossier", "num_dossier_a_numeriser", "num_dossier_a_numeriser_tab",),
3645     "open" => array("index.php|num_dossier_a_numeriser[module=tab]","index.php|num_dossier_a_numeriser[module=form]", ),
3646     );
3647     //
3648     $links[] = array(
3649     "href" => OM_ROUTE_TAB."&obj=num_dossier_traite",
3650     "class" => "num_dossier_traite",
3651     "title" => __("num_dossier_traite"),
3652     "right" => array("num_dossier", "num_dossier_traite", "num_dossier_traite_tab",),
3653     "open" => array("index.php|num_dossier_traite[module=tab]","index.php|num_dossier_traite[module=form]", ),
3654     );
3655     //
3656     $links[] = array(
3657     "title" => "<hr/>",
3658     "right" => array( "num_dossier", "num_dossier_tab",) ,
3659     );
3660     //
3661     $links[] = array(
3662     "href" => OM_ROUTE_TAB."&obj=num_dossier",
3663     "class" => "num_dossier",
3664     "title" => __("tous les dossiers"),
3665     "right" => array("num_dossier", "num_dossier_tab",),
3666     "open" => array("index.php|num_dossier[module=tab]", "index.php|num_dossier[module=form]", ),
3667     );
3668    
3669     //
3670     $rubrik['links'] = $links;
3671     //
3672     $menu["menu-rubrik-numerisation"] = $rubrik;
3673     // }}}
3674     }
3675    
3676    
3677 softime 8329 // Commentaire de la rubrique EXPORT qui n'est pas prévue d'être opérationnelle
3678     // dans cette version
3679     // {{{ Rubrique EXPORT
3680     //
3681     $rubrik = array(
3682     "title" => _("export / import"),
3683     "class" => "edition",
3684     "right" => "menu_export",
3685     );
3686     //
3687     $links = array();
3688    
3689     //
3690     $links[] = array(
3691     "href" => "".OM_ROUTE_FORM."&obj=sitadel&action=6&idx=0",
3692     "class" => "sitadel",
3693     "title" => _("export sitadel"),
3694     "right" => "export_sitadel",
3695     "open" => "index.php|sitadel[module=form]",
3696     );
3697     //
3698     $links[] = array(
3699     "href" => "../app/versement_archives.php",
3700     "class" => "versement_archives",
3701     "title" => _("versement aux archives"),
3702     "right" => "versement_archives",
3703     "open" => "versement_archives.php|",
3704     );
3705     //
3706     $links[] = array(
3707     "href" => "../app/reqmo_pilot.php",
3708     "class" => "reqmo",
3709     "title" => _("statistiques a la demande"),
3710     "right" => "reqmo_pilot",
3711     "open" => "reqmo_pilot.php|",
3712     );
3713     //
3714 softime 9245 $links[] = array(
3715     "href" => OM_ROUTE_MODULE_REQMO,
3716     "class" => "reqmo",
3717     "title" => __("requetes memorisees"),
3718     "right" => "reqmo",
3719     "open" => array(
3720     "reqmo.php|",
3721     "index.php|[module=reqmo]",
3722     ),
3723     );
3724     //
3725 softime 8329 $rubrik['links'] = $links;
3726     //
3727     $menu[] = $rubrik;
3728     // }}}
3729    
3730    
3731     // {{{ Rubrique PARAMETRAGE
3732     //
3733     $rubrik = array(
3734     "title" => _("parametrage dossiers"),
3735     "class" => "parametrage-dossier",
3736     "right" => "menu_parametrage",
3737     );
3738     //
3739     $links = array();
3740     //
3741     $links[] = array(
3742     "class" => "category",
3743     "title" => _("dossiers"),
3744     "right" => array(
3745     "dossier_autorisation_type", "dossier_autorisation_type_tab",
3746     "dossier_autorisation_type_detaille",
3747     "dossier_autorisation_type_detaille_tab", "dossier_instruction_type",
3748     "dossier_instruction_type_tab", "cerfa", "cerfa_tab",
3749     ),
3750     );
3751     //
3752     $links[] = array(
3753     "title" => "<hr/>",
3754     "right" => array(
3755     "cerfa", "cerfa_tab",
3756     ),
3757     );
3758     //
3759     $links[] = array(
3760     "href" => "".OM_ROUTE_TAB."&obj=cerfa",
3761     "class" => "cerfa",
3762     "title" => _("cerfa"),
3763     "right" => array("cerfa", "cerfa_tab", ),
3764     "open" => array("index.php|cerfa[module=tab]", "index.php|cerfa[module=form]", ),
3765     );
3766     //
3767     $links[] = array(
3768     "title" => "<hr/>",
3769     "right" => array(
3770     "dossier_autorisation_type", "dossier_autorisation_type_tab",
3771     "dossier_autorisation_type_detaille",
3772     "dossier_autorisation_type_detaille_tab", "dossier_instruction_type",
3773     "dossier_instruction_type_tab",
3774     ),
3775     );
3776     //
3777     $links[] = array(
3778     "href" => "".OM_ROUTE_TAB."&obj=dossier_autorisation_type",
3779     "class" => "dossier_autorisation_type",
3780     "title" => _("type DA"),
3781     "right" => array("dossier_autorisation_type", "dossier_autorisation_type_tab", ),
3782     "open" => array("index.php|dossier_autorisation_type[module=tab]", "index.php|dossier_autorisation_type[module=form]", ),
3783     );
3784     //
3785     $links[] = array(
3786     "href" => "".OM_ROUTE_TAB."&obj=dossier_autorisation_type_detaille",
3787     "class" => "dossier_autorisation_type_detaille",
3788     "title" => _("type DA detaille"),
3789     "right" => array("dossier_autorisation_type_detaille", "dossier_autorisation_type_detaille_tab", ),
3790     "open" => array("index.php|dossier_autorisation_type_detaille[module=tab]", "index.php|dossier_autorisation_type_detaille[module=form]", ),
3791     );
3792     //
3793     $links[] = array(
3794     "href" => "".OM_ROUTE_TAB."&obj=dossier_instruction_type",
3795     "class" => "dossier_instruction_type",
3796     "title" => _("type DI"),
3797     "right" => array("dossier_instruction_type", "dossier_instruction_type_tab", ),
3798     "open" => array("index.php|dossier_instruction_type[module=tab]", "index.php|dossier_instruction_type[module=form]", ),
3799     );
3800     //
3801     $links[] = array(
3802     "title" => "<hr/>",
3803     "right" => array(
3804     "contrainte", "contrainte_tab",
3805     "contrainte_souscategorie", "contrainte_souscategorie_tab",
3806     "contrainte_categorie", "contrainte_categorie_tab"
3807     ),
3808     );
3809     //
3810     $links[] = array(
3811     "href" => "".OM_ROUTE_TAB."&obj=contrainte",
3812     "class" => "contrainte",
3813     "title" => _("contrainte"),
3814     "right" => array("contrainte", "contrainte_tab", ),
3815     "open" => array(
3816     "index.php|contrainte[module=tab]",
3817     "index.php|contrainte[module=form][action=0]",
3818     "index.php|contrainte[module=form][action=1]",
3819     "index.php|contrainte[module=form][action=2]",
3820     "index.php|contrainte[module=form][action=3]",
3821     ),
3822     );
3823     //
3824     $links[] = array(
3825     "class" => "category",
3826     "title" => _("demandes"),
3827     "right" => array(
3828     "demande_type",
3829     "demande_type_tab", "demande_nature", "demande_nature_tab",
3830     ),
3831     );
3832     //
3833     $links[] = array(
3834     "title" => "<hr/>",
3835     "right" => array(
3836     "demande_type",
3837     "demande_type_tab", "demande_nature", "demande_nature_tab",
3838     ),
3839     );
3840     //
3841     $links[] = array(
3842     "href" => "".OM_ROUTE_TAB."&obj=demande_nature",
3843     "class" => "demande_nature",
3844     "title" => _("nature"),
3845     "right" => array("demande_nature", "demande_nature_tab", ),
3846     "open" => array("index.php|demande_nature[module=tab]", "index.php|demande_nature[module=form]", ),
3847     );
3848     //
3849     $links[] = array(
3850     "href" => "".OM_ROUTE_TAB."&obj=demande_type",
3851     "class" => "demande_type",
3852     "title" => _("type"),
3853     "right" => array("demande_type", "demande_type_tab",),
3854     "open" => array("index.php|demande_type[module=tab]", "index.php|demande_type[module=form]", ),
3855     );
3856     //
3857     $links[] = array(
3858     "class" => "category",
3859     "title" => _("workflows"),
3860     "right" => array(
3861     "workflows",
3862     "action", "action_tab", "etat",
3863     "etat_tab", "evenement", "evenement_tab", "bible", "bible_tab", "avis_decision",
3864     "avis_decision_tab", "avis_consultation", "avis_consultation_tab",
3865 softime 10573 "avis_decision_type", "avis_decision_type_tab",
3866     "avis_decision_nature", "avis_decision_nature_tab",
3867 softime 8329 ),
3868     );
3869 softime 10573
3870 softime 8329 //
3871     $links[] = array(
3872     "title" => "<hr/>",
3873     "right" => array(
3874     "workflows",
3875     "action", "action_tab", "etat",
3876     "etat_tab", "evenement", "evenement_tab", "bible", "bible_tab", "avis_decision",
3877     "avis_decision_tab", "avis_consultation", "avis_consultation_tab",
3878 softime 10573 "avis_decision_type", "avis_decision_type_tab",
3879     "avis_decision_nature", "avis_decision_nature_tab",
3880 softime 8329 ),
3881     );
3882     //
3883     $links[] = array(
3884     "href" => "../app/workflows.php",
3885     "class" => "workflows",
3886     "title" => _("workflows"),
3887     "right" => array("workflows", ),
3888     "open" => array("workflows.php|", ),
3889     );
3890     //
3891     $links[] = array(
3892     "title" => "<hr/>",
3893     "right" => array(
3894     "evenement", "evenement_tab",
3895     ),
3896     );
3897     //
3898     $links[] = array(
3899     "href" => "".OM_ROUTE_TAB."&obj=evenement",
3900     "class" => "evenement",
3901     "title" => _("evenement"),
3902     "right" => array("evenement", "evenement_tab", ),
3903     "open" => array("index.php|evenement[module=tab]", "index.php|evenement[module=form]", ),
3904     );
3905     //
3906     $links[] = array(
3907     "title" => "<hr/>",
3908     "right" => array(
3909     "action", "action_tab", "etat",
3910     "etat_tab", "avis_decision",
3911 softime 10573 "avis_decision_tab", "avis_decision_type", "avis_decision_type_tab",
3912     "avis_decision_nature", "avis_decision_nature_tab",
3913 softime 8329 ),
3914     );
3915     //
3916     $links[] = array(
3917     "href" => "".OM_ROUTE_TAB."&obj=etat",
3918     "class" => "workflow-etat",
3919     "title" => _("etat"),
3920     "right" => array("etat", "etat_tab", ),
3921     "open" => array("index.php|etat[module=tab]", "index.php|etat[module=form]", ),
3922     );
3923     //
3924     $links[] = array(
3925     "href" => "".OM_ROUTE_TAB."&obj=avis_decision",
3926     "class" => "avis_decision",
3927     "title" => _("avis decision"),
3928     "right" => array("avis_decision", "avis_decision_tab", ),
3929     "open" => array("index.php|avis_decision[module=tab]", "index.php|avis_decision[module=form]", ),
3930     );
3931     //
3932     $links[] = array(
3933 softime 10573 "href" => "".OM_ROUTE_TAB."&obj=avis_decision_type",
3934     "class" => "avis_decision_type",
3935     "title" => __("avis_decision_type"),
3936     "right" => array("avis_decision_type", "avis_decision_type_tab", ),
3937     "open" => array("index.php|avis_decision_type[module=tab]", "index.php|avis_decision_type[module=form]", ),
3938     );
3939     //
3940     $links[] = array(
3941     "href" => "".OM_ROUTE_TAB."&obj=avis_decision_nature",
3942     "class" => "avis_decision_nature",
3943     "title" => __("avis_decision_nature"),
3944     "right" => array("avis_decision_nature", "avis_decision_nature_tab", ),
3945     "open" => array("index.php|avis_decision_nature[module=tab]", "index.php|avis_decision_nature[module=form]", ),
3946     );
3947     //
3948     $links[] = array(
3949 softime 8329 "href" => "".OM_ROUTE_TAB."&obj=action",
3950     "class" => "action",
3951     "title" => _("action"),
3952     "right" => array("action", "action_tab", ),
3953     "open" => array("index.php|action[module=tab]", "index.php|action[module=form]", ),
3954     );
3955     //
3956     $links[] = array(
3957     "title" => "<hr/>",
3958     "right" => array(
3959     "bible", "bible_tab",
3960     ),
3961     );
3962     //
3963     $links[] = array(
3964     "href" => "".OM_ROUTE_TAB."&obj=bible",
3965     "class" => "bible",
3966     "title" => _("bible"),
3967     "right" => array("bible", "bible_tab", ),
3968     "open" => array("index.php|bible[module=tab]", "index.php|bible[module=form]", ),
3969     );
3970     //
3971     $links[] = array(
3972     "class" => "category",
3973     "title" => _("editions"),
3974     "right" => array(
3975     "om_etat", "om_etat_tab", "om_sousetat", "om_sousetat_tab",
3976     "om_lettretype", "om_lettretype_tab", "om_requete", "om_requete_tab",
3977     "om_logo", "om_logo_tab",
3978     ),
3979     );
3980     //
3981     $links[] = array(
3982     "title" => "<hr/>",
3983     "right" => array(
3984     "om_etat", "om_etat_tab", "om_lettretype", "om_lettretype_tab",
3985     ),
3986     );
3987     //
3988     $links[] = array(
3989     "href" => "".OM_ROUTE_TAB."&obj=om_etat",
3990     "class" => "om_etat",
3991     "title" => _("om_etat"),
3992     "right" => array("om_etat", "om_etat_tab", ),
3993     "open" => array("index.php|om_etat[module=tab]", "index.php|om_etat[module=form]", ),
3994     );
3995     //
3996     $links[] = array(
3997     "href" => "".OM_ROUTE_TAB."&obj=om_lettretype",
3998     "class" => "om_lettretype",
3999     "title" => _("om_lettretype"),
4000     "right" => array("om_lettretype", "om_lettretype_tab"),
4001     "open" => array("index.php|om_lettretype[module=tab]", "index.php|om_lettretype[module=form]", ),
4002     );
4003     //
4004     $links[] = array(
4005     "title" => "<hr/>",
4006     "right" => array(
4007     "om_logo", "om_logo_tab",
4008     ),
4009     );
4010     //
4011     $links[] = array(
4012     "href" => "".OM_ROUTE_TAB."&obj=om_logo",
4013     "class" => "om_logo",
4014     "title" => _("om_logo"),
4015     "right" => array("om_logo", "om_logo_tab", ),
4016     "open" => array("index.php|om_logo[module=tab]", "index.php|om_logo[module=form]", ),
4017     );
4018     //
4019     $rubrik['links'] = $links;
4020     //
4021     $menu[] = $rubrik;
4022     // }}}
4023    
4024     // {{{ Rubrique PARAMETRAGE
4025     //
4026     $rubrik = array(
4027     "title" => _("parametrage"),
4028     "class" => "parametrage",
4029     "right" => "menu_parametrage",
4030     );
4031     //
4032     $links = array();
4033     //
4034     $links[] = array(
4035     "href" => "".OM_ROUTE_TAB."&obj=civilite",
4036     "class" => "civilite",
4037     "title" => _("civilite"),
4038     "right" => array("civilite", "civilite_tab", ),
4039     "open" => array("index.php|civilite[module=tab]", "index.php|civilite[module=form]", ),
4040     );
4041     //
4042     $links[] = array(
4043     "href" => "".OM_ROUTE_TAB."&obj=arrondissement",
4044     "class" => "arrondissement",
4045     "title" => _("arrondissement"),
4046     "right" => array("arrondissement", "arrondissement_tab", ),
4047     "open" => array("index.php|arrondissement[module=tab]", "index.php|arrondissement[module=form]", ),
4048     );
4049     //
4050     $links[] = array(
4051     "href" => "".OM_ROUTE_TAB."&obj=quartier",
4052     "class" => "quartier",
4053     "title" => _("quartier"),
4054     "right" => array("quartier", "quartier_tab", ),
4055     "open" => array("index.php|quartier[module=tab]", "index.php|quartier[module=form]", ),
4056     );
4057     //
4058     $links[] = array(
4059     "class" => "category",
4060     "title" => _("Organisation"),
4061     "right" => array(
4062     "direction", "direction_tab", "division", "division_tab", "instructeur_qualite",
4063     "instructeur_qualite_tab", "instructeur", "instructeur_tab", "groupe",
4064     "groupe_tab", "genre", "genre_tab", "signataire_arrete", "signataire_arrete_tab",
4065     "taxe_amenagement_tab", "taxe_amenagement",
4066     ),
4067     );
4068     $links[] = array(
4069     "title" => "<hr/>",
4070     "right" => array(
4071     "direction", "direction_tab", "division", "division_tab", "instructeur_qualite",
4072     "instructeur_qualite_tab", "instructeur", "instructeur_tab", "groupe",
4073     "groupe_tab", "genre", "genre_tab", "signataire_arrete", "signataire_arrete_tab",
4074     "taxe_amenagement_tab", "taxe_amenagement",
4075     ),
4076     );
4077     //
4078     $links[] = array(
4079     "href" => "".OM_ROUTE_TAB."&obj=genre",
4080     "class" => "genre",
4081     "title" => _("genre"),
4082     "right" => array("genre", "genre_tab", ),
4083     "open" => array("index.php|genre[module=tab]", "index.php|genre[module=form]", ),
4084     );
4085     //
4086     $links[] = array(
4087     "href" => "".OM_ROUTE_TAB."&obj=groupe",
4088     "class" => "groupe",
4089     "title" => _("groupe"),
4090     "right" => array("groupe", "groupe_tab", ),
4091     "open" => array("index.php|groupe[module=tab]", "index.php|groupe[module=form]", ),
4092     );
4093     //
4094     $links[] = array(
4095     "href" => "".OM_ROUTE_TAB."&obj=direction",
4096     "class" => "direction",
4097     "title" => _("direction"),
4098     "right" => array("direction", "direction_tab", ),
4099     "open" => array("index.php|direction[module=tab]", "index.php|direction[module=form]", ),
4100     );
4101     //
4102     $links[] = array(
4103     "href" => "".OM_ROUTE_TAB."&obj=division",
4104     "class" => "division",
4105     "title" => _("division"),
4106     "right" => array("division", "division_tab", ),
4107     "open" => array("index.php|division[module=tab]", "index.php|division[module=form]", ),
4108     );
4109     //
4110     $links[] = array(
4111     "href" => "".OM_ROUTE_TAB."&obj=instructeur_qualite",
4112     "class" => "instructeur_qualite",
4113     "title" => _("instructeur_qualite"),
4114     "right" => array("instructeur_qualite", "instructeur_qualite_tab", ),
4115     "open" => array("index.php|instructeur_qualite[module=tab]", "index.php|instructeur_qualite[module=form]", ),
4116     );
4117     //
4118     $links[] = array(
4119     "href" => "".OM_ROUTE_TAB."&obj=instructeur",
4120     "class" => "instructeur",
4121     "title" => _("instructeur"),
4122     "right" => array("instructeur", "instructeur_tab", ),
4123     "open" => array("index.php|instructeur[module=tab]", "index.php|instructeur[module=form]", ),
4124     );
4125     //
4126     $links[] = array(
4127     "href" => "".OM_ROUTE_TAB."&obj=signataire_arrete",
4128     "class" => "signataire_arrete",
4129     "title" => _("signataire arrete"),
4130     "right" => array("signataire_arrete", "signataire_arrete", ),
4131     "open" => array("index.php|signataire_arrete[module=tab]", "index.php|signataire_arrete[module=form]", ),
4132     );
4133     //
4134     $links[] = array(
4135     "href" => "".OM_ROUTE_TAB."&obj=taxe_amenagement",
4136     "class" => "taxe_amenagement",
4137     "title" => _("taxes"),
4138     "right" => array("taxe_amenagement", "taxe_amenagement_tab", ),
4139     "open" => array("index.php|taxe_amenagement[module=tab]", "index.php|taxe_amenagement[module=form]", ),
4140     );
4141     //
4142     $links[] = array(
4143     "class" => "category",
4144     "title" => _("gestion des commissions"),
4145     "right" => array(
4146     "commission_type", "commission_type_tab",
4147     ),
4148     );
4149     //
4150     $links[] = array(
4151     "title" => "<hr/>",
4152     "right" => array(
4153     "commission_type", "commission_type_tab",
4154     ),
4155     );
4156     //
4157     $links[] = array(
4158     "href" => "".OM_ROUTE_TAB."&obj=commission_type",
4159     "class" => "commission-type",
4160     "title" => _("commission_type"),
4161     "right" => array("commission_type", "commission_type_tab", ),
4162     "open" => array("index.php|commission_type[module=tab]", "index.php|commission_type[module=form]", ),
4163     );
4164     //
4165     $links[] = array(
4166     "class" => "category",
4167     "title" => _("gestion des consultations"),
4168     "right" => array(
4169     "avis_consultation", "avis_consultation_tab", "service", "service_tab",
4170     "service_categorie", "service_categorie_tab",
4171     "lien_service_service_categorie", "lien_service_service_categorie_tab",
4172     ),
4173     );
4174     //
4175     $links[] = array(
4176     "title" => "<hr/>",
4177     "right" => array(
4178     "avis_consultation", "avis_consultation_tab", "service", "service_tab",
4179     "service_categorie", "service_categorie_tab",
4180     "lien_service_service_categorie", "lien_service_service_categorie_tab",
4181     ),
4182     );
4183     //
4184     $links[] = array(
4185     "href" => "".OM_ROUTE_TAB."&obj=avis_consultation",
4186     "class" => "avis_consultation",
4187     "title" => _("avis consultation"),
4188     "right" => array("avis_consultation", "avis_consultation_tab", ),
4189     "open" => array("index.php|avis_consultation[module=tab]", "index.php|avis_consultation[module=form]", ),
4190     );
4191     //
4192     $links[] = array(
4193     "href" => "".OM_ROUTE_TAB."&obj=service",
4194     "class" => "service",
4195     "title" => _("service"),
4196     "right" => array("service", "service_tab", ),
4197     "open" => array("index.php|service[module=tab]", "index.php|service[module=form]", ),
4198     );
4199     $links[] = array(
4200     "href" => "".OM_ROUTE_TAB."&obj=service_categorie",
4201     "class" => "service_categorie",
4202     "title" => _("thematique des services"),
4203     "right" => array("service_categorie", "service_categorie_tab", ),
4204     "open" => array("index.php|service_categorie[module=tab]", "index.php|service_categorie[module=form]", ),
4205     );
4206     //
4207     $links[] = array(
4208     "class" => "category",
4209     "title" => _("Gestion des dossiers"),
4210     "right" => array(
4211     "dossier_autorisation_type", "dossier_autorisation_type_tab",
4212     "dossier_autorisation_type_detaille",
4213     "dossier_autorisation_type_detaille_tab", "dossier_instruction_type",
4214     "dossier_instruction_type_tab",
4215     "autorite_competente", "autorite_competente_tab",
4216 softime 10573 "affectation_automatique", "affectation_automatique_tab",
4217     "pec_metier", "pec_metier_tab",
4218 softime 8329 ),
4219     );
4220     //
4221     $links[] = array(
4222     "title" => "<hr/>",
4223     "right" => array(
4224     "dossier_autorisation_type", "dossier_autorisation_type_tab",
4225     "dossier_autorisation_type_detaille",
4226     "dossier_autorisation_type_detaille_tab", "dossier_instruction_type",
4227     "dossier_instruction_type_tab",
4228     "autorite_competente", "autorite_competente_tab",
4229 softime 10573 "affectation_automatique", "affectation_automatique_tab",
4230     "pec_metier", "pec_metier_tab",
4231 softime 8329 ),
4232     );
4233     //
4234     $links[] = array(
4235     "href" => "".OM_ROUTE_TAB."&obj=etat_dossier_autorisation",
4236     "class" => "etat_dossier_autorisation",
4237     "title" => _("etat dossiers autorisations"),
4238     "right" => array("etat_dossier_autorisation", "etat_dossier_autorisation_tab", ),
4239     "open" => array("index.php|etat_dossier_autorisation[module=tab]", "index.php|etat_dossier_autorisation[module=form]", ),
4240     );
4241     //
4242     $links[] = array(
4243     "href" => "".OM_ROUTE_TAB."&obj=affectation_automatique",
4244     "class" => "affectation_automatique",
4245     "title" => _("affectation automatique"),
4246     "right" => array("affectation_automatique", "affectation_automatique_tab", ),
4247     "open" => array("index.php|affectation_automatique[module=tab]", "index.php|affectation_automatique[module=form]", ),
4248     );
4249     //
4250     $links[] = array(
4251     "href" => "".OM_ROUTE_TAB."&obj=autorite_competente",
4252     "class" => "autorite_competente",
4253     "title" => _("autorite")." "._("competente"),
4254     "right" => array("autorite_competente", "autorite_competente_tab", ),
4255     "open" => array("index.php|autorite_competente[module=tab]", "index.php|autorite_competente[module=form]", ),
4256     );
4257     //
4258     $links[] = array(
4259     "href" => "".OM_ROUTE_TAB."&obj=phase",
4260     "class" => "phase",
4261     "title" => _("phase"),
4262     "right" => array("phase", "phase_tab", ),
4263     "open" => array("index.php|phase[module=tab]", "index.php|phase[module=form]", ),
4264     );
4265 softime 10573 //
4266     $links[] = array(
4267     "href" => "".OM_ROUTE_TAB."&obj=pec_metier",
4268     "class" => "pec_metier",
4269     "title" => _("pec_metier"),
4270     "right" => array("pec_metier", "pec_metier_tab", ),
4271     "open" => array("index.php|pec_metier[module=tab]", "index.php|pec_metier[module=form]", ),
4272     );
4273 softime 8329
4274     //Gestion des pièces
4275     $links[] = array(
4276     "class" => "category",
4277     "title" => _("Gestion des pièces"),
4278     "right" => array(
4279     "document_numerise_type_categorie", "document_numerise_type_categorie_tab",
4280     "document_numerise_type",
4281     "document_numerise_type_tab", "document_numerise_traitement_metadonnees",
4282     "document_numerise_traitement_metadonnees_executer",
4283     ),
4284     );
4285     //
4286     $links[] = array(
4287     "title" => "<hr/>",
4288     "right" => array(
4289     "document_numerise_type_categorie", "document_numerise_type_categorie_tab",
4290     "document_numerise_type",
4291     "document_numerise_type_tab", "document_numerise_traitement_metadonnees",
4292     "document_numerise_traitement_metadonnees_executer",
4293     ),
4294     );
4295     //
4296     $links[] = array(
4297     "href" => "".OM_ROUTE_TAB."&obj=document_numerise_type_categorie",
4298     "class" => "document_numerise_type_categorie",
4299     "title" => _("Catégorie des pièces"),
4300     "right" => array(
4301     "document_numerise_type_categorie",
4302     "document_numerise_type_categorie_tab",
4303     ),
4304     "open" => array(
4305     "index.php|document_numerise_type_categorie[module=tab]",
4306     "index.php|document_numerise_type_categorie[module=form]",
4307     ),
4308     );
4309     //
4310     $links[] = array(
4311     "href" => "".OM_ROUTE_TAB."&obj=document_numerise_type",
4312     "class" => "document_numerise_type",
4313     "title" => _("Type des pièces"),
4314     "right" => array(
4315     "document_numerise_type",
4316     "document_numerise_type_tab",
4317     ),
4318     "open" => array(
4319     "index.php|document_numerise_type[module=tab]",
4320     "index.php|document_numerise_type[module=form][action=0]",
4321     "index.php|document_numerise_type[module=form][action=1]",
4322     "index.php|document_numerise_type[module=form][action=2]",
4323     "index.php|document_numerise_type[module=form][action=3]",
4324     ),
4325     );
4326     //
4327     $links[] = array(
4328 softime 10573 "href" => "".OM_ROUTE_TAB."&obj=lien_document_n_type_d_i_t",
4329     "class" => "lien_document_n_type_d_i_t",
4330     "title" => _("Nomenclature des pièces"),
4331     "right" => array(
4332     "lien_document_n_type_d_i_t",
4333     "lien_document_n_type_d_i_t_tab",
4334     ),
4335     "open" => array(
4336     "index.php|lien_document_n_type_d_i_t[module=tab]",
4337     "index.php|lien_document_n_type_d_i_t[module=form][action=0]",
4338     "index.php|lien_document_n_type_d_i_t[module=form][action=1]",
4339     "index.php|lien_document_n_type_d_i_t[module=form][action=2]",
4340     "index.php|lien_document_n_type_d_i_t[module=form][action=3]",
4341     ),
4342     );
4343     //
4344     $links[] = array(
4345 softime 8329 "href" => "".OM_ROUTE_FORM."&obj=document_numerise_traitement_metadonnees&action=100&idx=0",
4346     "class" => "document_numerise_traitement_metadonnees",
4347     "title" => _("Mise à jour des métadonnées"),
4348     "description" => _("Mettre à jour les métadonnées de tous les documents numérisés."),
4349     "right" => array(
4350     "document_numerise_traitement_metadonnees",
4351     "document_numerise_traitement_metadonnees_executer",
4352     ),
4353     "open" => array("index.php|document_numerise_traitement_metadonnees[module=form]", ),
4354     );
4355    
4356     // Gestion des contentieux
4357     $links[] = array(
4358     "class" => "category",
4359     "title" => _("Gestion des contentieux"),
4360     "right" => array(
4361     "objet_recours", "objet_recours_tab", "moyen_souleve", "moyen_souleve_tab",
4362     "moyen_retenu_juge", "moyen_retenu_juge_tab",
4363     ),
4364     );
4365     //
4366     $links[] = array(
4367     "title" => "<hr/>",
4368     "right" => array(
4369     "objet_recours", "objet_recours_tab", "moyen_souleve", "moyen_souleve_tab",
4370     "moyen_retenu_juge", "moyen_retenu_juge_tab",
4371     ),
4372     );
4373     //
4374     $links[] = array(
4375     "href" => "".OM_ROUTE_TAB."&obj=objet_recours",
4376     "class" => "objet_recours",
4377     "title" => _("objet_recours"),
4378     "right" => array(
4379     "objet_recours", "objet_recours_tab",
4380     ),
4381     "open" => array(
4382     "index.php|objet_recours[module=tab]", "index.php|objet_recours[module=form]",
4383     ),
4384     );
4385     //
4386     $links[] = array(
4387     "href" => "".OM_ROUTE_TAB."&obj=moyen_souleve",
4388     "class" => "moyen_souleve",
4389     "title" => _("moyen_souleve"),
4390     "right" => array(
4391     "moyen_souleve", "moyen_souleve_tab",
4392     ),
4393     "open" => array(
4394     "index.php|moyen_souleve[module=tab]", "index.php|moyen_souleve[module=form]",
4395     ),
4396     );
4397     //
4398     $links[] = array(
4399     "href" => "".OM_ROUTE_TAB."&obj=moyen_retenu_juge",
4400     "class" => "moyen_retenu_juge",
4401     "title" => _("moyen_retenu_juge"),
4402     "right" => array(
4403     "moyen_retenu_juge", "moyen_retenu_juge_tab",
4404     ),
4405     "open" => array(
4406     "index.php|moyen_retenu_juge[module=tab]", "index.php|moyen_retenu_juge[module=form]",
4407     ),
4408     );
4409    
4410     //
4411 softime 10573 $links[] = array(
4412     "class" => "category",
4413     "title" => _("géolocalisation"),
4414     "right" => array(
4415     "sig_groupe",
4416     "sig_sousgroupe",
4417     "sig_contrainte"
4418     ),
4419     );
4420     //
4421     $links[] = array(
4422     "href" => "".OM_ROUTE_TAB."&obj=sig_couche",
4423     "class" => "sig_couche",
4424     "title" => _("Couches"),
4425     "right" => array("sig_contrainte", "sig_contrainte_tab","sig_couche", "sig_couche_tab", ),
4426     "open" => array("index.php|sig_couche[module=tab]", "index.php|sig_couche[module=form]", ),
4427     );
4428     //
4429     $links[] = array(
4430     "href" => "".OM_ROUTE_TAB."&obj=sig_groupe",
4431     "class" => "sig_groupe",
4432     "title" => _("sig_groupe"),
4433     "right" => array(
4434     "sig_groupe", "sig_groupe_tab",
4435     ),
4436     "open" => array(
4437     "index.php|sig_groupe[module=tab]", "index.php|sig_groupe[module=form]",
4438     ),
4439     );
4440     //
4441     $links[] = array(
4442     "href" => "".OM_ROUTE_TAB."&obj=sig_sousgroupe",
4443     "class" => "sig_sousgroupe",
4444     "title" => _("sig_sousgroupe"),
4445     "right" => array(
4446     "sig_sousgroupe", "sig_sousgroupe_tab",
4447     ),
4448     "open" => array(
4449     "index.php|sig_sousgroupe[module=tab]", "index.php|sig_sousgroupe[module=form]",
4450     ),
4451     );
4452     //
4453     $links[] = array(
4454     "href" => "".OM_ROUTE_TAB."&obj=sig_contrainte",
4455     "class" => "sig_contrainte",
4456     "title" => _("sig_contrainte"),
4457     "right" => array(
4458     "sig_contrainte", "sig_contrainte_tab", "sig_attribut", "sig_attribut_tab"
4459     ),
4460     "open" => array(
4461     "index.php|sig_contrainte[module=tab]", "index.php|sig_contrainte[module=form]",
4462     ),
4463     );
4464     //
4465 softime 8329 $rubrik['links'] = $links;
4466     //
4467     $menu[] = $rubrik;
4468     // }}}
4469    
4470     // {{{ Rubrique ADMINISTRATION
4471     //
4472     $rubrik = array(
4473     "title" => _("administration"),
4474     "class" => "administration",
4475     "right" => "menu_administration",
4476     );
4477     //
4478     $links = array();
4479     //
4480 softime 10573 // Renomme la collectivité en service
4481     $om_collectivite_title = __("om_collectivite");
4482     if (isset($_SESSION['collectivite']) === true
4483     && $this->is_option_renommer_collectivite_enabled() === true) {
4484     //
4485     $om_collectivite_title = __("service");
4486     }
4487 softime 8329 $links[] = array(
4488     "href" => "".OM_ROUTE_TAB."&obj=om_collectivite",
4489     "class" => "collectivite",
4490 softime 10573 "title" => $om_collectivite_title,
4491 softime 8329 "right" => array("om_collectivite", "om_collectivite_tab", ),
4492     "open" => array("index.php|om_collectivite[module=tab]", "index.php|om_collectivite[module=form]", ),
4493     );
4494     //
4495     $links[] = array(
4496     "href" => "".OM_ROUTE_TAB."&obj=om_parametre",
4497     "class" => "parametre",
4498     "title" => _("om_parametre"),
4499     "right" => array("om_parametre", "om_parametre_tab", ),
4500     "open" => array("index.php|om_parametre[module=tab]", "index.php|om_parametre[module=form]", ),
4501     );
4502     //
4503     $links[] = array(
4504 softime 10573 "title" => "<hr/>",
4505     "right" => array("commune", "commune_tab", )
4506     );
4507     $links[] = array(
4508     "href" => "".OM_ROUTE_TAB."&obj=commune",
4509     "title" => __("communes"),
4510     "right" => array("commune", "commune_tab"),
4511     "open" => array("index.php|commune[module=tab]", "index.php|commune[module=form]", ),
4512     );
4513     $links[] = array(
4514     "href" => "".OM_ROUTE_TAB."&obj=departement",
4515     "title" => __("départements"),
4516     "right" => array("departement", "departement_tab"),
4517     "open" => array("index.php|departement[module=tab]", "index.php|departement[module=form]")
4518     );
4519     $links[] = array(
4520     "href" => "".OM_ROUTE_TAB."&obj=region",
4521     "title" => __("régions"),
4522     "right" => array("region", "region_tab"),
4523     "open" => array("index.php|region[module=tab]", "index.php|region[module=form]")
4524     );
4525     //
4526     $links[] = array(
4527 softime 8329 "class" => "category",
4528     "title" => _("gestion des utilisateurs"),
4529     "right" => array(
4530     "om_utilisateur", "om_utilisateur_tab", "om_profil", "om_profil_tab",
4531     "om_droit", "om_droit_tab", "directory",
4532     ),
4533     );
4534     //
4535     $links[] = array(
4536     "title" => "<hr/>",
4537     "right" => array(
4538     "om_utilisateur", "om_utilisateur_tab", "om_profil", "om_profil_tab",
4539     "om_droit", "om_droit_tab",
4540     ),
4541     );
4542     //
4543     $links[] = array(
4544     "href" => "".OM_ROUTE_TAB."&obj=om_profil",
4545     "class" => "profil",
4546     "title" => _("om_profil"),
4547     "right" => array("om_profil", "om_profil_tab", ),
4548     "open" => array("index.php|om_profil[module=tab]", "index.php|om_profil[module=form]", ),
4549     );
4550     //
4551     $links[] = array(
4552     "href" => "".OM_ROUTE_TAB."&obj=om_droit",
4553     "class" => "droit",
4554     "title" => _("om_droit"),
4555     "right" => array("om_droit", "om_droit_tab", ),
4556     "open" => array("index.php|om_droit[module=tab]", "index.php|om_droit[module=form]", ),
4557     );
4558     //
4559     $links[] = array(
4560     "href" => "".OM_ROUTE_TAB."&obj=om_utilisateur",
4561     "class" => "utilisateur",
4562     "title" => _("om_utilisateur"),
4563     "right" => array("om_utilisateur", "om_utilisateur_tab", ),
4564     "open" => array(
4565     "index.php|om_utilisateur[module=tab]",
4566     "index.php|om_utilisateur[module=form][action=0]",
4567     "index.php|om_utilisateur[module=form][action=1]",
4568     "index.php|om_utilisateur[module=form][action=2]",
4569     "index.php|om_utilisateur[module=form][action=3]",
4570     ),
4571     );
4572     //
4573     $links[] = array(
4574     "title" => "<hr/>",
4575     "right" => array("om_utilisateur", "om_utilisateur_synchroniser", ),
4576     "parameters" => array("isDirectoryOptionEnabled" => true, ),
4577     );
4578     //
4579     $links[] = array(
4580     "href" => "".OM_ROUTE_FORM."&obj=om_utilisateur&idx=0&action=11",
4581     "class" => "annuaire",
4582     "title" => _("annuaire"),
4583     "right" => array("om_utilisateur", "om_utilisateur_synchroniser", ),
4584     "open" => array("index.php|om_utilisateur[module=form][action=11]", ),
4585     "parameters" => array("isDirectoryOptionEnabled" => true, ),
4586     );
4587     //
4588     $links[] = array(
4589     "class" => "category",
4590     "title" => _("tableaux de bord"),
4591     "right" => array(
4592     "om_widget", "om_widget_tab", "om_dashboard",
4593     ),
4594     );
4595     //
4596     $links[] = array(
4597     "title" => "<hr/>",
4598     "right" => array(
4599     "om_widget", "om_widget_tab", "om_dashboard",
4600     ),
4601     );
4602     //
4603     $links[] = array(
4604     "href" => "".OM_ROUTE_TAB."&obj=om_widget",
4605     "class" => "om_widget",
4606     "title" => _("om_widget"),
4607     "right" => array("om_widget", "om_widget_tab", ),
4608     "open" => array("index.php|om_widget[module=tab]", "index.php|om_widget[module=form]", ),
4609     );
4610     //
4611     $links[] = array(
4612     "href" => "".OM_ROUTE_FORM."&obj=om_dashboard&amp;idx=0&amp;action=4",
4613     "class" => "om_dashboard",
4614     "title" => _("composition"),
4615     "right" => array("om_dashboard", ),
4616     "open" => array("index.php|om_dashboard[module=form][action=4]", ),
4617     );
4618     //
4619     $links[] = array(
4620     "class" => "category",
4621     "title" => _("sig"),
4622     "right" => array(
4623     "om_sig_map", "om_sig_map_tab", "om_sig_flux", "om_sig_flux_tab", "om_sig_extent", "om_sig_extent_tab",
4624     ),
4625     "parameters" => array("option_localisation" => "sig_interne", ),
4626     );
4627     //
4628     $links[] = array(
4629     "title" => "<hr/>",
4630     "right" => array(
4631     "om_sig_map", "om_sig_map_tab", "om_sig_flux", "om_sig_flux_tab", "om_sig_extent", "om_sig_extent_tab",
4632     ),
4633     "parameters" => array("option_localisation" => "sig_interne", ),
4634     );
4635     //
4636     $links[] = array(
4637     "href" => "".OM_ROUTE_TAB."&obj=om_sig_extent",
4638     "class" => "om_sig_extent",
4639     "title" => _("om_sig_extent"),
4640     "right" => array("om_sig_extent", "om_sig_extent_tab", ),
4641     "open" => array("index.php|om_sig_extent[module=tab]", "index.php|om_sig_extent[module=form]", ),
4642     "parameters" => array("option_localisation" => "sig_interne", ),
4643     );
4644     //
4645     $links[] = array(
4646     "href" => "".OM_ROUTE_TAB."&obj=om_sig_map",
4647     "class" => "om_sig_map",
4648     "title" => _("om_sig_map"),
4649     "right" => array("om_sig_map", "om_sig_map_tab", ),
4650     "open" => array("index.php|om_sig_map[module=tab]", "index.php|om_sig_map[module=form]", ),
4651     "parameters" => array("option_localisation" => "sig_interne", ),
4652     );
4653     //
4654     $links[] = array(
4655     "href" => "".OM_ROUTE_TAB."&obj=om_sig_flux",
4656     "class" => "om_sig_flux",
4657     "title" => _("om_sig_flux"),
4658     "right" => array("om_sig_flux", "om_sig_flux_tab", ),
4659     "open" => array("index.php|om_sig_flux[module=tab]", "index.php|om_sig_flux[module=form]", ),
4660     "parameters" => array("option_localisation" => "sig_interne", ),
4661     );
4662     //
4663     $links[] = array(
4664     "class" => "category",
4665     "title" => _("options avancees"),
4666     "right" => array("import", "gen", "om_requete", "om_requete_tab",
4667     "om_sousetat", "om_sousetat_tab",),
4668     );
4669     //
4670     $links[] = array(
4671     "title" => "<hr/>",
4672     "right" => array(
4673     "interface_referentiel_erp",
4674     ),
4675     );
4676     //
4677     $links[] = array(
4678     "href" => "../app/settings.php?controlpanel=interface_referentiel_erp",
4679     "class" => "interface_referentiel_erp",
4680     "title" => _("interface_referentiel_erp"),
4681     "right" => array("interface_referentiel_erp", ),
4682     "open" => array("settings.php|[controlpanel=interface_referentiel_erp]", ),
4683     );
4684     //
4685     $links[] = array(
4686     "title" => "<hr/>",
4687     "right" => array(
4688     "om_sousetat", "om_sousetat_tab",
4689     ),
4690     );
4691     //
4692     $links[] = array(
4693     "href" => "".OM_ROUTE_TAB."&obj=om_sousetat",
4694     "class" => "om_sousetat",
4695     "title" => _("om_sousetat"),
4696     "right" => array("om_sousetat", "om_sousetat_tab", ),
4697     "open" => array("index.php|om_sousetat[module=tab]", "index.php|om_sousetat[module=form]", ),
4698     );
4699     //
4700     $links[] = array(
4701     "title" => "<hr/>",
4702     "right" => array("om_requete", "om_requete_tab", ),
4703     );
4704     //
4705     $links[] = array(
4706     "href" => "".OM_ROUTE_TAB."&obj=om_requete",
4707     "class" => "om_requete",
4708     "title" => _("om_requete"),
4709     "right" => array("om_requete", "om_requete_tab", ),
4710     "open" => array("index.php|om_requete[module=tab]", "index.php|om_requete[module=form]", ),
4711     );
4712     //
4713     $links[] = array(
4714     "title" => "<hr/>",
4715 softime 10573 "right" => array("task", "task_tab", ),
4716     );
4717     //
4718     $links[] = array(
4719     "href" => "".OM_ROUTE_TAB."&obj=task",
4720     "class" => "task",
4721     "title" => _("Moniteur Plat'AU"),
4722     "right" => array("task", "task_tab", ),
4723     "open" => array("index.php|task[module=tab]", "index.php|task[module=form]", ),
4724     );
4725 softime 10968
4726     //Afficher le menu moniteur IDE'AU si l'option notification portal est activée.
4727     if (isset($_SESSION['collectivite']) === true &&
4728     ($this->get_param_option_notification() === "portal" ||
4729     $this->get_param_option_notification() === "" ||
4730     $this->get_param_option_notification() === NULL ))
4731     {
4732     $links[] = array(
4733     "href" => "".OM_ROUTE_TAB."&obj=task_portal",
4734     "class" => "task_portal",
4735     "title" => __("Moniteur iDE'AU"),
4736     "right" => array("task_portal", "task_portal_tab", ),
4737     "open" => array("index.php|task_portal[module=tab]", "index.php|task_portal[module=form]", ),
4738     );
4739     }
4740    
4741 softime 10573 //
4742     $links[] = array(
4743     "title" => "<hr/>",
4744 softime 8329 "right" => array("import", ),
4745     );
4746     //
4747     $links[] = array(
4748     "href" => OM_ROUTE_MODULE_IMPORT,
4749     "class" => "import",
4750 softime 9245 "title" => __("Import"),
4751     "description" => __("Ce module permet l'intégration de données dans l'application depuis des fichiers CSV."),
4752 softime 8329 "right" => array("import", ),
4753 softime 9245 "open" => array(
4754     "import.php|",
4755     "index.php|[module=import]",
4756     ),
4757 softime 8329 );
4758     //
4759     $links[] = array(
4760     "href" => "../app/import_specific.php",
4761     "class" => "import_specific",
4762     "title" => _("Import specifique"),
4763     "right" => array("import", ),
4764     "open" => array("import_specific.php|", ),
4765     );
4766     //
4767     $links[] = array(
4768     "title" => "<hr/>",
4769     "right" => array("gen", ),
4770     );
4771     //
4772     $links[] = array(
4773     "title" => _("Generateur"),
4774     "href" => OM_ROUTE_MODULE_GEN,
4775     "class" => "generator",
4776     "right" => array("gen", ),
4777     "open" => array(
4778     "gen.php|","genauto.php|", "gensup.php|", "genfull.php|",
4779     "genetat.php|", "gensousetat.php|", "genlettretype.php|",
4780     "genimport.php|",
4781     ),
4782     );
4783     //
4784     $links[] = array(
4785 softime 10573 "title" => "<hr/>",
4786     "right" => array("contrainte", "contrainte_synchronisation"),
4787     );
4788     //
4789     $links[] = array(
4790 softime 8329 "href" => "".OM_ROUTE_FORM."&obj=contrainte&action=100&idx=0",
4791     "class" => "contrainte",
4792     "title" => _("synchronisation des contraintes"),
4793     "right" => array("contrainte", "contrainte_synchronisation", ),
4794     "open" => array("index.php|contrainte[module=form][action=100]", ),
4795     "parameters" => array(
4796     "option_sig" => "sig_externe",
4797     ),
4798     );
4799     //
4800     $links[] = array(
4801     "href" => "".OM_ROUTE_FORM."&obj=dossier_instruction&action=126&idx=0",
4802     "class" => "geocoder",
4803     "title" => _("Géolocalisation des dossiers"),
4804     "right" => array("dossier_instruction_geocoder", ),
4805     "open" => array("index.php|dossier_instruction[module=form][action=126]", ),
4806     "parameters" => array(
4807     "option_sig" => "sig_externe",
4808     ),
4809     );
4810     //
4811     $rubrik['links'] = $links;
4812     //
4813     $menu[] = $rubrik;
4814     $this->config__menu = $menu;
4815     }
4816 softime 8640
4817     /**
4818     * Récupère tous les résultats d'une requête SQL.
4819     *
4820     * @param string $query Requête SQL
4821     * @param boolean $force_return Force le retour d'un boolean en cas d'erreur
4822     *
4823 softime 8989 * @return array
4824 softime 8640 */
4825     function get_all_results_from_db_query($query = "", $force_return = false) {
4826     $res = $this->db->query($query);
4827     $this->addToLog(
4828     __METHOD__."(): db->query(\"".$query."\");",
4829     VERBOSE_MODE
4830     );
4831     $result = array(
4832     'code' => '',
4833     'message' => '',
4834     'result' => array(),
4835     );
4836     if ($this->isDatabaseError($res, $force_return) !== false) {
4837     $result['code'] = 'KO';
4838     $result['message'] = __("Erreur de base de donnees. Contactez votre administrateur.");
4839     return $result;
4840     }
4841     $result['code'] = 'OK';
4842     while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
4843     array_push($result['result'], $row);
4844     }
4845     $res->free();
4846     return $result;
4847     }
4848 mbroquet 3730
4849 softime 8989 /**
4850     * Récupère un résultat d'une requête SQL.
4851     *
4852     * @param string $query Requête SQL
4853     * @param boolean $force_return Force le retour d'un boolean en cas d'erreur
4854     *
4855     * @return array
4856     */
4857     function get_one_result_from_db_query($query = "", $force_return = false) {
4858     $res = $this->db->getone($query);
4859     $this->addToLog(
4860     __METHOD__."(): db->getone(\"".$query."\");",
4861     VERBOSE_MODE
4862     );
4863     $result = array(
4864     'code' => '',
4865     'message' => '',
4866     'result' => array(),
4867     );
4868     if ($this->isDatabaseError($res, $force_return) !== false) {
4869     $result['code'] = 'KO';
4870     $result['message'] = __("Erreur de base de donnees. Contactez votre administrateur.");
4871     return $result;
4872     }
4873     $result['code'] = 'OK';
4874     $result['result'] = $res;
4875     return $result;
4876     }
4877 softime 7996
4878 softime 8989 /**
4879     * Instanciation de la classe 'edition'.
4880     * (surcharge de la fonction pour ajouter la prise en compte
4881     * de la surcharge locale de la classe om_edition).
4882     *
4883     * @param array $args Arguments à passer au constructeur.
4884     * @return edition
4885     */
4886     function get_inst__om_edition($args = array()) {
4887     if (file_exists("../obj/om_edition.class.php")) {
4888     require_once "../obj/om_edition.class.php";
4889     $class_name = "om_edition";
4890     } else {
4891     require_once PATH_OPENMAIRIE."om_edition.class.php";
4892     $class_name = "edition";
4893     }
4894     return new $class_name();
4895     }
4896    
4897     /**
4898 softime 9245 * Instanciation de la classe 'reqmo'.
4899     * (surcharge de la fonction pour ajouter la prise en compte
4900     * de la surcharge locale de la classe om_edition).
4901     *
4902     * @param array $args Arguments à passer au constructeur.
4903     * @return edition
4904     */
4905     function get_inst__om_reqmo($args = array()) {
4906     if (file_exists("../obj/om_reqmo.class.php")) {
4907     require_once "../obj/om_reqmo.class.php";
4908     $class_name = "om_reqmo";
4909     } else {
4910     require_once PATH_OPENMAIRIE."om_reqmo.class.php";
4911     $class_name = "reqmo";
4912     }
4913     return new $class_name();
4914     }
4915    
4916     /**
4917 softime 8989 * Permet d'enregistrer un fichier dans la table 'storage'.
4918     *
4919     * @return mixed Identifiant du fichier dans la table storage ou false.
4920     */
4921     function store_file($filecontent, $filemetadata, $type, $info = null, $collectivite = null) {
4922     if ($collectivite === null) {
4923     $get_collectivite = $this->getCollectivite();
4924     $collectivite = $get_collectivite['om_collectivite_idx'];
4925     }
4926 softime 10573 $uid = $this->storage->create($filecontent, $filemetadata, "from_content", "storage.uid");
4927 softime 8989 if ($uid == 'OP_FAILURE') {
4928     return false;
4929     }
4930     $inst_storage = $this->get_inst__om_dbform(array(
4931     "obj" => "storage",
4932     "idx" => "]",
4933     ));
4934     $val = array(
4935     "storage" => '',
4936     "file" => "NEW",
4937     "creation_date" => date("Y-m-d"),
4938     "creation_time" => date("G:i:s"),
4939     "uid" => $uid,
4940     "filename" => $filemetadata["filename"],
4941     "size" => $filemetadata["size"],
4942     "mimetype" => $filemetadata["mimetype"],
4943     "type" => $type,
4944     "info" => $info,
4945     "om_collectivite" => $collectivite,
4946     );
4947     $ret = $inst_storage->ajouter($val);
4948     if ($ret !== true) {
4949     return false;
4950     }
4951     // Récupère l'identifiant dans le storage
4952     $id = $inst_storage->get_storage_id_by_uid($uid);
4953     //
4954     return $id;
4955     }
4956    
4957     /**
4958     * Surcharge de la fonction d'affichage pour ajouter
4959     * un détecteur de bloqueur de pub (cassant l'application).
4960     *
4961     * @return void
4962     */
4963     function displayHTMLFooter() {
4964     parent::displayHTMLFooter();
4965 softime 9511 if (in_array($this->flag, array("login_and_nohtml", "nohtml", "login", "logout", "anonym")) !== true) {
4966 softime 8989 $this->ad_blocker_detector();
4967     }
4968     }
4969    
4970     /**
4971 softime 10968 * "Fausse" surcharge de la méthode du même nom dans om_layout.
4972     * Ajoute la possibilité d'ajouter une class CSS à la balise legend.
4973     *
4974     * Cette methode permet d'ouvrir un fieldset
4975     */
4976     public function display_formulaire_debutFieldset($params) {
4977     // Ouverture du fieldset
4978     echo " <fieldset";
4979     echo (isset($params["identifier"]) ? " id=\"".$params["identifier"]."\"" : "");
4980     echo " class=\"cadre ui-corner-all ui-widget-content ".$params["action2"]."\">\n";
4981     echo " <legend class=\"ui-corner-all ui-widget-content ui-state-active ".$params["legend_class"]."\">";
4982     echo $params["action1"];
4983     echo " </legend>\n";
4984     // Ouverture du conteneur interne du fieldset
4985     echo " <div class=\"fieldsetContent\">\n";
4986     }
4987    
4988     /**
4989 softime 8989 * Affiche un bloc de code Javascript
4990     * responsable de détecter les bloqueurs de pub
4991     * et d'afficher un message le cas échéant.
4992     */
4993     protected function ad_blocker_detector() {
4994    
4995     printf(
4996     '<script type="text/javascript">
4997     var blocked = [];
4998     // jquery has not loaded
4999     if(typeof($) == "undefined" && typeof(jQuery) == "undefined") {
5000     blocked.push("jquery");
5001     }
5002     // tinyMCE has not loaded
5003     if(typeof(tinyMCE) == "undefined") {
5004     blocked.push("tinyMCE");
5005     }
5006     // locale has not loaded
5007     if(typeof(locale) == "undefined") {
5008     blocked.push("locale");
5009     }
5010     // om_layout has not loaded
5011     if(typeof(om_initialize_content) == "undefined") {
5012     blocked.push("om_layout");
5013     }
5014     // app script has not loaded
5015     if(typeof(app_script_t4Fv4a59uSU7MwpJ59Qp) == "undefined") {
5016     blocked.push("app_script");
5017     }
5018    
5019     // something was blocked
5020     if(blocked.length > 0) {
5021    
5022     // removing every node in the body
5023     while(document.body.firstChild) { document.body.removeChild(document.body.firstChild); }
5024    
5025     // creating the message (node) and its style
5026     var msgNode = document.createElement("p");
5027     msgNode.id = "adblocker-detected";
5028     msgNode.style.position = "relative";
5029     msgNode.style.width = "calc(100%% - 60px)";
5030     msgNode.style.margin = "20px auto";
5031     msgNode.style.padding = "20px";
5032     msgNode.style.background = "#FEF8F6";
5033     msgNode.style.color = "#cd0a0a";
5034     msgNode.style.border = "1px solid #cd0a0a";
5035     msgNode.style.borderRadius = "4px";
5036     msgNode.innerHTML = "%s";
5037    
5038     // appending the message (node) to the body
5039     document.body.insertBefore(msgNode, document.body.firstChild);
5040     }
5041     </script>',
5042     sprintf(
5043     '<span>%s</span><br/><br/><span>%s</span><br/><br/><span>%s</span>',
5044     __("Un bloqueur de publicité a été détecté, et ceci empêche l'application de fonctionner normalement."),
5045     __("Afin de rétablir le bon fonctionnement, il vous est nécessaire d'ajouter l'application à la liste blanche des applications autorisées (<small>pour cela, référez-vous à la documentation de votre extension bloqueuse de publicité</small>)."),
5046 softime 9245 __("<em>Pour information, ceci se produit parce que l'application se nomme openADS, or les bloqueurs de publicité ont tendance à bloquer tout ce qui contient la chaîne de caractères 'ads' (<small>publicité</small> en anglais) comme c'est le cas dans le nom open<strong>ADS</strong>.</em>")
5047 softime 8989 )
5048     );
5049     }
5050    
5051 softime 10573 /**
5052     * Récupère l'identifiant de l'enregistrement par rapport aux arguments.
5053     *
5054     * @param string $idx_name Nom du champ de l'identifiant
5055     * @param string $table Nom de la table
5056     * @param string $condition_field Nom du champ pour la condition
5057     * @param string $condition_value Valeur du champ de condition
5058     *
5059     * @return mixed Résultat de la requête ou null
5060     */
5061     public function get_idx_by_args(array $args) {
5062     $where2 = '';
5063     if (isset($args['condition2_field']) === true
5064     && isset($args['condition2_value']) === true
5065     && $args['condition2_field'] !== ''
5066     && $args['condition2_field'] !== null
5067     && $args['condition2_value'] !== ''
5068     && $args['condition2_value'] !== null) {
5069     //
5070     $where2 = sprintf(" AND %s = '%s'", $args['condition2_field'], $args['condition2_value']);
5071     }
5072     //
5073     $query = sprintf("SELECT %s FROM %s%s WHERE %s = '%s' %s",
5074     $args['idx_name'],
5075     DB_PREFIXE,
5076     $args['table'],
5077     $args['condition_field'],
5078     $args['condition_value'],
5079     $where2
5080     );
5081     //
5082     $res = $this->get_one_result_from_db_query($query);
5083     //
5084     return $res['result'];
5085     }
5086    
5087     public function get_inst__by_other_idx(array $args) {
5088     // En cas de plusieurs résultat, instancie seulement le premier retourné
5089     $idx = $this->get_idx_by_args(array(
5090     'idx_name' => $args['obj'],
5091     'table' => $args['obj'],
5092     'condition_field' => $args['fk_field'],
5093     'condition_value' => $args['fk_idx'],
5094     'condition2_field' => isset($args['fk_field_2']) === true ? $args['fk_field_2'] : null,
5095     'condition2_value' => isset($args['fk_idx_2']) === true ? $args['fk_idx_2'] : null,
5096     ));
5097     $inst = $this->get_inst__om_dbform(array(
5098     'obj' => $args['obj'],
5099     'idx' => $idx,
5100     ));
5101     return $inst;
5102     }
5103    
5104     /**
5105     * Retourne l'objet demandé avec ses propriétés remplis à partir des données en base
5106     * ou 'null' si l'objet n'est pas trouvé en base de données.
5107     *
5108     * @param string class La classe de l'objet demandé
5109     * @param int id L'identifiant de l'objet en base de donnée
5110     *
5111     * @return $mixed L'objet ou null
5112     *
5113     * (à partir de PHP 7.1 on pourra utiliser le ReturnType ?object)
5114     */
5115     public function findObjectById(string $class, string $idx) {
5116     $obj = null;
5117     if (!empty($class) && !empty($idx)) {
5118     $sqlExist = "SELECT COUNT($class) FROM ".DB_PREFIXE."$class WHERE $class = ?";
5119     $this->addToLog(__METHOD__."(): db->getOne(\"".$sqlExist."\");", VERBOSE_MODE);
5120     $res = $this->db->getOne($sqlExist, $idx);
5121     if ($this->db->isError($res)){
5122     throw new RuntimeException("Failed database query (".$res->getMessage().")");
5123     }
5124     if (intval(strval($res)) > 0) {
5125     $obj = $this->get_inst__om_dbform(array('obj' => $class, 'idx' => $idx));
5126     }
5127     }
5128     return $obj;
5129     }
5130    
5131     /**
5132     * Récupère la totalité des objets d'un type donné.
5133     * Si l'argument $sqlFilter est non-vide alors il sera utilisé pour filtrer les objets.
5134     * Si l'argument $sqlOrder est non-vide alors il sera utilisé pour ordonner les objets.
5135     *
5136     * Note: le code de cette méthode est largement inspiré de dbform::init_record_data().
5137     *
5138     * @return array|false
5139     */
5140     public function getAllObjects(string $type, string $sqlfilter = '', string $sqlOrder = '') {
5141    
5142     // objet "modèle" utilisé pour accéder aux variables nécessaires à la construction
5143     // de la requête SQL et aussi pour y stocker les infos communes à tous les objets de
5144     // ce type (ex: tailles des champs, etc.).
5145     $objectTemplate = $this->get_inst__om_dbform(array('obj' => $type));
5146    
5147     // construction de la requpete SQL (éventuellement avec un filtre)
5148     $sqlSelectedColumns = $objectTemplate->get_var_sql_forminc__champs();
5149     if (! empty($objectTemplate->_var_from_sql_forminc__champs)) {
5150     $sqlSelectedColumns = $objectTemplate->_var_from_sql_forminc__champs;
5151     }
5152     $sqlSelectColumns = implode(', ', $sqlSelectedColumns);
5153     $sqlSelectFrom = $objectTemplate->get_var_sql_forminc__tableSelect();
5154     if (! empty($objectTemplate->_var_from_sql_forminc__tableSelect)) {
5155     $sqlSelectFrom = $objectTemplate->_var_from_sql_forminc__tableSelect;
5156     }
5157     $sqlSelectWhere = '';
5158     if (! empty($sqlfilter)) {
5159     $sqlSelectWhere = "WHERE $sqlfilter";
5160     }
5161     $sqlSelectOrder = $objectTemplate->table." ASC";
5162     if (! empty($sqlOrder)) {
5163     $sqlSelectOrder = $sqlOrder;
5164     }
5165     $sql = sprintf('SELECT %s FROM %s %s ORDER BY %s',
5166     $sqlSelectColumns,
5167     $sqlSelectFrom,
5168     $sqlSelectWhere,
5169     $sqlSelectOrder);
5170    
5171     // exécution de la requête
5172     $this->addToLog(__METHOD__."() : sql query: $sql", VERBOSE_MODE);
5173     $res = $this->db->execute($this->db->prepare($sql));
5174     if ($this->isDatabaseError($res, true)) {
5175     $this->addToLog(
5176     __METHOD__."(): erreur SQL sur la table '".$objectTemplate->table."': ".
5177     $res->getMessage(), DEBUG_MODE);
5178     return false;
5179     }
5180    
5181     // recuperation des informations sur la structure de la table
5182     // ??? compatibilite POSTGRESQL (len = -1, type vide, flags vide)
5183     $info = $res->tableInfo();
5184    
5185     // Recuperation des infos
5186     foreach ($info as $index => $item) {
5187     $objectTemplate->champs[$index] = $item['name'];
5188     $objectTemplate->longueurMax[$index] = $item['len'];
5189     $objectTemplate->type[$index] = $item['type'];
5190     $objectTemplate->flags[$index] = $item['flags'];
5191     }
5192    
5193     // création et remplissage des objets
5194     $allObjects = array();
5195     while ($row = $res->fetchRow()) {
5196     $object = new $type(null);
5197     foreach(array('champs', 'longueurMax', 'type', 'flags') as $key) {
5198     $object->$key = $objectTemplate->$key;
5199     }
5200     foreach ($row as $index => $item) {
5201     $object->val[$index] = $item;
5202     }
5203     $allObjects[] = $object;
5204     }
5205    
5206     return $allObjects;
5207     }
5208    
5209     /**
5210     * Cette méthode permet de transformer une chaine de caractère standard
5211     * en une chaine sans caractères spéciaux ni accents.
5212     *
5213     * NOTE: la convertion est de 1 caractère vers 1 caractères afin de permettre
5214     * à la fonction 'sqlNormalizeSearchValue()' d'effectuer la même conversion.
5215     *
5216     * @param string $string La chaine de caractère à normaliser
5217     *
5218     * @return string La chaine de caractère normalisée
5219     */
5220     public function normalize_string($string = "") {
5221     //
5222     $invalid = array('Š'=>'S', 'š'=>'s', 'Đ'=>'D', 'đ'=>'d', 'Ž'=>'Z',
5223     'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c', 'À'=>'A', 'Á'=>'A',
5224     'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E',
5225     'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I',
5226     'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O',
5227     'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'S',
5228     'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a',
5229     'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i',
5230     'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o',
5231     'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y',
5232     'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'Ŕ'=>'R', 'ŕ'=>'r', "`" => "_",
5233     "„" => "_", "`" => "_", "´" => "_", "“" => "_", "”" => "_",
5234     "{" => "_", "}" => "_", "~" => "_", "–" => "-",
5235     "’" => "_", "(" => "_", ")" => "_", "/"=>"-", "'"=>"_",
5236     );
5237     $string = str_replace(array_keys($invalid), array_values($invalid), $string);
5238     $string = strtolower($string);
5239     return $string;
5240     }
5241    
5242     /**
5243     * Transforme une chaine en une suite d'instruction pSQL pour la normaliser.
5244     * En l'occurence cela supprimer les accents et la passe en casse minuscule.
5245     *
5246     * NOTE: la convertion est de 1 caractère vers 1 caractères afin de permettre
5247     * à la fonction 'normalize_string()' d'effectuer la même conversion.
5248     *
5249     * @param string $value Chaîne recherchée à normaliser.
5250     *
5251     * @return string
5252     */
5253     public function sqlNormalizeSearchValue($value){
5254     $value = html_entity_decode($value, ENT_QUOTES);
5255     // échappement des caractères spéciaux
5256     $value = pg_escape_string($value);
5257     // encodage
5258     if (DBCHARSET != 'UTF8' and HTTPCHARSET == 'UTF-8') {
5259     $value = utf8_decode($value);
5260     }
5261     // normalisation des caractères
5262     $value = " TRANSLATE(LOWER(".
5263     $value."::varchar), ".
5264     "'ŠšĐđŽžČčĆćÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýþÿŔŕ`„´“”{}~–’()/''', ".
5265     "'SsDdZzCcCcAAAAAAACEEEEIIIINOOOOOOUUUUYBSaaaaaaaceeeeiiiionoooooouuuybyRr________-___-_') ";
5266     return $value;
5267     }
5268    
5269     /**
5270     * Retourne une valeur unique récupérée à partir d'une requête SQL "basique".
5271     *
5272     * Il faut fournir une (ou deux) valeur filtre qui va sélectionner la ligne à partir
5273     * de laquelle récupérer la valeur souhaitée.
5274     *
5275     * @param string $table La table sur laquelle faire la requête
5276     * @param string $columnSelect La colonne permettant de récupérer la valeur recherchée
5277     * @param string $columnWhere La colonne à laquelle la valeur '$value' va être comparée
5278     * @param string $value La valeur filtre qui permet de sélectionner une ligne
5279     * @param string $extraTable Une table supplémentaire pour tester une seconde valeur
5280     * @param string $extraColumn Une colonne supplémentaire pour tester une seconde valeur
5281     * @param string $extraValue La seconde valeur 'filtre' pour mieux sélectionner une ligne
5282     * @param bool $normalizeColumn Si vaut 'true' alors on normalise la colonne '$columnWhere'
5283     * @param bool $normalizeValue Si vaut 'true' alors on normalise la valeur '$value'
5284     */
5285     public function getSingleSqlValue(
5286     string $table, string $columnSelect, string $columnWhere, string $value,
5287     string $extraTable = null, string $extraColumn = null, string $extraValue = null,
5288     bool $normalizeColumn = true, bool $normalizeValue = true) {
5289    
5290     // colonnes utilisées pour la clause WHERE
5291     $columnNormalized = $columnWhere;
5292     if ($normalizeColumn) {
5293     $columnNormalized = $this->sqlNormalizeSearchValue($columnWhere);
5294     }
5295     $valueNormalized = $this->db->escapeSimple($value);
5296     if ($normalizeValue) {
5297     $valueNormalized = $this->db->escapeSimple(strtolower(
5298     $this->normalize_string($value)));
5299     }
5300     // valeur utilisée pour la clause WHERE
5301     if (ctype_digit($value)) {
5302     $columnNormalized = "$table.$table";
5303     $valueNormalized = intval($value);
5304     }
5305    
5306     // SQL de base
5307     $sql = sprintf("SELECT $columnSelect FROM ".DB_PREFIXE."$table WHERE %s = '%s'",
5308     $columnNormalized,
5309     $valueNormalized);
5310    
5311     // s'il y a une colonne supplémentaire à ajouter à la clause WHERE
5312     if (! empty($extraColumn)) {
5313    
5314     // si cette colonne provient d'une autre table, on ajoute cette autre table
5315     $tables = array($table);
5316     if (! empty($extraTable) && $extraTable != $table) {
5317     $tables[] = $extraTable;
5318     }
5319    
5320     // construit le SQL avec les deux colonnes dans la clause WHERE
5321     $columnsNormalized = array($columnNormalized, $extraColumn);
5322     $valuesNormalized = array($valueNormalized, $extraValue);
5323     $sql = sprintf("SELECT $columnSelect FROM %s WHERE %s",
5324     DB_PREFIXE.implode(', '.DB_PREFIXE, $tables),
5325     implode(' AND ', array_map(
5326     function ($col, $val) {
5327     return "$col = '$val'";
5328     },
5329     $columnsNormalized, $valuesNormalized)));
5330     }
5331    
5332     // exécute la requête en demandant en résultat une unique valeur
5333     $res = $this->db->getOne($sql);
5334     $this->addToLog(__METHOD__."() : db->getOne(\"".$sql."\")", VERBOSE_MODE);
5335    
5336     // vérifie les erreurs
5337     if ($this->isDatabaseError($res, true) === true) {
5338     throw new RuntimeException(__("Erreur de base de données.").' '.
5339     sprintf(__("Détails: %s"), $res->getMessage()));
5340     }
5341     // si la ligne n'a pas été trouvée
5342     if ($res === null) {
5343     throw new InvalidArgumentException(__(
5344     "L'objet $table '$valueNormalized' n'existe pas."));
5345     }
5346    
5347     // renvoie la valeur trouvée
5348     return $res;
5349     }
5350    
5351     /**
5352     * Vérifie si la saisie du numéro complet est proche de la numérotation
5353     * réglementaire d'un dossier d'urbanisme (code de l'urbanisme A423-1 à A423-4)
5354     *
5355     * @param string $numero [description]
5356     * @param array $extra_args [description]
5357     * @return [type] [description]
5358     */
5359     public function numerotation_urbanisme(string $numero, array $extra_args = []) {
5360     // Masques
5361     $pattern_di = "/^([A-Z]{2})([0-9]{3})([0-9]{3})([0-9]{2})([A-Z0-9]{1})([0-9]{4})([A-Z]{1,5})?([0-9]{1,2})?$/i";
5362     $pattern_da = "/^([A-Z]{2})([0-9]{3})([0-9]{3})([0-9]{2})([A-Z0-9]{1})([0-9]{4})$/i";
5363    
5364     //
5365     $result = array(
5366     "di" => array(),
5367     "da" => array(),
5368     );
5369    
5370     //
5371     if (preg_match($pattern_di, $numero, $matches_di) === 1) {
5372     $result["di"] = $matches_di;
5373     $numero = $matches_di[1].$matches_di[2].$matches_di[3].$matches_di[4].$matches_di[5].$matches_di[6];
5374     }
5375     //
5376     if (preg_match($pattern_da, $numero, $matches_da) === 1) {
5377     $result["da"] = $matches_da;
5378     }
5379    
5380     return $result;
5381     }
5382 softime 10713
5383 softime 8989 }

Properties

Name Value
svn:keywords "Id"

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26