Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/admin/lib/com/sergids/topmusic/model/ConfigAdminDAO.php
<?php
require_once("ConfigAdminO.php");
/**
* Configuration Data Access Object
* @author sergi
* @copyright Copyright &copy; 2005, sergi
*/
class ConfigAdminDAO{
	var $db;
	var $prefix;
	/**
	* The constructor
	* @param DB db database object
	* @param string prefix phpnuke database tables prefix
	* @return void
	* @author sergi
	*/
	function ConfigAdminDAO($db,$prefix="nuke"){
		$this->db=$db;
		$this->prefix=$prefix;
	} 
	/**
	* Set configuration parameters
	* @param ConfigAdminO $config Configuration object
	* @author sergi
	*/
	function update($config){
		$sSQL="UPDATE ".$this->prefix."_topmusic_config SET
			main_page='".$config->main_page."',
			nuke_menu=".$config->nuke_menu.",
			rate_songs=".$config->rate_songs.",
			rate_albums=".$config->rate_albums.",
			rate_artists=".$config->rate_artists.",
			upload=".$config->upload.",
			theme='".$config->theme."',
			top_menu=".$config->top_menu.",
			ind=".$config->ind.",
			rank_items=".$config->rank_items.",
			result_items=".$config->result_items.",
			az_columns=".$config->az_columns.",
			az_advanced=".$config->az_advanced.",
			easyurl=".$config->easyURL.",
			easyurl_type=".$config->easyURL_type.",
			base_url='".$config->base_url."'";
		//echo $sSQL;
		$this->db->sql_query($sSQL);
		$error=$this->db->sql_error();
		if($error['message']!="")
			return false;
		else
			return true;
	}
		/**
	* Get configuration object
	* @return ConfigO Configuration object
	* @author sergi
	*/
	function load(){
		$configO=new ConfigAdminO();
		$sSql="SELECT * from  
		  ".$this->prefix."_topmusic_config";
		//echo "sql=".$sSql."<br>";
		$stmt=$this->db->sql_query($sSql);
		$num_columns=$this->db->sql_numfields($stmt);
		$rs=$this->db->sql_fetchrow($stmt);
		for($i=0;$i<$num_columns;$i++){
			$column=$this->db->sql_fieldname($i);
			$configO->{$column}=$rs[$column];
			//echo $column."->".$configO->{$column}."\n";
		}
		$this->db->sql_freeresult($stmt);
		return $configO;
	}
}
?>
Return current item: Top Music module