/Quản lý website bán áo đồng phục PHP/lamao/admins/modules/viewtbl.php
PHP | 424 lines | 390 code | 12 blank | 22 comment | 34 complexity | 5424a3ce5867ee8b6a411b8785b0523a MD5 | raw file
- <form name="goback" method="get" action="">
- <input type="hidden" name="module" value="categories">
- <input type="hidden" name="tblname" value="">
- </form>
- <script language="JavaScript">
- function takeback(name)
- {
- document.goback.tblname.value=name;
- document.goback.submit();
- }
- </script>
-
- <form name="img_mng" method="get" action="img_mng.php">
- <input type="hidden" name="tblname" value="">
- <input type="hidden" name="id" value="">
- <input type="hidden" name="catname" value="">
- <input type="hidden" name="catID" value="">
- </form>
- <form name="viewnedit" method="get" action="">
- <input type="hidden" name="module" value="viewrec">
- <input type="hidden" name="tblname" value="">
- <input type="hidden" name="catID" value="">
- <input type="hidden" name="catname" value="">
- <input type="hidden" name="id" value="">
- <input type="hidden" name="seriid" value="">
- </form>
- <form name="del" method="get" action="">
- <input type="hidden" name="module" value="delete">
- <input type="hidden" name="tblname" value="">
- </form>
- <script language="JavaScript">
- function img_mng(tblname,id,cname,cid)
- {
- document.img_mng.tblname.value=tblname;
- document.img_mng.id.value=id;
- document.img_mng.catname.value=cname;
- document.img_mng.catID.value=cid;
- document.img_mng.submit();
- }
- function view(tblname,id,cname,cid,seriid)
- {
- document.viewnedit.tblname.value=tblname
- document.viewnedit.id.value=id
- document.viewnedit.catID.value=cid
- document.viewnedit.catname.value=cname
- document.viewnedit.seriid.value=seriid
- document.viewnedit.submit()
- }
- function dodelete()
- {
- var isvalid=false
- for (var counter=0; counter < data_table.length; counter++)
- {
- if (data_table.elements[counter].checked == true)
- {
- isvalid=true;
- }
- }
- if (isvalid==true)
- {
- if (confirm('<?php echo $strDelete; ?> ?!!'))
- {
- if (confirm("<?php echo $strConfirm.' '.$strAgain; ?> !!!"))
- {
- document.data_table.submit();
- }
- }
- }
- else
- alert('Bạn phải chọn ít nhất một thông tin')
- }
- </script>
- <table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/tablebg.gif">
- <tr>
- <td align="center" valign="middle" colspan="3">
- <table width="100%" height="30" border="0" cellpadding="2" cellspacing="2">
- <tr>
- <td bgcolor="#E1E1E1"> </td>
- <!--
- <td width="90" onClick="javascript: document.data_table.submit();" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/mail.gif" width="22" height="22">
- Gửi Email</p>
- </td>-->
- <?php
- if (isset($_SESSION['userID']))
- {
- $allow_edit=true;
- ?>
- <td width="100" onClick="window.history.go(-1)" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/previous.gif" width="24" height="24"> <?php echo $strBack; ?></p>
- </td>
- <td width="90" onClick="document.addnew.submit();" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/filenew.gif" width="22" height="22"> <?php echo $strAdd; ?></p>
- </td>
- <!--
- <td width="150" onClick="setdisplay('edit_list','change');" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/move_user.gif" width="22" height="22">
- <?php echo $strChangeCat; ?></p>
- </td>-->
- <td width="100" style="cursor: hand; border: 1px solid #E1E1E1" onClick="dodelete('data_table')" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/cancel.gif" width="22" height="22"> <?php echo $strDelete; ?></p>
- </td>
- <?php
- }
- else
- {
- ?>
- <td width="400" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"> <?php echo $strNotice['208']; ?></p>
- </td>
- <?php
- }
- ?>
- <td bgcolor="#E1E1E1"> </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr><td height="40">
- <p class="bigtitle" style="text-align: left; margin: 0 0 0 36;">
- <img src="images/bs_forward.gif" width="16" height="16" align="absmiddle">
- <?php
- if (isset($_REQUEST['catname']) and $_REQUEST['catname']!='')
- echo $_REQUEST['catname'];
- else
- echo $_REQUEST['tblname'];
- ?></p>
- </td></tr>
-
- <tr align="center" valign="top">
- <td colspan="3" align="center" valign="top">
- <?php
- $havedata=false;
- if (!isset($_REQUEST['tblname']))
- {
- echo '<tr><td>';
- echo '<p class="bigtitle">No selected table !</p>';
- echo '</td></tr>';
- }
- else
- {
- $tblname=$_REQUEST['tblname'];
- //echo $tblname;
- // Khai bao thong tin ve bang
- //Thong tin ve cac cot cua bang
- @$open_file=fopen($db_dir.$tblname.'.'.$db_fileex,'r',1);
- if (!$open_file)
- {
- echo '<tr><td><p>';
- echo 'Can not retrieve Table field !';
- echo '</td></tr></p>';
- }
- else
- {
- //Khoi tao
- $start=0;
- $real_colum=1;
- $line=0;
- $title_array=array();
- $field_array=array();
- //Doc noi dung tung dong
- while($cur_line=fgets($open_file))
- {
- $line+=1;
- //echo $line;
- //Neu gap dong trong
- if (strlen($cur_line)==2)
- {
- $start=1;
- $start_line=$line+1;
- //echo $start_line;
- $index=$real_colum;
- $dimension=0;
- }
- //Bat dau lay DL
- if ($start==1 && $line>=$start_line)
- {
- $line_array=explode('-',$cur_line);
- $title_array[$index]=$line_array[0];
- $dimension+=round(strlen(trim($title_array[$index]))*12,0);
- $field_array[$index]=$line_array[1];
- //echo $field_array[$index];
- $index+=1;
- $havedata=true;
- }
- }
- }
- $title_array[0]='<input name="cbxSelectAll" style="display: ; margin: 0;" type="checkbox" onclick="javascript: checkAll(this.form);">';
- $field_array[0]='id';
- // So dong hien thi
- $max=100;
- //So cot hien thi
- $colum=5;
- //Kich thuoc chung cho moi cot
- //$dimension=100;
- $bordercolor='#336699';
- $titlecolor='#FFCC33';
- $hightlightcolor='#EEEEEE';
- $div_height=400;
- //show_datatbl($list,'datatbl','','dataTable',$title_array,$dimension,$field_array);
- ?>
- <!-- Data Table -->
- <DIV style="WIDTH: 900px; HEIGHT: <?php echo $div_height;?>px; OVERFLOW: auto; border: solid 1px <?php echo $bordercolor; ?>">
- <form name='addnew' method="get" action="">
- <input type="hidden" name="module" value="addnew">
- <input type="hidden" name="tblname" value="<?php echo $tblname; ?>">
- <?php
- if (isset($_REQUEST['catID']))
- {
- ?>
- <input type="hidden" name="catID" value="<?php echo $_REQUEST['catID']; ?>">
- <?php
- }
- if (isset($_REQUEST['catname']))
- {
- ?>
- <input type="hidden" name="catname" value="<?php echo $_REQUEST['catname']; ?>">
- <?php
- }
- ?>
- </form>
- <form name="data_table" method="post" action="">
- <input type="hidden" name="module" value="delete">
- <TABLE id="dataTable" cellSpacing="1" cellPadding="0" border="0" width="1200">
- <TR bgcolor="<?php echo $titlecolor; ?>">
- <?php
- $i=0;
- while (isset($title_array[$i]))
- {
- echo '<td ';
- //echo 'width="" ';
- //echo $dimension;
- echo 'class="tdtitle">';
- echo $title_array[$i];
- echo '</td>';
- $i++;
- }
- ?>
- </TR>
- <?php
- //Thong tin Browse
- if (isset($_POST['found']))
- $found=$_POST['found'];
- if (isset($_POST['totalpage']))
- $totalpage=$_POST['totalpage'];
- if (isset($_POST['curpage']))
- {
- $curpage=$_POST['curpage'];
- $from=($curpage-1)*$max;
- $to=$from+$max;
- $range=' limit '.$from.','.$to;
- }
- else
- $curpage=1;
-
- $list='select * from '.$tblname.' where';
- if (isset($_REQUEST['catID']) and $_REQUEST['catID']!='')
- $list.=' category="'.$_REQUEST['catID'].'" and';
- $list.=' lang="'.get_langID().'"';
- $list.=' order by id ASC';
- if (isset($range))
- $list.=$range;
- //echo $list;
- $doview=mysql_query($list,$link);
- //$doview=mysql_query($view,$link);
- $counter=1;
- if ($doview and mysql_num_rows($doview)>0)
- {
- $return_rows=mysql_num_rows($doview);
- //for ($i=0; $i<30000; $i++)
- while ($result=mysql_fetch_array($doview))
- {
- //$result=mysql_fetch_array($doview);
- $x=0;
- while (isset($field_array[$x]))
- {
- $$field_array[$x]=stripslashes(strip_tags(chop($result[$field_array[$x]])));
- $x++;
- }
- ?>
- <TR id="dataRow<?php echo $id; ?>" onMouseOver="change(this,'<?php echo $hightlightcolor; ?>')" onMouseOut="undo(this)" style="cursor: hand">
- <TD TF_colKey="check" align="center" class="tdtext">
- <input type="checkbox" name="chkbox<?php echo $counter; ?>" value="<?php echo $id; ?>" onClick="javascript:colorRow(this);">
- </TD>
- <?php
- $j=$real_colum;
- while (isset($field_array[$j]))
- {
- $$field_array[$j]=get($$field_array[$j],20);
- echo '<TD width="';
- if ( strlen($title_array[$j]) < strlen($$field_array[$j]) )
- echo (strlen($$field_array[$j])*15);
- else
- echo (strlen($title_array[$j])*15);
- echo '" TF_colKey="'.$field_array[$j].'" class="tdtext" onClick="javascript: view(\''.$tblname.'\','.$result[0].'';
- if (isset($_REQUEST['catname']))
- echo ',\''.$_REQUEST['catname'].'\'';
- else
- echo ",''";
- if (isset($_REQUEST['catID']))
- echo ',\''.$_REQUEST['catID'].'\'';
- else
- echo ",''";
- if (isset($result['manufacturer']))
- {
- $seriid=$result['manufacturer'];
- echo ',\''.$seriid.'\'';
- }
- else
- echo ",''";
- echo ');">';
- echo $$field_array[$j];
- echo '</TD>';
- $j++;
- }
- ?>
- </TR>
- <?php
- $counter++;
- }
- }
- ?>
- </TABLE>
- <input type="hidden" name="tblname" value="<?php echo $tblname; ?>">
- <?php
- if (isset($_REQUEST['catname']))
- echo '<input type="hidden" name="catname" value="'.$_REQUEST['catname'].'">';
- if (isset($_REQUEST['catname']))
- echo '<input type="hidden" name="catID" value="'.$_REQUEST['catID'].'">';
- ?>
- <input type="hidden" name="total_rows" value="<?php echo $return_rows; ?>">
- </form>
- </DIV>
- <!-- End Data Table -->
- <?php
- }
- ?>
- </td>
- </tr>
-
-
- <tr align="center" valign="top">
- <td colspan="3" bordercolor="#FF3300" style="border-bottom-style: solid; border-bottom-width: 2">
- <!-- Filter -->
- <table width="100%" cellpadding="0" cellspacing="0" align="center">
- <tr>
- <td align="center" valign="middle">
- <table width="100%" height="30" border="0" cellpadding="2" cellspacing="2">
- <tr>
- <td bgcolor="#E1E1E1"> </td>
- <td width="200" style="border: 1px solid #E1E1E1">
- <p class="buttontext">
- <INPUT onclick="TF_enableFilter(dataTable, filter, this)" type="checkbox">
- Enable / Disable Filter</p></td>
- <td width="80" onclick="filter.reset()" style="cursor: hand; border: 1px solid #E1E1E1" onMouseOver="changebd(this,'#336699')" onMouseOut="undobd(this)">
- <p class="buttontext"><img align="absmiddle" src="images/reset.gif" width="22" height="22">
- Reset</p></td>
- <td bgcolor="#E1E1E1"> </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td align="center" valign="top">
- <form name="filter" onsubmit="TF_filterTable(dataTable, filter);return false" onreset="_TF_showAll(dataTable)" style="display: none">
- <DIV style="WIDTH: 650px; HEIGHT: 80; OVERFLOW: auto; border: solid 1px #336699; display: block">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <?php
- if ($havedata==true)
- {
- $itemonrow=4;
- $width=100/$itemonrow;
- $counter=$itemonrow;
- $i=1;
- echo '<tr>';
- while (isset($field_array[$i]))
- {
- if ($counter==$itemonrow)
- {
- echo '</tr><tr>';
- $counter=0;
- }
- ?>
- <td onMouseOver="change(this,'#EEEEEE')" onMouseOut="undo(this)">
- <p class="formtitle"><?php echo $title_array[$i]; ?></p>
- <p class="formindex"><?php echo $strAll; ?>
- <input type="text" onkeyup="TF_filterTable(dataTable, filter)" name="s<?php echo $field_array[$i]; ?>" TF_colKey="<?php echo $field_array[$i]; ?>" TF_searchType="substring1" class="shortinput">
- <br><?php echo $strHavein; ?>
- <input type="text" onkeyup="TF_filterTable(dataTable, filter)" name="s<?php echo $field_array[$i]; ?>" TF_colKey="<?php echo $field_array[$i]; ?>" TF_searchType="substring" class="shortinput"></p>
- </td>
- <?php
- $counter++;
- $i++;
- }
- ?>
- </table>
- </div>
- </form>
- </td>
- </tr>
- <?php
- }
- else
- {
- echo '<tr>';
- echo '<td align="center" valign="top">';
- echo '<br><br>';
- echo '<p class="bigtitle">Mời chọn nhm cần xem bằng cch chọn một nhm trong số CC NHM HIỆN C v click XEM !</p>';
- echo '</td>';
- echo '</tr>';
- }
- ?>
- </table>
- </td>
- </tr>
- <!-- End of Filter -->
- </table>