Viewing file: addDocNews.php (6.1 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once "template.php"; include_once "../class/clsdocNews.php"; include_once "../link/function.php"; include_once "funct.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']); $odN = new docNews($oC); $odN2 = new docNews($oC);
if($method=="addDocNews"){ $odN->AddNew(); $odN->dnId=$odN->GetNextCode(); $odN->newsSubject=$newsSubject; $odN->newsDetail=$newsDetail; $odN->newsStartDate=splitDateForm($newsStartDate,"/"); $odN->newsEndDate=splitDateForm($newsEndDate,"/"); $odN->postDate=getNowDateTh()." ".date('H:i:s'); $odN->postName=$postName; $odN->Save(); ?> <script language="JavaScript"> parent.location.href ="docNews.php"; </script> <? }else if($method=="editDocNews"){ $odN->SearchByKey($dnId); $odN->GetRecord(); $odN->Edit(); $odN->newsSubject=$newsSubject; $odN->newsDetail=$newsDetail; $odN->newsStartDate=splitDateForm($newsStartDate,"/"); $odN->newsEndDate=splitDateForm($newsEndDate,"/"); $odN->postName=$postName; $odN->Save(); ?> <script language="JavaScript"> parent.location.href ="docNews.php?monthe=<? echo $monthe;?>&searchYear=<? echo $searchYear;?>"; </script> <? }
if($edit==1){ $odN2->SearchByKey($dnId); $odN2->GetRecord(); } ?> <html> <head> <script language="javascript" src="../source/calendarDateInput.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=tis-620"> <link href="../source/style.css" rel="stylesheet" type="text/css"> <!-- TinyMCE --> <script type="text/javascript" src="../source/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "advanced", theme_advanced_buttons1_add_before : "newdocument,separator", theme_advanced_buttons1_add : "fontselect,fontsizeselect", theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle", theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,", theme_advanced_buttons3_add : "flash,advhr,separator,fullscreen", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_disable : "fontselect,styleselect ,cleanup , image ,anchor ", extended_valid_elements : "hr[class|width|size|noshade]", file_browser_callback : "ajaxfilemanager", paste_use_dialog : false, theme_advanced_resizing : true, theme_advanced_resize_horizontal : true, apply_source_formatting : true, force_br_newlines : true, force_p_newlines : false, relative_urls : true
}); </script> <!-- /TinyMCE -->
</head>
<body> <iframe id="config" name="config" src="" style="width:$0px;height:0px;border:0"></iframe> <br> <table width=703 align="center"> <tr><td height="150"> <fieldset> <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="?mm=1">จัดการระบบ</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"><a href="docNews.php"> จัดการข่าวประชาสัมพันธ์</a> <img src="../picture/ico3.gif" width="10" height="10" border="0" align="absmiddle"> <? if($edit!=1){ echo "บันทึก"; }else{ echo "แก้ไข"; }?>ข่าวประชาสัมพันธ์</font></legend> <form name="ff" method="post" ><? //target="config" ?> <table align="center" width="95%" > <tr> <td width="68%" height="25"><img src="../picture/official_letter.gif" border="0" > <font color="<?php echo $GLOBALS["COLOR_FONT_2"]; ?>" size="3"><strong>ข่าวประชาสัมพันธ์</strong></font> </td> </tr> <tr> <td colspan="3"><hr color="#000099"></hr> </td> </tr> </table> <table width="90%" border="0" align="center" > <tr><td colspan="2"><b>หัวข้อ</b></td></tr> <tr><td colspan="2" align="center"><textarea id="newsSubject" name="newsSubject" rows="4" cols="50" style="width: 80%"><? echo $odN2->newsSubject;?></textarea><br></td></tr> <tr><td colspan="2"><b>รายละเอียด</b></td></tr> <tr><td colspan="2" align="center"><textarea id="newsDetail" name="newsDetail" rows="10" cols="50" style="width: 80%" ><? echo $odN2->newsDetail;?></textarea><br></td></tr> <tr><td width="25%"><b>วันที่เริ่มต้นประชาสัมพันธ์</b></td><td width="75%"><? if($edit!=1){ ?><script>DateInput('newsStartDate', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script><? }else{ ?><script>DateInput('newsStartDate', true, 'DD/MM/YYYY','<?php echo splitDateDb($odN2->newsStartDate,"/");?>');</script><? } ?></td></tr> <tr><td><b>วันที่สิ้นสุดประชาสัมพันธ์</b></td><td><? if($edit!=1){ ?><script>DateInput('newsEndDate', true, 'DD/MM/YYYY','<?php echo getNowDateFw2();?>');</script><? }else{ ?><script>DateInput('newsEndDate', true, 'DD/MM/YYYY','<?php echo splitDateDb($odN2->newsEndDate,"/");?>');</script><? } ?></td></tr> <tr><td><b>โดย</b></td><td><input name="postName" id="postName" type="text" style="" size="40" value="<? echo $odN2->postName;?>"></td></tr> </table> <table border="0" align="center" width="100%"><tr><td align="center"> <br><? if($edit!=1){ ?> <input type="submit" name="setDoc" value="บันทึก" onClick="return checkFormat();"> <input type="hidden" name="method" id="method" value="addDocNews"> <? }else{?> <input type="submit" name="setDoc" value="แก้ไข" onClick="return checkFormat();"> <input type="hidden" name="method" id="method" value="editDocNews"> <input type="hidden" name="dnId" id="dnId" value="<? echo $dnId; ?>"> <? }?> <input type="button" name="cancel" value="กลับสู่เมนูหลัก" onClick="location.href = 'docNews.php'"> </td> </tr></table> </form> </fieldset> <br>
</td> </tr> </table> </body> </html> <script language="javascript"> function checkFormat(){ if(tinyMCE.get("newsSubject").getContent()==""){ alert("กรุณากรอกหัวข้อข่าวประชาสัมพันธ์"); return false ; } if(document.getElementById("postName").value==""){ alert("กรุณากรอกโดย"); return false ; } var agree=confirm("คุณต้องการบันทึกใช่หรือไม่ ?"); if (agree){ return true ; }else{ return false ; } } </script>
|