コード例 #1
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->ge_id = (int) initVar('ge_id');
     $this->gs_id = (int) initVar('gs_id');
     $this->gc_id = initVar('gc_id');
     $this->act = initVar('act', initVar('parent_act', 'mod'));
     $this->parent_act = initVar('parent_act', 'mod');
     $this->kind = strToUpper(initVar('kind'));
     $this->new_udm_divider = initVar('udm_divider');
     $this->merge_municipality_data = PageVar('merge_municipality_data', 'T') == 'T' ? true : false;
     $this->toggle_subcategory = initVar('toggle_subcategory');
     $this->do_id = PageVar('do_id', $_SESSION['do_id'], $init | $reset, false, $this->baseName);
     $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName);
     $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName);
     $this->bpu_id = PageVar('bpu_id', null, $init | $reset, false, $this->baseName);
     $this->order = PageVar('order', '1A', $init, false, $this->baseName);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('toggleSubcategory');
     $this->registerAjaxFunction('updateLastOpenCloseStatus');
 }
コード例 #2
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list';
     // if true store the filter variables
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->id = initVar('id');
     $this->last_id = initVar('last_id');
     $this->parent_act = initVar('parent_act');
     $this->tab_mode = initVar('tab_mode');
     $this->act = initVar('act', 'list');
     $this->do_id = $_SESSION['do_id'];
     $this->gpr_id = initVar('gpr_id');
     $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('askDelGlobalPlainGauge');
 }
コード例 #3
0
ファイル: obj.stat_general.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $this->act = initVar('act', 'mod');
     $this->do_id = $_SESSION['do_id'];
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('submitFormData');
 }
コード例 #4
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $init = array_key_exists('init', $this->request);
     $this->act = initVar('act', 'list');
     $this->sl_id = PageVar('sl_id');
     $this->last_id = initVar('consumption_last_id');
     $this->parent_act = PageVar('parent_act');
     $this->tab_mode = initVar('tab_mode');
     $this->order = PageVar('order', '6A', $init, false, $this->baseName);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
 }
コード例 #5
0
ファイル: obj.device.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->kind = PageVar('kind');
     $this->em_id = PageVar('em_id', null, $init | $reset, false, $this->baseName);
     $this->tabMode = PageVar('tab_mode', null, $init | $reset, false, $this->baseName);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('confirm_delete_device');
     $this->registerAjaxFunction('submitFormData');
 }
コード例 #6
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list';
     // if true store the filter variables
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->gc_id_filter = PageVar('gc_id_filter', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->gp_name = PageVar('gp_name', null, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('countGaugeAndMonitor');
 }
コード例 #7
0
ファイル: obj.consumption.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->kind = PageVar('kind');
     $this->em_id = PageVar('em_id', null, $init | $reset, false, $this->baseName);
     $this->sl_id = PageVar('sl_id', null, $init | $reset, false, $this->baseName);
     $this->tabMode = PageVar('tab_mode', null, $init | $reset, false, $this->baseName);
     $data = R3EcoGisHelper::getMeterData($_SESSION['do_id'], $this->em_id);
     $this->fields = $this->defFields($data['em_is_production'] == 'T');
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('confirm_delete_consumption');
     $this->registerAjaxFunction('submitFormData');
 }
コード例 #8
0
ファイル: obj.meter.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->do_id = $_SESSION['do_id'];
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->kind = initVar('kind');
     $this->bu_id = initVar('bu_id');
     $this->tabMode = initVar('tab_mode');
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('fetchUDM');
     $this->registerAjaxFunction('getEnergySourceList');
     $this->registerAjaxFunction('getUtilityProductList');
     $this->registerAjaxFunction('confirmDeleteMeter');
     $this->registerAjaxFunction('submitFormData');
 }
