Ejemplo n.º 1
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');
 }
Ejemplo n.º 2
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');
 }
Ejemplo n.º 3
0
 /**
  * Get the php date format
  * @return string  The php date format
  */
 public static function getPhpDateTimeFormat()
 {
     global $phpDateTimeFormat;
     if (isset($phpDateTimeFormat[R3Locale::getLanguageCode()])) {
         return $phpDateTimeFormat[R3Locale::getLanguageCode()];
     }
     return null;
 }
Ejemplo n.º 4
0
 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');
 }
 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' => "."));
 }
Ejemplo n.º 6
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->kind = initVar('kind');
     $this->act = initVar('act', 'add');
     $this->mu_id = initVar('mu_id');
     $this->mu_name = initVar('mu_name');
     if ($this->mu_name != '') {
         // Convert municipality text into id
         $db = ezcDbInstance::get();
         $lang = R3Locale::getLanguageID();
         $this->mu_id = (int) $db->query("SELECT mu_id FROM municipality WHERE mu_name_{$lang} ILIKE " . $db->quote($request['mu_name']))->fetchColumn();
     }
     setLang(R3Locale::getLanguageCode());
     $this->registerAjaxFunction('submitFormData');
 }
Ejemplo n.º 7
0
 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');
 }
Ejemplo n.º 8
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');
 }
Ejemplo n.º 9
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->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');
 }
Ejemplo n.º 10
0
 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');
 }
Ejemplo n.º 11
0
 public function __construct(array $request = array(), array $opt = array())
 {
     parent::__construct($request, $opt);
     $this->id = initVar('id');
     $this->act = initVar('act', 'list');
     $this->tab_mode = initVar('tab_mode');
     $this->kind = initVar('kind');
     $this->ge_id = (int) initVar('ge_id');
     $this->gc_id = (int) initVar('gc_id');
     $this->limit = 0;
     $this->do_id = PageVar('do_id', $_SESSION['do_id'], false, false, $this->baseName);
     setLang(R3Locale::getLanguageCode());
     setLangInfo(array('thousands_sep' => "."));
     $this->fields = $this->defFields();
     $this->registerAjaxFunction('fetchUDM');
     $this->registerAjaxFunction('performEnergySourceRowCalc');
     $this->registerAjaxFunction('confirmDeleteGlobalConsumptionRow');
     $this->registerAjaxFunction('getEnergySource');
     $this->registerAjaxFunction('getEnergyUDM');
     $this->registerAjaxFunction('performActionCatalogCalc');
     $this->registerAjaxFunction('submitFormData');
 }
Ejemplo n.º 12
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 = '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');
 }
Ejemplo n.º 13
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');
 }
Ejemplo n.º 14
0
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;
    }
}
Ejemplo n.º 15
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 = (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');
 }
Ejemplo n.º 16
0
 /**
  * Return the help data (ajax)
  * @param array $request    the request
  * @return text             the help text (usually html)
  */
 public function getHelp($request)
 {
     require_once R3_LIB_DIR . 'eco_help.php';
     $body = R3Help::getHelpPartFromSection($request['section'], $request['id'], R3Locale::getLanguageCode());
     return array('data' => $body !== null ? $body : '');
 }
Ejemplo n.º 17
0
/**
 * Build the js if necessary
 *
 */
