Location: PHPKode > projects > WB News > admin/category.php
<?php

/*========================================================*\
||########################################################||
||#                                                      #||
||#     WB News v1.0.0                                   #||
||# ---------------------------------------------------- #||
||#     Copyright (c) 2004-2005                          #||
||#     Created: 19th August 2005                        #||
||#     Filename: category.php                           #||
||#                                                      #||
||########################################################||
/*========================================================*/

/**
 *  @author $Author: pmcilwaine $
 *	@version $Id: category.php,v 1.2.2.4.2.1 2008/07/14 11:04:00 pmcilwaine Exp $
 */

require_once( "global.php" );
$auth->login_if( !$auth->is_logged() );

$_SESSION["return_page"] = make_url( array("ajax"=>FALSE) );

$page = new PageTemplateEngine( BuildPath("admin/main-page.ihtml") );
$tmpl->SetFilename( BuildPath("admin/category.ihtml") );

$params = array(
	"entry" => "\t<li>%s</li>\n\t",
	"separator" => FALSE,
	"class_open" => "open",
	"links" => toolbarmenu()
	);
$toolbar = include( INCDIR . "/page-menu.php" );

$page->AddParam( "toolbar", $toolbar );
$page->AddParam( "userinfo", $userinfo );

$rows =& $tmpl->AddParam( "rows", array() );

$offset = isset($_REQUEST["offset"]) ? intval( $_REQUEST["offset"] ) : 0 ;

$fields = array(
	"c.id",
	"c.name",
	"c.avatar_name",
	"c.avatar_url"
	);

$cond = array();
$cond = join( " AND ", $cond );
$joins = array();
$joins["leftjoin"][] = TBL_CATPERMS . " p on c.id = p.catid and p.groupid = " . $userinfo["groupid"];

$ids = $DB->ListByJoin( array( TBL_CATEGORY . " c"), $fields, $cond, $joins, "name DESC", 10, $offset );
$count_ids = $DB->CountBy( TBL_CATEGORY );

if ( is_array($ids) && count($ids) != 0 )
{
	foreach ( $ids as $id )
	{
		$rows[$id["id"]] = array(
			"name" => $id["name"],
			"avatar_name" => $id["avatar_name"],
			"avatar_url" => $id["avatar_url"],
			"edit-link" => make_url_html( array("id"=>$id["id"]), MAIN_SERVER . "/admin/edit-category" ),
			"perm-link" => $auth->has_perm( "usergroups" ) ? make_url_html( array("id"=>$id["id"]), MAIN_SERVER . "/admin/category-permission" ) : FALSE
			);
	}
}

$pagemenu =& $tmpl->AddParam( "pagemenu", array() );
$page->BindParam( "pagemenu", $tmpl );

$params = array(
	"entry" => "\t<li>%s</li>\n\t",
	"separator" => "\t<li>|</li>\n\t",
	"links" => buildmenu( $theme_info["pagemenu_build"] )
	);
$params = array_merge( $params, $theme_info["pagemenu"] );
$pagemenu = include( INCDIR . "/page-menu.php" );

$tmpl->Pagination( $count_ids, $offset, 10 );
$page->ParseContent( $tmpl->GetHTML() );
$page->ShowPage();

?>
Return current item: WB News