Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     date_default_timezone_set(DEFAULT_TIMEZONE);
     $this->lang->load('mallerp', $this->get_current_language());
     // check user session
     $current_uri = fetch_request_uri();
     if (!in_array($current_uri, $this->never_verify_list())) {
         if (!$this->account->get_account() && $current_uri != 'mallerp/login' && $current_uri != 'authenticate/login') {
             if ($this->input->is_post()) {
                 echo $this->create_json(0, lang('session_timeout_login_again'));
                 die('');
             }
             redirect(site_url('mallerp/login'));
         }
         // end of check user session
         // start verify secret key
         if (uri_string() && $this->config->item('enable_secret_key')) {
             if (strpos($this->uri->uri_string(), $current_uri . '/' . 'popup')) {
                 $current_uri = $current_uri . '/' . 'popup';
             }
             $total_segments = $this->uri->total_segments();
             if (!$this->cipherkey->verify_key($current_uri, $this->uri->segment($total_segments))) {
                 if ($this->input->is_post()) {
                     echo $this->create_json(0, lang('session_timeout_login_again'));
                     die('');
                 }
                 redirect(site_url('mallerp/login'));
             }
         }
     }
     // end veirify secret key
     // debug model
     if (!$this->input->is_post()) {
         if (debug_mode()) {
             $this->output->enable_profiler(TRUE);
         }
     }
     $this->load->driver('cache', array('backup' => 'file'));
     $this->set_nav();
     $this->_save_referrer();
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('order_model');
     $this->load->model('ebay_order_model');
     $this->load->model('product_model');
     $this->load->model('product_makeup_sku_model');
     $this->load->model('order_shipping_record_model');
     $this->load->model('shipping_code_model');
     $this->load->model('shipping_subarea_model');
     $this->load->library('excel');
     $this->load->helper('shipping_helper');
     $this->load->helper('db_helper');
     date_default_timezone_set(DEFAULT_TIMEZONE);
     // check user session
     $current_uri = fetch_request_uri();
     if (!$this->input->is_post()) {
         if (debug_mode()) {
             $this->output->enable_profiler(TRUE);
         }
     }
     $this->load->driver('cache', array('backup' => 'file'));
 }
Exemplo n.º 3
0
 private function get($prefix, $key = NULL)
 {
     $key .= fetch_request_uri();
     return $this->CI->session->userdata($prefix . $key);
 }
Exemplo n.º 4
0
<?php

$current_uri = fetch_request_uri();
?>
<div id="page:left" class="side-col">
    <div class="switcher">
    <span class="title"><h3><?php 
echo lang('options');
?>
</h3></span>
    </div>
    <ul class="tabs config-tabs" id="system_config_tabs">
        <?php 
