Esempio n. 1
0
 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set != $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $html .= $this->ui->form_input($form_input);
         }
     }
     return $html .= $this->ui->form_end(1, app::get('ectools')->_('保存设置'));
 }
Esempio n. 2
0
 public function process($all_settings)
 {
     if (!is_array($all_settings)) {
         return '';
     }
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'textarea', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number', SET_T_HTML => 'html');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'post'));
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set != $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'required' => $setlib[$set]['required'], 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($setlib[$set]['javascript']) {
                 $js .= $setlib[$set]['javascript'];
             }
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $html .= $this->ui->form_input($form_input);
         }
     }
     return $html .= $this->ui->form_end() . '<script>' . $js . '</script>';
 }
Esempio n. 3
0
 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'html', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     $input_style = false;
     $arr_js = array();
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $this->app->getConf($set);
             if ($set == 'wap.shopname') {
                 $current_set = app::get('wap')->getConf('wap.name');
             }
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set !== $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'helpinfo' => $setlib[$set]['helpinfo'], 'value' => $current_set, 'options' => $setlib[$set]['options'], 'vtype' => $setlib[$set]['vtype'], 'class' => $setlib[$set]['class'], 'id' => $setlib[$set]['id'], 'default' => $setlib[$set]['default']);
             if ($input_type == 'select') {
                 $form_input['required'] = true;
             }
             if (isset($setlib[$set]['extends_attr']) && $setlib[$set]['extends_attr'] && is_array($setlib[$set]['extends_attr'])) {
                 foreach ($setlib[$set]['extends_attr'] as $_key => $extends_attr) {
                     $form_input[$_key] = $extends_attr;
                 }
             }
             $arr_js[] = $setlib[$set]['javascript'];
             $html .= $this->ui->form_input($form_input);
         }
     }
     if (!$_POST) {
         $this->pagedata['_PAGE_CONTENT'] = $html .= $this->ui->form_end();
         $str_js = '';
         if (is_array($arr_js) && $arr_js) {
             foreach ($arr_js as $str_javascript) {
                 $str_js .= $str_javascript;
             }
         }
         if ($str_js) {
             $this->pagedata['_PAGE_CONTENT'] .= '<script type="text/javascript">window.addEvent(\'domready\',function(){';
             $this->pagedata['_PAGE_CONTENT'] .= $str_js . '});</script>';
         }
         $this->page();
     } else {
         $this->begin();
         app::get('wap')->setConf('wap.name', $_POST['set']['wap.shopname']);
         $this->end(true, app::get('wap')->_('当前配置修改成功!'));
     }
 }
Esempio n. 4
0
 private function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'html', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     $input_style = false;
     $arr_js = array();
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $pre_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set !== $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                     #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
                     if ($obj_operatorlogs = kernel::service('operatorlog.system')) {
                         if (method_exists($obj_operatorlogs, 'logPaymentnoticeConfigInfo')) {
                             $obj_operatorlogs->logPaymentnoticeConfigInfo($setlib[$set]['desc'], strip_tags($pre_set), strip_tags($_POST['set'][$set]));
                         }
                     }
                     #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options'], 'required' => $input_type == 'select' ? true : false);
             if (isset($setlib[$set]['extends_attr']) && $setlib[$set]['extends_attr'] && is_array($setlib[$set]['extends_attr'])) {
                 foreach ($setlib[$set]['extends_attr'] as $_key => $extends_attr) {
                     $form_input[$_key] = $extends_attr;
                 }
             }
             $arr_js[] = $setlib[$set]['javascript'];
             $html .= $this->ui->form_input($form_input);
         }
     }
     if (!$_POST) {
         $this->pagedata['_PAGE_CONTENT'] = $html .= $this->ui->form_end();
         $str_js = '';
         if (is_array($arr_js) && $arr_js) {
             foreach ($arr_js as $str_javascript) {
                 $str_js .= $str_javascript;
             }
         }
         if ($str_js) {
             $this->pagedata['_PAGE_CONTENT'] .= '<script type="text/javascript">window.addEvent(\'domready\',function(){';
             $this->pagedata['_PAGE_CONTENT'] .= $str_js . '});</script>';
         }
         $this->page();
     } else {
         $this->begin();
         $this->end(true, app::get('ectools')->_('当前配置修改成功!'));
     }
 }
Esempio n. 5
0
 public function __construct($app)
 {
     parent::__construct($app);
     include $this->app->app_dir . '/datasetting.php';
     $this->setting = $setting;
     $this->router = app::get('site')->router();
 }
 /**
  * Processes a visibility change
  * @param bool $oldvisibility
  * @return bool
  */
 protected function process_visibility_change($oldvisibility)
 {
     // Store the current dependent settings visibility for comparison
     $prevalue = $this->dependentsetting->get_visibility();
     // Set it regardless of whether we need to
     $this->dependentsetting->set_visibility($this->setting->get_visibility());
     // Return true if it changed
     return $prevalue != $this->dependentsetting->get_visibility();
 }
