コード例 #1
0
ファイル: add.php プロジェクト: virutmath/suckhoe
$array_section = array('' => ' -- Bộ phận -- ');
$db_query = new db_query('SELECT * FROM sections WHERE sec_parent_id = 0 ORDER BY sec_id ASC');
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $array_section[$row['sec_id']] = $row['sec_name'];
    $db_child = new db_query('SELECT * FROM sections WHERE sec_parent_id = ' . $row['sec_id'] . ' ORDER BY sec_id ASC');
    while ($row_child = mysqli_fetch_assoc($db_child->result)) {
        $array_section[$row_child['sec_id']] = '       - ' . $row_child['sec_name'];
    }
}
unset($db_query);
#Phần code xử lý
$que_date = time();
$que_status = 1;
$myform = new generate_form();
$myform->addTable($bg_table);
$myform->add('que_title', 'que_title', 0, 0, '', 1, 'Bạn chưa nhập tiêu đề', 1, 'Tiêu đề trùng');
$myform->add('que_cat_id', 'que_cat_id', 1, 0, 0, 1, 'Bạn chưa chọn danh mục hỏi đáp');
$myform->add('que_sec_id', 'que_sec_id', 1, 0, 0, 1, 'Bạn chưa chọn bộ phận ảnh hưởng');
$myform->add('que_username', 'que_username', 0, 0, '', 1, 'Bạn chưa nhập tên người hỏi');
$myform->add('que_question_content', 'que_question_content', 0, 0, '', 1, 'Bạn chưa nhập nội dung câu hỏi');
$myform->add('que_answer_content', 'que_answer_content', 0, 0, '', 'Bạn chưa nhập nội dung câu trả lời');
$myform->add('que_professional', 'que_professional', 0, 0, '');
$myform->add('que_disease', 'que_disease', 0, 0, '');
$myform->add('que_status', 'que_status', 1, 1, 0);
$myform->add('que_type', 'que_type', 1, 0, 0);
$myform->add('que_date', 'que_date', 1, 1, 0);
$myform->removeHTML(0);
/**
 * Something here ...
 * insert, update...
 */
