?
Path : /home/admin/domains/happytokorea.com/public_html/backend/modules/tour/ |
Current File : /home/admin/domains/happytokorea.com/public_html/backend/modules/tour/content.server.php |
<? function update_comment($id,$comment){ global $db,$user_login; $objResponse = new xajaxResponse(); $dataCk=$db->getDataOneRow('time_schedule_comment',$id,'tour_id'); $dataa=Array('detail'=>$comment,'add_time'=>date('Y-m-d H:i:s',time()),'add_by'=>$user_login[ID]); if($dataCk[tour_id]==""){ $dataa=Array('detail'=>$comment,'add_time'=>date('Y-m-d H:i:s',time()),'add_by'=>$user_login[ID],'tour_id'=>$id); if ($_SESSION["la"] == 1){ $db->Insert('time_schedule_comment',$dataa); }else{ $db->Insert('time_schedule_comment_en',$dataa); } }else{ if ($_SESSION["la"] == 1){ $db->Update('time_schedule_comment',$dataa,"WHERE tour_id='$id'"); }else{ $db->Update('time_schedule_comment_en',$dataa,"WHERE tour_id='$id'"); } } if($db->mysqlError()==''){ $objResponse->addAlert('บันทึกสำเร็จ'); }else{ $objResponse->addAlert('ไม่สามารถบันทึกข้อมูลได้ '.$db->mysqlError()); } return $objResponse->getXML(); } $xajax->registerFunction("update_comment"); function AddData_tour($formData) { global $db,$user_login; $objResponse = new xajaxResponse(); $error=Array(); if($formData['catsub1']==''){ $objResponse->addAlert("กรอก หมวดหมู่บทความ ค่ะ"); array_push($error,"error"); $objResponse->addScript("document.getElementById('catsub1').focus();"); $objResponse->addAssign("catsub1","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("catsub1","style.backgroundColor", "#ffffff"); } if($formData['ToutName']==''){ $objResponse->addAlert("กรอกชื่อ ทัวร์ ด้วยค่ะ"); array_push($error,"error"); $objResponse->addScript("document.getElementById('ToutName').focus();"); $objResponse->addAssign("ToutName","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("ToutName","style.backgroundColor", "#ffffff"); } if(!is_numeric ($formData['price'])){ $objResponse->addAlert("ตัวเลขเท่านั้น"); array_push($error,"error"); $objResponse->addScript("document.getElementById('price').focus();"); $objResponse->addAssign("price","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("price","style.backgroundColor", "#ffffff"); } if(!in_array("error",$error)){ $filename=$_FILES['TourPhoto']['name']; $filetype=$_FILES['TourPhoto']['type']; $filetmp=$_FILES['TourPhoto']['tmp_name']; if($filename!=''){ $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto=$pic.".gif"; }else if ( $filetype == "image/bmp"){ $ContentPhoto=$pic.".bmp"; }else if ( $filetype == "image/png"){ $ContentPhoto=$pic.".png"; }else if (($filetype=="image/jpg")||($filetype=="image/jpeg")||($filetype=="image/pjpeg")){ $ContentPhoto=$pic.".jpg"; } else{ $objResponse->addAlert("ไฟล์รูปผิดพลาด"); return $objResponse; } if(move_uploaded_file($filetmp,$cfg[abs_path]."../tour/photo/".$ContentPhoto)){ make_thumb($cfg[abs_path]."../tour/photo/".$ContentPhoto,$cfg[abs_path]."../tour/photo/thumbs/".$ContentPhoto,$new_w=500); }else{ return $objResponse; } }//filename //$detail=Random_Int(8).date('dmYHism',time()).".txt"; //$detail = htmlspecialchars($formData['ContentDetail']); $addarr=array( 'catagory'=>$formData['catsub1'], 'catsub2'=>$formData['catsub2'], 'catsub3'=>$formData['catsub3'], 'catsub4'=>$formData['catsub4'], 'code'=>$formData['TourCode'], 'name'=>$formData['ToutName'], 'days'=>$formData['TourDay'], 'airline'=>$formData['TourAirline'], 'airline2'=>$formData['TourAirline2'], 'airline3'=>$formData['TourAirline3'], 'airline4'=>$formData['TourAirline4'], 'credit'=>$formData['credit'], 'price'=>$formData['price'], 'public'=>$formData['public'], 'Rating'=>$formData['Rating'], 'Detail'=>$formData['TourDetail'], 'MetaTitle'=>$formData['MetaTitle'], 'MetaKeyword'=>$formData['MetaKeyword'], 'title'=>$formData['TourTitle'], 'Cover'=>$formData['TourCover'], 'MetaDescription'=>$formData['MetaDescription'], 'image' =>$ContentPhoto, 'AddTime'=>date('Y-m-d H:i:s',time()), 'Addby'=>$user_login[ID], ); if ($_SESSION["la"] == 1){ $result=$db->Insert('tour',$addarr); }else{ $result=$db->Insert('tour_en',$addarr); } $rs2=$db->Query("SELECT * FROM tour ORDER BY id DESC"); $data2=mysql_fetch_array($rs2); $i=0; while(isset($_FILES['files']['name'][$i])){ if($_FILES['files']['name'][$i] != ''){ $filename = $_FILES['files']['name'][$i]; $filetype = $_FILES['files']['type'][$i]; $filetmp = $_FILES['files']['tmp_name'][$i]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto=$pic.".gif"; }else if ( $filetype == "image/bmp"){ $ContentPhoto=$pic.".bmp"; }else if ( $filetype == "image/png"){ $ContentPhoto=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto=$pic.".jpg"; } if($ContentPhoto != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "images/tour/".$ContentPhoto); } } $i++; $addarr=array( 'picture'=>$ContentPhoto, 'id'=>$data2['id'], 'time_add'=>date("Y-m-d H:i:s"), ); if ($_SESSION["la"] == 1){ $db->Insert('tour_photo',$addarr); }else{ $db->Insert('tour_photo',$addarr); } }else{ $i++; } } $i=0; while(isset($formData['sfd'][$i])){ if($formData['sfd'][$i] != ''){ $addarr=array( 'id'=>$data2['id'], 'sfd'=>$formData['sfd'][$i], 'sfhl'=>$formData['sfhl'][$i], 'sf1'=>$formData['sf1'][$i], 'sf2'=>$formData['sf2'][$i], 'sf3'=>$formData['sf3'][$i], 'sfho'=>$formData['sfho'][$i], ); if ($_SESSION["la"] == 1){ $db->Insert('tour_con',$addarr); }else{ $db->Insert('tour_con',$addarr); } $i++; }else{ $i++; } } if($result){ $messageError="บันทึกข้อมูลสำเร็จ"; $objResponse->addAlert($messageError); $objResponse->addRedirect("admin.php?mod=tour"); return $objResponse->getXML(); }else{ $error="ไม่สามารถเพิ่มข้อมูลได้".$db->mysqlError(); $objResponse->addAlert($error); $objResponse->addRedirect("admin.php?mod=tour"); return $objResponse->getXML(); } }///end check error return $objResponse->getXML(); } $xajax->registerFunction("AddData_tour"); //////////////////////////////////////////////////////////// function EditData_tour($formData){ global $db,$user_login; $objResponse = new xajaxResponse(); $error=Array(); $topic_id=$_GET['id']; if ($_SESSION["la"] == 1){ $pk=$db->getDataOneRow('tour',$topic_id,'id'); }else{ $pk=$db->getDataOneRow('tour_en',$topic_id,'id'); } if($formData['catsub1']==''){ $objResponse->addAlert("กรอกประเภททัวร์ด้วยค่ะ"); array_push($error,"error"); $objResponse->addScript("document.getElementById('catsub1').focus();"); $objResponse->addAssign("catsub1","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("catsub1","style.backgroundColor", "#ffffff"); } if($formData['ToutName']==''){ $objResponse->addAlert("กรอกชื่อ ทัวร์ ด้วยค่ะ"); array_push($error,"error"); $objResponse->addScript("document.getElementById('ToutName').focus();"); $objResponse->addAssign("ToutName","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("ToutName","style.backgroundColor", "#ffffff"); } if(!is_numeric ($formData['price'])){ $objResponse->addAlert("ตัวเลขเท่านั้น"); array_push($error,"error"); $objResponse->addScript("document.getElementById('price').focus();"); $objResponse->addAssign("price","style.backgroundColor", "#caf632"); return $objResponse->getXML(); }else{ $objResponse->addAssign("price","style.backgroundColor", "#ffffff"); } if(!in_array("error",$error)){ $filename=$_FILES['TourPhoto']['name']; $filetype=$_FILES['TourPhoto']['type']; $filetmp=$_FILES['TourPhoto']['tmp_name']; if($filename!=''){ $pic=Random_Int(8).date('dmYHism',time()); if(file_exists("../tour/photo/".$pk[image])) { unlink("../tour/photo/".$pk[image]); } if(file_exists("../tour/photo/thumbs/".$pk[image])) { unlink("../tour/photo/thumbs/".$pk[image]); } if ( $filetype == "image/gif" ){$ContentPhoto=$pic.".gif";} else if ( $filetype == "image/bmp" ){$ContentPhoto=$pic.".bmp";} else if ( $filetype == "image/png" ){$ContentPhoto=$pic.".png";} else if (($filetype=="image/jpg")||($filetype=="image/jpeg")||($filetype=="image/pjpeg")){$ContentPhoto=$pic.".jpg";} else{ $objResponse->addAlert("ไฟล์รูปผิดพลาด"); return $objResponse; } $addarr['image']=$ContentPhoto; if(move_uploaded_file($filetmp,$cfg[abs_path]."../tour/photo/".$ContentPhoto)){ make_thumb($cfg[abs_path]."../tour/photo/".$ContentPhoto,$cfg[abs_path]."../tour/photo/thumbs/".$ContentPhoto,$new_w=500); } }//filename //$detail=Random_Int(8).date('dmYHism',time()).".txt"; //$detail = htmlspecialchars($formData['ContentDetail']); $addarr['catagory'] = $formData['catsub1']; $addarr['catsub2'] = $formData['catsub2']; $addarr['catsub3'] = $formData['catsub3']; $addarr['catsub4'] = $formData['catsub4']; $addarr['code'] = $formData['TourCode']; $addarr['name'] = $formData['ToutName']; $addarr['days'] = $formData['TourDay']; $addarr['airline'] = $formData['TourAirline']; $addarr['airline2'] = $formData['TourAirline2']; $addarr['airline3'] = $formData['TourAirline3']; $addarr['airline4'] = $formData['TourAirline4']; $addarr['credit'] = $formData['credit']; $addarr['price'] = $formData['price']; $addarr['public'] = $formData['public']; $addarr['Rating'] = $formData['Rating']; $addarr['Detail'] = $formData['TourDetail']; $addarr['title'] = $formData['TourTitle']; $addarr['Cover'] = $formData['TourCover']; $addarr['MetaTitle'] = $formData['MetaTitle']; $addarr['MetaKeyword'] = $formData['MetaKeyword']; $addarr['MetaDescription'] = $formData['MetaDescription']; $addarr['AddTime'] = date('Y-m-d H:i:s',time()); $addarr['Addby'] = $user_login[ID]; if ($_SESSION["la"] == 1){ $result=$db->Update('tour',$addarr,"WHERE id='$topic_id'"); }else{ $result=$db->Update('tour_en',$addarr,"WHERE id='$topic_id'"); } $i=0; while(isset($_FILES['files']['name'][$i])){ if($_FILES['files']['name'][$i] != ''){ $filename = $_FILES['files']['name'][$i]; $filetype = $_FILES['files']['type'][$i]; $filetmp = $_FILES['files']['tmp_name'][$i]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto=$pic.".gif"; }else if ( $filetype == "image/bmp"){ $ContentPhoto=$pic.".bmp"; }else if ( $filetype == "image/png"){ $ContentPhoto=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto=$pic.".jpg"; } if($ContentPhoto != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "images/tour/".$ContentPhoto); } } $i++; $addarr=array( 'picture'=>$ContentPhoto, 'id'=>$topic_id, 'time_add'=>date("Y-m-d H:i:s"), ); if ($_SESSION["la"] == 1){ $db->Insert('tour_photo',$addarr); }else{ $db->Insert('tour_photo',$addarr); } }else{ $i++; } } $db->Query("DELETE FROM tour_con WHERE id='$topic_id'"); $i=0; while(isset($formData['sfdo'][$i])){ if($formData['sfdo'][$i] != ''){ $addarr=array( 'id'=>$topic_id, 'sfd'=>$formData['sfdo'][$i], 'sfhl'=>$formData['sfhlo'][$i], 'sf1'=>$formData['sf1o'][$i], 'sf2'=>$formData['sf2o'][$i], 'sf3'=>$formData['sf3o'][$i], 'sfho'=>$formData['sfhoo'][$i], ); if ($_SESSION["la"] == 1){ $db->Insert('tour_con',$addarr); }else{ $db->Insert('tour_con',$addarr); } $i++; }else{ $i++; } } $i=0; while(isset($formData['sfd'][$i])){ if($formData['sfd'][$i] != ''){ $addarr=array( 'id'=>$topic_id, 'sfd'=>$formData['sfd'][$i], 'sfhl'=>$formData['sfhl'][$i], 'sf1'=>$formData['sf1'][$i], 'sf2'=>$formData['sf2'][$i], 'sf3'=>$formData['sf3'][$i], 'sfho'=>$formData['sfho'][$i], ); if ($_SESSION["la"] == 1){ $db->Insert('tour_con',$addarr); }else{ $db->Insert('tour_con',$addarr); } $i++; }else{ $i++; } } if($result){ $messageError="บันทึกข้อมูลสำเร็จ"; $objResponse->addAlert($messageError); $objResponse->addRedirect("admin.php?mod=tour"); return $objResponse->getXML(); }else{ $error="ไม่สามารถเพิ่มข้อมูลได้".$db->mysqlError(); $objResponse->addAlert($error); $objResponse->addRedirect("admin.php?mod=tour"); return $objResponse->getXML(); } }///end check error return $objResponse->getXML(); } $xajax->registerFunction("EditData_tour"); ///////////////////////////////////////////////////////////////// function Adddata_credit($formData){ global $db,$user_login; $objResponse = new xajaxResponse(); $filename=$_FILES['TourPhoto']['name']; $filetype=$_FILES['TourPhoto']['type']; $filetmp=$_FILES['TourPhoto']['tmp_name']; if($filename!=''){ $pic=Random_Int(8).date('dmYHism',time()); if ( $filetype == "image/gif" ){$ContentPhoto=$pic.".gif";} else if ( $filetype == "image/bmp" ){$ContentPhoto=$pic.".bmp";} else if ( $filetype == "image/png" ){$ContentPhoto=$pic.".png";} else if (($filetype=="image/jpg")||($filetype=="image/jpeg")||($filetype=="image/pjpeg")){$ContentPhoto=$pic.".jpg";} else{ $objResponse->addAlert("ไฟล์รูปผิดพลาด"); return $objResponse; } $addarr['picture']=$ContentPhoto; if(move_uploaded_file($filetmp,$cfg[abs_path]."../images/logo_bank/".$ContentPhoto)){ make_thumb($cfg[abs_path]."../images/logo_bank/".$ContentPhoto,$cfg[abs_path]."../images/logo_bank/thumbs/".$ContentPhoto,$new_w=60); } }//filename $addarr=array( 'picture'=>$ContentPhoto, 'name'=>$formData['ToutName'], ); $result=$db->Insert('cadit_card',$addarr); if($result){ $messageError="บันทึกข้อมูลสำเร็จ"; $objResponse->addAlert($messageError); $objResponse->addRedirect("admin.php?mod=tour&ac=cadit_card"); return $objResponse->getXML(); }else{ $error="ไม่สามารถเพิ่มข้อมูลได้".$db->mysqlError(); $objResponse->addAlert($error); $objResponse->addRedirect("admin.php?mod=tour&ac=cadit_card"); return $objResponse->getXML(); } return $objResponse->getXML(); } $xajax->registerFunction("Adddata_credit"); function EditData_card($formData){ global $db,$user_login; $objResponse = new xajaxResponse(); $topic_id=$_GET['id']; $pk=$db->getDataOneRow('cadit_card',$topic_id,'id'); $filename=$_FILES['TourPhoto']['name']; $filetype=$_FILES['TourPhoto']['type']; $filetmp=$_FILES['TourPhoto']['tmp_name']; if($filename!=''){ $pic=Random_Int(8).date('dmYHism',time()); if(file_exists("../../images/logo_bank/".$pk[picture])) { unlink("../images/logo_bank/".$pk[picture]); } if(file_exists("../../images/logo_bank/thumbs/".$pk[picture])) { unlink("../../images/logo_bank/thumbs/".$pk[picture]); } if ( $filetype == "image/gif" ){$ContentPhoto=$pic.".gif";} else if ( $filetype == "image/bmp" ){$ContentPhoto=$pic.".bmp";} else if ( $filetype == "image/png" ){$ContentPhoto=$pic.".png";} else if (($filetype=="image/jpg")||($filetype=="image/jpeg")||($filetype=="image/pjpeg")){$ContentPhoto=$pic.".jpg";} else{ $objResponse->addAlert("ไฟล์รูปผิดพลาด"); return $objResponse; } $addarr['picture']=$ContentPhoto; if(move_uploaded_file($filetmp,$cfg[abs_path]."../images/logo_bank/".$ContentPhoto)){ make_thumb($cfg[abs_path]."../images/logo_bank/".$ContentPhoto,$cfg[abs_path]."../images/logo_bank/thumbs/".$ContentPhoto,$new_w=60); } }//filename $addarr['name'] = $formData['ToutName']; $result=$db->Update('cadit_card',$addarr,"WHERE id='$topic_id' "); if($result){ $messageError="บันทึกข้อมูลสำเร็จ"; $objResponse->addAlert($messageError); $objResponse->addRedirect("admin.php?mod=tour&ac=cadit_card"); return $objResponse->getXML(); }else{ $error="ไม่สามารถเพิ่มข้อมูลได้".$db->mysqlError(); $objResponse->addAlert($error); $objResponse->addRedirect("admin.php?mod=tour&ac=cadit_card"); return $objResponse->getXML(); } return $objResponse->getXML(); } $xajax->registerFunction("EditData_card"); //////////////////////////////////////////////// function addData($action){ global $db; if ($_SESSION["la"] == 1){ $rs=$db->Query("SELECT * FROM tour_content WHERE content_tour_id='{$_GET['tour_id']}' AND content_parent=''"); }else{ $rs=$db->Query("SELECT * FROM tour_content_en WHERE content_tour_id='{$_GET['tour_id']}' AND content_parent=''"); } $html.="<table border=\"1\" width=\"700\" height=\"50\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\">"; while($data=mysql_fetch_array($rs)){ $html.=" <tr> <td height=\"23\" width=\"700\" colspan=\"2\" bgcolor=\"#FFFF33\">{$data['content_topic']} <span style=\"cursor:hand;\" onclick=\"addTb({$data['content_id']})\">[เพิ่มตารางเวลา]</span></td> </tr>"; if ($_SESSION["la"] == 1){ $rs2=$db->Query("SELECT * FROM tour_content WHERE content_parent='{$data['content_id']}'"); }else{ $rs2=$db->Query("SELECT * FROM tour_content_en WHERE content_parent='{$data['content_id']}'"); } while($data2=mysql_fetch_array($rs2)){ $html.=" <tr> <td height=\"30\" width=\"165\">{$data2['content_time']}</td> <td height=\"30\" width=\"649\">{$data2['content_detail']}</td> </tr> "; } } if($action=='topic'){ $html.="<tr> <td height=\"23\" width=\"700\" colspan=\"2\" bgcolor=\"#FFFF33\"><input type='text' value='' style='width:600px;' onchange='xajax_addTopic(this.value);'></td> </tr>"; } $html.="</table>"; $objResponse = new xajaxResponse(); $objResponse->addAssign("mainbox","innerHTML",$html); return $objResponse; } function addHeader($formData) { global $db; $objResponse = new xajaxResponse(); $add=Array('title'=>$formData['header']); if ($_SESSION["la"] == 1){ $db->Update('tour',$add,"WHERE id='{$_GET['tour_id']}'"); }else{ $db->Update('tour_en',$add,"WHERE id='{$_GET['tour_id']}'"); } if($db->mysqlError()==''){ $objResponse->addAlert('บันทึกสำเร็จ'); }else{ $objResponse->addAlert('ไม่สามารถบันทึกข้อมูลได้ '.$db->mysqlError()); } return $objResponse->getXML(); } function addCondition($formData) { global $db; $objResponse = new xajaxResponse(); if ($_SESSION["la"] == 1){ $db->Query("DELETE FROM tour_content_condition WHERE condition_tour_id='{$_GET['tour_id']}'"); }else{ $db->Query("DELETE FROM tour_content_condition_en WHERE condition_tour_id='{$_GET['tour_id']}'"); } $i=0; foreach($formData['Condition'] as $k=>$v){ if($v!=''){ $data=Array( 'condition_tour_id'=>$_GET['tour_id'], 'condition_order'=>$formData['orderCondition'][$k], 'condition_name'=>$v, 'condition_detail'=>$formData['ConDetail'][$k] ); if ($_SESSION["la"] == 1){ $db->Insert('tour_content_condition',$data); }else{ $db->Insert('tour_content_condition_en',$data); } } $i++; } $objResponse->addScript("xajax_refreshCondition()"); $objResponse->addAlert("บันทึกสำเร็จ"); return $objResponse->getXML(); } function plus_tr($id){ global $db; $objResponse = new xajaxResponse(); if ($_SESSION["la"] == 1){ $data=$db->getDataOneRow('tour_content',$id,'content_id'); $rs2=$db->Query("SELECT * FROM tour_content WHERE content_parent='$id' ORDER BY content_order ASC"); }else{ $data=$db->getDataOneRow('tour_content_en',$id,'content_id'); $rs2=$db->Query("SELECT * FROM tour_content_en WHERE content_parent='$id' ORDER BY content_order ASC"); } $html.=" <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <input type='hidden' name=\"content_id[$id]\"> <tr> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\"><input type='text' name='TopicRound[]' value='{$data['content_topic']}' style=\"background:#FFFF33;width:550px;border:0px;\" onClick='editInput(this)' onMouseOut='InputTxt(this)'> Order:<input type='text' value='{$x}' style='width:20px;text-align:center'> <span style='cursor:hand;' onclick='plus_tr('{$id}')'>+</span> </td> </tr>"; while($data2=mysql_fetch_array($rs2)){ $html.=" <tr> <td height=\"30\" width=\"120\" align=center valign=top>{$data2['content_time']}</td> <td height=\"30\" width=\"500\">{$data2['content_detail']}</td> </tr> "; } $html.=" <tr> <td height=\"30\" width=\"120\" align=center valign=top><input type='text' name=\"time[]\"></td> <td height=\"30\" width=\"500\"><textarea name=\"timeDetail[]\"></textarea></td> </tr> "; $html.="</table>"; $objResponse->addAssign("table_round_".$id,"innerHTML",$html); return $objResponse; } function loadRound(){ global $db; $objResponse = new xajaxResponse(); if ($_SESSION["la"] == 1){ $rs=$db->Query("SELECT * FROM tour_content WHERE content_tour_id='{$_GET['tour_id']}' AND content_parent='' ORDER BY content_order ASC"); }else{ $rs=$db->Query("SELECT * FROM tour_content_en WHERE content_tour_id='{$_GET['tour_id']}' AND content_parent='' ORDER BY content_order ASC"); } $x=1; while($data=mysql_fetch_array($rs)){ $html.=" <div id=\"div_{$data['content_id']}\"> <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\" name=\"table_{$data['content_id']}\" id=\"table_{$data['content_id']}\"> <tbody id=\"tbody_{$data['content_id']}\"> <input type='hidden' name=\"content_id[{$data[content_id]}]\" id='tablex_{$data['content_id']}'> <tr id=\"tr_topic_{$data['content_id']}\"> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\" id=\"td_topic_{$data['content_id']}\" ><input type='text' name='TopicRound[]' value='{$data['content_topic']}' style=\"background:#FFFF33;width:550px;border:0px;\" > <span style='cursor:hand;' onclick=\"xajax_editTable('div_{$data['content_id']}','{$data['content_id']}')\"> แก้ไข</span> <span style='cursor:hand;' onclick=\"xajax_delTable('{$data['content_id']}')\"> ลบ</span></td> </tr>"; if ($_SESSION["la"] == 1){ $rs2=$db->Query("SELECT * FROM tour_content WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); }else{ $rs2=$db->Query("SELECT * FROM tour_content_en WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); } while($data2=mysql_fetch_array($rs2)){ $html.=" <tr id=\"tr_sub_{$data['content_id']}\"> <td height=\"30\" width=\"120\" align=center valign=top id=\"td_sub_time_{$data['content_id']}\">{$data2['content_time']}</td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_{$data['content_id']}\">{$data2['content_detail']}"; $Content_photo1=""; $Content_photo2=""; $Content_photo3=""; if($data2['Content_photo1'] <> "" || $data2['Content_photo2'] <> "" || $data2['Content_photo3'] <> ""){ if($data2['Content_photo1'] <> ""){ $Content_photo1="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=1&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo1']}\" width=\"120\"/></div>"; } if($data2['Content_photo2'] <> ""){ $Content_photo2="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=2&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo2']}\" width=\"120\"/></div>"; } if($data2['Content_photo3'] <> ""){ $Content_photo3="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=3&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo3']}\" width=\"120\"/></div>"; } $html.=" <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td valign=\"top\" width=\"33%\">$Content_photo1</td> <td valign=\"top\" width=\"33%\">$Content_photo2</td> <td valign=\"top\" width=\"33%\">$Content_photo3</td> </tr> </table>"; } $html.="</td> </tr> "; } $html.="</tbody></table></div>"; $x++; } $objResponse->addAssign("txtRound","innerHTML",$html); return $objResponse; } function createTable($divid){ $objResponse = new xajaxResponse(); $html=" <FORM id=\"NewForm\" enctype=\"multipart/form-data\" method=\"post\" action=\"q1.php\"> <div id=\"div_N_$divid\"> <table border=\"1\" width=\"100%\" cellspacing=\"0\" height=\"10\"style=\"border-collapse: collapse\" name=\"table_N_$divid\" id=\"table_N_$divid\"> <tbody id=\"tbody_N_$divid\"> <input type='hidden' name=\"content_id[]\" id='table_N_$divid'> <input type='hidden' name=\"content_tour_id\" id='content_tour_id' value=\"{$_GET['tour_id']}\"> <tr id=\"tr_topic_N_$divid\"> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\" id=\"td_topic_N_$divid\" ><input type='text' name='TopicRound' value='' style=\"background:#ffffff;width:550px;\"> <span style='cursor:hand;' onclick=\"addRow('tbody_N_$divid')\">เพิ่มแถว</span> </td> </tr> <tr id=\"tr_sub_N_1_$divid\"> <td height=\"30\" width=\"120\" align=center id=\"td_sub_time_N_1_$divid\"><input type='text' name='subTopic[]' style='width:100px'></td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_N_1_$divid\"><textarea name=detail[] style=\"width:520px;height:100px;\"></textarea><br>ภาพที่ 1 <input type=\"file\" name=\"photos1[]\" id=\"photos1[]\" /><br>ภาพที่ 2 <input type=\"file\" name=\"photos2[]\" id=\"photos2[]\" /><br>ภาพที่ 3 <input type=\"file\" name=\"photos3[]\" id=\"photos3[]\" /></td> </tr> <tr id=\"tr_sub_N_2_$divid\"> <td height=\"30\" width=\"120\" align=center id=\"td_sub_time_N_2_$divid\"><input type='text' name='subTopic[]' style='width:100px'></td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_N_2_$divid\"><textarea name=detail[] style=\"width:520px;height:100px;\"></textarea><br>ภาพที่ 1 <input type=\"file\" name=\"photos1[]\" id=\"photos1[]\" /><br>ภาพที่ 2 <input type=\"file\" name=\"photos2[]\" id=\"photos2[]\" /><br>ภาพที่ 3 <input type=\"file\" name=\"photos3[]\" id=\"photos3[]\" /></td> </table> <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <tr> <td width=\"100%\" valign=\"middle\" align=\"right\" height=\"20\" colspan=\"2\"><input type='button' value=' ยกเลิก ' onClick='xajax_undotable()'><input type=\"submit\" value=\" บันทึก \" ></td> </tr> </table> </div> </FORM>"; $objResponse->addAssign("$divid","innerHTML",$html); return $objResponse; } function delTable($id){ global $db; $objResponse = new xajaxResponse(); $result=$db->Query("SELECT * FROM tour_content WHERE content_parent='$id' "); while($arr=mysql_fetch_array($result)){ $flgDelete1 = unlink("../../images/tour/".$arr['Content_photo1']); $flgDelete2 = unlink("../../images/tour/".$arr['Content_photo2']); $flgDelete3 = unlink("../../images/tour/".$arr['Content_photo3']); } if ($_SESSION["la"] == 1){ if($db->Query("DELETE FROM tour_content WHERE content_id='$id'")){ $db->Query("DELETE FROM tour_content WHERE content_parent='$id'"); } }else{ if($db->Query("DELETE FROM tour_content_en WHERE content_id='$id'")){ $db->Query("DELETE FROM tour_content_en WHERE content_parent='$id'"); } } $objResponse->addScript("xajax_loadRound()"); return $objResponse; } function addDataTable($formData) { global $db; $objResponse = new xajaxResponse(); $k =0; $objResponse->addAlert($k.' : 1 '.$_FILES['photos1']['name'][$k].' s/'); $objResponse->addAlert($k.' : 2 '.$_FILES['photos2']['name'][$k].' s/'); $objResponse->addAlert($k.' : 3 '.$_FILES['photos3']['name'][$k].' s/'); if ($_SESSION["la"] == 1){ $ct=$db->count_data('tour_content',"WHERE content_tour_id='{$_GET['tour_id']}'"); }else{ $ct=$db->count_data('tour_content_en',"WHERE content_tour_id='{$_GET['tour_id']}'"); } $ct=$ct+1; $add=Array('content_topic'=>$formData['TopicRound'],'content_tour_id'=>$_GET['tour_id'],'content_order'=>$ct); if ($_SESSION["la"] == 1){ $db->Insert('tour_content',$add); $id=$db->getRow('tour_content',"WHERE content_topic='{$formData['TopicRound']}' AND content_tour_id='{$_GET['tour_id']}' And content_order='".$ct."'"); }else{ $db->Insert('tour_content_en',$add); $id=$db->getRow('tour_content_en',"WHERE content_topic='{$formData['TopicRound']}' AND content_tour_id='{$_GET['tour_id']}' And content_order='".$ct."'"); } if($_FILES['photos1']['name'][$k] != ''){ $filename = $_FILES['photos1']['name'][$k]; $filetype = $_FILES['photos1']['type'][$k]; $filetmp = $_FILES['photos1']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto1=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto1=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto1=$pic.".jpg"; } if($ContentPhoto1 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "images/tour/".$ContentPhoto1); } } } if($_FILES['photos2']['name'][$k] != ''){ $filename = $_FILES['photos2']['name'][$k]; $filetype = $_FILES['photos2']['type'][$k]; $filetmp = $_FILES['photos2']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto2=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto2=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto2=$pic.".jpg"; } if($ContentPhoto2 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "images/tour/".$ContentPhoto2); } } } if($_FILES['photos3']['name'][$k] != ''){ $filename = $_FILES['photos3']['name'][$k]; $filetype = $_FILES['photos3']['type'][$k]; $filetmp = $_FILES['photos3']['tmp_name'][$k]; $pic=Random_Int(8).date('dmYHism',time()); if($filetype == "image/gif"){ $ContentPhoto3=$pic.".gif"; }else if ( $filetype == "image/png"){ $ContentPhoto3=$pic.".png"; }else if (($filetype =="image/jpg")||($filetype =="image/jpeg")||($filetype =="image/pjpeg")){ $ContentPhoto3=$pic.".jpg"; } if($ContentPhoto3 != ""){ if ($filetype != ""){ move_uploaded_file($filetmp, "images/tour/".$ContentPhoto3); } } } $i=1; foreach($formData['subTopic'] as $k=>$v){ //if($v!=''){ $data1=Array( 'content_order'=>$i, 'content_parent'=>$id['content_id'], 'content_tour_id'=>$_GET['tour_id'], 'content_time'=>$v, 'content_detail'=>$formData['detail'][$k], 'Content_photo1'=>$ContentPhoto1, 'Content_photo2'=>$ContentPhoto2, 'Content_photo3'=>$ContentPhoto3 ); if ($_SESSION["la"] == 1){ $db->Insert('tour_content',$data1); }else{ $db->Insert('tour_content_en',$data1); } //} $i++; } if($db->mysqlError()==''){ $objResponse->addAlert('บันทึกสำเร็จ'); $objResponse->addScript("xajax_loadRound()"); $html=" <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <tr> <td width=\"100%\" valign=\"middle\" align=\"right\" height=\"20\" colspan=\"2\"><input type=\"button\" value=\" เพิ่มตาราง \" onclick=\"addTable()\"></td> </tr> </table>"; $objResponse->addAssign("DivNewTable","innerHTML",$html); }else{ $objResponse->addAlert('ไม่สามารถบันทึกข้อมูลได้ '.$db->mysqlError()); } return $objResponse->getXML(); } function editTable($div,$content_id){ global $db; $objResponse = new xajaxResponse(); if ($_SESSION["la"] == 1){ $data=$db->getDataOneRow('tour_content',$content_id,'content_id'); }else{ $data=$db->getDataOneRow('tour_content_en',$content_id,'content_id'); } $html.="<FORM id=\"FormEditTable\" enctype=\"multipart/form-data\" method=\"post\" action=\"q2.php\">"; $html.=" <table border=\"1\" cellspacing=\"0\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\" name=\"table_{$data['content_id']}\" id=\"table_{$data['content_id']}\"> <tbody id=\"tbody_{$data['content_id']}\"> <input type='hidden' name=\"content_id\" value='$content_id'> <input type='hidden' name=\"div_back[$content_id]\" value=\"$div\"> <input type='hidden' name=\"content_tour_id\" id='content_tour_id' value=\"{$_GET['tour_id']}\"> <tr id=\"tr_topic_{$data['content_id']}\"> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\" id=\"td_topic_{$data['content_id']}\" ><input type='text' name='TopicRound[$content_id]' value='{$data['content_topic']}' style=\"width:500px;\" ><input type='submit' value=' Save '><span style='cursor:hand;' onclick=\"addRow('tbody_{$data['content_id']}')\"> เพิ่มแถว</span> </td> </tr>"; if ($_SESSION["la"] == 1){ $rs2=$db->Query("SELECT * FROM tour_content WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); }else{ $rs2=$db->Query("SELECT * FROM tour_content_en WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); } while($data2=mysql_fetch_array($rs2)){ $html.=" <input type='hidden' name='subId[{$data2['content_id']}]' value='{$data2['content_id']}'> <tr id=\"tr_sub_{$data2['content_id']}\"> <td height=\"30\" width=\"120\" align=center valign=top id=\"td_sub_time_{$data2['content_id']}\"><input type='text' name='subTopic[{$data2['content_id']}]' style='width:100px' value='{$data2['content_time']}'><br>เรียงลำดับ<input type='text' name='order[{$data2['content_id']}]' style='width:20px' value='{$data2['content_order']}'></td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_{$data2['content_id']}\"><textarea name='detail[{$data2['content_id']}]' style=\"width:520px;height:100px;\">{$data2['content_detail']}</textarea> <table width=\"130\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td valign=\"top\">"; if($data2['Content_photo1'] <> ""){ $html.="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=1&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo1']}\" width=\"120\"/></div>"; } $html.="</td> </tr> <tr> <td valign=\"top\"> ภาพที่ 1 <input type=\"file\" name=\"photos1[]\" id=\"photos1[]\" /> <input type='hidden' name=\"photos1o[]\" value='{$data2['Content_photo1']}'> </td> </tr> </table> <table width=\"130\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td valign=\"top\">"; if($data2['Content_photo2'] <> ""){ $html.="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=2&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo2']}\" width=\"120\"/></div>"; } $html.="</td> </tr> <tr> <td valign=\"top\"> ภาพที่ 2 <input type=\"file\" name=\"photos2[]\" id=\"photos2[]\" /> <input type='hidden' name=\"photos2o[]\" value='{$data2['Content_photo2']}'> </td> </tr> </table> <table width=\"130\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td valign=\"top\">"; if($data2['Content_photo3'] <> ""){ $html.="<div align=\"right\"><a href=\"delete_photo_gallery.php?content_id={$data2['content_id']}&id=3&tour_id={$_GET['tour_id']}\"><img src=\"../../images/close.png\"></a><br /><img src=\"../../images/tour/{$data2['Content_photo3']}\" width=\"120\"/></div>"; } $html.="</td> </tr> <tr> <td valign=\"top\"> ภาพที่ 3 <input type=\"file\" name=\"photos3[]\" id=\"photos3[]\" /> <input type='hidden' name=\"photos3o[]\" value='{$data2['Content_photo3']}'> </td> </tr> </table> </td> </tr> "; } $html.="</tbody></table>"; $html.="</form>"; $objResponse->addAssign("$div","innerHTML",$html); return $objResponse; } function editDataTable($formData,$content_id){ global $db; $objResponse = new xajaxResponse(); $data=Array( 'content_topic'=>$formData['TopicRound'][$content_id], ); if ($_SESSION["la"] == 1){ if($db->Update('tour_content',$data,"WHERE content_id='$content_id'")){ $sub=1; foreach($formData['subId'] as $k=>$v){ if($v!=''){ $data=Array( 'content_order'=>$formData['order'][$k], 'content_tour_id'=>$_GET['tour_id'], 'content_time'=>$formData['subTopic'][$k], 'content_detail'=>$formData['detail'][$k] ); //$objResponse->addAlert($formData['detail'][$k].'-'.$formData['subTopic'][$k]); if($formData['detail'][$k]==''){ $db->Query("DELETE FROM tour_content WHERE content_id='$k' AND content_tour_id='{$_GET['tour_id']}' AND content_parent='$content_id'"); }else{ $db->Update('tour_content',$data,"WHERE content_id='$k'"); } }else{ $data=Array( 'content_order'=>$sub, 'content_tour_id'=>$_GET['tour_id'], 'content_time'=>$formData['subTopic'][$k], 'content_detail'=>$formData['detail'][$k], 'content_parent'=>$content_id ); //$objResponse->addAlert($formData['detail'][$k].'-'.$formData['subTopic'][$k]); $db->Insert('tour_content',$data); } $sub++; }//end foreach }//end update $data=$db->getDataOneRow('tour_content',$content_id,'content_id'); $html.=" <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\" name=\"table_{$data['content_id']}\" id=\"table_{$data['content_id']}\"> <tbody id=\"tbody_{$data['content_id']}\"> <input type='hidden' name=\"content_id\" value='$content_id'> <input type='hidden' name=\"div_id[$content_id]\" value='div_[$content_id]'> <tr id=\"tr_topic_{$data['content_id']}\"> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\" id=\"td_topic_{$data['content_id']}\" ><input type='text' name='TopicRound[$content_id]' value='{$data['content_topic']}' style=\"background:#FFFF33;width:550px;border:0px;\"><span style='cursor:hand;' onclick=\"xajax_editTable('{$formData['div_back'][$content_id]}','{$data['content_id']}')\"> แก้ไข </span> <span style='cursor:hand;' onclick=\"xajax_delTable('{$data['content_id']}')\"> ลบ</span></td> </tr>"; $rs2=$db->Query("SELECT * FROM tour_content WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); while($data2=mysql_fetch_array($rs2)){ $html.=" <input type='hidden' name='subId[$content_id]' value='{$data2['content_id']}'> <tr id=\"tr_sub_{$data2['content_id']}\"> <td height=\"30\" width=\"120\" align=center valign=top id=\"td_sub_time_{$data2['content_id']}\">{$data2['content_time']}</td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_{$data2['content_id']}\">{$data2['content_detail']}</td> </tr> "; } $html.="</tbody></table>"; }else{ if($db->Update('tour_content_en',$data,"WHERE content_id='$content_id'")){ $sub=1; foreach($formData['subId'] as $k=>$v){ if($v!=''){ $data=Array( 'content_order'=>$formData['order'][$k], 'content_tour_id'=>$_GET['tour_id'], 'content_time'=>$formData['subTopic'][$k], 'content_detail'=>$formData['detail'][$k] ); //$objResponse->addAlert($formData['detail'][$k].'-'.$formData['subTopic'][$k]); if($formData['detail'][$k]==''){ $db->Query("DELETE FROM tour_content_en WHERE content_id='$k' AND content_tour_id='{$_GET['tour_id']}' AND content_parent='$content_id'"); }else{ $db->Update('tour_content_en',$data,"WHERE content_id='$k'"); } }else{ $data=Array( 'content_order'=>$sub, 'content_tour_id'=>$_GET['tour_id'], 'content_time'=>$formData['subTopic'][$k], 'content_detail'=>$formData['detail'][$k], 'content_parent'=>$content_id ); //$objResponse->addAlert($formData['detail'][$k].'-'.$formData['subTopic'][$k]); $db->Insert('tour_content_en',$data); } $sub++; }//end foreach }//end update $data=$db->getDataOneRow('tour_content_en',$content_id,'content_id'); $html.=" <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\" name=\"table_{$data['content_id']}\" id=\"table_{$data['content_id']}\"> <tbody id=\"tbody_{$data['content_id']}\"> <input type='hidden' name=\"content_id\" value='$content_id'> <input type='hidden' name=\"div_id[$content_id]\" value='div_[$content_id]'> <tr id=\"tr_topic_{$data['content_id']}\"> <td height=\"23\" width=\"100%\" colspan=\"2\" bgcolor=\"#FFFF33\" id=\"td_topic_{$data['content_id']}\" ><input type='text' name='TopicRound[$content_id]' value='{$data['content_topic']}' style=\"background:#FFFF33;width:550px;border:0px;\"><span style='cursor:hand;' onclick=\"xajax_editTable('{$formData['div_back'][$content_id]}','{$data['content_id']}')\"> แก้ไข </span> <span style='cursor:hand;' onclick=\"xajax_delTable('{$data['content_id']}')\"> ลบ</span></td> </tr>"; $rs2=$db->Query("SELECT * FROM tour_content_en WHERE content_parent='{$data['content_id']}' ORDER BY content_order ASC"); while($data2=mysql_fetch_array($rs2)){ $html.=" <input type='hidden' name='subId[$content_id]' value='{$data2['content_id']}'> <tr id=\"tr_sub_{$data2['content_id']}\"> <td height=\"30\" width=\"120\" align=center valign=top id=\"td_sub_time_{$data2['content_id']}\">{$data2['content_time']}</td> <td height=\"30\" width=\"500\" id=\"td_sub_detail_{$data2['content_id']}\">{$data2['content_detail']}</td> </tr> "; } $html.="</tbody></table>"; } $objResponse->addAssign($formData['div_back'][$content_id],"innerHTML",$html); return $objResponse; } function undotable(){ $objResponse = new xajaxResponse(); $html.=" <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <tr> <td width=\"100%\" valign=\"middle\" align=\"right\" height=\"20\" colspan=\"2\"><input type=\"button\" value=\" เพิ่มตาราง \" onclick=\"addTable()\"></td> </tr> </table>"; $objResponse->addAssign("DivNewTable","innerHTML",$html); return $objResponse; } function refreshCondition(){ global $db; $objResponse = new xajaxResponse(); $html.="<FORM id=\"webForm3\" onsubmit=\"return false;\"> <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <tbody id=\"tb_condition\"> <tr> <td width=\"100%\" valign=\"middle\" align=\"center\" height=\"30\" colspan=\"2\">เงื่อนไข [<a href=\"javascript:void(0);\" onclick=\"addRowCondition('tb_condition')\">เพิ่มเงื่อนไขราคา</a>]</td> </tr> "; if ($_SESSION["la"] == 1){ $rs=$db->Query("SELECT * FROM tour_content_condition WHERE condition_tour_id='{$_GET['tour_id']}' ORDER BY condition_order ASC"); }else{ $rs=$db->Query("SELECT * FROM tour_content_condition_en WHERE condition_tour_id='{$_GET['tour_id']}' ORDER BY condition_order ASC"); } while($data=mysql_fetch_array($rs)){ $html.= "<tr> <td width=\"100%\" valign=\"middle\" align=\"left\" height=\"30\" colspan=\"2\"> เงื่อนไข:<input type=\"text\" name=\"Condition[]\" style=\"width:200px;\" value=\"{$data['condition_name']}\"> Order :<input type=\"text\" name=\"orderCondition[]\" style=\"width:20px;\" value=\"{$data['condition_order']}\"><br><textarea name=\"ConDetail[]\" style=\"width:100%px;height:100px;\">{$data['condition_detail']}</textarea></td> </tr>"; } $html.=" </tbody> </table> <table border=\"1\" width=\"100%\" height=\"10\"style=\"border-collapse: collapse\"> <tr> <td width=\"100%\" valign=\"middle\" align=\"right\" height=\"20\" colspan=\"2\"><input type='button' value=\" ยกเลิก \" onclick=\"xajax_refreshCondition()\"> <input type=\"submit\" value=\" บันทึกเงื่อนไข \" onclick=\"xajax_addCondition(xajax.getFormValues('webForm3')); return false;\" /></td> </tr> </table> </form>"; $objResponse->addAssign("txtCondition","innerHTML",$html); return $objResponse; } ?>