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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4156 by nmeucci, Fri May 13 12:58:37 2016 UTC revision 4218 by nhaye, Thu May 19 12:41:50 2016 UTC
# Line 1617  class utils extends application { Line 1617  class utils extends application {
1617          // Retour          // Retour
1618          return $emetteur;          return $emetteur;
1619      }      }
1620    
1621        /**
1622         * Récupère la liste des identifiants des collectivités
1623         *
1624         * @param  string $return_type 'string' ou 'array' selon que l'on retourne
1625         *                             respectivement une chaîne ou un tableau
1626         * @param  string $separator   caractère(s) séparateur(s) employé(s) lorsque
1627         *                             l'on retourne une chaîne, inutilisé si tableau
1628         * @return mixed               possibilité de boolean/string/array :
1629         *                             false si erreur BDD sinon résultat
1630         */
1631        public function get_list_id_collectivites($return_type = 'string', $separator = ',') {
1632            $sql = "
1633            SELECT
1634            array_to_string(
1635                array_agg(om_collectivite),
1636                '".$separator."'
1637            ) as list_id_collectivites
1638            FROM ".DB_PREFIXE."om_collectivite";
1639            $list = $this->db->getone($sql);
1640            $this->addTolog(
1641                __FILE__." - ".__METHOD__." : db->getone(\"".$sql."\");",
1642                VERBOSE_MODE
1643            );
1644            if ($this->isDatabaseError($list, true)) {
1645                return false;
1646            }
1647            if ($return_type === 'array') {
1648                return explode($separator, $list);
1649            }
1650            return $list;
1651        }
1652  }  }
1653    
1654  ?>  ?>

Legend:
Removed from v.4156  
changed lines
  Added in v.4218

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26