コード例 #9
0
ファイル: obj.street_lighting.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list';
     // if true store the filter variables
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->id = initVar('id');
     if (initVar('sl_id') !== null) {
         $this->id = initVar('sl_id');
     }
     $this->act = initVar('act', 'list');
     $this->last_id = initVar('last_id');
     $this->parent_act = initVar('parent_act');
     $this->do_id = $_SESSION['do_id'];
     $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->st_id = PageVar('st_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->st_name = PageVar('st_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->sl_full_name = PageVar('sl_full_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->sl_to_check = PageVar('sl_to_check', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('getMunicipalityList');
     $this->registerAjaxFunction('getStreetList');
     $this->registerAjaxFunction('getStreetLength');
     $this->registerAjaxFunction('confirmDeleteStreetLighting');
     $this->registerAjaxFunction('submitFormData');
 }
コード例 #10
0
ファイル: obj.public_user.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = array();
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->act = 'list';
     $this->order = PageVar('order', '1A', $init, false, $this->baseName);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName);
     $this->do_id = $_SESSION['do_id'];
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list' || $reset || $init;
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->us_name_email = PageVar('us_name_email', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->us_status = PageVar('us_status', null, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('askEnablePublicUser');
     $this->registerAjaxFunction('askDelPublicUser');
     $this->registerAjaxFunction('enablePublicUser');
     $this->registerAjaxFunction('delPublicUser');
 }
コード例 #11
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = array();
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->order = PageVar('order', '1A', $init, false, $this->baseName);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName);
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list' || $reset || $init;
     // if true store the filter variables
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->do_id_filter = (int) PageVar('do_id_filter', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_name_collection = PageVar('mu_name_collection', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('confirmDeleteMunicipalityCollection');
     $this->registerAjaxFunction('getAvailableMunicipalityForCollection');
 }
コード例 #12
0
ファイル: obj.action_catalog.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list';
     // if true store the filter variables
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->id = initVar('id');
     $this->last_id = initVar('last_id');
     $this->parent_act = initVar('parent_act');
     $this->tab_mode = initVar('tab_mode');
     $this->act = initVar('act', 'list');
     $this->do_id = $_SESSION['do_id'];
     $this->bu_id = initVar('bu_id');
     $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->ac_name = PageVar('ac_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->gc_id = PageVar('gc_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->gpa_name = PageVar('gpa_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->gpa_name = PageVar('ac_alternative_simulation', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar);
     $this->tableURL = array('bu_id' => $this->bu_id);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('getGlobalCategory');
     $this->registerAjaxFunction('getGlobalSubCategory');
     $this->registerAjaxFunction('getRelatedActionsList');
     $this->registerAjaxFunction('getEnergySource');
     $this->registerAjaxFunction('getEnergyUDM');
     $this->registerAjaxFunction('performActionCatalogCalc');
     $this->registerAjaxFunction('askDelActionCatalog');
     $this->registerAjaxFunction('updateActionName');
     $this->registerAjaxFunction('checkSubActionMapLink');
 }
コード例 #13
0
ファイル: obj.base_lookup.php プロジェクト: r3-gis/EcoGIS
 public function convert2Locale($vlu)
 {
     if (!is_array($vlu)) {
         return $vlu;
     }
     setLangInfo(array('thousands_sep' => "."));
     foreach ($this->fields as $key => $field) {
         if (isset($field['name'])) {
             $key = $field['name'];
             if (isset($field['dec']) && !isset($field['precision'])) {
                 $field['precision'] = $field['dec'];
             }
             if (array_key_exists($key, $vlu)) {
                 if ($vlu[$key] === null) {
                     $vlu[$key] = '';
                 } else {
                     $type = strToLower($field['type']);
                     switch ($field['type']) {
                         case 'real':
                         case 'double':
                         case 'number':
                         case 'float':
                             $vlu[$key] = R3NumberFormat($vlu[$key], isset($field['precision']) ? $field['precision'] : null, true);
                             break;
                         case 'integer':
                             $vlu[$key] = R3NumberFormat($vlu[$key], isset($field['precision']) ? $field['precision'] : 0, true);
                             break;
                         case 'date':
                             $vlu[$key] = SQLDateToStr($vlu[$key], R3Locale::getPhpDateFormat());
                             break;
                         case 'datetime':
                         case 'now':
                             $vlu[$key] = SQLDateToStr($vlu[$key], R3Locale::getPhpDateTimeFormat());
                             break;
                         case 'boolean':
                             if ($vlu[$key] === true) {
                                 $vlu[$key] = 'T';
                             } else {
                                 if ($vlu[$key] === false) {
                                     $vlu[$key] = 'F';
                                 }
                             }
                     }
                 }
             }
         }
     }
     return $vlu;
 }
コード例 #14
0
ファイル: obj.global_strategy.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $storeVar = isset($_GET['act']) && $_GET['act'] == 'list';
     // if true store the filter variables
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     if ($init || $reset) {
         $storeVar = true;
     }
     $this->id = (int) initVar('id');
     $this->last_id = initVar('last_id');
     $this->act = initVar('act', 'list');
     $this->parent_act = initVar('parent_act');
     $this->do_id = PageVar('do_id', $_SESSION['do_id'], $init | $reset, false, $this->baseName, $storeVar);
     $this->pr_id = PageVar('pr_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->gst_name = PageVar('gst_name', null, $init | $reset, false, $this->baseName, $storeVar);
     $this->order = PageVar('order', '1A', $init, false, $this->baseName, $storeVar);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName, $storeVar);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('loadGE_GS');
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('exportPAES');
     $this->registerAjaxFunction('exportPAESDlg');
     $this->registerAjaxFunction('getExportPAESStatus');
     $this->registerAjaxFunction('askDelGlobalStrategy');
 }
コード例 #15
0
ファイル: obj.utility.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->fields = $this->defFields();
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->last_id = initVar('last_id');
     $this->act = initVar('act', 'list');
     $this->do_id = $_SESSION['do_id'];
     // PageVar('do_id',          $_SESSION['do_id'],    $init | $reset, false, $this->baseName);
     $this->mu_id = PageVar('mu_id', null, $init | $reset, false, $this->baseName);
     $this->mu_name = PageVar('mu_name', null, $init | $reset, false, $this->baseName);
     $this->es_id = PageVar('es_id', null, $init | $reset, false, $this->baseName);
     $this->order = PageVar('order', '1A', $init, false, $this->baseName);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('askDelUtility');
 }
