54 $this->settings = Query::create(
Settings,
"WHERE component=:component ORDER BY category, weight, name")
70 if ($this->
filter && $this->
filter->isExcluded($setting->name))
continue;
78 $componentSettings->fields = $fields;
79 parent::AutoForm($componentSettings,
"POST",
"?component_id={$component_id}");
83 if ($this->
filter && $this->
filter->isExcluded($setting->name))
continue;
94 if(
$setting->options ==
"FileUploadFieldRenderer")
97 $this->annotate(
$setting->name,
"<a href='/action/settings/download?setting_id={$setting->settings_id}'>{$setting->value}</a>");
100 else if (
$setting->options ==
"Permissions")
107 $renderer->dropdownMessage =
"Select User Roles";
111 $optionList =
$setting->formatOptionList();
112 if(isset($optionList))
113 $renderers[
$setting->settings_id] =
new SelectFieldRenderer($this,
$setting->name, prettify(
$setting->name), $optionList);
130 if(array_key_exists(
$setting->field_type, Settings::$customTypes))
146 $this->patchUpReferences();
148 $this->configureValidators();
153 if (isset(
$_POST[
"#FORMID#"]))
155 $this->
id =
$_POST[
"#FORMID#"];
158 $this->msg = $this->validator->validate();
159 if ($this->msg !=
"")
return false;
163 $indexedSettings = reindexList($this->settings,
"name");
167 if(array_key_exists(
$name, $indexedSettings))
171 $setting->filter =
new InclusionFilter(
"value");
173 Cache::put(
"setting_{$setting->component}_{$setting->name}",
$setting->value);
177 Cache::invalidate(
"auto_form_defaults");
178 Cache::invalidate(
"config");
187 trace(
"Settings auto form returning true", 3);
199 trace(
"uploadSettingFile called for $field", 3);
203 trace(
"No upload record for $field", 2);
206 if ($_FILES[
$field][
"name"]==
"")
208 trace(
"Upload name is empty", 2);
214 trace(
"Upload Base: {$config['uploadbase']}", 3);
215 trace(
"Upload Directory: {$config['uploaddir']}", 3);
219 $file =
"$dir/$name";
221 trace (
"Uploading file to {$config['uploadbase']}/$file", 3);
223 if (!file_exists(
"{$config['uploadbase']}/$dir"))
226 mkdir(
"{$config['uploadbase']}/$dir");
228 else if (file_exists(
"{$config['uploadbase']}/$file"))
231 unlink(
"{$config['uploadbase']}/$file");
234 move_uploaded_file($_FILES[
$field][
"tmp_name"],
"{$config['uploadbase']}/$file");
235 chmod(
"{$config['uploadbase']}/$file", 0755);
if(!Settings::getValue("blog", "enable_extended_subscription_fields")) $form submitLabel
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static fireEventTo($event, $component, $parameter=null)
Fire an event to the specificed component.
Dummy data model to render a component's settings as a form, using the "type" field of the setting re...
static usingFeature()
Uses the specified framework feature(s).
SettingPageAutoForm($settings)
The Settings class provides components with a common API for specifying application settings and conf...
static getExtension($component)
static getRolesArray()
Retrieves the array of roles and their names for the current site for use in a CMS form.
uploadSettingFile($field, $setting)