CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

SystemConfiguration.php
Go to the documentation of this file.
1 <?php
2
3 class SystemConfiguration {
4
9 const UNCHANGED_VALUE = DB_NOVALUE;
10
11 # ---- PUBLIC INTERFACE --------------------------------------------------
12
13 # object constructor
14 function SystemConfiguration($DB = NULL)
15 {
16 $this->DB = new Database();
17 }
18
19 # data access methods
20 function TopLinkString($NewValue = DB_NOVALUE){ return $this->UpdateValue("TopLinkString", $NewValue); }
21 function TopLinkBeginLetter($NewValue = DB_NOVALUE) { return $this->UpdateValue("TopLinkBeginLetter", $NewValue); }
22 function TopLinkEndLetter($NewValue = DB_NOVALUE) { return $this->UpdateValue("TopLinkEndLetter", $NewValue); }
23 function AdminEmail($NewValue = DB_NOVALUE) { return $this->UpdateValue("AdminEmail", $NewValue); }
24 function PasswordMailSubject($NewValue = DB_NOVALUE) { return $this->UpdateValue("PasswordMailSubject", $NewValue); }
25 function PasswordMailBody($NewValue = DB_NOVALUE) { return $this->UpdateValue("PasswordMailBody", $NewValue); }
26 function PasswordResetMailSubject($NewValue = DB_NOVALUE) { return $this->UpdateValue("PasswordResetMailSubject", $NewValue); }
27 function PasswordResetMailBody($NewValue = DB_NOVALUE) { return $this->UpdateValue("PasswordResetMailBody", $NewValue); }
28 function MailChangeMailSubject($NewValue = DB_NOVALUE) { return $this->UpdateValue("MailChangeMailSubject", $NewValue); }
29 function MailChangeMailBody($NewValue = DB_NOVALUE) { return $this->UpdateValue("MailChangeMailBody", $NewValue); }
30 function PortalName($NewValue = DB_NOVALUE) { return $this->UpdateValue("PortalName", $NewValue); }
31 function DefaultActiveUI($NewValue = DB_NOVALUE) { return $this->UpdateValue("DefaultActiveUI", $NewValue); }
32 function CurrentTheme($NewValue = DB_NOVALUE) { return $this->UpdateValue("CurrentTheme", $NewValue); }
33 function DefaultCharacterSet($NewValue = DB_NOVALUE) { return $this->UpdateValue("DefaultCharacterSet", $NewValue); }
34 function SearchTermsRequired($NewValue = DB_NOVALUE) { return $this->UpdateValue("SearchTermsRequired", $NewValue); }
35 function ShowNumResourcesEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("ShowNumResourcesEnabled", $NewValue); }
36 function AnnouncementsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("AnnouncementsEnabled", $NewValue); }
37 function ForumsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("ForumsEnabled", $NewValue); }
38 function AllowMultipleUIsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("AllowMultipleUIsEnabled", $NewValue); }
39 function ResourceLaunchesNewWindowEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("ResourceLaunchesNewWindowEnabled", $NewValue); }
40 function UserAgentsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("UserAgentsEnabled", $NewValue); }
41 function ResourceRatingsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("ResourceRatingsEnabled", $NewValue); }
42 function ResourceCommentsEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("ResourceCommentsEnabled", $NewValue); }
43 function AccessibilityWizardEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("AccessibilityWizardEnabled", $NewValue); }
44 function ReleaseFlagApproved($NewValue = DB_NOVALUE) { return $this->UpdateValue("ReleaseFlagApproved", $NewValue); }
45 function SearchDBEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("SearchDBEnabled", $NewValue); }
46 function RecommenderDBEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("RecommenderDBEnabled", $NewValue); }
47 function OAISQEnabled($NewValue = DB_NOVALUE) { return $this->UpdateValue("OAISQEnabled", $NewValue); }
48 function NumAnnounceOnHomePage($NewValue = DB_NOVALUE) { return $this->UpdateValue("NumAnnounceOnHomePage", $NewValue); }
49 function NumResourcesOnHomePage($NewValue = DB_NOVALUE) { return $this->UpdateValue("NumResourcesOnHomePage", $NewValue); }
50 function LegalNotice($NewValue = DB_NOVALUE) { return $this->UpdateValue("LegalNotice", $NewValue); }
51 function DefaultRecordsPerPage($NewValue = DB_NOVALUE) { return $this->UpdateValue("DefaultRecordsPerPage", $NewValue); }
52 function NumClassesPerBrowsePage($NewValue = DB_NOVALUE)
53 {
54 # if new classes per browse page has been specified
55 if ($NewValue !== DB_NOVALUE &&
56 $NewValue != $this->UpdateValue("NumClassesPerBrowsePage",DB_NOVALUE))
57 {
58 # clear all classification links
59 $this->TopLinkString("");
60 $this->DB->Query("UPDATE Classifications SET LinkString=''");
61 }
62 return $this->UpdateValue("NumClassesPerBrowsePage", $NewValue);
63 }
64 function NumColumnsPerBrowsePage($NewValue = DB_NOVALUE) { return $this->UpdateValue("NumColumnsPerBrowsePage", $NewValue); }
65 function BrowsingFieldId($NewValue = DB_NOVALUE) { return $this->UpdateValue("BrowsingFieldId", $NewValue); }
66 function OaiIdDomain($NewValue = DB_NOVALUE) { return $this->UpdateValue("OaiIdDomain", $NewValue); }
67 function OaiIdPrefix($NewValue = DB_NOVALUE) { return $this->UpdateValue("OaiIdPrefix", $NewValue); }
68 function OaiEarliestDate($NewValue = DB_NOVALUE) { return $this->UpdateValue("OaiEarliestDate", $NewValue); }
69 function OaiDateGranularity($NewValue = DB_NOVALUE) { return $this->UpdateValue("OaiDateGranularity", $NewValue); }
70 function SiteKeywords($NewValue = DB_NOVALUE) { return $this->UpdateValue("SiteKeywords", $NewValue); }
71 function AboutText($NewValue = DB_NOVALUE) { return $this->UpdateValue("AboutText", $NewValue); }
72
73 function ContactName($NewValue = DB_NOVALUE) { return $this->UpdateValue("ContactName", $NewValue); }
74 function ContactEmail($NewValue = DB_NOVALUE) { return $this->UpdateValue("ContactEmail", $NewValue); }
75 function Organization($NewValue = DB_NOVALUE) { return $this->UpdateValue("Organization", $NewValue); }
76 function OrganizationType($NewValue = DB_NOVALUE) { return $this->UpdateValue("OrganizationType", $NewValue); }
77 function SiteType($NewValue = DB_NOVALUE) { return $this->UpdateValue("SiteType", $NewValue); }
78 function OkayToListSite($NewValue = DB_NOVALUE) { return $this->UpdateValue("OkayToListSite", $NewValue); }
79 function LastRegisteredOn($NewValue = DB_NOVALUE) { return $this->UpdateValue("LastRegisteredOn", $NewValue); }
80 function AddAWStatsScript($NewValue = DB_NOVALUE) { return $this->UpdateValue("AddAWStatsScript", $NewValue); }
81 function AddGoogleAnalytics($NewValue = DB_NOVALUE) { return $this->UpdateValue("AddGoogleAnalytics", $NewValue); }
82 function GoogleAnalyticsCode($NewValue = DB_NOVALUE) { return $this->UpdateValue("GoogleAnalyticsCode", $NewValue); }
83 function DisplayLimitsByDefault($NewValue = DB_NOVALUE) { return $this->UpdateValue("DisplayLimitsByDefault", $NewValue); }
84 function DefaultSortField($NewValue = DB_NOVALUE) { return $this->UpdateValue("DefaultSortField", $NewValue); }
85 function FieldDisplayFolder($NewValue = DB_NOVALUE) { return $this->UpdateValue("FieldDisplayFolder", $NewValue); }
86 function FieldEditFolder($NewValue = DB_NOVALUE) { return $this->UpdateValue("FieldEditFolder", $NewValue); }
87 function CollapseMetadataFieldGroups($NewValue = DB_NOVALUE) { return $this->UpdateValue("CollapseMetadataFieldGroups", $NewValue); }
88
89 function LogoFileName() { return $this->UpdateValue("LogoFileName",DB_NOVALUE, "UIStyleConfiguration"); }
90 function LogoAltText() { return $this->UpdateValue("LogoAltText",DB_NOVALUE, "UIStyleConfiguration"); }
91 function LogoWidth() { return $this->UpdateValue("LogoWidth",DB_NOVALUE,"UIStyleConfiguration"); }
92 function LogoHeight() { return $this->UpdateValue("LogoHeight",DB_NOVALUE,"UIStyleCOnfiguration"); }
93
94 function HasRegistered() { return strlen($this->UpdateValue("LastRegisteredOn",DB_NOVALUE)) ? TRUE : FALSE; }
95
96 function TitleField($NewValue = DB_NOVALUE) { return $this->UpdateValue("TitleField", $NewValue); }
97 function DescriptionField($NewValue = DB_NOVALUE) { return $this->UpdateValue("DescriptionField", $NewValue); }
98 function UrlField($NewValue = DB_NOVALUE) { return $this->UpdateValue("UrlField", $NewValue); }
99 function ScreenshotField($NewValue = DB_NOVALUE) { return $this->UpdateValue("ScreenshotField", $NewValue); }
100
101 function SecureLogin($NewValue = DB_NOVALUE) { return $this->UpdateValue("SecureLogin", $NewValue); }
102 function EmailLineEnding($NewValue = DB_NOVALUE) { return $this->UpdateValue("EmailLineEnding", $NewValue); }
103
104 function DefaultUserPrivs($NewValue = DB_NOVALUE)
105 {
106 if ($NewValue !== DB_NOVALUE)
107 {
108 $NewValue = serialize($NewValue);
109 }
110
111 $Result = unserialize($this->UpdateValue("DefaultUserPrivs", $NewValue));
112
113 if (!is_array($Result))
114 {
115 $Result = $this->DefaultUserPrivs(array());
116 }
117
118 return $Result;
119 }
120
121 function Value($FieldName, $NewValue = DB_NOVALUE)
122 { return $this->UpdateValue($FieldName, $NewValue); }
123
124 # ---- PRIVATE INTERFACE -------------------------------------------------
125
126 private $DB;
127 private $DBFields;
128 private function UpdateValue($FieldName, $NewValue, $Table="SystemConfiguration")
129 {
130 if ($NewValue != DB_NOVALUE)
131 {
132 $SignalResult = $GLOBALS["AF"]->SignalEvent(
133 "EVENT_SET_SYSCONFIG_VALUE", array(
134 "FieldName" => $FieldName,
135 "NewValue" => $NewValue));
136 $NewValue = $SignalResult["NewValue"];
137 }
138 $Value = $this->DB->UpdateValue($Table, $FieldName,
139 $NewValue, NULL, $this->DBFields);
140 $SignalResult = $GLOBALS["AF"]->SignalEvent(
141 "EVENT_GET_SYSCONFIG_VALUE", array(
142 "FieldName" => $FieldName,
143 "Value" => $Value));
144 $Value = $SignalResult["Value"];
145 return $Value;
146 }
147 }