Exemplo n.º 1
0
 public function lang_load($lang_id)
 {
     include $this->lang_dir . 'enLang.php';
     if ($this->lang_exists($lang_id)) {
         $file = $this->lang_dir . $lang_id . 'Lang.php';
     }
     if (!empty($file) && $lang_id != 'en') {
         include $file;
     }
     glb::set('txt', $txt);
 }
Exemplo n.º 2
0
 public static function dbg($message)
 {
     $phposHELPERS = glb::get('phposHELPERS');
     $phposHELPERS['messages'][] = array('text' => $message, 'type' => 'dbg');
     glb::set('phposHELPERS', $phposHELPERS);
 }
Exemplo n.º 3
0
function winConfig($helper_name, $helper_params = null)
{
    // Get globals
    $app_name = glb::get('app_name');
    $app_action = glb::get('app_action');
    $app_param = glb::get('app_param');
    $win_obj = glb::get('apiWindow');
    switch ($helper_name) {
        // ----------
        case 'use_params':
            // If GET parameters, then parse them and apply to window object
            if (!empty($_GET['app_params'])) {
                $win_obj->setAppParams($_GET['app_params']);
                glb::set('apiWIndow', $win_obj);
            }
            // If empty params (file included by ajax, from parent main window?)
            if (!$helper_params && !is_array(glb::get('app_param'))) {
                $app_param = $win_obj->getParam('app_params');
            }
            // Parse APP params
            foreach ($app_param as $key => $value) {
                $param_name = $key;
                $param_value = $value;
                // If object have param data in window object
                if ($win_obj->appParam($param_name)) {
                    $app_param[$param_name] = $win_obj->appParam($param_name);
                } else {
                    $win_obj->set_appParam($param_name, $param_value);
                }
            }
            glb::set('app_param', $app_param);
            // Apply parameters to global
            $win_obj->updateWindow();
            glb::set('apiWindow', $win_obj);
            break;
            // ----------
        // ----------
        case 'use_menu':
            // Default menu file = action, e.g. "indexMenu.php" (in main app folder)
            $menu_file = $app_action;
            // Override menu file if specified in array
            if (is_array($params)) {
                $menu_file = $params[$app_action];
            }
            // If menu exists, load it
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/' . $menu_file . 'Menu.php')) {
                include PHPOS_APPS_DIR . $app_name . '/' . $menu_file . 'Menu.php';
                glb::set('app_menu', $app_menu);
                // Apply loaded menu to global
            }
            break;
            // ----------
        // ----------
        case 'use_toolbar':
            // Default toolbar file = action, e.g. "indexToolbar.php" (in main app folder)
            $toolbar_file = $app_action;
            // Override menu file if specified in array
            if (is_array($params)) {
                $toolbar_file = $params[$app_action];
            }
            // If menu exists, load it
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/' . $toolbar_file . 'Toolbar.php')) {
                include PHPOS_APPS_DIR . $app_name . '/' . $toolbar_file . 'Toolbar.php';
                glb::set('app_toolbar', $app_toolbar);
                // Apply loaded menu to global
            }
            break;
            // ----------
        // ----------
        case 'use_action':
            // Override actual action
            break;
            // ----------
        // ----------
        case 'langs':
            // Load app langs config to global app_langs
            if (is_array($helper_params)) {
                $win_obj->appParam('_config_langs', $helper_params);
                glb::set('apiWindow', $win_obj);
                glb::set('app_langs', $helper_params);
            }
            break;
            // ----------
        // ----------
        case 'use_lang':
            // if param = choosen lang
            if (!empty($helper_params)) {
                $lang = $helper_params;
            } else {
                // if empty, get info from window
                $obj_lang = $win_obj->appParam('_config_lang');
                if (!empty($obj_lang)) {
                    $lang = $obj_lang;
                } else {
                    // set from global OS config
                    $lang = cfg::get('lang');
                }
            }
            // Set app lang
            glb::set("app_lang", $lang);
            // Get app available langs
            $app_langs = glb::get('app_langs');
            // If empty langs try load info from window params
            if (!is_array($app_langs)) {
                $app_langs = $win_obj->appParam('_config_langs');
            }
            // Get global lang file
            $txt = glb::get('txt');
            // Set app lang file to load
            $lang_file = $app_langs[$lang];
            // Load lang file
            if (file_exists(PHPOS_APPS_DIR . $app_name . '/lang/' . $lang_file . 'Lang.php')) {
                include PHPOS_APPS_DIR . $app_name . '/lang/' . $lang_file . 'Lang.php';
                $win_obj->appParam('_config_lang', $lang);
                $win_obj->updateWindow();
                glb::set('apiWindow', $win_obj);
                glb::set('txt', $txt);
                // add app lang to global lang
            }
            break;
    }
}
Exemplo n.º 4
0
 public function menu($norender = null)
 {
     if (empty($this->region)) {
         $this->region = 'north';
     }
     if (empty($this->split)) {
         $this->split = 'false';
     }
     if (empty($this->fit)) {
         $this->fit = 'true';
     }
     if (empty($this->height)) {
         $this->height = '45';
     }
     $css_height = $this->height;
     $str = '<div id="' . $this->get_id('menu') . '" data-options="' . $this->data_options() . '" class="' . $this->get_classes('') . '" style="' . $this->get_style() . '">';
     $menu_html = $this->my_app->window->get_layout_menu_html();
     $menu = glb::get('window_menu');
     if ($norender != 'norender') {
         $str .= '<div id="api_window_headermenu_container" style="background-color:#eff5fb">' . $menu_html . '</div>';
     } else {
         $html['menu'] = $menu_html;
         glb::set('html', $html);
     }
     $this->reset_params();
     return $str;
 }