Exemplo 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')->_('保存设置'));
 }
Exemplo 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>';
 }
Exemplo 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')->_('当前配置修改成功!'));
     }
 }
Exemplo 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')->_('当前配置修改成功!'));
     }
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 6
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')->_('保存设置'));
 }
Exemplo n.º 7
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')->_('当前配置修改成功!'));
     }
 }
Exemplo n.º 8
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();
    }