FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Widget.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Rsi\Fred\Controller;
4 
5 use Rsi\Fred\User;
6 
7 class Widget extends \Rsi\Thing{
8 
9  const CHILD_ID_SEPARATOR = '__';
10 
11  //configuration options
12  const CAPTION = 'caption';
13  const DEFAULT_VALUE = 'defaultValue';
14  const DISPLAY = 'display'; //!< Display type (see DISPLAY_* constants).
15  const HELP = 'help'; //!< Help string (translated).
16  const HINT = 'hint'; //!< Hint string (translated).
17  const META = 'meta'; //!< Meta data (array).
18  const PARAMS = 'params'; //!< Extra parameters for async calls (prefix the key with a '@' to point to the value of another
19  // widget).
20  const RIGHT = 'right'; //!< Optional different right with respect to the controller. If the user has the right, then (s)he
21  // may view the widget. If the level is also met, the widget is also writeable.
22  const TRAILER = 'trailer'; //!< Trailer string (translated).
23  const TAGS = 'tags'; //!< Extra tags for help, hint, and trailer.
24  const WIDGET_HELP = 'widgetHelp'; //!< General widget help (translated).
25  const CLASS_NAME = 'className';
26 
27  //checks
28  const MIN = 'min'; //!< Minimum value.
29  const MAX = 'max'; //!< Maximum value.
30  const REQUIRED = 'required'; //!< True for required. Set to self::VALID_FUNC to let the validation function handle this. Use
31  // an array with [reference,operator,value] to make this dependable on the value of another widget.
32  const VALID_FUNC = 'validFunc'; //!< Specific validation function (called with value and index; returns true if OK).
33  const WIDGETS = 'widgets'; //!< Optional child widgets (key = name, value = widget object).
34  const SECURITY_CHECKS_IGNORE = 'securityChecksIgnore'; //!< Security checks to ignore (array with checks to ignore, true =
35  // all).
36 
37  //display options (note: alphabetical order)
38  const DISPLAY_HIDDEN = 'h'; //!< Do not show (only hidden)
39  const DISPLAY_MINIMAL = 'm'; //!< Show only value (without input element(s)).
40  const DISPLAY_READABLE = 'r'; //!< Show input element(s), but read-only.
41  const DISPLAY_WRITEABLE = 'w'; //!< Show editable input element(s).
42 
43  const EVENT_ACTION_PREFIX = 'controller:widget:action:';
44 
45  public $defaultValue = null;
46  public $help = null;
47  public $min = null;
48  public $max = null;
49  public $required = null;
50  public $trailer = null;
51  public $widgetHelp = null;
52  public $validFunc = null;
53 
54  public $parent = null; //!< Optional parent widget.
55  public $indexes = [];
56 
57  protected $_controller = null;
58  protected $_id = null;
59  protected $_widgets = null; //!< Optional child widgets.
60  protected $_securityChecksIgnore = []; //!< Security checks to ignore.
61  protected $_config = []; //!< Widget configuration (see constants).
62  protected $_display = null;
63  protected $_meta = [];
64  protected $_params = [];
65  protected $_right = null;
66  protected $_tags = null;
67  protected $_executing = false; //!< Executing an direct action on the widget.
68 
69  public function __construct($config = null){
70  $this->_config = $config ?: [];
71  // Note: At this moment we do not perform the initialization, because the widget is not yet connected to a controller. When
72  // the controller gets set, the widget will be initialized.
73  }
74 
75  protected function init(){
76  $this->configure($this->_config = array_merge(
77  $this->_controller->config(['widget',lcfirst(\Rsi\File::basename(get_called_class()))],[]),
78  $this->_config
79  ));
80  $this->publish(['controller','securityChecksIgnore']);
81  $this->publish('parent',self::READWRITE);
82  }
83  /**
84  * Update the widget configuration.
85  * @param array $config New configuration (key-value pairs). Old values, which are not in the new configuration, are
86  * preserved.
87  */
88  public function update($config){
89  $this->_config = array_merge($this->_config,$config);
90  $this->configure($config);
91  }
92  /**
93  * Get single configuration value.
94  * @param string $key Key.
95  * @param mixed $default Default value.
96  * @return mixed Value.
97  */
98  protected function config($key,$default = null){
99  return \Rsi\Record::get($this->_config,$key,$default);
100  }
101  /**
102  * Public configuration.
103  * @return array Public configuration for this widget in key => value pairs.
104  */
105  public function clientConfig(){
106  $config = array_merge(
107  [self::CLASS_NAME => get_called_class()],
108  $this->get([self::DEFAULT_VALUE,self::DISPLAY,self::MIN,self::MAX,self::REQUIRED])
109  );
110  if($meta = $this->meta){
111  foreach($meta as $key => $value) $meta[$key] = $this->meta($key);
112  $config[self::META] = $meta;
113  }
114  if($params = $this->config(self::PARAMS)){
115  $ids = [];
116  foreach($params as $key => $value) if(substr($key,0,1) == '@') $ids[] = $value;
117  if($ids) $config[self::PARAMS] = $ids;
118  }
119  if($this->validFunc) $config[self::VALID_FUNC] = is_array($this->validFunc)
120  ? (is_object($this->validFunc[0]) ? get_class($this->validFunc[0]) : $this->validFunc[0]) . '::' . $this->validFunc[1]
121  : $this->validFunc;
122  if($this->trailer) $config[self::TRAILER] = $this->trans->str($this->trailer,$this->tags);
123  if($this->help) $config[self::HELP] = true;
124  if($this->widgetHelp) $config[self::WIDGET_HELP] = true;
125  if($this->widgets){
126  $widgets = [];
127  foreach($this->widgets as $id => $widget) $widgets[$id] = array_filter($widget->clientConfig());
128  $config[self::WIDGETS] = $widgets;
129  }
130  return $config;
131  }
132 
133  public function caption($id = null){
134  $caption = $this->config(self::CAPTION);
135  return $this->trans->str($caption === null ? $this->_controller->caption($id ?: $this->id) : $caption);
136  }
137 
138  public function hint($id = null){
139  $hint = $this->config(self::HINT);
140  return $hint === null
141  ? (
142  $this->trans->str($this->_controller->hint($id ?: $this->id),$this->tags) ?:
143  $this->trans->str($this->_controller->hint(\Rsi\File::basename(get_called_class())),$this->tags)
144  )
145  : $this->trans->str($hint,$this->tags);
146  }
147  /**
148  * Get a meta data value.
149  * @param string $key Key.
150  * @param mixed $default Default value.
151  * @return mixed Value.
152  */
153  public function meta($key,$default = null){
154  return is_callable($meta = $this->config(array_merge([self::META],(array)$key),$default)) ? call_user_func($meta,$this->id) : $meta;
155  }
156  /**
157  * Convert a value from user format to standard, internal format.
158  * @param mixed $value Value in user format.
159  * @return mixed Value in standard, internal format.
160  */
161  public function convert($value){
162  return $value;
163  }
164  /**
165  * Convert a value from client format to standard, internal format.
166  * @param mixed $value Value in client format.
167  * @return mixed Value in standard, internal format.
168  */
169  public function clientConvert($value){
170  return $value;
171  }
172  /**
173  * Convert an internal value before it is stored in the request data.
174  * @param mixed $value Value in internal format.
175  * @return mixed Value in request data format.
176  */
177  public function dataConvert($value){
178  return $value;
179  }
180  /**
181  * Format a value from standard, internal format to user format.
182  * @param mixed $value Value in standard, internal format.
183  * @return mixed Value in user format.
184  */
185  public function format($value){
186  return $value;
187  }
188  /**
189  * Format a value from standard, internal format to client format.
190  * @param mixed $value Value in standard, internal format.
191  * @return mixed Value in client format.
192  */
193  public function clientFormat($value){
194  return $value;
195  }
196  /**
197  * Format a tag value.
198  * @param mixed $value Value in standard, internal format.
199  * @return mixed Value in user format.
200  */
201  public function formatTag($value){
202  return $this->format($value);
203  }
204  /**
205  * Purge function that will be called first.
206  * @param mixed $value Raw value.
207  * @return string Purged value.
208  */
209  protected function purgeBase($value){
210  return $value;
211  }
212  /**
213  * Purge a value.
214  * @param mixed $value Raw value.
215  * @return string Purged value.
216  */
217  public function purge($value){
218  $value = $this->purgeBase($value);
219  foreach(get_class_methods($this) as $method)
220  if((strlen($method) > 5) && (substr($method,0,5) == 'purge') && ($method != 'purgeBase')) $value = call_user_func([$this,$method],$value);
221  return $value;
222  }
223  /**
224  * Note if an action is expected.
225  * @param string $action
226  */
227  public function expect($action){
228  $this->_controller->expect($this->id,$action);
229  }
230  /**
231  * Execute an action on a child widget.
232  * @param array $id Child ID (everything after the parent ID).
233  */
234  protected function executeChild($id){
235  $this->fred->externalError('Unknown child widget',['class' => get_called_class(),'id' => $id]);
236  }
237  /**
238  * Execute an action on this widget.
239  * Security checks are executed before. All input and output is handled through the request component. An action can only
240  * trust the values from the data array. An action must check if the widget is writeable for actions that perform 'write
241  * like' behaviour.
242  * @param array $id Sub widget ID.
243  */
244  public function execute($id){
245  $this->_executing = true;
246  if(!$this->security->check($this->securityChecksIgnore,$this->_controller->expected($this->id,$action = $this->_controller->action)))
247  $this->fred->externalError('Suspicious widget action call',['class' => get_called_class()]);
248  elseif($id) $this->executeChild($id);
249  elseif(!method_exists($this,$method = 'action' . ucfirst($action)))
250  $this->fred->externalError('Unknown widget action',['class' => get_called_class(),'action' => $action]);
251  else{ //action on this widget
252  $this->indexes = $this->request->record('indexes');
253  call_user_func([$this,$method]);
254  $this->event->trigger(self::EVENT_ACTION_PREFIX . lcfirst(\Rsi\File::basename(get_called_class())) . ':' . $action,$this);
255  }
256  }
257  /**
258  * Add indexes to an ID (with wildcards).
259  * @param string $id Base ID (with wildcards).
260  * @param bool $join Set to true to return a string again (otherwise array with sub ID's).
261  * @return array|string
262  */
263  protected function indexId($id,$join = false){
264  $id = explode(self::CHILD_ID_SEPARATOR,$id);
265  $index = 0;
266  foreach($id as $i => $sub) if(is_numeric($sub == '*' ? ($id[$i] = $this->indexes[$index] ?? null) : $sub)) $index++;
267  return $join ? implode(self::CHILD_ID_SEPARATOR,$id) : $id;
268  }
269  /**
270  * Check if a value is empty.
271  * @param mixed $value
272  * @return bool True when empty.
273  */
274  public function nothing($value){
275  return \Rsi::nothing($value);
276  }
277 
278  protected function checkMin($value){
279  return $this->nothing($this->min) || ($value >= $this->min);
280  }
281 
282  protected function checkMax($value){
283  return $this->nothing($this->max) || ($value <= $this->max);
284  }
285  /**
286  * Required check.
287  * This check will only be called when the value is empty.
288  * If the required parameter has the value self::VALID_FUNC, then the checkValidFunc() function will be used to determine
289  * whether the value is correct (allowed empty).
290  * If the required parameter is an array, the first entry is seen as an reference to another widget (e.g. 'List__*__Name' -
291  * where the asterisk will be replaced with the current index). Its value will then be used for an comparison with an
292  * operator (2nd entry) and a value (3rd entry). If this comparison returns true, the value is required.
293  */
294  protected function checkRequired($value){
295  if($this->required === self::VALID_FUNC) return $this->checkValidFunc($value,$index);
296  if(is_array($required = $this->required)){
297  $id = $this->indexId(array_shift($required));
298  $widget = $this->_controller->widgets[$widget_id = array_shift($id)];
299  $ref = $widget->purge($this->request->complex(['widget',$widget_id]));
300  $ref = $this->_controller->view->convert ? $widget->convert($ref) : $widget->clientConvert($ref);
301  $required = \Rsi\Str::operator($id ? \Rsi\Record::get($ref,$id) : $ref,array_shift($required),array_shift($required),true);
302  }
303  return !$required;
304  }
305 
306  protected function checkValidFunc($value){
307  return $this->validFunc ? call_user_func($this->validFunc,$value) : true;
308  }
309  /**
310  * Check a value.
311  * @param mixed $value Value in standard, internal format.
312  * @return string Error code (empty = OK).
313  */
314  public function check($value){
315  if($this->nothing($value)) return $this->checkRequired($value) ? null : 'required';
316  foreach(get_class_methods($this) as $method)
317  if(($method != 'checkRequired') && (strlen($method) > 5) && (substr($method,0,5) == 'check') && !call_user_func([$this,$method],$value))
318  return lcfirst(substr($method,5));
319  return null; //OK
320  }
321 
322  protected function actionHelp(){
323  $type = self::HELP;
324  switch($this->request->type){
325  case 'widget': $type = self::WIDGET_HELP; break;
326  }
327  $this->request->result = [
328  'caption' => $this->trans->str($this->_controller->helpCaption,$this->tags),
329  'help' => $this->trans->str(($this->widgets[$this->request->id] ?? $this)->$type,$this->tags)
330  ];
331  }
332 
333  protected function setController($value){
334  $this->_controller = $value;
335  $this->init();
336  }
337 
338  protected function getDisplay(){
339  if($this->_display === null){
340  if(!$this->user->authorized($this->right,User::RIGHT_LEVEL_READ)) $this->_display = false;
341  else{
342  $this->_display = $this->config(self::DISPLAY,$this->_controller->display);
343  if(($this->_display > self::DISPLAY_READABLE) && !$this->user->authorized($this->right,User::RIGHT_LEVEL_WRITE))
344  $this->_display = self::DISPLAY_READABLE;
345  if($this->parent) $this->_display = min($this->_display,$this->parent->display);
346  }
347  }
348  return $this->_display;
349  }
350 
351  protected function getFred(){
352  return $this->_controller->fred;
353  }
354 
355  protected function getId(){
356  if($this->_id === null){
357  $this->_id = false;
358  if($this->parent){
359  foreach($this->parent->widgets as $id => $widget) if($this === $widget){
360  $this->_id = $this->parent->id . self::CHILD_ID_SEPARATOR . $id;
361  break;
362  }
363  }
364  elseif($this->_controller) foreach($this->_controller->widgets as $id => $widget) if($this === $widget){
365  $this->_id = $id;
366  break;
367  }
368  }
369  return $this->_id;
370  }
371 
372  protected function getParams(){
373  $params = $refs = [];
374  foreach($this->config(self::PARAMS,[]) as $key => $value){
375  if(substr($key,0,1) == '@'){
376  $id = explode(self::CHILD_ID_SEPARATOR,$value);
377  $index = 0;
378  foreach($id as $i => $sub) if(is_numeric($sub == '*' ? ($id[$i] = $this->indexes[$index] ?? null) : $sub)) $index++;
379  $refs[$key] = $id;
380  }
381  else $params[$key] = $value;
382  }
383  if(!array_key_exists($params_key = serialize($refs + $params),$this->_params)){
384  foreach($refs as $key => $id){
385  $widget = null;
386  if(array_key_exists($widget_id = array_shift($id),$this->request->data)) $value = $this->request->data[$widget_id];
387  else{
388  $widget = $this->_controller->widgets[$widget_id];
389  $value = $widget->purge($this->request->complex(['widget',$widget_id]));
390  }
391  $index = 0;
392  while($id){
393  $value = $value[$sub = array_shift($id)] ?? null;
394  if($widget && !is_numeric($sub)) $widget = $widget->widgets[$sub] ?? null;
395  }
396  if($widget){
397  $value = $this->_controller->view->convert ? $widget->convert($value) : $widget->clientConvert($value);
398  if($widget->check($value)) $value = false;
399  }
400  $params[substr($key,1)] = $value;
401  }
402  $this->_params[$params_key] = $params;
403  }
404  return $this->_params[$params_key];
405  }
406 
407  protected function getReadable(){
408  return $this->display >= self::DISPLAY_READABLE;
409  }
410 
411  protected function getRight(){
412  if($right = $this->config(self::RIGHT)) return $right;
413  if($right !== false) return $this->_controller->right;
414  return null;
415  }
416 
417  protected function getTags(){
418  if($this->_tags === null){
419  $this->_tags = $this->config(self::TAGS,[]);
420  if($this->_config) foreach($this->_config as $key => $value)
421  $this->_tags[$key] = is_array($value) || is_object($value) ? (bool)$value : $value;
422  if(!$this->nothing($this->min)) $this->_tags[self::MIN] = $this->formatTag($this->min);
423  if(!$this->nothing($this->max)) $this->_tags[self::MAX] = $this->formatTag($this->max);
424  }
425  return $this->_tags;
426  }
427 
428  protected function getWidgets(){
429  if($this->_widgets === null){
430  $this->_widgets = $this->config(self::WIDGETS,[]);
431  foreach($this->_widgets as $widget){
432  $widget->parent = $this;
433  $widget->controller = $this->_controller;
434  }
435  }
436  return $this->_widgets;
437  }
438 
439  protected function getWriteable(){
440  return $this->user->authorized($this->right,User::RIGHT_LEVEL_WRITE);
441  }
442 
443  protected function _get($key){
444  return array_key_exists($key,$this->_config) ? $this->_config[$key] : $this->_controller->component($key);
445  }
446 
447 }
Rsi\Fred\Controller\Widget\indexId
indexId($id, $join=false)
Add indexes to an ID (with wildcards).
Definition: Widget.php:263
Rsi\Thing
Basic object.
Definition: Thing.php:13
Rsi\Fred\Controller\Widget\$_securityChecksIgnore
$_securityChecksIgnore
Security checks to ignore.
Definition: Widget.php:60
Rsi\Fred\Controller\Widget\$required
$required
Definition: Widget.php:49
Rsi\Fred\Controller
Rsi
Rsi\Fred\Controller\Widget\DISPLAY_HIDDEN
const DISPLAY_HIDDEN
Do not show (only hidden)
Definition: Widget.php:38
Rsi\Fred\Controller\Widget\DISPLAY_MINIMAL
const DISPLAY_MINIMAL
Show only value (without input element(s)).
Definition: Widget.php:39
Rsi\Fred\Controller\Widget\$_id
$_id
Definition: Widget.php:58
Rsi\Fred\Controller\Widget\$min
$min
Definition: Widget.php:47
Rsi\Fred\Controller\Widget\$widgetHelp
$widgetHelp
Definition: Widget.php:51
Rsi\Fred\Controller\Widget\META
const META
Meta data (array).
Definition: Widget.php:17
Rsi\Fred\Controller\Widget\caption
caption($id=null)
Definition: Widget.php:133
Rsi\Fred\Controller\Widget\$help
$help
Definition: Widget.php:46
Rsi\Fred\Controller\Widget\init
init()
Definition: Widget.php:75
Rsi\Fred\Controller\Widget
Definition: Widget.php:7
Rsi\Fred\Controller\Widget\MAX
const MAX
Maximum value.
Definition: Widget.php:29
Rsi\Fred\Controller\Widget\clientFormat
clientFormat($value)
Format a value from standard, internal format to client format.
Definition: Widget.php:193
Rsi\Fred\Controller\Widget\check
check($value)
Check a value.
Definition: Widget.php:314
Rsi\Fred\Controller\Widget\MIN
const MIN
Minimum value.
Definition: Widget.php:28
Rsi\Fred\Controller\Widget\getWriteable
getWriteable()
Definition: Widget.php:439
Rsi\Fred\Controller\Widget\DISPLAY
const DISPLAY
Display type (see DISPLAY_* constants).
Definition: Widget.php:14
Rsi\Fred\Controller\Widget\getId
getId()
Definition: Widget.php:355
Rsi\Fred\Controller\Widget\$_tags
$_tags
Definition: Widget.php:66
Rsi\Fred\Controller\Widget\getFred
getFred()
Definition: Widget.php:351
Rsi\Fred\Controller\Widget\REQUIRED
const REQUIRED
True for required. Set to self::VALID_FUNC to let the validation function handle this....
Definition: Widget.php:30
Rsi\Fred\Controller\Widget\getTags
getTags()
Definition: Widget.php:417
Rsi\Fred\Controller\Widget\checkMin
checkMin($value)
Definition: Widget.php:278
Rsi\Fred\Controller\Widget\update
update($config)
Update the widget configuration.
Definition: Widget.php:88
Rsi\Fred\Controller\Widget\CAPTION
const CAPTION
Definition: Widget.php:12
Rsi\Fred\Controller\Widget\convert
convert($value)
Convert a value from user format to standard, internal format.
Definition: Widget.php:161
Rsi\Fred\Controller\Widget\nothing
nothing($value)
Check if a value is empty.
Definition: Widget.php:274
Rsi\Fred\Controller\Widget\DISPLAY_WRITEABLE
const DISPLAY_WRITEABLE
Show editable input element(s).
Definition: Widget.php:41
Rsi\Fred\Controller\Widget\hint
hint($id=null)
Definition: Widget.php:138
Rsi\Fred\Controller\Widget\EVENT_ACTION_PREFIX
const EVENT_ACTION_PREFIX
Definition: Widget.php:43
Rsi\Fred\Controller\Widget\$parent
$parent
Optional parent widget.
Definition: Widget.php:54
Rsi\Fred\Controller\Widget\clientConfig
clientConfig()
Public configuration.
Definition: Widget.php:105
Rsi\Fred\Controller\Widget\setController
setController($value)
Definition: Widget.php:333
Rsi\Fred\Controller\Widget\formatTag
formatTag($value)
Format a tag value.
Definition: Widget.php:201
Rsi\Fred\Controller\Widget\CHILD_ID_SEPARATOR
const CHILD_ID_SEPARATOR
Definition: Widget.php:9
Rsi\Fred\Controller\Widget\executeChild
executeChild($id)
Execute an action on a child widget.
Definition: Widget.php:234
Rsi\Fred\Controller\Widget\actionHelp
actionHelp()
Definition: Widget.php:322
Rsi\Fred\Controller\Widget\$trailer
$trailer
Definition: Widget.php:50
Rsi\Fred\Controller\Widget\getWidgets
getWidgets()
Definition: Widget.php:428
Rsi\Fred\Controller\Widget\_get
_get($key)
Default getter if no specific setter is defined, and the property is also not published (readable).
Definition: Widget.php:443
Rsi\Fred\Controller\Widget\DEFAULT_VALUE
const DEFAULT_VALUE
Definition: Widget.php:13
Rsi\Fred\Controller\Widget\$_controller
$_controller
Definition: Widget.php:57
Rsi\Fred\Controller\Widget\format
format($value)
Format a value from standard, internal format to user format.
Definition: Widget.php:185
Rsi\Fred\Controller\Widget\$max
$max
Definition: Widget.php:48
Rsi\Fred\Controller\Widget\getDisplay
getDisplay()
Definition: Widget.php:338
Rsi\Fred\Controller\Widget\getParams
getParams()
Definition: Widget.php:372
Rsi\Fred\Controller\Widget\purgeBase
purgeBase($value)
Purge function that will be called first.
Definition: Widget.php:209
Rsi\Fred\Controller\Widget\DISPLAY_READABLE
const DISPLAY_READABLE
Show input element(s), but read-only.
Definition: Widget.php:40
Rsi\Fred\Controller\Widget\PARAMS
const PARAMS
Extra parameters for async calls (prefix the key with a '@' to point to the value of another.
Definition: Widget.php:18
Rsi\Fred\Controller\Widget\$_executing
$_executing
Executing an direct action on the widget.
Definition: Widget.php:67
Rsi\Thing\configure
configure($config)
Configure the object.
Definition: Thing.php:55
Rsi\Fred\Controller\Widget\SECURITY_CHECKS_IGNORE
const SECURITY_CHECKS_IGNORE
Security checks to ignore (array with checks to ignore, true =.
Definition: Widget.php:34
Rsi\Fred\Controller\Widget\expect
expect($action)
Note if an action is expected.
Definition: Widget.php:227
Rsi\Fred\Controller\Widget\$_params
$_params
Definition: Widget.php:64
Rsi\Fred\Controller\Widget\getRight
getRight()
Definition: Widget.php:411
Rsi\Fred\Controller\Widget\__construct
__construct($config=null)
Definition: Widget.php:69
Rsi\Fred\Controller\Widget\clientConvert
clientConvert($value)
Convert a value from client format to standard, internal format.
Definition: Widget.php:169
Rsi\Fred\Controller\Widget\$_right
$_right
Definition: Widget.php:65
Rsi\Fred\Controller\Widget\checkValidFunc
checkValidFunc($value)
Definition: Widget.php:306
Rsi\Fred\Controller\Widget\config
config($key, $default=null)
Get single configuration value.
Definition: Widget.php:98
Rsi\Fred\Controller\Widget\execute
execute($id)
Execute an action on this widget.
Definition: Widget.php:244
Rsi\Fred\Controller\Widget\purge
purge($value)
Purge a value.
Definition: Widget.php:217
Rsi\Thing\publish
publish($property, $visibility=self::READABLE)
Publish a property (or hide it again).
Definition: Thing.php:28
Rsi\Fred\Controller\Widget\$_meta
$_meta
Definition: Widget.php:63
Rsi\Fred\Controller\Widget\$_display
$_display
Definition: Widget.php:62
Rsi\Fred\Controller\Widget\dataConvert
dataConvert($value)
Convert an internal value before it is stored in the request data.
Definition: Widget.php:177
Rsi\Fred\User
Rsi\Fred\Controller\Widget\checkMax
checkMax($value)
Definition: Widget.php:282
Rsi\Fred\Controller\Widget\VALID_FUNC
const VALID_FUNC
Specific validation function (called with value and index; returns true if OK).
Definition: Widget.php:32
Rsi\Fred\Controller\Widget\TAGS
const TAGS
Extra tags for help, hint, and trailer.
Definition: Widget.php:23
Rsi\Fred\Controller\Widget\checkRequired
checkRequired($value)
Required check.
Definition: Widget.php:294
Rsi\Fred\Controller\Widget\meta
meta($key, $default=null)
Get a meta data value.
Definition: Widget.php:153
Rsi\Fred\User\RIGHT_LEVEL_WRITE
const RIGHT_LEVEL_WRITE
Definition: User.php:8
Rsi\Fred\Controller\Widget\$defaultValue
$defaultValue
Definition: Widget.php:45
Rsi\Fred\Controller\Widget\TRAILER
const TRAILER
Trailer string (translated).
Definition: Widget.php:22
Rsi\Fred\Controller\Widget\getReadable
getReadable()
Definition: Widget.php:407
Rsi\Fred\Controller\Widget\$indexes
$indexes
Definition: Widget.php:55
Rsi\Fred\Controller\Widget\RIGHT
const RIGHT
Optional different right with respect to the controller. If the user has the right,...
Definition: Widget.php:20
Rsi\Fred\User\RIGHT_LEVEL_READ
const RIGHT_LEVEL_READ
Definition: User.php:7
Rsi\Fred\Controller\Widget\$validFunc
$validFunc
Definition: Widget.php:52
Rsi\Fred\Controller\Widget\$_config
$_config
Widget configuration (see constants).
Definition: Widget.php:61
Rsi\Fred\Controller\Widget\HELP
const HELP
Help string (translated).
Definition: Widget.php:15
Rsi\Fred\Controller\Widget\HINT
const HINT
Hint string (translated).
Definition: Widget.php:16
Rsi\Fred\Controller\Widget\WIDGETS
const WIDGETS
Optional child widgets (key = name, value = widget object).
Definition: Widget.php:33
Rsi\Fred\Controller\Widget\CLASS_NAME
const CLASS_NAME
Definition: Widget.php:25
Rsi\Fred\Controller\Widget\WIDGET_HELP
const WIDGET_HELP
General widget help (translated).
Definition: Widget.php:24
Rsi\Fred\Controller\Widget\$_widgets
$_widgets
Optional child widgets.
Definition: Widget.php:59