Esempio n. 7
0
 public function __construct($app)
 {
     parent::__construct($app);
     include $this->app->app_dir . '/datasetting.php';
     $this->setting = $setting;
     $this->goods_list = $goods_list;
     $this->order_list = $order_list;
     $this->order_list_items = $order_list_items;
     $this->store = $store;
     $this->router = app::get('site')->router();
 }
Esempio n. 8
0
 private function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $pre_set = $this->app->getConf($set);
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('label' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($input_type == 'select') {
                 $form_input['required'] = true;
             }
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $form_inputs[] = $form_input;
         }
     }
     return $form_inputs;
 }
Esempio n. 9
0
 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $pre_set = $this->app->getConf($set);
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set != $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                     #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
                     if ($obj_operatorlogs = kernel::service('operatorlog.system')) {
                         if (method_exists($obj_operatorlogs, 'logEctoolsConfigInfo')) {
                             $obj_operatorlogs->logEctoolsConfigInfo($setlib[$set]['desc'], $pre_set, $_POST['set'][$set]);
                         }
                     }
                     #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options']);
             if ($input_type == 'select') {
                 $form_input['required'] = true;
             }
             if ($input_type == 'image') {
                 $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
             }
             $html .= $this->ui->form_input($form_input);
         }
     }
     return $html .= $this->ui->form_end(1, app::get('ectools')->_('保存设置'));
 }
 public function add_dependency(backup_setting $dependentsetting, $type = setting_dependency::DISABLED_VALUE, $options = array())
 {
     // Check the dependency level is >= current level
     if ($dependentsetting->get_level() < $this->level) {
         throw new backup_setting_exception('cannot_add_upper_level_dependency');
     }
     parent::add_dependency($dependentsetting, $type, $options);
 }
 /**
  * Gets the the PARAM_XXXX validation to be applied to the setting
  *
  * return string The PARAM_XXXX constant of null if the setting type is not defined
  */
 public function get_param_validation()
 {
     return $this->setting->get_param_validation();
 }
Esempio n. 12
0
 function _process($all_settings)
 {
     $setting = new base_setting($this->app);
     $setlib = $setting->source();
     $obj_b2c_shop = $this->app->model('shop');
     //ajx 添加ecos.ocs节点
     $node_type = array('ecos.ome', 'ecos.ocs');
     $cnt = $obj_b2c_shop->count(array('status' => 'bind', 'node_type|in' => $node_type));
     // 发票高级配置埋点
     foreach (kernel::servicelist('invoice_setting') as $services) {
         if (is_object($services)) {
             if (method_exists($services, 'addHtml')) {
                 $addHtml = $services->addHtml();
             }
         }
     }
     if (isset($addHtml) && !empty($addHtml)) {
         $setlib = array_merge($setlib, $addHtml);
     }
     $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
     $tabs = array_keys($all_settings);
     $html = $this->ui->form_start(array('tabs' => $tabs, 'method' => 'POST'));
     $input_style = false;
     $arr_js = array();
     foreach ($tabs as $tab => $tab_name) {
         foreach ($all_settings[$tab_name] as $set) {
             $current_set = $this->app->getConf($set);
             if ($set == 'system.shopname') {
                 $current_set = app::get('site')->getConf('site.name');
             }
             if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                 if ($current_set !== $_POST['set'][$set]) {
                     $current_set = $_POST['set'][$set];
                     $this->app->setConf($set, $_POST['set'][$set]);
                 }
             }
             $input_type = $typemap[$setlib[$set]['type']];
             $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'helpinfo' => $setlib[$set]['helpinfo'], 'value' => $current_set, 'options' => $setlib[$set]['options'], 'vtype' => $setlib[$set]['vtype'], 'class' => $setlib[$set]['class'], 'id' => $setlib[$set]['id'], 'default' => $setlib[$set]['default']);
             if ($input_type == 'select') {
                 $form_input['required'] = true;
             }
             if ($cnt > 0) {
                 if ($form_input['name'] == "set[system.goods.freez.time]") {
                     if ($current_set != '1') {
                         $current_set = 1;
                     }
                     if ($current_set == '1') {
                         $form_input['disabled'] = "disabled";
                     }
                 }
             }
             if (isset($setlib[$set]['extends_attr']) && $setlib[$set]['extends_attr'] && is_array($setlib[$set]['extends_attr'])) {
                 foreach ($setlib[$set]['extends_attr'] as $_key => $extends_attr) {
                     $form_input[$_key] = $extends_attr;
                 }
             }
             $arr_js[] = $setlib[$set]['javascript'];
             $html .= $this->ui->form_input($form_input);
         }
     }
     if (!$_POST) {
         $this->pagedata['_PAGE_CONTENT'] = $html .= $this->ui->form_end() . '<script type="text/javascript">window.addEvent(\'domready\',function(){';
         $str_js = '';
         if (is_array($arr_js) && $arr_js) {
             foreach ($arr_js as $str_javascript) {
                 $str_js .= $str_javascript;
             }
         }
         $str_js .= '$("main").addEvent("click",function(el){
             el = el.target || el;
             if ($(el).get("id")){
                 var _id = $(el).get("id");
                 var _class_name = "";
                 if (_id.indexOf("-t") > -1){
                     _class_name = _id.substr(0, _id.indexOf("-t"));
                     $$("."+_class_name).getParent("tr").show();
                 }
                 if (_id.indexOf("-f") > -1){
                     _class_name = _id.substr(0, _id.indexOf("-f"));
                     var _destination_node = $$("."+_class_name);
                     _destination_node.getParent("tr").hide();
                     _destination_node.each(function(item){if (item.getNext(".caution") && item.getNext(".caution").hasClass("error")) item.getNext(".caution").remove();});
                 }
             }
         });';
         $this->pagedata['_PAGE_CONTENT'] .= $str_js . '});</script>';
         $this->page();
     } else {
         $this->begin();
         app::get('site')->setConf('site.name', $_POST['set']['system.shopname']);
         $this->end(true, app::get('b2c')->_('当前配置修改成功!'));
     }
 }