コード例 #2
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
}
//danh sách danh mục hỏi đáp
$array_cat_hoidap = array();
$db_query = new db_query('SELECT * FROM categories WHERE cat_type = ' . CATEGORY_TYPE_HOIDAP);
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $array_cat_hoidap[$row['cat_id']] = $row['cat_name'];
}
unset($db_query);
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('cdi_name', 'cdi_name', 0, 0, '', 1, 'Bạn chưa nhập tên bệnh');
$myform->add('cdi_name_alias', 'cdi_name_alias', 0, 0, '');
$myform->add('cdi_tag', 'cdi_tag', 0, 0, '');
$myform->add('cdi_body_system', 'cdi_body_system', 1, 0, 0);
$myform->add('cdi_popular', 'cdi_popular', 1, 0, 0);
$myform->add('cdi_truyen_nhiem', 'cdi_truyen_nhiem', 1, 0, 0);
$form_redirect = getValue('form_redirect', 'str', 'POST', '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $bg_errorMsg = $myform->checkdata();
    /**
     * something code here
     */
    $cdi_sec_id = getValue('cdi_sec_id', 'arr', 'POST', array());
    $cdi_sec_id = array_unique($cdi_sec_id);
    $cdi_sec_id = implode(',', $cdi_sec_id);
コード例 #3
0
ファイル: quickedit.php プロジェクト: virutmath/suckhoe
$returnurl = base64_decode(getValue("url", "str", "GET", base64_encode("listing.html")));
$errorMsg = '';
$errorMsgAll = "";
$iQuick = getValue("iQuick", "str", "POST", "");
$record_id = getValue("record_id", "arr", "POST", "");
if (!$record_id) {
    redirect('listing.html');
}
if ($iQuick == 'update') {
    $total_record = count($record_id);
    if ($total_record > 0) {
        for ($i = 0; $i < $total_record; $i++) {
            //Call Class generate_form();
            $myform = new generate_form();
            //Insert to database
            $myform->add('cat_name', "cat_name" . $record_id[$i], 0, 0, '', 0, '', 0, '');
            $myform->add('cat_order', "cat_order" . $record_id[$i], 1, 0, '', 0, '', 0, '');
            //Add table
            $myform->addTable($bg_table);
            $errorMsg .= $myform->checkdata($id_field, $record_id[$i]);
            //Check loi cua tat ca cac ban ghi duoc sua
            $errorMsgAll .= $errorMsg;
            if ($errorMsg == "") {
                $db_ex = new db_execute($myform->generate_update_SQL($id_field, $record_id[$i]));
                unset($db_ex);
            } else {
                echo $record_id[$i] . " : " . $errorMsg . "</br>";
            }
            unset($myform);
        }
    }
コード例 #4
0
ファイル: add.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('add');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
$myform->add('cit_name', 'cit_name', 0, 0, '', 1, 'Bạn chưa nhập tên tỉnh - thành phố');
$myform->add('cit_tw', 'cit_tw', 1, 0, '');
$myform->add('cit_static_fee', 'cit_static_fee', 1, 0, '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $bg_errorMsg = $myform->checkdata();
    if (!$bg_errorMsg) {
        $db_insert = new db_execute_return();
        $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
        //insert quận huyện nếu có
        $array_district = getValue('array_district', 'arr', 'POST', '');
        if ($array_district) {
            $sql_district = 'INSERT INTO ' . $bg_table_district . '(dis_city_id,dis_name) VALUES';
            foreach ($array_district as $district) {
                if (!$district) {
                    continue;
                }
                $district = remove_magic_quote($district);
                $district = removeScript($district);
                $district = removeHTML($district);
                $sql_district .= '(' . $last_id . ',"' . $district . '"),';
            }
            $sql_district = rtrim($sql_district, ',');
            //insert
コード例 #5
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
<?php

require 'inc_security.php';
$record_id = getValue('record_id');
$listGender = array();
$listGender[0] = '-- Giới tính --';
$listGender[1] = 'Nam';
$listGender[2] = 'Nữ';
$listGender[3] = 'Khác';
$use_birthday = getValue('use_birthday', 'str', 'POST', '');
$use_birthday = convertDateTime($use_birthday);
$myform = new generate_form();
$myform->removeHTML(0);
$myform->add('use_email', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 0, 'Trùng email');
$myform->add('use_name', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 0, 'Trùng email');
$myform->add('use_firstname', 'use_firstname', 0, 0, '', 1, 'Bạn chưa nhập họ', 0);
$myform->add('use_lastname', 'use_lastname', 0, 0, '', 1, 'Bạn chưa nhập tên', 0);
$myform->add('use_birthday', 'use_birthday', 0, 1, '', 1, 'Bạn chưa nhập ngày sinh', 0);
$myform->add('use_phone', 'use_phone', 1, 0, 0, 1, 'Bạn chưa nhập số điện thoại', 0);
$myform->add('use_contact', 'use_contact', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ', 0);
$myform->add('use_gender', 'use_gender', 1, 0, 0, 0, '', 0, '');
$myform->add('use_date', 'use_date', 1, 1, 0, 0, '', 0, '');
$myform->add('use_active', 'use_active', 1, 0, 0, 0, '', 0, '');
$myform->add('use_group', 'use_group', 1, 1, 0, 0, '', 0, '');
$myform->removeHTML(0);
$myform->addTable($bg_table);
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $bg_errorMsg .= $myform->checkdata();
    $upload = new upload('use_avatar', $bg_filepath, $bg_extension, $limit_size);
    $filename = $upload->file_name;
コード例 #6
0
ファイル: add.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('add');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('new_title', 'new_title', 0, 0, '', 1, 'Bạn chưa nhập tiêu đề');
$myform->add('new_active', 'new_active', 1, 0, 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) {
        //update ảnh
        $new_picture = getValue('new_picture', 'str', 'POST', '');
        if ($new_picture) {
            $myform->add('new_picture', 'new_picture', 0, 1, '');
            //move ảnh
            $path_upload = '../../..' . get_picture_dir($new_picture) . '/' . $new_picture;
            rename('../../../temp/' . $new_picture, $path_upload);
        }
        $db_insert = new db_execute_return();
        $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
コード例 #7
0
ファイル: config.php プロジェクト: nhphong0104/thietkeweb360
	//,array("con_list_currency",0,1000,90,"Các kiểu tiền tệ","text")
	//,array("con_support_online",0,180,90,"Hỗ trợ trực tuyến","textarea")
	,array("con_meta_description",0,180,90,translate_text("Page_infomation"),"textarea")
	,array("con_meta_keywords",0,180,90,translate_text("Google_keyword"),"textarea")	
   
   ,array("con_help_visitor",0,0,30,"Visitor","text")
   ,array("con_admin_email",0,0,30,"Email web","text")
   ,array("con_help_product_model",0,0,30,"Model","text")
   ,array("con_help_online_trading",0,0,30,"Giao dịch online / ngày","text")
   ,array("con_phone_1",0,0,30,"Hỗ trợ chung","text")
   ,array("con_phone_2",0,0,30,"Hotline","text")
);

//Insert to database
for($i=0;$i<count($arrayField);$i++){
	$myform->add($arrayField[$i][0],$arrayField[$i][0],$arrayField[$i][1],0,"",0,"",0,"");
}
//Add table
$myform->addTable($fs_table);
//Warning Error!
$errorMsg = "";
//Get Action.
$action	= getValue("action", "str", "POST", "");
if($action == "update"){
	//Check Error!
	$errorMsg .= $myform->checkdata();
	if($errorMsg == ""){
		$db_ex = new db_execute($myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]));
		//echo $myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]);
		//Redirect to:
		redirect($_SERVER['REQUEST_URI']);
コード例 #8
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
$record_id = getValue('record_id');
$hcq = array('' => ' -- Hệ cơ quan --');
$array_he_co_quan = $hcq + $array_he_co_quan;
$group_section = array(0 => ' -- Chọn nhóm bộ phận --');
$db_query = new db_query('SELECT sec_id,sec_name FROM sections WHERE sec_parent_id = 0');
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $group_section[$row['sec_id']] = $row['sec_name'];
}
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('sec_name', 'sec_name', 0, 0, '', 1, 'Bạn chưa nhập tên bộ phận');
$myform->add('sec_parent_id', 'sec_parent_id', 1, 0, 0, 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) {
コード例 #9
0
ファイル: index.php プロジェクト: virutmath/crm_local
         $db_insert = new db_execute_return();
         $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
         unset($db_insert);
         //log action
         if ($last_id) {
             log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table);
         }
         redirect('index.php');
     }
     break;
 case 'edit_record':
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $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, '');
         }
コード例 #10
0
ファイル: add.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('add');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('dic_key', 'key', 0, 0, '', 1, 'Bạn chưa nhập nội dung cần dịch');
$myform->add('dic_translate_en', 'translate_en', 0, 0, '', 1, 'Bạn chưa nhập bản dịch tiếng Anh');
$form_redirect = getValue('form_redirect', 'str', 'POST', '');
$action = getValue('action', 'str', 'POST', '');
if ($action == 'execute') {
    $bg_errorMsg = $myform->checkdata();
    /**
     * something code here
     */
    //upload file ở đây
    //upload voice giọng nam
    $file_name = 'audio_' . time() . '.wav';
    $file_path = '../../../sounds/' . $file_name;
    $upload_voice_en = upload_file('voice_en', $file_path);
    if ($upload_voice_en['success']) {
        //upload thành công
        $file_name = $upload_voice_en['file_name'];
        $myform->add('dic_voice_en', 'file_name', 0, 1, '');
    } else {
        //không thành công, tìm file trong thư mục ghi âm
コード例 #11
0
ファイル: index.php プロジェクト: virutmath/crm_local
             module_upload_picture($use_image);
         }
         $db_insert = new db_execute_return();
         $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
         unset($db_insert);
         //log action
         log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table);
         redirect('index.php');
     }
     break;
 case 'edit_record':
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $myform->addTable($bg_table);
     /* code something */
     $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);
