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_Keyword

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_Keyword


Implements interface: HammerKit_MultilevelObjectInterface

This class describes and contains the functionality for adding, removing and managing keywords and their attributes. A keyword is identified by its database id, which is an integer number.

Keywords are used for linking and grouping different HammerKit resources to each other. Objects of type HammerKit_Component, HammerKit_File, HammerKit_User and HammerKit_UserGroup can be linked to keywords.



Attributes

HammerKit_ObjectList:HammerKit_Keyword ancestors
Description: A HammerKit_ObjectList of Keyword object ids ordered as they appear in the keyword hierarchy from top to bottom.
Settable: no

string description
Description: A description of the keyword.
Settable: yes

unique integer:HammerKit_Keyword id
Description: The database id number of the keyword.
Settable: no

integer level
Description: The level on which the keyword is in the keyword tree hierarchy. The first level is 0.
Settable: no

integer:HammerKit_Keyword linkto_id
Description: The database id number of the keyword that this keyword is a link to.
Settable: yes

string name
Description: The name of the keyword.
Settable: yes

integer ordern
Description: The order number of the keyword at the level it is on in the keyword tree hierarchy. The first
Settable: yes

integer:HammerKit_Keyword parent_id
Description: The database id number of the parent keyword. The parent_id is 0 if the keyword is on the top of the keyword tree hierarchy.
Settable: no

string value
Description: !!!Not implemented yet!!!
Settable: yes

boolean visible
Description: The visibility of the keyword defines if the keyword is in use.
Settable: yes


Methods

static HammerKit_Keyword add(mixed[] attributes)
Description: Creates a new keyword under the current keyword.
Arguments: attributes is an array of settable keyword attributes
Returns: The database id of the created keyword.

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

static string[string[]] getAttributeList([string property])
Description: see the description of the HammerKit_ObjectInterface interface

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

integer getChildCount(void)
Description: see the description of the HammerKit_MultilevelObjectInterface interface

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

HammerKit_Keyword getParent(void)
Description: see the description of the HammerKit_MultilevelObjectInterface interface

mixed getPath([string attribute="name" [, string separator=" / "]])
Description: Get the path of the keyword, i.e. the list of all the parent keywords up to the root of the keywords tree hierarchy. The first keyword in the list is the one at the top of the keywords tree hierarchy and the last keyword is the current keyword.
Arguments: attribute is a keyword attribute, separator is a string
Returns: If an attribute is specified this function will return a string containing the values of the attributes separated by separator. If no attribute is given this function will return an array of keyword ids in the right hierarchical order.

array getRelations(void)
Description: Get all the resources this keyword is linked to.
Returns: An array where the first level key is the object type of the resource, i.e. HammerKit_Component, HammerKit_File, HammerKit_User or HammerKit_UsergGroup and the second level is a list of the database id numbers of the resources.

boolean isAncestorOf(integer keyword_id)
Description: Test if a keyword is an ancestor of the current keyword.
Arguments: keyword_id is the database id number of the keyword to test
Returns: TRUE if the keyword represented by keyword_id is an ancestor to the current keyword and FALSE otherwise

boolean isLink(void)
Description: The keyword is a link to another keyword if the attribute linkto_id is greater than 0. This function tests if linkto_id is greater than 0.
Returns: TRUE if the current keyword is a link and FALSE otherwise

boolean isVisible(void)
Description: Returns the value of the visible attribute.
Returns: TRUE if visible and FALSE otherwise

boolean linkTree()
Description:
Returns: TRUE on success and FALSE otherwise

boolean move(integer new_parent_id)
Description: Move the current keyword under another keyword.
Arguments: new_parent_id is the database id number of the keyword to move the current keyword under
Returns: TRUE on success and FALSE otherwise

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

boolean setAttribute(string name, mixed value)
Description: see the description of the HammerKit_ObjectInterface interface

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

boolean setRelation(string resource_type, integer resource_id)
Description: Link this keyword to a HammerKit resource.
Arguments: resource_type is either HammerKit_Component, HammerKit_File, HammerKit_User or HammerKit_Usergroup, resource_id is the database id number of the resource
Returns: TRUE on success and FALSE otherwise



� HammerKit Oy 2008 UPDATED: 26.01.2009 15:41