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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:keywords "Id"

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26