예제 #1
0
파일: eco_utils.php 프로젝트: r3-gis/EcoGIS
 /**
  * If has municipality collection, return a 2D array with municipality and municipality collection.
  * if anly municipality present return only the municipality list in 1Dim array. Used for option and optiongroup in html select
  * 
  * @param type $do_id
  * @return type
  */
 public static function getMunicipalityAndMunicipalityCollectionList($do_id, $like = null, $limit = null, array $opt = array())
 {
     $result = array();
     $result['has_municipality_collection'] = R3EcoGisHelper::hasMunicipalityCollection($do_id);
     if ($result['has_municipality_collection']) {
         $munucipalityCollectionList = R3EcoGisHelper::getMunicipalityCollectionList($do_id, $like, $limit, $opt);
         $munucipalityList = R3EcoGisHelper::getMunicipalityList($do_id, $like, $limit, $opt);
         if (count($munucipalityCollectionList) > 0) {
             $result['data'][_('Raggruppamenti')] = $munucipalityCollectionList;
             $result['tot']['collection'] = count($result['data'][_('Raggruppamenti')]);
         } else {
             $result['tot']['collection'] = 0;
         }
         if (count($munucipalityList) > 0) {
             $result['data'][_('Comuni')] = $munucipalityList;
             $result['tot']['municipality'] = count($result['data'][_('Comuni')]);
         } else {
             $result['tot']['municipality'] = 0;
         }
     } else {
         $result['data'] = R3EcoGisHelper::getMunicipalityList($do_id, $like, $limit, $opt);
         $result['tot']['municipality'] = count($result['data']);
     }
     return $result;
 }