/** * Return the data for a single customer */ public function getData($id = null) { $lang = R3Locale::getLanguageID(); if ($id === null) { $id = $this->id; } $db = ezcDbInstance::get(); if ($this->act == 'add') { $vlu = array(); if ($this->kind == 'street_lighting') { $data = $this->getElectricityUDMData($_SESSION['do_id']); $vlu['em_data']['udm_name'] = $data["udm_name_{$lang}"]; } else { $vlu['em_data'] = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $this->em_id); } } else { $q = $db->createSelectQuery(); $q->select('*')->from('consumption_data')->where('co_id=' . (int) $id); $vlu = $db->query($q)->fetch(PDO::FETCH_ASSOC); $this->em_id = $vlu['em_id']; $vlu['em_data'] = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $vlu['em_id']); $vlu = array_merge($vlu, R3EcoGisHelper::getChangeLogData('consumption', $vlu['co_id'])); //em_is_production } $this->data = $vlu; // Save the data (prevent multiple sql) return $vlu; }
/** * Return the data for a single customer */ public function getData($id = null) { $lang = R3Locale::getLanguageID(); if ($id === null) { $id = $this->id; } $db = ezcDbInstance::get(); if ($this->act == 'add') { $vlu = array(); $vlu['em_data'] = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $this->em_id); } else { $q = $db->createSelectQuery(); $q->select('*')->from('device_data')->where('dev_id=' . (int) $id); $vlu = $db->query($q)->fetch(PDO::FETCH_ASSOC); $this->em_id = $vlu['em_id']; $vlu['em_data'] = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $vlu['em_id']); $vlu = array_merge($vlu, R3EcoGisHelper::getChangeLogData('device', $vlu['dev_id'])); } $this->data = $vlu; // Save the data (prevent multiple sql) return $vlu; }