<?php

/***************************************************************************

 m_ttagcategories.php
 ---------------------
 copyright : (C) 2002-2003 The ezContents Development Team

 ***************************************************************************/

/***************************************************************************
 The ezContents Development Team offers no warranties on this script.
 The owner/licensee of the script is solely responsible for any problems
 caused by installation of the script or use of the script.

 All copyright notices regarding ezContents must remain intact on the
 scripts and in the HTML for the scripts.

 For more info on ezContents,
 visit http://www.ezcontents.org/

/***************************************************************************

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the License which can be found within the
 *   zipped package.
 *
 ***************************************************************************/

include_once ("rootdatapath.php");
require_once ($GLOBALS["rootdp"]."include/config.php");
require_once ($GLOBALS["rootdp"]."include/db.php");
require_once ($GLOBALS["rootdp"]."include/session.php");

include ($GLOBALS["rootdp"]."include/access.php");


$GLOBALS["form"] = 'ttagcategories';
$GLOBALS["validaccess"] = VerifyAdminLogin();


include ($GLOBALS["rootdp"]."include/settings.php");
include ($GLOBALS["rootdp"]."include/functions.php");
include ("adminfunctions.php");
include ("adminbutton.php");
includeLanguageFiles('admin','tagcategories');


force_page_refresh();
frmTagCategories();


function frmTagCategories()
{
   global $HTTP_GET_VARS;

   adminheader();
   admintitle(2,$GLOBALS["tFormTitle"]);
   adminbuttons($GLOBALS["tViewCategory"],'',$GLOBALS["tEditCategory"],'');

   $strQuery = "SELECT * FROM ".$GLOBALS["eztbTagCategories"]." WHERE language='".$GLOBALS["gsLanguage"]."' ORDER BY catdesc";
   $result = dbRetrieve($strQuery,true,0,0);
   $rs     = dbFetch($result);
   $lRecCount = dbRowsReturned($result);
   dbFreeResult($result);

   $nCurrentPage = 0;
   if($HTTP_GET_VARS["page"] != "") { $nCurrentPage = $HTTP_GET_VARS["page"]; }
   $nPages = intval(($lRecCount - 0.5) / $GLOBALS["RECORDS_PER_PAGE"]) + 1;
   if ($nCurrentPage >= $nPages) { $nCurrentPage = 0; }
   $lStartRec = $nCurrentPage * $GLOBALS["RECORDS_PER_PAGE"];

   adminHdFt('ttagcategories',2,$nCurrentPage,$nPages,'');
   ?>
   <tr class="teaserheadercontent">
       <?php
       adminlistitem(10,$GLOBALS["tEdit"],'');
       adminlistitem(90,$GLOBALS["tCatDesc"],'');
       ?>
   </tr>
   <?php

   $sqlQuery = "SELECT * FROM ".$GLOBALS["eztbTagCategories"]." WHERE language='".$GLOBALS["gsLanguage"]."' ORDER BY catname";
   $result = dbRetrieve($sqlQuery,true,$lStartRec,$GLOBALS["RECORDS_PER_PAGE"]);
   while ($rs = dbFetch($result)) { ?>
   <tr class="teasercontent">
      <td align="center" valign="top" class="content">
         <?php admineditcheck('ttagcategoriesform','CatName',$rs["catname"],$rs["authorid"]); ?>
      </td>
      <td valign="top" class="content">
         <?php echo $rs["catdesc"]; ?>
      </td>
   </tr><?php
   }
   dbFreeResult($result);

   adminHdFt('ttagcategories',2,$nCurrentPage,$nPages,'');
   ?>
   </table>
   </body>
   </html>
   <?php
} // function frmTagCategories()

?>