コード例 #16
0
ファイル: eco_utils.php プロジェクト: r3-gis/EcoGIS
function R3NumberFormat($value, $decimals = null, $useThousandsSep = false, $maxDec = 10)
{
    if (is_array($value)) {
        foreach ($value as $key => $val) {
            $value[$key] = R3NumberFormat($val, $decimals, $useThousandsSep, $maxDec);
        }
        return $value;
    } else {
        if (strlen($value) == '') {
            return '';
        }
        if (!defined("__R3_LOCALE__")) {
            require_once 'r3locale.php';
        }
        $oldLocale = setlocale(LC_NUMERIC, 0);
        setlocale(LC_NUMERIC, getLocaleInfo(R3Locale::getLanguageCode()));
        setLangInfo(array('thousands_sep' => "."));
        $localeInfo = getLocaleInfo(getLangLocaleByCode(R3Locale::getLanguageCode()));
        if ($decimals === null) {
            $diff = round($value - (int) $value, $maxDec);
            if ($diff == 0) {
                $decimals = 0;
            } else {
                $decimals = strlen($diff) - 2;
                // -2 is 0. of the number
            }
        }
        $thousands_sep = $useThousandsSep === true ? $localeInfo['thousands_sep'] : '';
        $result = number_format($value, $decimals, $localeInfo['decimal_point'], $thousands_sep);
        setlocale(LC_ALL, $oldLocale);
        return $result;
    }
}
コード例 #17
0
ファイル: obj.base.php プロジェクト: r3-gis/EcoGIS
 public function convert2Locale(array $vlu)
 {
     // Change to locale
     $oldMessageLocale = setlocale(LC_MESSAGES, 0);
     $oldNumericLocale = setlocale(LC_NUMERIC, 0);
     setlocale(LC_NUMERIC, getLocaleInfo(R3Locale::getLanguageCode()));
     setLangInfo(array('thousands_sep' => "."));
     foreach ($this->fields as $key => $field) {
         if (isset($field['name'])) {
             $key = $field['name'];
             if (isset($field['dec']) && !isset($field['precision'])) {
                 $field['precision'] = $field['dec'];
             }
             if (isset($field['is_primary_key']) && $field['is_primary_key'] === true) {
                 continue;
             }
             if (array_key_exists($key, $vlu)) {
                 if ($vlu[$key] === null) {
                     $vlu[$key] = '';
                     // IE Fix in json response
                 } else {
                     $type = strToLower($field['type']);
                     switch ($field['type']) {
                         case 'real':
                         case 'double':
                         case 'number':
                         case 'float':
                             $vlu[$key] = R3NumberFormat($vlu[$key], isset($field['precision']) ? $field['precision'] : null, true);
                             break;
                         case 'integer':
                             $vlu[$key] = R3NumberFormat($vlu[$key], isset($field['precision']) ? $field['precision'] : 0, true);
                             break;
                         case 'date':
                             $vlu[$key] = SQLDateToStr($vlu[$key], R3Locale::getPhpDateFormat());
                             break;
                         case 'datetime':
                         case 'now':
                             $vlu[$key] = SQLDateToStr($vlu[$key], R3Locale::getPhpDateTimeFormat());
                             break;
                         case 'boolean':
                             if ($vlu[$key] === true) {
                                 $vlu[$key] = 'T';
                             } else {
                                 if ($vlu[$key] === false) {
                                     $vlu[$key] = 'F';
                                 }
                             }
                     }
                 }
             }
         }
     }
     setlocale(LC_MESSAGES, $oldMessageLocale);
     setlocale(LC_NUMERIC, $oldNumericLocale);
     return $vlu;
 }