foreach ($links as $title => $link) {
    ?>
        <li>
            <dl>
                <dt style="" class="label"><?php 
    echo lang($title);
    ?>
</dt>
                <?php 
    $link_count = count($link);
    $i = 0;
    ?>
                <?php 
    foreach ($link as $uri => $span) {
        ?>
                    <?php 
        $class = $uri == $current_uri ? ' active ' : '';
        ?>
Exemplo n.º 5
0
function request_uri_count()
{
    return count(explode('/', fetch_request_uri()));
}
Exemplo n.º 6
0
 public function generate_reset_search($config = array(), $content_id = '')
 {
     $url = site_url(fetch_request_uri());
     if (isset($config['url'])) {
         $url = $config['url'];
     }
     $key = NULL;
     if (isset($config['key'])) {
         $key = $config['key'];
     }
     $params = '{}';
     if (isset($config['filters'])) {
         $filters = $config['filters'];
         $params = '{';
         foreach ($filters as $filter) {
             if (isset($filter['field'])) {
                 $field_method = 'LIKE';
                 if (isset($filter['method'])) {
                     $field_method = $filter['method'];
                 }
                 switch ($field_method) {
                     case 'from_to':
                         $field = $filter['field'];
                         $field = str_replace('.', '_DOT_', $field);
                         $field = str_replace('|', '_OR_', $field);
                         $field_method = '>=';
                         $from_field = $field . '_from';
                         $params .= "'from_MULT_{$field}': \$('filter_{$from_field}').value,'{$field}_method': '{$field_method}',";
                         $field_method = '<=';
                         $to_field = $field . '_to';
                         $params .= "'to_MULT_{$field}': \$('filter_{$to_field}').value,'{$to_field}_method': '{$field_method}',";
                         break;
                     default:
                         $field = $filter['field'];
                         $field = str_replace('.', '_DOT_', $field);
                         $field = str_replace('|', '_OR_', $field);
                         $params .= "'{$field}': \$('filter_{$field}').value,'{$field}_method': '{$field_method}',";
                         break;
                 }
             }
         }
         $params = rtrim($params, ',');
         $params .= '}';
     }
     $config = array('name' => 'search_button', 'id' => 'search_button', 'type' => 'submit', 'value' => lang('search'), 'class' => 'form-button', 'style' => 'float: right', 'onclick' => "helper.reset_or_search('{$url}', {$params}, '{$content_id}');return false;");
     $buttons = form_input($config);
     $params = "{reset: 'reset'}";
     $config = array('name' => 'reset_button', 'id' => 'reset_button', 'type' => 'button', 'value' => lang('reset'), 'class' => 'form-button', 'style' => 'float: right', 'onclick' => "helper.reset_or_search('{$url}', {$params}, '{$content_id}');return false;");
     $buttons .= form_input($config) . '<div style="clear:right;"></div>';
     return $buttons;
 }
Exemplo n.º 7
0
    /**
     * Generate the table
     *
     * @access	public
     * @param	mixed
     * @return	string
     */
    function generate($table_data = NULL, $sort_config = array())
    {
        // The table data can optionally be passed to this function
        // either as a database result object or an array
        if (!is_null($table_data)) {
            if (is_object($table_data)) {
                $this->_set_from_object($table_data);
            } elseif (is_array($table_data)) {
                $set_heading = (count($this->heading) == 0 and $this->auto_heading == FALSE) ? FALSE : TRUE;
                $this->_set_from_array($table_data, $set_heading);
            }
        }
        // Is there anything to display?  No?  Smite them!
        if (count($this->heading) == 0 and count($this->rows) == 0) {
            return 'Undefined table data';
        }
        // Compile and validate the template date
        $this->_compile_template();
        // set a custom cell manipulation function to a locally scoped variable so its callable
        $function = $this->function;
        // Build the table!
        $out = $this->template['table_open'];
        $out .= $this->newline;
        // Add any caption here
        if ($this->caption) {
            $out .= $this->newline;
            $out .= '<caption>' . $this->caption . '</caption>';
            $out .= $this->newline;
        }
        // Is there a table heading to display?
        if (count($this->heading) > 0) {
            $out .= $this->template['thead_open'];
            $out .= $this->newline;
            $out .= $this->template['heading_row_start'];
            $out .= $this->newline;
            // hacked by lion weng starts here
            $i = 0;
            $base_url = base_url();
            $CI =& get_instance();
            $head_id = NULL;
            // hacked by lion weng ends here
            foreach ($this->heading as $heading) {
                $temp = $this->template['heading_cell_start'];
                foreach ($heading as $key => $val) {
                    if ($key != 'data') {
                        //$temp = str_replace('<th', "<th $key='$val'", $temp);
                    } else {
                        if (is_array($val)) {
                            $sort_url = site_url(fetch_request_uri());
                            if (isset($val['sort_url'])) {
                                $sort_url = $val['sort_url'];
                            }
                        }
                        if (is_array($val) && isset($val['sort_key'])) {
                            $out .= "<th onclick='helper.sort_table(\"{$sort_url}\", \"{$val['sort_key']}\")'>";
                        } else {
                            if (isset($sort_config[$i])) {
                                $out .= "<th sort='{$sort_config[$i]}'>";
                            } else {
                                $out .= $this->template['heading_cell_start'];
                            }
                        }
                        $i++;
                        if (is_array($val)) {
                            $direction = '';
                            $sorter = '';
                            if ($head_id || isset($val['id'])) {
                                $head_id = isset($val['id']) ? $val['id'] : $head_id;
                                $direction = $CI->filter->get_sorter_direction($head_id);
                                $sorters = $CI->filter->get_sorters($head_id) ? $CI->filter->get_sorters($head_id) : array();
                                $sorter = implode(' ', $sorters);
                                $sorter = str_replace(array(' desc', ' asc'), '', $sorter);
                            }
                            if ($direction && isset($val['sort_key']) && $val['sort_key'] == $sorter) {
                                if ($direction == 'desc') {
                                    $class = 'desc';
                                } else {
                                    if ($direction == 'asc') {
                                        $class = 'asc';
                                    }
                                }
                                $heading_text = <<<HEAD_TEXT
        <span class='sortable-base sortable-bg'>
            <span class="sortable-{$class}">
            {$val['text']}
            </span>
        </span>
HEAD_TEXT;
                            } else {
                                if (isset($val['sort_key'])) {
                                    $heading_text = <<<HEAD_TEXT
            <span class='sortable-base'>
            {$val['text']}
            </span>
HEAD_TEXT;
                                } else {
                                    $heading_text = $val['text'];
                                }
                            }
                        } else {
                            $heading_text = $val;
                        }
                        $temp = $heading_text;
                    }
                    // hacked by lion weng ends here
                }
                $out .= $temp;
                // hacked by lion weng starts here
                // $out .= isset($heading['data']) ? $heading['data'] : '';
                // hacked by lion weng ends here
                $out .= $this->template['heading_cell_end'];
            }
            $out .= $this->template['heading_row_end'];
            $out .= $this->newline;
            $out .= $this->template['thead_close'];
            $out .= $this->newline;
        }
        // Build the table rows
        if (count($this->rows) > 0) {
            $out .= $this->template['tbody_open'];
            $out .= $this->newline;
            $i = 1;
            foreach ($this->rows as $row) {
                if (!is_array($row)) {
                    break;
                }
                // We use modulus to alternate the row colors
                $name = fmod($i++, 2) ? '' : 'alt_';
                $out .= $this->template['row_' . $name . 'start'];
                $out .= $this->newline;
                foreach ($row as $cell) {
                    $temp = $this->template['cell_' . $name . 'start'];
                    foreach ($cell as $key => $val) {
                        if ($key != 'data') {
                            $temp = str_replace('<td', "<td {$key}='{$val}'", $temp);
                        }
                    }
                    $cell = isset($cell['data']) ? $cell['data'] : '';
                    $out .= $temp;
                    if ($cell === "" or $cell === NULL) {
                        $out .= $this->empty_cells;
                    } else {
                        if ($function !== FALSE && is_callable($function)) {
                            $out .= call_user_func($function, $cell);
                        } else {
                            $out .= $cell;
                        }
                    }
                    $out .= $this->template['cell_' . $name . 'end'];
                }
                $out .= $this->template['row_' . $name . 'end'];
                $out .= $this->newline;
            }
            $out .= $this->template['tbody_close'];
            $out .= $this->newline;
        }
        $out .= $this->template['table_close'];
        return $out;
    }