Location: PHPKode > projects > Simple Way to Usenet > libs/core/pgen/engine/page_db.class.php
<?php
/**
 *  
 * @author  Benjamin Gillissen <hide@address.com>
 * 
 *	**************************************************************

	Copyright (C) 2009  Benjamin Gillissen
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details at:
	http://www.gnu.org/copyleft/gpl.html

 *	**************************************************************
 */
class page_db extends dbobject {
	

	public function __construct($cnf='site_pages'){ parent::__construct($cnf); }
	
	public function exists($pid){
		$arg=Array('id'=>$pid );
		return $this->dbquery($arg, __FUNCTION__);
	}
	
	public function pidby_namelvl($name, $lvl){
		$arg=Array('title'=>$name, 'depth'=>$lvl );
		while( FALSE !== ($r = $this->dbquery($arg, __FUNCTION__, 'pid')) ){
			$o[] = $r;
		}
		if ( isset($o) ){ return $o; }
		return FALSE;
	}
	
	public function get_infobypid($info, $pid){
		$arg=Array('field'=>$info, 'id'=>$pid );
		return $this->dbquery($arg, __FUNCTION__, $info);
	}
		

	
	public function get_childs($pid){
		$arg=Array('id'=>$pid );
		while( FALSE !== ($r = $this->dbquery($arg, __FUNCTION__, 'pid')) ){
			$o[] = $r;
		}
		if ( isset($o) ){ return $o; }
		return FALSE;
	}
	
	public function got_childpage($pid){
		$arg=Array('id'=>$pid );
		return $this->dbquery($arg, __FUNCTION__);
	}
	
	public function listall(){
		$arg=Array();
		return $this->dbquery($arg, __FUNCTION__, 'pid');
	}
	
}	

Return current item: Simple Way to Usenet