コード例 #18
0
 public function submitFormData($request)
 {
     $errors = array();
     $db = ezcDbInstance::get();
     setLocale(LC_ALL, 'C');
     setLangInfo(array('thousands_sep' => "."));
     $request['gs_id'] = forceInteger($request['id'], 0, false, '.');
     if ($this->act == 'mod') {
         $sql = "SELECT ge_id, gc_id FROM global_subcategory WHERE gs_id={$request['gs_id']}";
         list($request['ge_id'], $request['gc_id']) = $db->query($sql)->fetch(PDO::FETCH_NUM);
     }
     if ($this->act != 'del') {
         $errors = $this->checkFormData($request, $request['kind']);
     }
     if (count($errors) > 0) {
         return $this->getAjaxErrorResult($errors);
     } else {
         $db->beginTransaction();
         // Remove consumption
         $em_list = $this->getEnergyMeterList($request['gs_id']);
         if (count($em_list) > 0) {
             $sql = "DELETE FROM consumption WHERE em_id IN (" . implode(', ', $em_list) . ")";
             // Remove consumption
             $db->exec($sql);
             $sql = "DELETE FROM energy_meter WHERE em_id IN (" . implode(', ', $em_list) . ")";
             // Remove energy_meter
             $db->exec($sql);
         }
         $sql = "DELETE FROM global_data WHERE gs_id=" . $request['gs_id'];
         $db->exec($sql);
         if ($this->act == 'del') {
             $sql = "DELETE FROM global_subcategory WHERE gs_id=" . $request['gs_id'];
             $db->exec($sql);
         } else {
             if (isset($request['gs_tot_value'])) {
                 $request['gs_tot_value'] = $request['gs_tot_value'] * 1000;
             }
             if (isset($request['gs_tot_production_value'])) {
                 $request['gs_tot_production_value'] = $request['gs_tot_production_value'] * 1000;
             }
             if (isset($request['gs_tot_emission_value'])) {
                 $request['gs_tot_emission_value'] = $request['gs_tot_emission_value'] * 1000;
             }
             if (isset($request['gs_tot_emission_factor'])) {
                 $request['gs_tot_emission_factor'] = $request['gs_tot_emission_factor'] * 1000;
             }
             $id = $this->applyData($request);
             $geData = $db->query("SELECT mu_id, ge_year FROM global_entry WHERE ge_id={$request['ge_id']}")->fetch(PDO::FETCH_ASSOC);
             $year = $geData['ge_year'];
             $mu_id = $geData['mu_id'];
             $totalOnly = $db->query("SELECT gc_total_only FROM global_category WHERE gc_id=" . (int) $request['gc_id'])->fetchColumn() == true;
             if (!$totalOnly) {
                 foreach ($request['ges_id_consumption'] as $key => $value) {
                     if (empty($request['ac_expected_energy_saving'][$key])) {
                         continue;
                     }
                     $ges_id = $this->getGlobalEnergySource($request['es_id_consumption'][$key], $request['udm_id_consumption'][$key]);
                     if (empty($ges_id)) {
                         throw new Exception("getGlobalEnergySource(" . $request['es_id_consumption'][$key] . ', ' . $request['udm_id_consumption'][$key] . ") key={$key} faild");
                     }
                     $sql = "INSERT INTO global_data (ges_id, gs_id) VALUES ({$ges_id}, {$id})";
                     $db->exec($sql);
                     $gd_id = $db->lastInsertId('global_data_gd_id_seq');
                     $esu_id = R3EcoGisHelper::getEnergySourceUdmID($this->do_id, $request['es_id_consumption'][$key], $request['udm_id_consumption'][$key], $mu_id, false);
                     if (!empty($esu_id)) {
                         $em_id = R3EcoGisHelper::addDummyEnergyMeter(array('esu_id' => $esu_id, 'em_object_id' => $gd_id), 'GLOBAL_ENERGY');
                         $data = array();
                         $data['co_start_date'] = "'{$year}-01-01'";
                         $data['co_end_date'] = "'{$year}-12-31'";
                         $data['co_value'] = forceFloat($request['ac_expected_energy_saving'][$key], null, '.');
                         $data['co_bill'] = 0;
                         $data['em_id'] = $em_id;
                         if (in_array($this->kind, array('ENERGY_PRODUCTION', 'HEATH_PRODUCTION'))) {
                             $data['co_production_co2_factor'] = (double) forceFloat($request['co_production_co2_factor'][$key], null, '.');
                         }
                         $sql = "INSERT INTO consumption (" . implode(', ', array_keys($data)) . ") VALUES (" . implode(', ', $data) . ")";
                         $db->exec($sql);
                     } else {
                         throw new Exception("Unknown esu [es_id={$request['es_id_consumption'][$key]}; udm_id={$request['udm_id_consumption'][$key]}; do_id={$this->do_id}; mu_id={$mu_id}]");
                     }
                 }
             }
             if (isset($request['geometryStatus']) && strtoupper($request['geometryStatus']) == 'CHANGED') {
                 $session_id = session_id();
                 $sql = "UPDATE global_subcategory\r\n                            SET the_geom=foo.the_geom\r\n                            FROM (SELECT MULTI(ST_Force_2d(ST_union(ST_Buffer(the_geom, 0.0)))) AS the_geom FROM edit_tmp_polygon WHERE session_id='{$session_id}') AS foo\r\n                            WHERE gs_id={$id}";
                 $db->exec($sql);
             }
         }
         $db->commit();
         R3EcoGisEventNotifier::notifyDataChanged($this, array('data_changed' => true));
         return array('status' => R3_AJAX_NO_ERROR, 'js' => "submitFormDataDoneEnergySourceRow({$id}, '{$this->kind}')");
     }
 }
コード例 #19
0
ファイル: obj.customer.php プロジェクト: r3-gis/EcoGIS
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $init = array_key_exists('init', $this->request);
     $reset = array_key_exists('reset', $this->request);
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->order = PageVar('order', '1A', $init, false, $this->baseName);
     $this->pg = PageVar('pg', 0, $init | $reset, false, $this->baseName);
     $this->fields = $this->defFields();
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->registerAjaxFunction('getHelp');
     $this->registerAjaxFunction('validateDomain');
     $this->registerAjaxFunction('getSRIDDesc');
     $this->registerAjaxFunction('getMunicipality');
     $this->registerAjaxFunction('submitFormData');
     $this->registerAjaxFunction('confirmDeleteCustomer');
     $this->registerAjaxFunction('vacuum');
     $this->registerAjaxFunction('create_grid');
 }