Execute($sql); if ($result === false) { AddError(DB_ERROR,$adodbConnection->ErrorMsg(),'',"","SystemConfiguration","SystemConfiguration"); return false; } $this->m_DefaultLanguage = $result->fields[0]; $this->m_DefaultTheme = $result->fields[1]; $this->m_DBSchemaVersion = $result->fields[2]; $this->m_SystemSecurityContextId = $result->fields[3]; //get module list $m_ModuleList=array(); $i=0; $sql = sprintf("SELECT Name,Path,Version,Loaded FROM Modules"); $result = $adodbConnection->Execute($sql); if ($result === false) { AddError(DB_ERROR,$adodbConnection->ErrorMsg(),'',"","SystemConfiguration","SystemConfiguration"); return false; } else while($result) { if($result->fileds[0] != "In-portal") { $this->m_ModuleList[$i]['Name']=$result->fileds[0]; $this->m_ModuleList[$i]['Path']=$result->fileds[1]; $this->m_ModuleList[$i]['Version']=$result->fileds[2]; $this->m_ModuleList[$i]['Loaded']=$result->fileds[3]; $i++; } $result->MoveNext(); } } //Required attributes accessors YOU MUST USE THIS FUNCTIONS //TO READ AND WRITE ATTRIBUTES VALUES function GetDefaultLanguage() { return $this->m_DefaultLanguage; } function SetDefaultLanguage($value) { $this->m_DefaultLanguage = $value; $this->m_dirtyFieldsMap['DefaultLanguage'] = $value; } function GetDefaultTheme() { return $this->m_DefaultTheme; } function SetDefaultTheme($value) { $this->m_DefaultTheme = $value; $this->m_dirtyFieldsMap['DefaultTheme'] = $value; } function GetDBSchemaVersion() { return $this->m_DBSchemaVersion; } function SetDBSchemaVersion($value) { $this->m_DBSchemaVersion = $value; $this->m_dirtyFieldsMap['DBSchemaVersion'] = $value; } function GetSystemSecurityContext() { return $this->m_SystemSecurityContextId; } function SetSystemSecurityContext($value) { $this->m_SystemSecurityContextId = $value; $this->m_dirtyFieldsMap['SystemSecurityContextId'] = $value; } function Update($adodbConnection) { if(count($this->m_dirtyFieldsMap) == 0) return true; $adodbConnection = &GetADODBConnection(); $sql = 'UPDATE SystemConfiguration SET '; $first = 1; foreach ($this->m_dirtyFieldsMap as $key => $value) { if($first) { $sql = sprintf("%s %s=%s",$sql,$key,$adodbConnection->qstr($value)); $first = 0; } else { $sql = sprintf("%s, %s=%s",$sql,$key,$adodbConnection->qstr($value)); } } if ($adodbConnection->Execute($sql) === false) { AddError(DB_ERROR,$adodbConnection->ErrorMsg(),'',"","SystemConfiguration","Update"); return false; } return true; } function GetValue($variableName) { $adodbConnection = &GetADODBConnection(); // create a connection $sql = sprintf("SELECT VariableValue FROM ConfigurationValues WHERE VariableName = '%s'",$variableName); $result = $adodbConnection->Execute($sql); if ($result === false) { AddError(DB_ERROR,$adodbConnection->ErrorMsg(),'',"","SystemConfiguration","GetValue"); return false; } return $result->fields[0]; } function SetValue($variableName, $variableValue) { $adodbConnection = &GetADODBConnection(); // create a connection if($variableValue == NULL) //Remove field { $sql = sprintf("DELETE FROM ConfigurationValues WHERE VariableName = '%s'",$variableName); $adodbConnection->Execute($sql); return true; } //Befoe insert may be field already exists - try to update it $sql = sprintf("SELECT * FROM ConfigurationValues WHERE VariableName = '%s'",$variableName); $result = $adodbConnection->Execute($sql); if ($result === false) { AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"","SystemConfiguration","SetValue"); return false; } if(!$result->EOF) //Field alredy exists - just update it;s value { $sql = sprintf("UPDATE ConfigurationValues SET VariableValue = '$variableValue' WHERE VariableName = '%s'",$variableName); $adodbConnection->Execute($sql); if ($result === false) { AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"","SystemConfiguration","SetValue"); return false; } return true; } //Does not exists - insert if($result->EOF) //Field alredy exists - just update it;s value { $sql = sprintf("INSERT INTO ConfigurationValues (VariableName,VariableValue) VALUES('%s','%s')", $variableName,$variableValue); $adodbConnection->Execute($sql); if ($result === false) { AddError("error.DatabaseError",NULL,$adodbConnection->ErrorMsg(),"","SystemConfiguration","SetValue"); return false; } return true; } } function GetModuleList() { return $this->m_ModuleList; } //Common DB operation class variables var $m_dirtyFieldsMap = array(); //Required attributes var $m_DefaultLanguage; var $m_DefaultTheme; var $m_DBSchemaVersion; var $m_SystemSecurityContextId; var $m_ModuleList; }*/ ?>