Viewing file: umShowMenu.php (5.01 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? $MnStID = $_GET['MnStID']; include_once("pagebody.php"); pageHeader(); $pageTitle="กำหนดเมนูระบบงาน"; // $StID"; ?> <table width=100% class="pageTitleBgColor" align="center"> <tr><td align=center><? echo $pageTitle; ?></td></tr> </table> <!--your code here--------------------------------------------------------------------------> <br> <? include_once("clsUmSystem.php"); include_once("clsUmMenu.php"); $oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB'], $GLOBALS['USER'], $GLOBALS['PASSWORD']); //------------------------------------------- if ($_POST['method']=="updSeq") include_once("processUpdMenuSeq.php"); //------------------------------------------- $oSt = new umSystem($oC); $oSt->SearchByKey($MnStID); $oSt->GetRecord(); $StName = $oSt->StNameT; $oSt->Close(); $oMnT = new umMenu($oC); $oMn = new umMenu($oC); $oT = new clsTable(array("เมนู", "ดำเนินการ","ลำดับ")); $oT->bgColor="#efefef"; $oT->headerBgColor="#dddddd"; $oT->align="center"; $oMnT->RSMainMenuBySt($MnStID);
$rw=0;
while ($oMnT->GetRecord()){ ShowmenuM($oMnT->MnID); } $oT->rowStart("","#dddddd"); $oT->addCell(""); $oT->addCell("<a href=\"umAddMenu.php?MnStID=$MnStID&Level=0&ParentMnID=\" ><img src=\"images/new.gif\" alt=\"เพิ่มหัวข้อเมนู\" border=\"0\"></a>"); $oT->addCell("<input type=button name=doSave value='บันทึก' onclick='doUpdateMenuSeq()'>", "center"); $oT->rowEnd();
echo "<form name=formSeq method=post>"; echo "<input type=hidden name=method value=''>"; echo $oT->output(); echo "</form>"; //////////////////////////////////////////
function ShowMenuM($MnID){ global $oC; global $oT; global $Str; global $rw;
//include_once("../class/clsDB.php"); $oMn = new ummenu($oC); $oMn->SearchByKey($MnID); $oMn->GetRecord(); /////////////////////////////////////////////// // if (!$oMn->hasSubMenu($oMn->MnID) and $oMn->MnLevel>=1){ // if ($oMn->numMenuInSameParent($oMn->MnParentMnID)>1){ // $mn = $oMn->getMinSeq($oMn->MnParentMnID); // $mx = $oMn->getMaxSeq($oMn->MnParentMnID); // $bnkimg=str_repeat("<td></td>", ($oMn->MnLevel-1)*2); // if ($mn<>$mx){ // if ($oMn->MnSeq==$mn) // $updown = $bnkimg . // "<a href=\"javascript:doUpDown('d', '$oMn->MnStID','$oMn->MnID', '$oMn->MnSeq', '$oMn->MnParentMnID', '$oMn->MnLevel')\"> // <img src=\"images/down.gif\" border=\"0\"></a>"; // elseif ($oMn->MnSeq==$mx) // $updown = $bnkimg . // "<a href=\"javascript:doUpDown('u', '$oMn->MnStID','$oMn->MnID', '$oMn->MnSeq', '$oMn->MnParentMnID', '$oMn->MnLevel')\"> // <img src=\"images/up.gif\" border=\"0\"></a>"; // else // $updown = $bnkimg . // "<a href=\"javascript:doUpDown('d', '$oMn->MnStID','$oMn->MnID', '$oMn->MnSeq', '$oMn->MnParentMnID', '$oMn->MnLevel')\"> // <img src=\"images/down.gif\" border=\"0\"></a> // <a href=\"javascript:doUpDown('u', '$oMn->MnStID','$oMn->MnID', '$oMn->MnSeq', '$oMn->MnParentMnID', '$oMn->MnLevel')\"> // <img src=\"images/up.gif\" border=\"0\"></a>"; // } // } // } ///////////////////////////////////////////// if ($oMn->MnLevel==0){ $bs="<b>"; $be="</b>"; } $lv = $oMn->MnLevel+1; $oT->addRow(array(str_repeat("<img src=images/blank.gif>", $oMn->MnLevel*3). $bs .$oMn->MnNameT. $be , "<a href=\"umAddMenu.php?MnStID=$oMn->MnStID&Level=$lv&ParentMnID=$oMn->MnID\" > <img src=\"images/new.gif\" alt=\"เพิ่มเมนู\" border=\"0\"></a> <a href=\"javascript:doEditMenu('$oMn->MnStID','$oMn->MnID')\"> <img src=\"images/edit.gif\" alt=\"แก้ไข\" border=\"0\"></a> <a href=\"javascript:doDelete(document.form1, '$oMn->MnNameT', '$oMn->MnStID', '$MnID')\"> <img src=\"images/del.gif\" alt=\"ลบ\" border=\"0\"></a>", "<input type=hidden size=4 name='MnID[]' value=\"$oMn->MnID\" readonly>" . str_repeat("<img src=images/blank.gif>", $oMn->MnLevel*1) . "<input type=text size=10 name='seq[]' value=\"$oMn->MnSeq\" style=text-align:center onKeypress='CheckNum(event.keyCode)'> ")); $oMn->RSmenuByParentMn($MnID); while ($oMn->GetRecord()){ ShowMenuM($oMn->MnID); } } ?> <br> <!---------------------------------------------------------------------> <? pageFooter(); ?> <!---------------------------------------------------------------------> <!--put javascript here--> <script language="javascript"> function doEditMenu(StID, MnID){ window.location="umEditMenu.php?MnStID=" + StID + "&MnID=" + MnID; } function doDelete(f, txt, StID, MnID){ if (confirm('ต้องการลบเมนู ' + txt + ' ใช่หรือไม่') ) { window.location="processUmMenu.php?method=delete&MnStID=" + StID + "&MnID=" + MnID; } } function doUpDown(ud, MnStID, MnID, MnSeq, PmnID, MnLevel){ s='processUmMenu.php?method=updown&ud=' + ud + '&MnStID=' + MnStID + '&MnID=' + MnID + '&MnSeq=' + MnSeq + '&PmnID=' + PmnID + '&MnLevel=' + MnLevel; window.location= s; } function doUpdateMenuSeq(){ document.formSeq.method.value='updSeq'; document.formSeq.submit(); }
function CheckNum(xx){ // . = 46 // 0..9 = 48-57 //if (xx==46) return event.returnValue; if (xx < 48 || xx > 57) event.returnValue = false; return event.returnValue; } </script>
|