コード例 #12
0
ファイル: index.php プロジェクト: virutmath/crm_local
         }
         $db_insert = new db_execute_return();
         $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
         unset($db_insert);
         //log action
         log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table);
         redirect('index.php');
     }
     break;
 case 'edit_record':
     checkPermission('edit');
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $myform->addTable($bg_table);
     /* code something */
     $myform->add('men_name', 'men_name', 0, 0, '', 1, 'Bạn chưa nhập tên thực đơn');
     $myform->add('men_unit_id', 'men_unit_id', 0, 0, '', 1, 'Bạn chưa nhập đơn vị tính');
     $myform->add('men_cat_id', 'men_cat_id', 0, 0, '', 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) {
コード例 #13
0
ファイル: add.php プロジェクト: nhphong0104/thietkeweb360
#+
#+ Array Menus
$menu = new menu();
$listAll = $menu->getAllChild("menus_multi","mnu_id","mnu_parent_id","0","mnu_type = " . $iType . " AND lang_id = " . $_SESSION["lang_id"],"mnu_id,mnu_name,mnu_link,mnu_target,mnu_order,mnu_type,mnu_parent_id,mnu_has_child","mnu_order ASC, mnu_name ASC","mnu_has_child");

#+
#+ Goi class generate form
$myform = new generate_form();	//Call Class generate_form();
$myform->removeHTML(0);	//Loại bỏ chức năng không cho điền tag html trong form
#+
#+ Khai bao bang du lieu
$myform->addTable($fs_table);	// Add table
#+
#+ Khai bao thong tin cac truong
$myform->add("mnu_type","mnu_type",1,0,0,1,tt("Bạn chưa chọn loại trình đơn"),0,tt("Bạn chưa chọn loại trình đơn"));
$myform->add("mnu_name","mnu_name",0,0,"",1,tt("Bạn chưa nhập tên trình đơn"),0,tt("Bạn chưa nhập tên trình đơn"));
$myform->add("mnu_link","mnu_link",0,0,"",0,"Bạn chưa nhập địa chỉ liên kết !",0,"Bạn chưa nhập địa chỉ liên kết");
$myform->add("mnu_background","mnu_background",0,0,"",0,"Bạn chưa nhập màu nền",0,"Bạn chưa nhập màu nền");
$myform->add("mnu_target","mnu_target",0,0,"_self",1,tt("Bạn chưa nhập thực thi khi ấn vào trình đơn"),0,tt("Bạn chưa nhập thực thi khi ấn vào trình đơn"));
if($array_config["order"]==1) $myform->add("mnu_order","mnu_order",1,0,0,0,"",0,"");
if($array_config["upper"]==1) $myform->add("mnu_parent_id","mnu_parent_id",1,0,0,0,"",0,"");
if($array_config["description"]==1) $myform->add("mnu_description","mnu_description",0,0,"",0,"",0,"");
$myform->add("mnu_data","mnu_data",0,0,"",0,"",0,"");	
#+
#+ đổi tên trường thành biến và giá trị
$myform->evaluate();

#+
#+ Neu nhu co submit form
if($action == "submitForm"){
コード例 #14
0
ファイル: edit.php プロジェクト: nhphong0104/thietkeweb360
					$query_str = "INSERT INTO admin_user_language VALUES(" . $iAdm . "," . $user_lang_id_list[$i] .")";
					$db_ex = new db_execute($query_str);
					unset($db_ex);
				}
			}
			redirect($ff_redirect_succ);
			exit();
		}
}

//Edit user password
$errorMsgpass = '';
if ($Action =='update_password')
{
	$myform = new generate_form();
	$myform->add("adm_password","adm_password",4,0,"",1,translate_text("Please enter new password"),0,"");
	$myform->addTable($fs_table);
	$errorMsgpass .= $myform->checkdata();
	if($errorMsgpass == ""){
		$db_ex = new db_execute($myform->generate_update_SQL("adm_id",$iAdm));
		unset($db_ex);
		echo '<script>alert("' . translate_text("Your_new_password_has_been_updated") . '")</script>';
		redirect($ff_redirect_succ);
	}
}




//Select access module
$acess_module			= "";
コード例 #15
0
ファイル: edit.php プロジェクト: nhphong0104/thietkeweb360
$sta_strtime		= getValue("sta_strtime", "str", "POST", date("H:i:s"));
$sta_date			= convertDateTime($sta_strdate, $sta_strtime);

#+
checkRowUser($fs_table,$field_id,$record_id,$listing);

