CMS  Version 3.9
Panel Class Reference

Panel provides a reloadable panel tied to an action handler. More...

Public Member Functions

 __construct ($id, $handler, $attrs="")
 Creates a new panel. More...
 
 getID ()
 Returns the DOM ID for the panel. More...
 
 draw ()
 Draws the panel. More...
 

Public Attributes

 $id
 
 $handler
 
 $attrs
 
 $preRender = true
 

Detailed Description

Panel provides a reloadable panel tied to an action handler.

A reload() method is automatically attached to the panel's DOM and can be called from Javascript to refresh the panel contents via an asynchronous request (i.e. without refreshing the page). Additionally the panel is filled by default using the ComponentManager's local action dispatch mechanism. Panels can be used to easily provide updatable content areas without having to re-implement too much plumbing.

Author
Andy Green

Definition at line 50 of file panel.inc.

Constructor & Destructor Documentation

◆ __construct()

Panel::__construct (   $id,
  $handler,
  $attrs = "" 
)

Creates a new panel.

Parameters
string$idthe DOM ID for the panel
string$handlerthe URL for the handler that will generate the panel contents
string$attrsany extra HTML attributes that should be added to the panel (such as CSS styles/class)

Definition at line 63 of file panel.inc.

64  {
65  $this->id = $id;
66  $this->handler = $handler;
67  $this->attrs = $attrs;
68  }
$handler
Definition: panel.inc:53
$id
Definition: panel.inc:52
$attrs
Definition: panel.inc:54

Member Function Documentation

◆ draw()

Panel::draw ( )

Draws the panel.

Definition at line 82 of file panel.inc.

83  {
84  $mgr = new ComponentManager();
85  echo "<div id='{$this->id}' $this->attrs data-url='{$this->handler}'>";
86  if ($this->handler && $this->preRender) echo $mgr->dispatchLocalAction($this->handler);
87  echo "</div>";
88  }
ComponentManager provides the core functionality for building the component map describing the applic...

◆ getID()

Panel::getID ( )

Returns the DOM ID for the panel.

Returns
string the DOM ID

Definition at line 74 of file panel.inc.

75  {
76  return $this->id;
77  }

Member Data Documentation

◆ $attrs

Panel::$attrs

Definition at line 54 of file panel.inc.

◆ $handler

Panel::$handler

Definition at line 53 of file panel.inc.

◆ $id

Panel::$id

Definition at line 52 of file panel.inc.

◆ $preRender

Panel::$preRender = true

Definition at line 55 of file panel.inc.


The documentation for this class was generated from the following file: