54 var
$fields = array(
"settings_id" => Number,
55 "component" => String,
61 "field_type" => String,
71 "Boolean" =>
"Boolean",
73 "Currency" =>
"Currency",
79 Cache::invalidate(
"setting_{$this->component}_{$this->name}");
87 $setting = Query::create(
Settings,
"WHERE component=:component AND name=:name")
90 Cache::put(
"setting_{$component}_{$name}",
$setting->value);
93 catch(DataNotFoundException $e)
106 $value = Cache::get(
"setting_{$component}_{$name}");
107 if ($value !==
null)
return $value;
112 ->filter(
new InclusionFilter(
"value"))
115 Cache::put(
"setting_{$component}_{$name}",
$setting->value);
118 catch (DataNotFoundException $e)
120 trace(
"Setting not found for $component $name", 3);
155 Cache::put(
"setting_{$component}_{$name}",
$setting->value);
206 Cache::invalidate(
"setting_{$component}_{$name}");
245 return checkRole(
$roles, $account);
276 foreach($perms as $perm)
278 list(
$component, $permission) = explode(
":", $perm);
303 if ($this->options !=
'Permissions')
308 $expr =
"/\\b{$role}\\b/";
309 return (preg_match($expr, $this->value) > 0) ?
true :
false;
317 $options = explode(
"\n", $this->options);
319 $optionList = array();
322 if (strpos($option,
"=>") !==
false)
324 list($val,
$text) = explode(
"=>", $option);
327 $optionList[$val] =
$text;
331 $optionList[$option] = $option;
340 return Query::create(
Component,
"WHERE name in (SELECT DISTINCT component FROM settings) ORDER BY name")->execute();
345 $permissions = Query::create(
Settings,
"WHERE category='Permissions' ORDER BY component, annotation")->execute();
357 $c = prettify($p->component);
360 $options[
$c][
"{$p->component}:{$p->name}"] = $p->annotation;
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
Dummy data model to render a component's settings as a form, using the "type" field of the setting re...
FakoliException is the base exception class for all Fakoli errors.
static usingFeature()
Uses the specified framework feature(s).
static assertRole($role, $redirect="", $message="")
Assert that the user has one of the specified roles.
The Settings class provides components with a common API for specifying application settings and conf...
static checkPermissions($permissions, $account=null)
Check all the permissions specified in the given string.
static getValue($component, $name)
Retrieve the value of the specified Setting.
static deletePermission($component, $name)
Deletes the specified permissions.
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
static setDefaultPermission($component, $name, $annotation, $value, $weight=0)
Set a default Permission value indicating which SiteRoles have the given permission.
static setPermission($component, $name, $annotation, $value, $weight)
Set a Permission value indicating which SiteRoles have the given permission.
static checkPermission($component, $name, $account=null)
Check whether a user has a specific permission.
static createPermissionsFieldRenderer($form, $field, $label="")
static assertPermission($component, $name, $redirect="", $message="")
Asserts whether the current user has a specific permission, optionally redirecting to a specified loc...
static deleteValue($component, $name)
Delete the specified value from the settings table.
static setValue($component, $name, $value, $field_type, $annotation="", $category="", $options="", $weight=0)
Sets the value of the given component setting.
static getSetting($component, $name)
if(!checkRole("admin")) $c
$table column("Redirect From", "<a href='redirect_form?redirect_id={redirect_id}'>{redirect_from}</a>", true, "width: 30%") -> column("Redirect To", "<a href='{redirect_to}' target='_blank'>{redirect_to}</a>", true, "width: 30%") ->column("Last Modified", "{last_modified}", true, "width: 20%; text-align: center") ->column("Override", "{ override true