#+
#+ Goi class generate form
$myform = new generate_form();	//Call Class generate_form();
$myform->removeHTML(0);	//Loại bỏ chức năng không cho điền tag html trong form
#+
#+ Khai bao bang du lieu
$myform->addTable($fs_table);	// Add table
#+
#+ Khai bao thong tin cac truong
$myform->add("sta_category_id", "sta_category_id", 1, 0, 0, 1, "Bạn chưa chọn danh mục.", 0, "");
$myform->add("sta_title", "sta_title", 0, 0, "", 1, "Bạn chưa nhập tiêu đề.", 0, "");
$myform->add("sta_order", "sta_order", 1, 0, 0, 1, "Thứ tự phải lớn hơn hoặc bằng 0.", 0, "");
$myform->add("sta_date", "sta_date", 1, 1, 0, 0, "", 0, "");
$myform->add("sta_description", "sta_description", 0, 0, "", 0, "", 0, "");
$myform->add("sta_description1", "sta_description1", 0, 0, "", 0, "", 0, "");

#+
#+ đổi tên trường thành biến và giá trị
$myform->evaluate();

#+
#+ Neu nhu co submit form
if($action == "submitForm"){

	#+
コード例 #16
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('edit');
$record_id = getValue('record_id');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$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', 1, 0, 0, 0);
$myform->add('cat_title', 'cat_title', 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) {
        $cat_picture = getValue('cat_picture', 'str', 'POST', '');
        if ($cat_picture) {
            $myform->add('cat_picture', 'cat_picture', 0, 1, '');
            $path_upload = '../../..' . get_picture_dir($cat_picture) . '/' . $cat_picture;
            rename('../../../temp/' . $cat_picture, $path_upload);
        }
        $db_update = new db_execute($myform->generate_update_SQL($id_field, $record_id));
        unset($db_update);
コード例 #17
0
ファイル: index.php プロジェクト: virutmath/crm_local
             $sql_store .= '(' . $last_id . ',' . $store['cat_id'] . ',0),';
         }
         $sql_store = rtrim($sql_store, ',');
         $db_store = new db_execute($sql_store);
         unset($db_store);
         //log action
         log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table);
         redirect('index.php');
     }
     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);
コード例 #18
0
ファイル: add.php プロジェクト: virutmath/suckhoe
$db_query = new db_query('SELECT * FROM sections WHERE sec_parent_id = 0 ORDER BY sec_id ASC');
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $array_section[$row['sec_id']] = $row['sec_name'];
    $db_child = new db_query('SELECT * FROM sections WHERE sec_parent_id = ' . $row['sec_id'] . ' ORDER BY sec_id ASC');
    while ($row_child = mysqli_fetch_assoc($db_child->result)) {
        $array_section[$row_child['sec_id']] = ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- ' . $row_child['sec_name'];
    }
}
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('ana_sec_id', 'ana_sec_id', 1, 0, 0, 1, 'Bạn chưa chọn bộ phận');
$myform->add('ana_title', 'ana_title', 0, 0, '');
$myform->add('ana_alt', 'ana_alt', 0, 0, '');
$myform->add('ana_coords', 'ana_coords', 0, 0, '', 1, 'Bạn chưa nhập tọa độ');
$myform->add('ana_type', 'ana_type', 1, 0, 0);
$myform->add('ana_sex', 'ana_sex', 1, 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) {
        $db_insert = new db_execute_return();
        $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
コード例 #19
0
ファイル: cron_news.php プロジェクト: virutmath/suckhoe
$myform->add('new_teaser', 'teaser', 0, 1, $teaser);
$myform->add('new_tags', 'tag_string', 0, 1, $tag_string);
$myform->add('new_date', 'time', 1, 1, $time);
$myform->add('new_active', 'active', 1, 1, $active);
$myform->removeHTML(0);
if (!$myform->checkdata()) {
    $db_execute_return = new db_execute_return();
    $last_id = $db_execute_return->db_execute($myform->generate_insert_SQL());
    unset($db_execute_return);
    if ($last_id) {
        //cập nhật link lấy thành công
        $db_update = new db_execute('UPDATE links SET lin_status = ' . LINK_STATUS_SUCCESS . ' WHERE lin_id = ' . $link_id);
        //insert content vào bảng news detail
        $myform2 = new generate_form();
        $myform2->addTable('news_detail');
        $myform2->add('ndt_id', 'last_id', 1, 1, 0, 1, 'Không có ID bài viết');
        $myform2->add('ndt_content', 'content', 0, 1, '', 1, 'Content trống');
        $myform2->removeHTML(0);
        if (!$myform2->checkdata()) {
            $db_insert = new db_execute($myform2->generate_insert_SQL());
            unset($db_insert);
            echo 'Lấy thành công tin : <a href="' . $link_url . '">' . $link_url . '</a>';
            reload(30);
            die;
        } else {
            $db_update = new db_execute('UPDATE links SET lin_status = ' . LINK_STATUS_FAIL . ' WHERE lin_id = ' . $link_id);
            echo 'Dữ liệu trống';
            reload(30);
            die;
        }
    } else {
コード例 #20
0
ファイル: index_modal.php プロジェクト: virutmath/crm_local
             $myform->add('cus_picture', 'cus_picture', 0, 0, '');
         }
         $db_insert = new db_execute_return();
         $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
         unset($db_insert);
         //log action
         log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table);
         redirect('index.php');
     }
     break;
 case 'edit_record':
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $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));
コード例 #21
0
ファイル: index.php プロジェクト: virutmath/crm_local
<?php

