5 private $config_params;
7 private $catalogs = array();
12 $this->config = $config;
15 public function Check_Config_file()
17 // Check if config file exist and is readable
18 return is_readable( CONFIG_FILE );
21 public function Load_Config()
25 if( is_array($config) && !empty($config) ) {
26 // Loading database connection information
27 foreach( $config as $parameter => $value )
29 if( is_array($value) ) // Parsing database section
30 array_push( $this->catalogs, $value );
38 public function Get_Config_Param( $param )
40 if( isset( $config[$param] ) )
41 return $config[$param];
44 public function Get_Catalogs()
47 foreach( $this->catalogs as $db )
48 array_push( $result, $db['label']);
53 public function Count_Catalogs()
55 return count( $this->catalogs );
58 public function Get_Dsn( $catalog_id )
60 // Construct a valid dsn
62 $dsn['hostspec'] = $this->catalogs[$catalog_id]["host"];
63 $dsn['username'] = $this->catalogs[$catalog_id]["login"];
64 $dsn['password'] = $this->catalogs[$catalog_id]["password"];
65 $dsn['database'] = $this->catalogs[$catalog_id]["db_name"];
66 $dsn['phptype'] = $this->catalogs[$catalog_id]["db_type"];
75 } // end classe BW_Config