Esempio n. 13
0
    function _process($all_settings)
    {
        $setting = new base_setting($this->app);
        $setlib = $setting->source();
        $typemap = array(SET_T_STR => 'text', SET_T_INT => 'number', SET_T_ENUM => 'select', SET_T_BOOL => 'bool', SET_T_TXT => 'text', SET_T_FILE => 'file', SET_T_IMAGE => 'image', SET_T_DIGITS => 'number');
        $tabs = array_keys($all_settings);
        $html = $this->ui->form_start(array('tabs' => $tabs));
        $input_style = false;
        foreach ($tabs as $tab => $tab_name) {
            foreach ($all_settings[$tab_name] as $set) {
                $current_set = $this->app->getConf($set);
                if ($_POST['set'] && array_key_exists($set, $_POST['set'])) {
                    if ($current_set !== $_POST['set'][$set]) {
                        $current_set = $_POST['set'][$set];
                        $this->app->setConf($set, $_POST['set'][$set]);
                    }
                }
                $input_type = $typemap[$setlib[$set]['type']];
                if ($set == 'site.get_policy.method' && $current_set != '2') {
                    $input_style = true;
                }
                $form_input = array('title' => $setlib[$set]['desc'], 'type' => $input_type, 'name' => "set[" . $set . "]", 'tab' => $tab, 'value' => $current_set, 'options' => $setlib[$set]['options'], 'required' => $input_type == 'select' ? true : false);
                if ($input_style && $set == 'site.get_rate.method') {
                    $form_input['style'] = "display:none;";
                    $input_style = false;
                }
                if ($input_type == 'image') {
                    $form_input = array_merge($form_input, array('width' => $setlib[$set]['width'], 'height' => $setlib[$set]['height']));
                }
                $html .= $this->ui->form_input($form_input);
            }
        }
        $this->pagedata['_PAGE_CONTENT'] = $html .= $this->ui->form_end() . '<script type="text/javascript">window.addEvent(\'domready\',function(){
          
            $$(\'input[name^=set[site.trigger_tax]\',\'input[name^=set[site.show_mark_price]\').addEvent(\'click\',function(e){
                    var row=this.getParent(\'tr\');                     
                    if(this.checked&&this.get(\'value\')==\'true\'){
                        row.getNext(\'tr\').show();
                        if(this.name==\'set[site.show_mark_price]\')
                        row.getNext(\'tr\').getNext(\'tr\').show();
                    }
                    if(this.checked&&this.get(\'value\')==\'false\'){
                        row.getNext(\'tr\').hide();
                        if(this.name==\'set[site.show_mark_price]\')
                        row.getNext(\'tr\').getNext(\'tr\').hide();
                    }
           });            
            $$(\'input[name^=set[site.trigger_tax]\',\'input[name^=set[site.show_mark_price]\').each(function(el){
                el.fireEvent(\'click\');                
            })
        

            $$(\'select.inputstyle\').each(function(e){
                if (e.get(\'name\') == "set[site.get_policy.method]")
                {
                    e.addEvent(\'change\', function(){
                        if (e.get(\'value\') == \'2\')
                        {
                            $$(\'input\').each(function(el){
                                if (el.get(\'name\') == \'set[site.get_rate.method]\')
                                {
                                    el.getParent().getParent().show();
                                    el.show();
                                    el.set(\'value\', \'\');
                                }
                            });
                        }
                        else
                        {
                            $$(\'input\').each(function(el){
                                if (el.get(\'name\') == \'set[site.get_rate.method]\')
                                {
                                    el.getParent().getParent().hide();
                                    el.hide();
                                    el.set(\'value\', \'\');
                                }
                            });
                        }
                    });
                }
            });
        });</script>';
        $this->page();
    }
Esempio n. 14
0
 /**
  * Gets the value to display in a static quickforms element
  * @return mixed
  */
 public function get_static_value()
 {
     return $this->setting->get_value();
 }