<?php
/*
  $Id: pepexpress.php $
  TomatoCart Open Source Shopping Cart Solutions
  http://www.tomatocart.com

  Copyright (c) 2010 Wuxi Elootec Technology Co., Ltd

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License v2 (1991)
  as published by the Free Software Foundation.
*/

  class osC_Shipping_pepexpress extends toC_China_Shipping_Admin {
    var $icon;

    var $_title,
        $_code = 'pepexpress',
        $_author_name = 'TomatoCart',
        $_author_www = 'http://www.tomatocart.com',
        $_status = false,
        $_sort_order,
        $_zone_params;

// class constructor
    function osC_Shipping_pepexpress() {
      global $osC_Language;

      $this->icon = '';

      $this->_title = $osC_Language->get('shipping_pepexpress_title');
      $this->_description = $osC_Language->get('shipping_pepexpress_description');
      $this->_status = (defined('MODULE_SHIPPING_PEPEXPRESS_STATUS') && (MODULE_SHIPPING_PEPEXPRESS_STATUS == 'True') ? true : false);
      $this->_sort_order = (defined('MODULE_SHIPPING_PEPEXPRESS_SORT_ORDER') ? MODULE_SHIPPING_PEPEXPRESS_SORT_ORDER : null);
      $this->_zone_params = array('pepexpress_base_fee' => 5,
                                  'pepexpress_step1_fee' => 2,
                                  'pepexpress_step2_fee' => 1,
                                  'pepexpress_free_shipping' => 0);
    }

// class methods
    function isInstalled() {
      return (bool)defined('MODULE_SHIPPING_PEPEXPRESS_STATUS');
    }

    function install() {
      global $osC_Database;

      parent::install();

      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values('激活邮政快递包裹', 'MODULE_SHIPPING_PEPEXPRESS_STATUS', '是', '您想要使用邮政快递包裹吗?', '6', '0', 'osc_cfg_set_boolean_value(array(\'是\', \'否\'))', now())");
      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('税种', 'MODULE_SHIPPING_PEPEXPRESS_TAX_CLASS', '0', '请选择邮政快递包裹所使用的税种。', '6', '0', 'osc_cfg_use_get_tax_class_title', 'osc_cfg_set_tax_classes_pull_down_menu', now())");
      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('保价费用', 'MODULE_SHIPPING_PEPEXPRESS_INSURE_FEE', '0', '邮政快递包裹保价费用。', '6', '0', now())");
      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('排序', 'MODULE_SHIPPING_PEPEXPRESS_SORT_ORDER', '0', '邮政快递包裹显示位置顺序。', '6', '0', now())");
      $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('网站地址', 'MODULE_SHIPPING_PEPEXPRESS_URL', 'http://post.post5.org/', '邮政快递包裹查看运输单的网址', '6', '0', now())");
    }

    function getKeys() {
      if (!isset($this->_keys)) {
        $this->_keys = array('MODULE_SHIPPING_PEPEXPRESS_STATUS',
                             'MODULE_SHIPPING_PEPEXPRESS_TAX_CLASS',
                             'MODULE_SHIPPING_PEPEXPRESS_INSURE_FEE',
                             'MODULE_SHIPPING_PEPEXPRESS_SORT_ORDER');
      }

      return $this->_keys;
    }
    
    function getZoneParams() {
      return $this->_zone_params;
    }
  }
?>
