예제 #1
0
 function manage_trans_config()
 {
     if (!$this->m_admin->check_is_any_admin(76)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $login_id = $this->login_id;
     $login_type = $this->login_type;
     $editable_list = $this->m_admin->trans_config_get_all('editable', 1);
     if (isset($_POST) && !empty($_POST)) {
         $can_redirect_to = 0;
         foreach ($editable_list as $row) {
             $conf_type = $row['conf_type'];
             $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
             $post_data = 'post_data' . $row['trans_conf_id'];
             $field_desc = $row['conf_name'] . ' (' . $row['trans_conf_desc'] . ')';
             if ($conf_type == 'can') {
                 $post_list[$post_data] = check_is_positive_numeric($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|integer');
             } else {
                 $post_list[$post_data] = check_is_positive_decimal($this->input->post($conf_slug));
                 $this->form_validation->set_rules($conf_slug, $field_desc, 'trim|required|numeric');
             }
         }
         if ($this->input->post('button_action') == "save") {
             if ($this->form_validation->run() === TRUE) {
                 foreach ($editable_list as $row) {
                     $post_data = 'post_data' . $row['trans_conf_id'];
                     $update_value = format_decimal($post_list[$post_data]);
                     $this->m_admin->trans_config_set($row['trans_conf_id'], $update_value);
                 }
                 $message_info = add_message_info($message_info, 'Transaction Config success update.');
                 $can_redirect_to = 1;
             }
         }
         direct_go:
         if ($message_info != NULL) {
             $this->session->set_flashdata('message', $message_info);
         }
         if ($can_redirect_to == 1) {
             redirect(uri_string(), 'refresh');
         }
     }
     // set the flash data error message if there is one
     $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));
     foreach ($editable_list as $row) {
         $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
         $conf_value = $this->m_admin->trans_config_get($row['trans_conf_id']);
         $this->data[$conf_slug] = array('name' => $conf_slug, 'id' => $conf_slug, 'type' => 'text', 'style' => 'text-align:right;width:50px', 'value' => $this->form_validation->set_value($conf_slug, $conf_value));
     }
     $this->data['editable_list'] = $editable_list;
     $this->data['page_path_name'] = 'admin/manage_trans_config';
     $this->load->view('template/index', $this->data);
 }
예제 #2
0
<div id="profile">
    <h1>Transaction Config Edit</h1>
    <div id='profile-content'>  
        <?php 
$this->load->view('admin/manage_setting_sub_menu');
?>
        <div id='profile-info'> 
            <?php 
echo form_open(uri_string());
?>
            <div id='profile-info-form'>
                <?php 
foreach ($editable_list as $row) {
    $conf_type = $row['conf_type'];
    $change_type = $row['change_type'];
    $conf_slug = generate_label_name($row['conf_name']) . $row['trans_conf_id'];
    $field_desc = $row['conf_name'] . ' (' . $row['trans_conf_desc'] . ')';
    if ($conf_type == 'can') {
        ?>
   
                        <div id='profile-info-form-each' style='width:500px'>
                            <div id='profile-info-form-each-label'><?php 
        echo $field_desc;
        ?>
</div>
                            <?php 
        if ($change_type == 'dec') {
            echo '- ';
        }
        echo form_input(${$conf_slug});
        ?>