Manual and Documentation

NOTE: This manual describes HammerKit version 3.5. To view documentation for the current release of HammerKit Studio, please go to http://manual.hammerkit.com/
search
Index / D. Object API / Classes / HammerKit_Component

A. Introduction
B. Installation and Configuration
C. Using HammerKit tools
D. Object API
Classes
Button
FileUtils
HammerKit_BasicFile
HammerKit_Color
HammerKit_ColorPalette
HammerKit_Component
HammerKit_Converter
HammerKit_CssRule
HammerKit_Db
HammerKit_DbQueryResult
HammerKit_Document
HammerKit_Element
HammerKit_File
HammerKit_GenericObject
HammerKit_Image
HammerKit_Keyword
HammerKit_ObjectCache
HammerKit_ObjectList
HammerKit_Session
HammerKit_Shortcut
HammerKit_Site
HammerKit_System
HammerKit_User
HammerKit_UserGroup
HammerKit_VariableHandler
Style
Interfaces
Object Choosers
Global Variables
Modules
Tools
Converters
Using the API
E. HammerScript
F. Access Rights
HammerKit_Component


Implements interface: HammerKit_MultilevelObjectInterface

This class describes and contains the functionality for adding, removing and managing components and their attributes. A component is uniquely identified by its id attribute.



Attributes

HammerKit_Component[] ancestors
Description: A list of all the ancestors in the component hierarchy. The list is sorted with the components highest in the hierarchy first.
Settable: no

integer:HammerKit_File button_active
Description: Active button for menus listing the component.
Settable: yes

integer:HammerKit_File button_mouseover
Description: Mouse over button for menus listing the component.
Settable: yes

integer:HammerKit_File button_normal
Description: Button for menus listing the component.
Settable: yes

time calendar_from
Description: The time from which the component is valid in the calendar.
Settable: yes

time calendar_to
Description: The time to which the component is valid in the calendar.
Settable: yes

integer component_count
Description: The number of child components directly under the component.
Settable: no

time creation_time
Description: The time the component was created.
Settable: no

integer:HammerKit_User creator_id
Description: Deprecated alias to attribute user_id

integer duration
Description:
Settable: no

array elements
Description: The elements of the component as an array with the element names as keys.
Settable: no

unique integer:HammerKit_Component id (deprecated alias article_id)
Description: The database id number of the component.
Settable: no

integer[]:HammerKit_Keyword keywords
Description: A list of identifiers of keywords linked to the component. The list is an array with numerical keys in particular order.
Settable: yes

integer:HammerKit_Component linked_component_id
Description:
Settable: yes

time lock_time (deprecated alias lockTime)
Description: The time when a component was locked for editing.
Settable: yes

integer:HammerKit_User lock_user (deprecated alias lockUser)
Description: The user that locked the component for editing.
Settable: yes

boolean menu_visible
Description: Defines whether the component is listed in menus.
Settable: yes

time modification_time (deprecated alias date)
Description: The time when the components contents was last modified.
Settable: yes

integer ordern
Description: The order number of the component in the folder.
Settable: no

string output
Description: The output that the component generates.
Settable: no

integer:HammerKit_Component parent_id
Description: The database number of the component's parent component.
Settable: yes

mixed[] properties
Description: A list of user defined object properties for components and their values ordered in the order they were defined.
Settable: yes

string session_id
Description: The id of the session in which the component was created.
Settable: yes

mixed template (deprecated alias page)
Description: The template component id or "no_template", "no_skeleton" or "hammerscript:" followed by valid HammerScript variable containing a template component id.
Settable: yes

string title
Description: The title of the component.
Settable: yes

integer:HammerKit_User user_id
Description: The owner of the component. Usually the user who created the component.
Settable: yes

string type
Description: The type of the component, there can only be one of each component types starting with "system_".
Settable: yes
Possible values: "", "component", "template", "etemplate", "system_main", "system_main_extra" and "system_main_dvb"

time valid_from
Description: The time from which the component is valid.
Settable: yes

time valid_to
Description: The time to which the component is valid.
Settable: yes

string[] variables
Description: An array containing key-value pairs of variables.
Settable: yes

integer visible
Description: The visibility mode of the component.
Settable: yes
Possible values: 0, 1 and 2


Methods

constructor __construct(integer id)
Description: creates a component object
Arguments: id is the id number of the component to create
Returns: a HammerKit_Component object

string exec([array arguments])
Description: get the contents of the component
Arguments: arguments is the list of argument values passed to the component's private variable scope
Returns: a string of the output the elements of the component produces

string getAttribute(string attribute [, boolean formatted [, array format_options]])
Description: see the description of the HammerKit_ObjectInterface interface

array getAttributeList([string parameter])
Description: see the description of the HammerKit_ObjectInterface interface

string getChooser(string name [, string value [, array specials [, array settings [, array options]]]])
Description: see the description of the HammerKit_ObjectInterface interface

integer getComponentCount(void)
Description: get the number of child components under one component
Returns: the number of components

array getComponentList([string sort_attribute [, boolean reverse_order]])
Description: get a list of all the components under the current component
Arguments: sort_attribute is the component attribute by which to sort the component list - default value is "title", reverse_order determines if the list is returned in reverse order - default value FALSE
Returns: an array of component id numbers

HammerKit_Component getInstance(integer id)
Description: see the description of the HammerKit_ObjectInterface interface

integer[]:HammerKit_Keyword getKeywords(void)
Description: get the keywords that are linked to the component
Returns: an array of keyword ids

HammerKit_ObjectList:HammerKit_Component getList([array where])
Description: see the description of the HammerKit_ObjectInterface interface

boolean isAncestotrOf(integer component_id)
Description: checks if the current component is an ancestor of component with id component_id
Arguments: component_id is the id of a component
Returns: TRUE if the current component is an ancestor of the component with id component_id and otherwise FALSE

boolean move(integer component_id)
Description: move the current component under the component with id component_id
Arguments: component_id is the id of a component
Returns: TRUE on success and otherwise FALSE

boolean remove(void)
Description: see the description of the HammerKit_ObjectInterface interface

boolean setAttributes(array attributes)
Description: see the description of the HammerKit_ObjectInterface interface

boolean sortComponents([string sort_attribute [, boolean reverse_order]])
Description: sorts the child components of a component in some order and saves the ordern attribute according to this order
Arguments: the same as in the getComponentList method
Returns: TRUE on success and FALSE otherwise



� HammerKit Oy 2008 UPDATED: 08.05.2009 12:01