Пример #1
0
 public static function getSelectedMunicipalityList($mu_id)
 {
     $db = ezcDbInstance::get();
     $lang = R3Locale::getLanguageID();
     $constraints = array();
     $constraints[] = 'mu_parent_id=' . (int) $mu_id;
     return R3Opt::getOptList('municipality', 'mu_id', "mu_name_{$lang}", array('constraints' => $constraints));
 }
Пример #2
0
 public static function getGlobalPlainList($do_id, $mu_id, array $opt = array())
 {
     $db = ezcDbInstance::get();
     $lang = R3Locale::getLanguageID();
     $constraints = array('do_id=' . (int) $do_id, 'mu_id=' . (int) $mu_id);
     $opt = array_merge(array('constraints' => $constraints), $opt);
     return R3Opt::getOptList('global_plain_data', 'gp_id', 'gp_name_' . R3Locale::getLanguageID(), $opt);
 }
Пример #3
0
 public static function getSelectedMunicipalityList($do_id, array $opt = array())
 {
     $opt = array_merge(array('pr_id' => '', 'mu_name' => ''), $opt);
     $db = ezcDbInstance::get();
     $lang = R3Locale::getLanguageID();
     $constraints = array();
     $constraints[] = 'do_id=' . (int) $do_id;
     if ($opt['pr_id'] > 0) {
         $constraints[] = 'pr_id=' . (int) $opt['pr_id'];
     }
     if ($opt['mu_name'] != '') {
         $constraints[] = "mu_name_{$lang} ILIKE " . $db->quote('%' . $opt['mu_name'] . '%');
     }
     return R3Opt::getOptList('municipality_data', 'mu_id', 'mu_name_prov_' . R3Locale::getLanguageID(), array('constraints' => $constraints));
 }
Пример #4
0
 /**
  * Return the electricity energy source for the work
  *
  * param integer|null $do_id        the user domain. If null no domain filter
  * return array                     the municipality list
  */
 public static function getUtilityProductList($do_id, $us_id, $kind)
 {
     $db = ezcDbInstance::get();
     $opt = array('show_query' => false, 'constraints' => array('us_id=' . (int) $us_id, 'et_code=' . $db->quote($kind)));
     return R3Opt::getOptList('utility_product_data', 'up_id', 'up_name_' . R3Locale::getLanguageID(), $opt);
 }
Пример #5
0
 /**
  * Return the data for a single customer
  */
 public function getLookupData($id = null)
 {
     $lang = R3Locale::getLanguageID();
     $db = ezcDbInstance::get();
     $lkp = array();
     if ($this->auth->getParam('mu_id') == '') {
         $lkp['pr_values'] = R3EcoGisHelper::getProvinceList($this->do_id);
         $lkp['mu_values'] = R3EcoGisHelper::getMunicipalityList($this->do_id);
     } else {
         $lkp['mu_values'] = array($this->auth->getParam('mu_id') => '');
     }
     $mu_id = $this->auth->getParam('mu_id');
     if ($this->act == 'add' && count($lkp['mu_values']) == 1) {
         $mu_id = key($lkp['mu_values']);
     } else {
         if ($this->act == 'mod') {
             $mu_id = $this->data['mu_id'];
         }
     }
     $lkp['es_values'] = R3Opt::getOptList('energy_source_udm_data', 'es_id', 'es_name_' . R3Locale::getLanguageID(), array('constraints' => "do_id={$this->do_id} AND mu_id IS NULL"));
     // AND esu_is_private IS FALSE"));
     if ($this->data['es_id'] != '') {
         $sqlUDM = "SELECT udm_id, udm_name_{$lang} AS udm_name\r\n                       FROM energy_source_udm_data\r\n                       WHERE do_id IS NULL AND es_id={$this->data['es_id']}\r\n                       GROUP BY udm_id, udm_name_{$lang}\r\n                       ORDER BY udm_name, udm_id";
         $lkp['udm_values'] = $db->query($sqlUDM)->fetchAll(PDO::FETCH_COLUMN | PDO::FETCH_UNIQUE);
     }
     return $lkp;
 }
Пример #6
0
 static function getGlobalStrategyList($do_id, $mu_id, array $opt = array())
 {
     $db = ezcDbInstance::get();
     $opt['constraints'] = 'mu_id=' . (int) $mu_id;
     return R3Opt::getOptList('global_strategy', 'gst_id', 'gst_name_' . R3Locale::getLanguageID(), $opt);
 }
Пример #7
0
 public function getGlobalMethodList($do_id)
 {
     $do_id = (int) $do_id;
     return R3Opt::getOptList('global_method', 'gm_id', 'gm_name_' . R3Locale::getLanguageID(), array('order' => 'gm_order, gm_name_' . R3Locale::getLanguageID(), 'constraints' => array("(do_id IS NULL OR do_id={$do_id}) AND gm_visible IS TRUE")));
 }