require_once 'inc_security.php';
global $isAdmin;
global $admin_id;
//Phần xử lý
if ($isAjaxRequest) {
    $action = getValue('action', 'str', 'POST', '', 2);
    switch ($action) {
        case 'setup':
            $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');
コード例 #22
0
<?php

require 'config_security.php';
$bg_errorMsg = '';
$bg_table = 'navigate_admin';
//array module
$array_module = array();
$db_query = new db_query('SELECT mod_id, mod_name FROM modules ORDER BY mod_id ASC');
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $array_module[$row['mod_id']] = $row['mod_name'];
}
check_super_admin();
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
$myform->add('nav_name', 'nav_name', 0, 0, '', 1);
$myform->add('nav_module_id', 'nav_module_id', 1, 0, 1);
$myform->add('nav_order', 'nav_order', 1, 0, 1);
/**
 * Something here ...
 * insert, update...
 */
$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) {
        $db_insert = new db_execute_return();
コード例 #23
0
ファイル: grid.php プロジェクト: nhphong0104/thietkeweb360
	function ajaxedit($fs_table){
	
		$this->edit_ajax = true;
		
		//nếu truong hợp checkbox thì chỉ thay đổi giá trị 0 và 1 thôi
		
		$checkbox 	= getValue("checkbox","int","GET",0);
		if($checkbox==1){
			$record_id 	= getValue("record_id","int","GET",0);
			$field 		= getValue("field","str","GET","dfsfdsfdddddddddddddddd");
			if(trim($field) != '' && in_array($field,$this->arrayField)){
				$db_query = new db_query("SELECT " . $field . " FROM " . $fs_table . " WHERE " . $this->field_id . "=" . $record_id);
				if($row = mysql_fetch_assoc($db_query->result)){
					$value = ($row[$field]==1) ? 0 : 1;
					$db_update	= new db_execute("UPDATE " . $fs_table . " SET " . $field . " = " . $value . " WHERE " . $this->field_id . "=" . $record_id);
					unset($db_update);
					echo '<img src="' . $this->image_path . 'check_' . $value . '.gif" border="0">';
				}
				unset($db_query);
			}
			exit();
		}
		//phần sửa đổi giá trị  từng trường
		$ajaxedit 	= getValue("ajaxedit","int","GET",0);
		$id 	 		= getValue("id","str","POST","");
		$value 	 	= getValue("value","str","POST","");
		$array 	 	= trim(getValue("array","str","POST",""));
		
		if($ajaxedit == 1){
		
			$arr 		= explode(",",$id);
			$id  		= isset($arr[1]) ? intval($arr[1]) : 0;
			$field  	= isset($arr[0]) ? strval($arr[0]) : '';
			$type  	= isset($arr[2]) ? intval($arr[2]) : 0;
			if($type == 3) $_POST["value"] = str_replace(array("."),"",$value);
			
			//print_r($_POST);
			if($id != 0 && in_array($field,$this->arrayField)){
				
				$myform = new generate_form();
				$myform->removeHTML(0);
				$myform->add($field,"value",$type,0,"",0,"",0,"");
				
				$myform->addTable($fs_table);
				$errorMsg = $myform->checkdata();
				
				if($errorMsg == ""){
					$db_ex = new db_execute($myform->generate_update_SQL($this->field_id,$id));
				}
				
				
			}
			
			if($array!=''){
				if(in_array($array,$this->arrayField)){
					global $$array;
					$arr = $$array;
					$value = isset($arr[$value]) ? $arr[$value] : 'error';
				}
			}
			echo $value;
			exit();
		}
	}
コード例 #24
0
<? include("config_security.php"); ?>
<?
$record_id 		= getValue("record_id", "arr", "POST", array());
$field_id		= "mod_id";
$fs_table		= "modules";
//Warning Error!
$errorMsg = "";
//Get Action.
//Call Class generate_form();
$myform = new generate_form();
//Loại bỏ chuc nang thay the Tag Html
//$myform->removeHTML(0);
//Check Error!

$myform->add("mod_name","mod_name",0,0,"",0,"",0,"Bạn chưa nhập tiêu đề bài viết");
$myform->add("mod_path","mod_path",0,0,"",0,"",0,"");
$myform->add("mod_listname","mod_listname",0,0,"",0,"",0,"");
$myform->add("mod_listfile","mod_listfile",0,0,"",0,"",0,"");
$myform->add("mod_order","mod_order",1,0,0,0,"",0,"Bạn chưa nhập ngày đăng tin");
//Add table
$myform->addTable($fs_table);

$iQuick = getValue("iQuick","str","POST","");
if ($iQuick == "update"){
	$errorMsg='';
	$errorMsg .= $myform->checkdata();
	if($errorMsg == ""){
		//echo $myform->generate_insert_SQL();
		$db_ex = new db_execute($myform->generate_insert_SQL());
		unset($db_ex);
		//Hien thi loi
コード例 #25
0
ファイル: get_news_local.php プロジェクト: virutmath/suckhoe
$myform->add('new_cat_id', 'new_cat_id', 1, 0, 0, 1);
$myform->add('new_lin_id', 'new_lin_id', 1, 0, 0, 1);
$myform->add('new_picture', 'new_picture', 0, 0, '');
$myform->add('new_teaser', 'new_teaser', 0, 0, '', 1);
$myform->add('new_tags', 'new_tags', 0, 0, '');
$myform->add('new_date', 'new_date', 1, 0, 0, 1);
$myform->add('new_active', 'new_active', 1, 0, 0, 1);
if (!$myform->checkdata()) {
    $db_insert = new db_execute_return();
    $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
    unset($db_insert);
    //lưu ảnh
    if ($last_id) {
        $path_picture = generate_dir_upload($_POST['new_picture'], 'organic') . $_POST['new_picture'];
        move_uploaded_file($_FILES['data_picture']['tmp_name'], $path_picture);
        //lưu chi tiết tin
        $myform_dt = new generate_form();
        $myform_dt->addTable('news_detail');
        $myform_dt->add('ndt_id', 'last_id', 1, 1, 0);
        $myform_dt->add('ndt_content', 'ndt_content', 0, 0, '');
        $myform_dt->removeHTML(0);
        $db_insert = new db_execute($myform_dt->generate_insert_SQL());
        $total = $db_insert->total;
        unset($db_insert);
        if ($total) {
            echo $last_id;
        } else {
            echo 0;
        }
    }
}
コード例 #26
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('edit');
$record_id = getValue('record_id');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('cit_name', 'cit_name', 0, 0, '', 1, 'Bạn chưa nhập tên');
$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) {
        $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
コード例 #27
0
ファイル: edit.php プロジェクト: virutmath/suckhoe
<?php

require_once 'inc_security.php';
checkPermission('edit');
$record_id = getValue('record_id');
#Phần code xử lý
$myform = new generate_form();
$myform->addTable($bg_table);
/**
 * Something here ...
 * insert, update...
 */
$myform->add('pha_name', 'pha_name', 0, 0, '', 1);
$myform->add('pha_title', 'pha_title', 0, 0, '', 1);
$myform->add('pha_description', 'pha_description', 0, 0, '', 0);
$myform->add('pha_content', 'pha_content', 0, 0, '', 0);
$myform->add('pha_so_dang_ky', 'pha_so_dang_ky', 0, 0, '', 1);
$myform->add('pha_dang_bao_che', 'pha_dang_bao_che', 0, 0, '', 0);
$myform->add('pha_dong_goi', 'pha_dong_goi', 0, 0, '', 0);
$myform->add('pha_gia_buon', 'pha_gia_buon', 0, 0, '', 0);
$myform->add('pha_gia_le', 'pha_gia_le', 0, 0, '', 0);
$pha_nha_sx_name = getValue('pha_nha_sx_name', 'str', 'POST', '');
$check_id_nsx = new db_query('SELECT phc_id 
                              FROM pharma_company 
                              WHERE phc_name = "' . $pha_nha_sx_name . '" 
                              LIMIT 1');
$check_id_nsx = mysqli_fetch_assoc($check_id_nsx->result);
if ($check_id_nsx && $check_id_nsx['phc_id']) {
    $check_id_nsx = $check_id_nsx['phc_id'];
    $myform->add('pha_nha_sx_id', 'check_id_nsx', 1, 1, 0);
} else {
コード例 #28
0
ファイル: ajax.php プロジェクト: virutmath/crm_local
 public function openDesk()
 {
     //Phần này sẽ trả về json - khai báo biến chứa array kết quả trả về
     $array_return = array();
     //Kiểm tra xem bàn hiện tại đã mở chưa
     $desk_id = getValue('desk_id', 'int', 'POST', 0);
     if (!$desk_id) {
         return;
     }
     check_desk_exist($desk_id);
     $db_query = new db_query('SELECT * FROM current_desk WHERE cud_desk_id = ' . $desk_id);
     $desk_data = mysqli_fetch_assoc($db_query->result);
     unset($db_query);
     if ($desk_data) {
         //Nếu bàn đang mở thì show ra
         $this->getCurrentDeskDetail();
         return;
     }
     //nếu không thì mở bàn
     //khai báo các giá trị default khi mở bàn
     $cud_start_time = time();
     $cud_note = '';
     $cud_desk_id = $desk_id;
     //id bàn
     $cud_customer_id = 0;
     //id khách hàng
     $cud_staff_id = 0;
     //id nhân viên phục vụ
     $cud_extra_fee = 0;
     //phụ phí tính theo %
     $cud_vat = 0;
     //thuế VAT tính theo %
     $cud_customer_discount = 0;
     //giảm giá áp dụng cho loại khách
     $cud_debit = 0;
     //ghi nợ hay ko?
     $cud_pay_type = PAY_TYPE_CASH;
     //loại thanh toán là tiền mặt hay qua thẻ
     $array_return['cud_start_time'] = $cud_start_time;
     $array_return['start_time_string'] = date('d/m/Y H:i', $cud_start_time);
     $array_return['cud_note'] = $cud_note;
     $array_return['cud_desk_id'] = $cud_desk_id;
     $array_return['cud_customer_id'] = $cud_customer_id;
     $array_return['cud_staff_id'] = $cud_staff_id;
     $array_return['cud_extra_fee'] = $cud_extra_fee;
     $array_return['cud_vat'] = $cud_vat;
     $array_return['cud_customer_discount'] = $cud_customer_discount;
     $array_return['cud_debit'] = $cud_debit;
     $array_return['cud_pay_type'] = $cud_pay_type;
     $myform = new generate_form();
     $myform->addTable('current_desk');
     $myform->add('cud_desk_id', 'cud_desk_id', 1, 1, $cud_desk_id);
     $myform->add('cud_customer_id', 'cud_customer_id', 1, 1, $cud_customer_id);
     $myform->add('cud_staff_id', 'cud_staff_id', 1, 1, $cud_staff_id);
     $myform->add('cud_note', 'cud_note', 0, 1, $cud_note);
     $myform->add('cud_start_time', 'cud_start_time', 1, 1, $cud_start_time);
     $myform->add('cud_extra_fee', 'cud_extra_fee', 3, 1, $cud_extra_fee);
     $myform->add('cud_vat', 'cud_vat', 3, 1, $cud_vat);
     $myform->add('cud_customer_discount', 'cud_customer_discount', 3, 1, $cud_customer_discount);
     $myform->add('cud_debit', 'cud_debit', 1, 1, $cud_debit);
     $myform->add('cud_pay_type', 'cud_pay_type', 1, 1, $cud_pay_type);
     //insert to current_desk
     $db_execute = new db_execute($myform->generate_insert_SQL());
     unset($db_execute);
     //lấy ra thông tin về menu mở bàn
     $list_menu = '';
     $this->list->add('', 'Tên thực đơn');
     $this->list->add('', 'ĐVT');
     $this->list->add('', 'SL');
     $this->list->add('', 'Đơn giá');
     $this->list->add('', 'Giảm');
     $this->list->add('', 'Thành tiền');
     $menu_start = array(0);
     if ($this->start_menu) {
         foreach ($this->start_menu as $men_id => $men_number) {
             $menu_start[] = $men_id;
         }
     }
     $menu_start = implode(',', $menu_start);
     $db_count = new db_count('SELECT count(*) AS count
                               FROM menus
                               WHERE men_id IN(' . $menu_start . ')');
     $total = $db_count->total;
     unset($db_count);
     $db_listing = new db_query('SELECT *
                                 FROM menus
                                 WHERE men_id IN(' . $menu_start . ')' . $this->list->limit($total));
     $total_row = mysqli_num_rows($db_listing->result);
     $list_menu .= $this->list->showHeader($total_row);
     $i = 0;
     $array_unit = array();
     $db_query = new db_query('SELECT * FROM units');
     while ($row = mysqli_fetch_assoc($db_query->result)) {
         $array_unit[$row['uni_id']] = $row['uni_name'];
     }
     while ($row = mysqli_fetch_assoc($db_listing->result)) {
         $i++;
         $list_menu .= $this->list->start_tr($i, $row['men_id'], 'onclick="selectMenuInDesk(' . $row['men_id'] . ')" class="menu-normal record-item" data-record_id="' . $row['men_id'] . '"');
         /* code something */
         //Thành tiền - công thức tính bằng giá * (100 - %giảm giá) * số lượng
         $menu_item_number = $this->start_menu[$row['men_id']];
         $menu_item_price = $row['men_price'];
         $menu_item_discount = 0;
         $menu_item_total = $menu_item_number * (100 - $menu_item_discount) / 100 * $menu_item_price;
         $list_menu .= '<td class="text-left" width="200px;">' . $row['men_name'] . '</td>';
         $list_menu .= '<td class="center">' . $array_unit[$row['men_unit_id']] . '</td>';
         $list_menu .= '<td class="center">' . $menu_item_number . '</td>';
         $list_menu .= '<td class="text-right">' . format_number($menu_item_price) . '</td>';
         //Giảm giá của menu - theo khuyến mại. hiện tại chưa có quản lý khuyến mại nên để 0 mặc định
         $list_menu .= '<td class="text-center">0</td>';
         $list_menu .= '<td class="text-right">' . format_number($menu_item_total) . '</td>';
         $list_menu .= $this->list->end_tr();
         //insert thông tin về menu mở bàn vào bảng current_desk_menu
         $sql = 'INSERT INTO current_desk_menu(cdm_desk_id, cdm_menu_id, cdm_number, cdm_price, cdm_price_type, cdm_create_time, cdm_updated_time)
                 VALUES (' . $desk_id . ',' . $row['men_id'] . ',' . $this->start_menu[$row['men_id']] . ',' . $row['men_price'] . ',"men_price", ' . time() . ', ' . time() . ')';
         $db_insert = new db_execute($sql);
         unset($db_insert);
     }
     $list_menu .= $this->list->showFooter();
     //log action
     log_action(ACTION_LOG_ADD, 'Tạo bàn ID: ' . $desk_id);
     $array_return['list_menu'] = $list_menu;
     $array_return['array_menu'] = $this->getArrayMenu($desk_id);
     $array_return['customer_code'] = format_codenumber($array_return['cud_customer_id'], 6, PREFIX_CUSTOMER_CODE);
     $array_return['customer_name'] = 'Khách lẻ';
     $array_return['staff_code'] = format_codenumber($array_return['cud_staff_id'], 6, PREFIX_STAFF_CODE);
     $array_return['staff_name'] = 'Không chọn nhân viên';
     $this->add($array_return);
 }
コード例 #29
0
ファイル: websetting.php プロジェクト: virutmath/suckhoe
<?php

require 'config_security.php';
$record_id = getValue("record_id", "arr", "POST", '');
//Warning Error!
$errorMsg = "";
//Get Action.
//Call Class generate_form();
$db_query = new db_query('SELECT MAX(mod_order) as max_order FROM ' . $fs_table);
$max_order = mysqli_fetch_assoc($db_query->result);
$max_order = $max_order['max_order'];
$myform = new generate_form();
$myform->add("mod_name", "mod_name", 0, 0, "", 1, "Bạn chưa nhập tên module", 0, "");
$myform->add("mod_path", "mod_path", 0, 0, "", 0, "", 0, "");
$myform->add("mod_listname", "mod_listname", 0, 0, "", 0, "", 0, "");
$myform->add("mod_listfile", "mod_listfile", 0, 0, "", 0, "", 0, "");
$myform->add("mod_order", "mod_order", 1, 0, 0, 0, "", 0, "");
//Add table
$myform->addTable($fs_table);
$iQuick = getValue("action", "str", "POST", "");
if ($iQuick == "execute") {
    $errorMsg = '';
    $errorMsg .= $myform->checkdata();
    if ($errorMsg == "") {
        //echo $myform->generate_insert_SQL();
        $db_ex = new db_execute($myform->generate_insert_SQL());
        unset($db_ex);
        //Hien thi loi
    }
    redirect($_SERVER['REQUEST_URI']);
}
コード例 #30
0
ファイル: ajax.php プロジェクト: virutmath/crm_local
 function EditRecord()
 {
     //check quyền
     checkCustomPermission('edit');
     //khai bao bien global
     global $time_end, $time_start;
     $promo_id = getValue('id', 'int', 'POST', 0);
     // id chien dich
     if (!$promo_id) {
         //lỗi không tồn tại id của khuyến mại
         $array_return['error'] = 0;
         $array_return['msg'] = 'Bản ghi không tồn tại';
         die(json_encode($array_return));
     }
     // ten chien dich khuyen mai
     $promo_name = getValue('name', 'str', 'POST', '', 2);
     if (!$promo_name) {
         //lỗi chưa nhập tên chiến dịch km
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập tên chiến dịch khuyến mại';
         die(json_encode($array_return));
     }
     $promo_agencies = getValue('agencies', 'int', 'POST', 0, 3);
     if (!$promo_agencies) {
         //lỗi chưa nhập tên chiến dịch km
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa chọn cửa hàng áp dụng khuyến mại';
         die(json_encode($array_return));
     }
     // thoi gian bat dau
     $start_time = getValue('start_date', 'str', 'POST', '', 3);
     $time_start_h = getValue('time_start_h', 'int', 'POST', 0, 3);
     $time_start_i = getValue('time_start_i', 'int', 'POST', 0, 3);
     //thoi gian ket thuc
     $end_time = getValue('end_date', 'str', 'POST', '');
     $time_end_h = getValue('time_end_h', 'int', 'POST', 0, 3);
     $time_end_i = getValue('time_end_i', 'int', 'POST', 0, 3);
     // ghi chú
     $promo_note = getValue('note', 'str', 'POST', '');
     $list_menus = getValue('menus', 'arr', 'POST', array());
     // dieu kien giam gia
     $promo_condition = getValue('condition', 'str', 'POST', 0, 3);
     // gia tri giảm giá hóa đơn dựa vào kiểu giảm giá promo_type có 2 giá trị là % và tiền mặt
     $promo_value = getValue('promo_value', 'int', 'POST', 0, 3);
     $promo_type = getValue('promo_type', 'int', 'POST', 0, 3);
     $time_start = convertDateTime($start_time, $time_start_h . ':' . $time_start_i . ':0');
     if (!$time_start) {
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập thời gian bắt đầu chiến dịch';
         die(json_encode($array_return));
     }
     $time_end = convertDateTime($end_time, $time_end_h . ':' . $time_end_i . ':0');
     if (!$time_end) {
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập thời gian kết thúc chiến dịch';
         die(json_encode($array_return));
     }
     // ket quả tra ve
     // update chiến dịch khuyến mãi
     $myform = new generate_form();
     $myform->addTable('promotions');
     $myform->add('pms_name', 'name', 0, 0, $promo_name, 1, 'Bạn chưa nhập tên chiến dịch');
     $myform->add('pms_agency_id', 'agencies', 1, 0, $promo_agencies, 1, 'Bạn chưa chọn địa điểm áp dụng');
     $myform->add('pms_start_time', 'time_start', 0, 1, $time_start, 1, 'Thời gian bắt đầu chưa nhập');
     $myform->add('pms_end_time', 'time_end', 0, 1, $time_end, 1, 'Thời gian kết thúc chưa nhập');
     $myform->add('pms_value_sale', 'promo_value', 1, 0, $promo_value, 0);
     $myform->add('pms_type_sale', 'promo_type', 1, 0, $promo_type, 0);
     $myform->add('pms_condition', 'condition', 1, 0, $promo_condition, 0);
     $myform->add('pms_note', 'note', 0, 0, $promo_note, 0);
     if (!$myform->checkdata()) {
         $db_update = new db_execute($myform->generate_update_SQL('pms_id', $promo_id));
         //echo $myform->generate_update_SQL('pms_id', $promo_id);
         unset($db_update);
         //log action
         log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $promo_id . ' bảng promotions');
     }
     //xóa hết các thực đơn có trong chiến dịch khuyến mãi đang sửa và sau đó insert lại danh sách các thực đơn bổ sung
     $db_delete = new db_execute('DELETE FROM promotions_menu WHERE pms_id = ' . $promo_id . '');
     unset($db_delete);
     // insert lại những thực đơn cập nhập
     $db_insert = 'INSERT INTO promotions_menu(pms_id ,pms_menu_id, pms_menu_value, pms_menu_type)
                        VALUES';
     //sử dụng id của promotion để insert vào bảng promotions_menu
     foreach ($list_menus as $menu) {
         $db_insert .= '(
                        ' . $promo_id . ',
                        ' . $menu['men_id'] . ',
                        ' . $menu['men_value'] . ',
                        ' . $menu['men_type'] . '
                        ),';
     }
     $db_insert = rtrim($db_insert, ',');
     $db_insert_menu = new db_execute($db_insert);
     unset($db_insert_menu);
     // trả về kết quả thành công
     $array_return['success'] = 1;
     $array_return['msg'] = 'Cập nhật thành công';
     die(json_encode($array_return));
 }