Exemplo n.º 1
0
     $array_return = array();
     $myform = new generate_form();
     $myform->addTable($bg_table);
     $myform->add('con_restaurant_name', 'res_name', 0, 0, '');
     $myform->add('con_restaurant_address', 'res_address', 0, 0, '');
     $myform->add('con_restaurant_phone', 'res_phone', 0, 0, '');
     // quay tinh tien
     $myform->add('con_default_svdesk', 'con_default_svdesk', 1, 0, 0);
     //kho hang
     $myform->add('con_default_store', 'con_default_store', 1, 0, 0);
     if (!$myform->checkdata()) {
         $con_picture = getValue('con_restaurant_image', 'str', 'POST', '');
         if ($con_picture) {
             $myform->add('con_restaurant_image', 'con_restaurant_image', 0, 0, '');
             //upload ảnh
             module_upload_picture($con_picture);
         }
         $db_update = new db_execute($myform->generate_update_SQL('con_admin_id', $admin_id));
         unset($db_update);
         // log action
         log_action(ACTION_LOG_ADD, 'Cập nhật hệ thống cài đặt chung');
         $array_return['msg'] = "Cập nhập thành công";
         $array_return['success'] = 1;
         die(json_encode($array_return));
     }
     break;
 case 'setup-system':
     break;
     // cập nhập thực đơn mặc định khi bắt đầu
 // cập nhập thực đơn mặc định khi bắt đầu
 case 'defaultMenus':
