Location: PHPKode > projects > PHP Manual Creator > adm/page_view.php
<?php
require_once("../includes/config.php");
require_once("../includes/functions/func.global.php");
require_once("../includes/functions/loggincheck.php");
require_once("class.menu.php");

// Connect to database
db_connect($config);

$obj = new Menu();
$nav = $obj->get_js_menu(0,$config);

if(isset($_GET['pageno']))
{
	$pageno = $_GET['pageno'];
}
else
{
	$pageno = 1;
}

if(!isset($_GET['sortby']))
{
	$_GET['sortby']='manual_id,page_title';
}
if(!isset($_GET['direction']))
{
	$_GET['direction']='DESC';
}

$manuals = array();

$query = "SELECT manual_id,manual_title FROM ".$config['db']['pre']."manuals";
$query_result = mysql_query($query);
while ($info = @mysql_fetch_array($query_result))
{
	$manuals[$info['manual_id']] = $info['manual_title'];
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PHP Manual Creator Admin - Edit Pages</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="images/style.css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/JSCookMenu.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<LINK REL="stylesheet" HREF="menu/themes/Office/theme.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="menu/themes/Office/theme.js"></SCRIPT>
<script language="JavaScript">
<!--
function checkBox(theBox){
  var aBox = theBox.form["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
  }
  if(theBox.name=="selall"){
    for(i=0;i<aBox.length;i++){
      aBox[i].checked = selAll;
    }
    selAll = !selAll;
  }
  //theBox.form.selall.checked = selAll;
}
function init(){
  var theForm = document.f1;
  var aBox = theForm["list[]"];
  var selAll = false;
  var i;
  for(i=0;i<aBox.length;i++){
    if(aBox[i].checked==false) selAll=true;
    aBox[i].onclick = function(){checkBox(this)};
  }
  //theForm.selall.checked = selAll;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<!--Start top-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" height="42" align="left" background="images/bg_top.gif"><a href="index.php"><img src="images/logo.gif" width="207" height="17" hspace="10" border="0"></a></td>
  </tr>
  <tr>
    <td><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<!--End top-->
<!--Start topmenu-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#F0F0F0" height="25" style="padding-left:20px;" id="menu"><SCRIPT language="JavaScript" type="text/javascript">
			var myMenu =
				
			// Start the menu
[
<?php echo $nav; ?>
];				

			// Output the menu
			cmDraw ('menu', myMenu, 'hbr', cmThemeOffice, 'ThemeOffice');
			</SCRIPT></td>
  </tr>
  <tr>
    <td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
  </tr>
</table>
<br>

<!--End topmenu-->
<!--Start heading page-->
<table width="850" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td class="heading"><img src="images/icons/icon_editrule.gif" width="21" height="22" alt="" align="absmiddle" hspace="5">Edit Pages</td>
</tr>
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
</table>
<!--End heading page-->
<!--Start form-->
<br>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC;">
  <tr>
    <td align="center" bgcolor="#F6F6F6" style="padding:15px;"><div align="right">
        <form action="page_delete.php" method="post" name="f1" id="f1">
          <div align="right"> 
            <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
              <option value="page_view.php">View All</option>
			  <?
			  foreach ($manuals as $key => $value) 
			  {
			  	$selected = '';
				
				if(isset($_GET['manual']))
				{
					if($_GET['manual'] == $key)
					{
						$selected = ' selected';
					}
				}
              ?>
			  <option value="page_view.php?manual=<?=$key;?>"<?=$selected;?>><?=stripslashes($value);?></option>
			  <?
			  }
			  ?>
            </select>
			<br>
            <br>
          </div>
          <table width="99%" border="0" align="center" cellpadding="2" cellspacing="0">
            <tr bgcolor="#FF9900">
              <td width="50" height="30" bgcolor="#941406"><div align="center">
                  <input type="checkbox" name="selall" value="checkbox" onClick="checkBox(this)">
              </div></td>
              <td height="30" bgcolor="#941406" width="200"><span class="rowheader"><a href="<?= $PHP_SELF ?>?sortby=page_title&direction=<? if($_GET['direction']=="ASC"){ echo "DESC"; }else{ echo "ASC"; } ?>&pageno=<?=$pageno;?>" class="rowheader">Page Title</a></span></td>
              <td height="30" bgcolor="#941406"><span class="rowheader">Manual</span></td>
            </tr>
            <tr bgcolor="#000000">
              <td height="1" colspan="3" style="padding:0px;"></td>
            </tr>
<?php
$count = 0;
$counter = 0;

//Pagination Continued
if(isset($_GET['manual']))
{
	$query = "SELECT 1 FROM ".$config['db']['pre']."pages WHERE manual_id='".addslashes($_GET['manual'])."'";
}
else
{
	$query = "SELECT 1 FROM ".$config['db']['pre']."pages";
}
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
$lastpage = ceil($numrows/15);
if ($pageno < 1) 
{
	$pageno = 1;
} 
elseif($pageno > $lastpage) 
{
	$pageno = $lastpage;
}
$limit = 'LIMIT '.(($pageno-1)*15) .',15';

if(isset($_GET['manual']))
{
	$query = "SELECT page_id,page_title,manual_id FROM ".$config['db']['pre']."pages WHERE manual_id='".addslashes($_GET['manual'])."' ORDER BY ".$_GET['sortby']." ".$_GET['direction']." ".$limit;
}
else
{
	$query = "SELECT page_id,page_title,manual_id FROM ".$config['db']['pre']."pages ORDER BY ".$_GET['sortby']." ".$_GET['direction']." ".$limit;
}
$query_result = mysql_query($query);
while ($info = @mysql_fetch_array($query_result))
{
	$counter++;
	IF($count == 0)
	{
		$colour = '#F7F7F7';
		$count = 1;
	}
	ELSE
	{
		$colour = '#EFEFEF';
		$count = 0;
	}
?>
            <tr bgcolor="<? echo $colour; ?>">
              <td width="50" height="25" align="center"><input type="hidden" name="titles[]" id="titles[]" value="<? echo $info['page_title']; ?>">
                  <input type="checkbox" name="list[]" id="list[]" value="<? echo $info['page_id']; ?>"></td>
              <td height="25"><span class="style5"><? echo $info['page_title']; ?></span></td>
			  <td height="25"><span class="style5"><?=$manuals[$info['manual_id']];?></span></td>
            </tr>
<?php
}
?>
            <tr bgcolor="#000000">
              <td height="1" colspan="3" style="padding:0px;"></td>
            </tr>
          </table>
          <div align="left"> <br>
              <table width="99%"  border="0" align="center" cellpadding="2" cellspacing="0">
                <tr>
                  <td width="200" valign="middle">With Selected:&nbsp;<a href="#" onclick="document.f1.action='page_edit.php'; document.f1.submit();"><img src="images/button_edit.gif" width="12" height="13" border="0"></a>
                      <input name="imageField" type="image" src="images/button_empty.gif" width="11" height="13" border="0"></td>
                  <td valign="middle">
<?php
if($numrows==0)
{
	$st=0;
	$en=0;
}
elseif($lastpage==$pageno)
{
	$st=$numrows-$counter+1;
	$en=$numrows;
}
else
{
	$st=$counter*$pageno-$rows_per_page+1;
	$en=$counter*$pageno;
}
?>
                      <div align="center">Showing <?php echo ((($pageno-1)*10)+1) ?>-<?php echo $en; ?> of <?php echo $numrows; ?> result(s)</div></td>
                  <td width="200" valign="middle"><div align="right">
<?php
if(isset($_GET['manual']))
{
	if ($pageno != 1 AND $numrows!=0) 
	{
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."&manual=".$_GET['manual']."'>&lt;&lt;</a> ";
	   $prevpage = $pageno-1;
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."&manual=".$_GET['manual']."'>&lt;</a> ";
	}
	echo ' ( Page '.$pageno.' of '.$lastpage.' ) ';
	
	if ($pageno != $lastpage AND $numrows!=0) 
	{
	   $nextpage = $pageno+1;
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."&manual=".$_GET['manual']."'>&gt;</a> ";   
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."&manual=".$_GET['manual']."'>&gt;&gt;</a> ";
	}
}
else
{
	if ($pageno != 1 AND $numrows!=0) 
	{
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."'>&lt;&lt;</a> ";
	   $prevpage = $pageno-1;
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."'>&lt;</a> ";
	}
	echo ' ( Page '.$pageno.' of '.$lastpage.' ) ';
	
	if ($pageno != $lastpage AND $numrows!=0) 
	{
	   $nextpage = $pageno+1;
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."'>&gt;</a> ";   
	   echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage&sortby=".$_GET['sortby']."&direction=".$_GET['direction']."&locale=".$_GET['locale']."'>&gt;&gt;</a> ";
	}
}
?>
                  </div></td>
                </tr>
              </table>
          </div>
        </form>
    </div></td>
  </tr>
</table>
<!--End form-->
<br><br>
<!--Start bottom-->
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#333333"><img src="images/dot.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td style="padding:15px;" align="center">
<span class="copyright">Copyright &copy; 2007 <a href="http://www.kubelabs.com/phpmanualcreator.php" class="copyright" target="_blank">Kubelabs.com</a> All Rights Reserved.</span></td>
</tr>
</table>
<!--End bottom-->
</body>
</html>
Return current item: PHP Manual Creator