function R3BuildJS($force = false)
{
    global $auth, $jsPacker;
    $appCode = strtolower(APPLICATION_CODE);
    $jsDestPath = R3_UPLOAD_DATA_DIR . strtolower(R3EcoGisHelper::getCurrentDomainName()) . "/js/";
    $masterFileName = "{$jsDestPath}{$appCode}_all.js";
    if (!$force) {
        $rebuild = !file_exists($masterFileName);
        if (!$rebuild) {
            $compiledAge = filemtime($masterFileName);
            $files = $jsPacker['JS_files'];
            if (isset($jsPacker['files'])) {
                foreach ($jsPacker['files'] as $name => $fileGroup) {
                    $name = str_replace('<LANG>', R3Locale::getLanguageCode(), $name);
                    if (!file_exists("{$jsDestPath}{$name}")) {
                        $rebuild = true;
                        ezcLog::getInstance()->log("JavaScript file \"{$jsDestPath}{$name}\" not found. Rebuild necessary", ezcLog::DEBUG);
                        break;
                    }
                    foreach ($fileGroup as $file) {
                        $files[] = $file;
                    }
                }
            }
            foreach ($files as $file) {
                $file = str_replace('<LANG>', R3Locale::getLanguageCode(), $file);
                if (filemtime(R3_WEB_JS_DIR . $file) > $compiledAge) {
                    // Complie needed
                    $rebuild = true;
                    break;
                }
            }
        }
    }
    if ($force || $rebuild) {
        checkPath(dirname($masterFileName), true, true);
        // Non packed files
        if (isset($jsPacker['files'])) {
            foreach ($jsPacker['files'] as $name => $fileGroup) {
                $script = '';
                foreach ($fileGroup as $file) {
                    $file = str_replace('<LANG>', R3Locale::getLanguageCode(), $file);
                    $script .= "/*** " . basename($file) . " ***/\n\n\n" . file_get_contents(R3_WEB_JS_DIR . $file) . "\n\n\n";
                }
                $name = str_replace('<LANG>', R3Locale::getLanguageCode(), dirname($masterFileName) . '/' . $name);
                ezcLog::getInstance()->log("JavaScript rebuild for \"{$name}\"", ezcLog::DEBUG);
                file_put_contents($name, $script);
            }
        }
        require_once R3_LIB_DIR . 'class.JavaScriptPacker.php';
        $script = '';
        $funcList = array();
        foreach ($jsPacker['JS_files'] as $file) {
            $data = file_get_contents(R3_WEB_JS_DIR . $file);
            $script .= "{$data}\n\n\n";
            // Check function averride!
            foreach (explode("\n", $data) as $lineNo => $line) {
                if (substr($line, 0, 9) == 'function ' && ($p = strpos($line, '(')) !== false) {
                    $name = trim(substr($line, 9, $p - 9));
                    if (isset($funcList[$name])) {
                        echo "<b>Warning</b>: JavaScript function \"{$name}\" in file {$file}:{$lineNo} already declared in file {$funcList[$name]['file']}:{$funcList[$name]['line']}.<br />\n";
                    }
                    $funcList[$name] = array('file' => $file, 'line' => $lineNo);
                }
            }
        }
        if (!isset($jsPacker['minify_output'])) {
            ezcLog::getInstance()->log("JavaScript rebuild for \"{$masterFileName}\"", ezcLog::DEBUG);
            file_put_contents($masterFileName, $script);
        } else {
            $packer = new JavaScriptPacker($script, $jsPacker['minify_output'] ? 'Normal' : 'None', true, false);
            $packed = $packer->pack();
            ezcLog::getInstance()->log("JavaScript rebuild for \"{$masterFileName}\"", ezcLog::DEBUG);
            file_put_contents($masterFileName, $packed);
        }
    }
}
Ejemplo n.º 18
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->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');
 }
Ejemplo n.º 19
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->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');
 }
Ejemplo n.º 20
0
 /**
  * Return the help data (ajax)
  * @param array $request    the request
  * @return text             the help text (usually html)
  */
 public function getHelp($request)
 {
     global $smarty;
     require_once R3_LIB_DIR . 'eco_help.php';
     $smarty->assign('ELECTRICITY_KWH_FACTOR', R3Locale::convert2PHP($this->auth->getConfigValue('GENERAL', 'ELECTRICITY_KWH_FACTOR', 1)));
     $body = R3Help::getHelpPartFromSection($request['section'], $request['id'], R3Locale::getLanguageCode());
     return array('data' => $body !== null ? $body : '');
 }
Ejemplo n.º 21
0
 /**
  * Return the help data (ajax)
  * @param array $request    the request
  * @return text             the help text (usually html)
  */
 public function getHelp($request)
 {
     require_once R3_LIB_DIR . 'eco_help.php';
     $body = R3Help::getHelpPartFromSection($request['section'], $request['id'], R3Locale::getLanguageCode());
     // Help can be cacheable
     $ttl = 1 * 24 * 60 * 60;
     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $ttl) . ' GMT');
     header('Cache-Control: max-age=' . $ttl);
     header("Pragma: public", true);
     return array('data' => $body !== null ? $body : '');
 }