Exemplo n.º 2
0
            $myform->addTable($bg_table);
            /* code something */
            $myform->add('cus_name', 'cus_name', 0, 0, '', 1, 'Bạn chưa nhập tên khách hàng');
            $myform->add('cus_address', 'cus_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ');
            $myform->add('cus_phone', 'cus_phone', 0, 0, '', 0, '');
            $myform->add('cus_email', 'cus_email', 0, 0, '', 1, '');
            $myform->add('cus_cat_id', 'cus_cat_id', 1, 0, '', 0, '');
            $myform->add('cus_code', 'cus_code', 0, 0, '', 0, '');
            $myform->add('cus_note', 'cus_note', 0, 0, '', 0, '');
            $bg_errorMsg .= $myform->checkdata();
            if (!$myform->checkdata()) {
                $cus_picture = getValue('cus_picture', 'str', 'POST', '');
                if ($cus_picture) {
                    $myform->add('cus_picture', 'cus_picture', 0, 0, '');
                    //upload ảnh
                    module_upload_picture($cus_picture);
                }
                $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
                unset($db_insert);
                //log action
                log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $record_id . ' bảng ' . $bg_table);
                redirect('index.php');
            }
            break;
    }
}
//Phần hiển thị
//Khởi tạo
$left_control = '';
$right_control = '';
$footer_control = '';
Exemplo n.º 3
0
            break;
        case 'edit_record':
            $record_id = getValue('record_id', 'int', 'POST', 0);
            $myform = new generate_form();
            $myform->addTable($bg_table);
            /* code something */
            $myform->add('pro_name', 'pro_name', 0, 0, '', 1, 'Bạn chưa nhập tên thực đơn');
            $myform->add('pro_unit_id', 'pro_unit_id', 1, 0, '', 1, 'Bạn chưa nhập đơn vị tính');
            $myform->add('pro_cat_id', 'pro_cat_id', 1, 0, '', 0, '');
            $myform->add('pro_instock', 'pro_instock', 1, 0, '', 0, '');
            $myform->add('pro_code', 'pro_code', 0, 0, '', 0, '');
            $myform->add('pro_note', 'pro_note', 0, 0, '', 0, '');
            if (!$myform->checkdata()) {
                $pro_image = getValue('pro_image', 'str', 'POST', '');
                if ($pro_image) {
                    module_upload_picture($pro_image);
                    $myform->add('pro_image', 'pro_image', 0, 0, '');
                }
                $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
                unset($db_insert);
                //log action
                log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $record_id . ' bảng ' . $bg_table);
                redirect('index.php');
            }
            break;
    }
}
//Phần hiển thị
//Khởi tạo
$left_control = '';
$right_control = '';
Exemplo n.º 4
0
$myform->add('sec_type', 'sec_type', 1, 0, 0);
$myform->add('sec_body_system', 'sec_body_system', 1, 0, 0);
$myform->add('sec_desc', 'sec_desc', 0, 0, '');
$form_redirect = getValue('form_redirect', 'str', 'POST', '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $bg_errorMsg = $myform->checkdata();
    /**
     * something code here
     */
    if (!$bg_errorMsg) {
        //lưu ảnh
        $sec_picture = getValue('sec_picture', 'str', 'POST', '');
        if ($sec_picture) {
            $myform->add('sec_picture', 'sec_picture', 0, 1, '');
            module_upload_picture($sec_picture);
        }
        $db_update = new db_execute($myform->generate_update_SQL($id_field, $record_id));
        unset($db_update);
        /**
         * something code here
         */
        //redirect
        redirect($form_redirect);
    }
}
//lấy dữ liệu record cần sửa đổi
$db_data = new db_query("SELECT * FROM " . $bg_table . " WHERE " . $id_field . " = " . $record_id);
if ($row = mysqli_fetch_assoc($db_data->result)) {
    foreach ($row as $key => $value) {
        ${$key} = $value;
Exemplo n.º 5
0
            $myform->addTable($bg_table);
            /* code something */
            $myform->add('sup_name', 'sup_name', 0, 0, '', 1, 'Bạn chưa nhập tên nhà cung cấp');
            $myform->add('sup_address', 'sup_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ nhà cung cấp');
            $myform->add('sup_phone', 'sup_phone', 0, 0, '', 0, '');
            $myform->add('sup_mobile', 'sup_mobile', 0, 0, '', 0, '');
            $myform->add('sup_fax', 'sup_fax', 0, 0, '', 0, '');
            $myform->add('sup_email', 'sup_email', 0, 0, '', 0, '');
            $myform->add('sup_website', 'sup_website', 0, 0, '', 0, '');
            $myform->add('sup_cat_id', 'sup_cat_id', 1, 0, '', 0, '');
            if (!$myform->checkdata()) {
                $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
                //upload image
                $sup_image = getValue('sup_image', 'str', 'POST', '');
                if ($sup_image) {
                    module_upload_picture($sup_image);
                    $myform->add('sup_image', 'sup_image', 0, 0, '');
                }
                unset($db_insert);
                //log action
                log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $record_id . ' bảng ' . $bg_table);
                redirect('index.php');
            }
            break;
    }
}
//Phần hiển thị
//Khởi tạo
$left_control = '';
$right_control = '';
$left_column = '';
Exemplo n.º 6
0
            $myform->add('use_name', 'use_name', 0, 0, '', 1, 'Bạn chưa nhập tên nhân viên');
            $myform->add('use_address', 'use_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ nhân viên');
            $myform->add('use_phone', 'use_phone', 0, 0, '', 0, '');
            $myform->add('use_pay', 'use_pay', 1, 0, '', 0, '');
            $myform->add('use_discount', 'use_discount', 1, 0, '', 0, '');
            $myform->add('use_group_id', 'use_group_id', 1, 0, '', 0, '');
            $myform->add('use_code', 'use_code', 0, 0, '', 0, '');
            $myform->add('use_note', 'use_note', 0, 0, '', 0, '');
            $bg_errorMsg .= $myform->checkdata();
            //            add_error_msg('Chưa nhập tên nv');
            if (!$myform->checkdata()) {
                $use_image = getValue('use_image', 'str', 'POST', '');
                if ($use_image) {
                    $myform->add('use_image', 'use_image', 0, 0, '');
                    //upload ảnh
                    module_upload_picture($use_image);
                }
                $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
                unset($db_insert);
                //log action
                log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $record_id . ' bảng ' . $bg_table);
                redirect('index.php');
            }
            break;
    }
}
//Phần hiển thị
//Khởi tạo
$left_control = '';
$right_control = '';
$footer_control = '';
Exemplo n.º 7
0
     $myform->add('men_price', 'men_price', 1, 0, '', 1, 'Bạn chưa nhập giá bán chính');
     $myform->add('men_price1', 'men_price1', 1, 0, '', 0, '');
     $myform->add('men_price2', 'men_price2', 1, 0, '', 0, '');
     $myform->add('men_note', 'men_note', 0, 0, '', 0, '');
     if (!$myform->checkdata()) {
         $men_image = getValue('men_image', 'str', 'POST', '');
         if ($men_image) {
             $myform->add('men_image', 'men_image', 0, 0, '');
             //upload ảnh
             module_upload_picture($men_image);
         }
         $men_image = getValue('men_image', 'str', 'POST', '');
         if ($men_image) {
             $myform->add('men_image', 'men_image', 0, 0, '');
             //upload ảnh
             module_upload_picture($men_image);
         }
         $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
         unset($db_insert);
         //log action
         log_action(ACTION_LOG_EDIT, 'Chỉnh sửa bản ghi ' . $record_id . ' bảng ' . $bg_table);
         redirect('index.php');
     }
     break;
 case 'add_menu_product':
     //quyền đặc biệt : công thức chế biến
     $custom_permission = 'CONG_THUC_CHE_BIEN';
     checkCustomPermission($custom_permission);
     $mep_menu_id = getValue('mep_menu_id', 'int', 'POST', 0);
     $mep_product_id = getValue('mep_product_id', 'int', 'POST', 0);
     $mep_quantity = getValue('mep_quantity', 'flo', 'POST', 0);
