
Public Member Functions | |
| __call ($name, $args) | |
| Implements dynamic function calls for, e.g., setXxx(). | |
| __clone () | |
| Clones this component and subcomponents for reuse. | |
| __construct () | |
| Constructor. | |
| add ($component, $slot="", $params=array()) | |
| Adds a component to this container. | |
| addText ($txt, $params=array()) | |
| Add text element to container. | |
| addTextTo ($slot, $txt, $params=array()) | |
| Add text element to a specific slot of a container. | |
Public Attributes | |
| const | SLOT_ACCESS_PRIVATE |
| Slot is private (components can only be added from within the class). | |
| const | SLOT_ACCESS_PUBLIC |
| Slot is public (components can be added to it from outside class). | |
| const | SLOT_SIZE_MULTI |
| Slot can have any number of components in it. | |
| const | SLOT_SIZE_SINGLE |
| Slot can only have one component in it. | |
Static Public Attributes | |
| static | $ENABLE_ADD_CHECKS |
| If true, check to make sure that adding a component doesn't violate slot options. | |
Protected Member Functions | |
| addPriv ($component, $slot, $params=array()) | |
| Adds component to a private slot. | |
| addSlot ($slotName, $options=array()) | |
| Add a new slot to this container. | |
| addToChildParams ($slot, $child, $params) | |
| Appends additional parameters for a child component. | |
| getChild ($slot, $id) | |
| Retrieve a specific child. | |
| getChildParams ($slot, $child) | |
| Retrieves parameters of a given child in a given slot. | |
| getChildrenBySlot ($slotName) | |
| Retrieves all children from a slot. | |
| getSlotOption ($slot, $option) | |
| Get options for slot. | |
| onAdd (&$component, &$slot, &$params, $id) | |
| Called when a component is added to the container. | |
| removeSlot ($slotName) | |
| Remove slot from available slots for this container. | |
| renderComponent ($class, $style, $events, $id) | |
| Called when rendering; should be overridden by descendent components. | |
| renderContainer ($class, $style, $events, $id) | |
| Containers must override this function to do their rendering. | |
| setChildParams ($slot, $child, $params) | |
| Sets parameters for a child component. | |
| setDefaultSlot ($slot) | |
| Changes the slot to which components are added by default. | |
| setSlotOption ($slot, $option, $value) | |
| Modifies a slot's options. | |
Static Protected Member Functions | |
| static | convertStdChildren ($obj, $children) |
| Adds children to container from TKXML. | |
Protected Attributes | |
| $childParams | |
| Array of parameters for children added to this container. | |
| $children | |
| Array of children (id => child object). | |
| $defaultSlot | |
| Name of default slot to which children are added when no slot name is given to add(). | |
| $defaultSlotOptions | |
| Default options used to populate options for new slots. | |
| $slotInfo | |
| Array of information about slots. | |
A container is a component that is inteded to contain other components in some way. It must render those components and also do any rendering for itself.
public, TKComponent, multi]: default slot
Definition at line 15 of file TKContainer.php5.
| TKContainer::__construct | ( | ) |
Constructor.
For internal use only.
This method needs no arguments. It should be called by derived classes before doing anything else since this constructor initializes many mechanisms for the component.
Reimplemented from TKComponent.
Reimplemented in TKBorderPanel, TKHBox, TKNullBox, TKScrollPane, TKTree, and TKVBox.
Definition at line 45 of file TKContainer.php5.
| TKContainer::__call | ( | $ | name, | |
| $ | args | |||
| ) |
Implements dynamic function calls for, e.g., setXxx().
This method allows you to call, e.g., setStyle(...) instead of set('style', ...). See the main documentation for this class for more on the dynamic functions.
This method implements setXxx(), getXxx(), appendXxx() and existsXxx() corresponding to set(), get(), append(), exists().
| $name | [string]: name of method | |
| $args | [array]: arguments to method |
Reimplemented from TKComponent.
Definition at line 57 of file TKContainer.php5.
References SObject::setError().
| TKContainer::__clone | ( | ) |
Clones this component and subcomponents for reuse.
Once a component has been rendered, it is not safe to re-use the HTML generated because it may contain unique IDs, events, etc. This method attempts to clone this component so that it can be reused with its configuration. It is NOT safe for use at the moment because of many sticky details in properly cloning components and espcially containers.
Reimplemented from TKComponent.
Definition at line 141 of file TKContainer.php5.
| TKContainer::add | ( | $ | component, | |
| $ | slot = "", |
|||
| $ | params = array() | |||
| ) |
Adds a component to this container.
With only one parameter, this function adds the specified component to the default slot (usually 'main'). The slot can also be specified, and additional parameters can be given as the third argument. The meaning of these parameters depends on the container, so see the appropriate documentation for that container.
There is a shorthand way to add components. One can use the addXxx() syntax or addXxxTo(), where Xxx is a class name without the leading TK. For example: addLabel() or addLabelTo(). The syntax without "-To" creates an object of type Xxx and calls its constructor with all of the arguments given to addXxx(). The syntax with "-To" takes as its first argument the name of the slot to add the component to. The remaining arguments are passed to the component's constructor.
| $component | [TKComponent]: object to add to this container | |
| $slot | [string]: name of slot to add object to | |
| $params | [array]: additional parameters |
Definition at line 170 of file TKContainer.php5.
References TKComponent::getId(), getSlotOption(), onAdd(), and SObject::setError().
| TKContainer::addPriv | ( | $ | component, | |
| $ | slot, | |||
| $ | params = array() | |||
| ) | [protected] |
Adds component to a private slot.
For internal use only.
You must use this function to add to private slots. It otherwise behaves the same as add().
| $component | [TKComponent]: component to add to slot | |
| $slot | [string]: name of slot to add component to | |
| $params | [array]: additional parameters |
Definition at line 388 of file TKContainer.php5.
References getSlotOption(), and SObject::setError().
Referenced by TKClosePopup::renderContainer().
| TKContainer::addSlot | ( | $ | slotName, | |
| $ | options = array() | |||
| ) | [protected] |
Add a new slot to this container.
For internal use only.
Slots can be public or private. Private slots can only be used by the container itself. Slots can also be single or multi. If the latter, then multiple components can be added to the slot. Finally, slots can contrl what type of object can be added to them, by specifying a parent class for which only objects of that class, or of subclasses of that class can be added to the container. These options are passed in the $options array in key value pairs. The keys are 'access' (SLOT_ACCESS_PUBLIC or SLOT_ACCESS_PRIVATE), 'type (name of parent class) and 'size' (SLOT_SIZE_SINGLE or SLOT_SIZE_MULTI). If any options are not specified, the defaults are used (public, TKComponent, multi).
| $slotName | [string]: name of new slot | |
| $options | [array]: slot options |
Definition at line 290 of file TKContainer.php5.
References SObject::setWarning().
Referenced by TKTable::__construct(), TKClosePopup::__construct(), TKBorderPanel::__construct(), and TKTable::addRow().
| TKContainer::addText | ( | $ | txt, | |
| $ | params = array() | |||
| ) |
Add text element to container.
A text element is a lightweight replacement for a label that doesn't actually create a full scale component. Use it instead of TKLabel when you are adding plain text or HTML.
| $txt | [string]: text to add | |
| $params | [array]: additionally parameters |
Definition at line 222 of file TKContainer.php5.
References onAdd().
Referenced by TKSnapEditor::__construct(), TKTable::addData(), TKPagedView::build(), TKSnapInteractivateLessonEditor::grabResponse(), TKSnapPreview::previewVersion(), TKSnapXmlEditor::processSave(), TKSnapMediaNetlogoEditor::processSave(), TKSnapMediaInteractivateEditor::processSave(), TKSnapMediaImageEditor::processSave(), TKSnapMediaFileEditor::processSave(), TKSnapMediaDocumentEditor::processSave(), TKSnapMediaAgentsheetsEditor::processSave(), TKSnapLessonPlanEditor::processSave(), TKSnapInteractivateLessonEditor::processSave(), TKSnapInteractivateInstructorEditor::processSave(), TKSnapHtmlEditor::processSave(), TKSnapCssEditor::processSave(), TKSnapXmlEditor::showEditor(), TKSnapInteractivateLessonEditor::showEditor(), TKSnapInteractivateInstructorEditor::showEditor(), TKSnapHtmlEditor::showEditor(), TKSnapCssEditor::showEditor(), and TKSnapPreview::showInfoInt().
| TKContainer::addTextTo | ( | $ | slot, | |
| $ | txt, | |||
| $ | params = array() | |||
| ) |
Add text element to a specific slot of a container.
A text element is a lightweight replacement for a label that doesn't actually create a full scale component. Use it instead of TKLabel when you are adding plain text or HTML.
| $slot | [string]: slot to add text to | |
| $txt | [string]: text to add | |
| $params | [array]: additionally parameters |
Definition at line 246 of file TKContainer.php5.
References onAdd().
| TKContainer::addToChildParams | ( | $ | slot, | |
| $ | child, | |||
| $ | params | |||
| ) | [protected] |
Appends additional parameters for a child component.
For internal use only.
This method is the same as setChildParams() except that it adds to the parameters array instead of completely replacing it.
| $slot | [TYPE]: container slot in which the child lives | |
| $child | [TYPE]: child object or ID of child object | |
| $params | [TYPE]: additional parameters for child |
Definition at line 473 of file TKContainer.php5.
| static TKContainer::convertStdChildren | ( | $ | obj, | |
| $ | children | |||
| ) | [static, protected] |
Adds children to container from TKXML.
For internal use only.
If there are no special requirements for adding children to this container in the XML, then it is best to call this method to do it automatically.
| $obj | [TKContainer]: container to add to | |
| $children | [array]: array of XML-parsed children |
Definition at line 534 of file TKContainer.php5.
References $children.
| TKContainer::getChild | ( | $ | slot, | |
| $ | id | |||
| ) | [protected] |
Retrieve a specific child.
For internal use only.
| $slot | [string]: name of slot to retrieve child from | |
| $id | [string]: ID of child to retrieve |
Definition at line 424 of file TKContainer.php5.
References TKComponent::$id.
Referenced by TKTree::renderSubtree().
| TKContainer::getChildParams | ( | $ | slot, | |
| $ | child | |||
| ) | [protected] |
Retrieves parameters of a given child in a given slot.
For internal use only.
| $slot | [string]: name of slot | |
| $child | [TKComponent]: child component |
Definition at line 436 of file TKContainer.php5.
Referenced by TKVBox::renderContainer(), TKNullBox::renderContainer(), TKList::renderContainer(), TKHBox::renderContainer(), and TKTable::renderHeader().
| TKContainer::getChildrenBySlot | ( | $ | slotName | ) | [protected] |
Retrieves all children from a slot.
For internal use only.
| $slotName | [string]: name of slot |
Definition at line 412 of file TKContainer.php5.
Referenced by TKForm::renderContainer(), TKVBox::renderContainer(), TKScrollPane::renderContainer(), TKPopup::renderContainer(), TKNullBox::renderContainer(), TKList::renderContainer(), TKHBox::renderContainer(), TKClosePopup::renderContainer(), TKBorderPanel::renderContainer(), TKPagedView::renderContainer(), TKSnapEditor::renderContainer(), TKTable::renderFooter(), and TKTable::renderHeader().
| TKContainer::getSlotOption | ( | $ | slot, | |
| $ | option | |||
| ) | [protected] |
Get options for slot.
For internal use only.
The slot options are the size, the type of component that can be put in the slot and the number of components that can be put into the slot.
| $slot | [string]: name of slot | |
| $option | [string]: which option to retrieve ('access', 'type', 'size') |
Definition at line 330 of file TKContainer.php5.
References SObject::setError().
| TKContainer::onAdd | ( | &$ | component, | |
| &$ | slot, | |||
| &$ | params, | |||
| $ | id | |||
| ) | [protected] |
Called when a component is added to the container.
For internal use only.
Override this method when your class needs to do something special before an object is added, or to be able to veto adds. The first three parameters to this method are reference parameters, which means that they can be modified if need be. You might, for example, want to change the slot that a component is going to be added to, or the parameters with which it is going to be added.
| $component | [TKComponent]: component to be added | |
| $slot | [string]: name of slot component will be added to | |
| $params | [array]: parameters | |
| $id | [string]: ID for new component |
Reimplemented in TKTree.
Definition at line 519 of file TKContainer.php5.
Referenced by add(), addText(), and addTextTo().
| TKContainer::removeSlot | ( | $ | slotName | ) | [protected] |
Remove slot from available slots for this container.
For internal use only.
The only reason to call this method is to remove a slot from a parent class that is not needed in a child class
| $slotName | [string]: name of slot to remove |
Definition at line 310 of file TKContainer.php5.
References SObject::setWarning().
Referenced by TKBorderPanel::__construct().
| TKContainer::renderComponent | ( | $ | class, | |
| $ | style, | |||
| $ | events, | |||
| $ | id | |||
| ) | [protected] |
Called when rendering; should be overridden by descendent components.
For internal use only.
This method is called only once to render an object. Future calls to render() will not call renderComponent() again. Thus, it can make assumptions that are only valid if it is called once per page load.
The toolkit pre-translates a number of common items so that they can be easily used when rendering. All classes and styles are pretranslated into ' class='...'' and ' style='...'' strings, as are events and the object id. $class[0] contains the contents of the 'class' property translated via Toolkit::classToString(). Similarly, $style[0] contains the contents of the 'style' property translated via Toolkit::styleToString. Additional classes and styles are contained in the array, to be referenced like $class['cell'] for the property 'cell_class'. The event JavaScript is a single self-contained string, that need not be modified.
| $class | [array]: array of pre-translated class properties | |
| $style | [array]: array of pre-translated style properties | |
| $events | [string]: all event JavaScript that should go inline | |
| $id | [string]: pre-translated ID of object (e.g., ' id='id27'') |
Reimplemented from TKComponent.
Definition at line 485 of file TKContainer.php5.
References TKComponent::$id, and renderContainer().
| TKContainer::renderContainer | ( | $ | class, | |
| $ | style, | |||
| $ | events, | |||
| $ | id | |||
| ) | [abstract, protected] |
Containers must override this function to do their rendering.
For internal use only.
It functions the same as renderComponent().
| $class | [array]: pre-translated class information | |
| $style | [array]: pre-translated style information | |
| $events | [string]: pre-translated JavaScript events | |
| $id | [string]: pre-translated ' id="foo"' stringe |
Reimplemented in TKSnapEditor, TKPagedView, TKBorderPanel, TKClosePopup, TKHBox, TKList, TKNullBox, TKPopup, TKScrollPane, TKTable, TKTree, TKVBox, TKForm, and TKFormTable.
Referenced by renderComponent().
| TKContainer::setChildParams | ( | $ | slot, | |
| $ | child, | |||
| $ | params | |||
| ) | [protected] |
Sets parameters for a child component.
For internal use only.
Child parameters are usually set with add() or addTo(). If they need to be modified later, this method can be used. Note that this function completely overwrites the existing child parameters.
| $slot | [TYPE]: container slot in which the child lives | |
| $child | [TYPE]: child object or ID of child object | |
| $params | [TYPE]: new parameters for child |
Definition at line 455 of file TKContainer.php5.
| TKContainer::setDefaultSlot | ( | $ | slot | ) | [protected] |
Changes the slot to which components are added by default.
For internal use only.
When add() is called without a slot argument, it adds components to the default slot.
| $slot | [string]: name of new default slot |
Definition at line 373 of file TKContainer.php5.
Referenced by TKClosePopup::__construct(), TKBorderPanel::__construct(), and TKTable::addRow().
| TKContainer::setSlotOption | ( | $ | slot, | |
| $ | option, | |||
| $ | value | |||
| ) | [protected] |
Modifies a slot's options.
For internal use only.
| $slot | [string]: name of slot to modify | |
| $option | [string]: name of option to modify ('access', 'type' or 'size') | |
| $value | [mixed]: new value for specified slot option |
Definition at line 355 of file TKContainer.php5.
References SObject::setError().
Referenced by TKScrollPane::__construct(), and TKClosePopup::__construct().
TKContainer::$childParams [protected] |
Array of parameters for children added to this container.
For internal use only.
Definition at line 24 of file TKContainer.php5.
TKContainer::$children [protected] |
Array of children (id => child object).
For internal use only.
Definition at line 18 of file TKContainer.php5.
Referenced by TKForm::convertFromXML(), TKVBox::convertFromXML(), TKHBox::convertFromXML(), convertStdChildren(), TKFormTable::createFromXML(), TKTable::createFromXML(), TKList::createFromXML(), TKTree::renderContainer(), TKClosePopup::renderContainer(), TKTree::renderSubtree(), and TKTree::setItemState().
TKContainer::$defaultSlot [protected] |
Name of default slot to which children are added when no slot name is given to add().
For internal use only.
Definition at line 27 of file TKContainer.php5.
TKContainer::$defaultSlotOptions [protected] |
Default options used to populate options for new slots.
For internal use only.
Definition at line 30 of file TKContainer.php5.
TKContainer::$slotInfo [protected] |
Array of information about slots.
For internal use only.
Definition at line 21 of file TKContainer.php5.
1.5.6