Exemplo n.º 8
0
     break;
 case 'edit_category':
     checkPermission('edit');
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $myform->addTable($cat_table);
     $myform->add('cat_name', 'cat_name', 0, 0, '', 1, 'Bạn chưa nhập tên danh mục');
     $myform->add('cat_type', 'cat_type', 0, 1, '');
     $myform->add('cat_desc', 'cat_desc', 0, 0, '');
     $myform->add('cat_note', 'cat_note', 0, 0, '');
     if (!$myform->checkdata()) {
         $cat_picture = getValue('cat_picture', 'str', 'POST', '');
         if ($cat_picture) {
             $myform->add('cat_picture', 'cat_picture', 0, 0, '');
             //upload ảnh
             module_upload_picture($cat_picture);
         }
         $db_insert = new db_execute($myform->generate_update_SQL('cat_id', $record_id));
         unset($db_insert);
         //log action
         log_action(ACTION_LOG_EDIT, 'Sửa danh mục ' . $record_id . ' bảng categories_multi');
         redirect('index.php');
     }
     break;
 case 'add_record':
     checkPermission('add');
     $myform = new generate_form();
     $myform->addTable($bg_table);
     /* code something */
     if (!$myform->checkdata()) {
         $db_insert = new db_execute_return();
Exemplo n.º 9
0
 * Something here ...
 * insert, update...
 */
$form_redirect = getValue('form_redirect', 'str', 'POST', '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $que_man_list = getValue('que_man_list', 'arr', 'POST', array());
    if ($que_man_list) {
        $que_man_list = implode(',', $que_man_list);
        $myform->add('que_man_list', 'que_man_list', 0, 1, '');
    }
    //up ảnh
    $que_image = getValue('que_image', 'str', 'POST', '');
    if ($que_image) {
        $myform->add('que_image', 'que_image', 0, 0, '');
        module_upload_picture($que_image);
    }
    $bg_errorMsg = $myform->checkdata();
    /**
     * something code here
     */
    if (!$bg_errorMsg) {
        $db_insert = new db_execute_return();
        $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
        unset($db_insert);
        /**
         * something code here
         */
        //redirect
        if ($last_id) {
            redirect($form_redirect);
Exemplo n.º 10
0
$myform->add('adv_name', 'adv_name', 0, 0, '', 1, 'Bạn chưa nhập tên quảng cáo');
$myform->add('adv_link', 'adv_link', 0, 0, '');
$myform->add('adv_position', 'adv_position', 1, 0, 0);
$myform->add('adv_active', 'adv_active', 1, 0, 0);
/**
 * Something here ...
 * insert, update...
 */
$form_redirect = getValue('form_redirect', 'str', 'POST', '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    //up ảnh
    $adv_image = getValue('adv_image', 'str', 'POST', '');
    if ($adv_image) {
        $myform->add('adv_image', 'adv_image', 0, 0, '');
        module_upload_picture($adv_image);
    }
    $bg_errorMsg = $myform->checkdata();
    /**
     * something code here
     */
    if (!$bg_errorMsg) {
        $db_insert = new db_execute_return();
        $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
        unset($db_insert);
        /**
         * something code here
         */
        //redirect
        if ($last_id) {
            redirect($form_redirect);