\net_nemein_tag_handler

Tag handling library

Note, that the request data, for ease of use, already contains the L10n Databases of the Component and MidCOM itself located in this class. They are stored as 'l10n' and 'l10n_midcom'. Also available as 'config' is the current component configuration.

Summary

Methods
Properties
Constants
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
tag_object()
resolve_tagname()
resolve_value()
resolve_context()
copy_tags()
get_object_tags()
get_tags_by_guid()
tag_link2tagname()
get_tags_by_class()
get_object_tags_by_contexts()
separate_machine_tags_in_content()
get_object_machine_tags_in_context()
get_tags()
get_objects_with_tags()
string2tag_array()
tag_array2string()
merge_tags()
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
No protected properties found
N/A
_create_tag()
_update_tag()
_remove_tag()
$_services
N/A

Properties

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

__construct()

__construct() 

Initialize all member variables, remember to set $_component before calling this constructor from your derived classes.

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

tag_object()

tag_object(object  $object, array  $tags,   $component = null) : boolean

Tags given object with the tags in the string

Creates missing tags and tag_links, sets tag_link navorder Deletes tag links from object that are not in the list provided

Parameters

object $object

MidCOM DBA object

array $tags

List of tags and urls, tag is key, url is value

$component

Returns

boolean —

indicating success/failure

resolve_tagname()

resolve_tagname(string  $tagname) : string

Resolve actual tag from user-inputted tags that may have contexts or values in them

Parameters

string $tagname

User-inputted tag that may contain a context or value

Returns

string —

Tag without context or value

resolve_value()

resolve_value(string  $tagname) : string

Resolve value from user-inputted tags that may have machine tag values

Parameters

string $tagname

User-inputted tag that may contain a value

Returns

string —

Value without tag or context

resolve_context()

resolve_context(string  $tagname) : string

Resolve context from user-inputted tags that may contain tag and context

Parameters

string $tagname

User-inputted tag that may contain a context

Returns

string —

Context without tag or empty if no context is found

copy_tags()

copy_tags(  $from,   $to,   $component = null) 

Copy tasks of one object to another object

Parameters

$from
$to
$component

get_object_tags()

get_object_tags(  $object) : array

Gets list of tags linked to the object

Tag names are modified to include a possible context in format context:tag

Parameters

$object

Returns

array —

list of tags and urls, tag is key, url is value (or false on failure)

get_tags_by_guid()

get_tags_by_guid(  $guid) 

Parameters

$guid

tag_link2tagname()

tag_link2tagname(  $tag,   $value = null,   $context = null) 

Parameters

$tag
$value
$context

get_tags_by_class()

get_tags_by_class(  $class,   $user = null) : array

Gets list of tags linked to objects of a particular class

Tag names are modified to include a possible context in format context:tag

Parameters

$class
$user

Returns

array —

list of tags and counts, tag is key, count is value

get_object_tags_by_contexts()

get_object_tags_by_contexts(  $object) : array

Gets list of tags linked to the object arranged by context

Parameters

$object

Returns

array —

list of contexts containing arrays of tags and urls, tag is key, url is value

separate_machine_tags_in_content()

separate_machine_tags_in_content(  $content) : string

Reads machine tag string from content and returns it, the string is removed from content on the fly

Parameters

$content

Returns

string —

string of tags, empty for no tags

get_object_machine_tags_in_context()

get_object_machine_tags_in_context(  $object,   $context) : array

Gets list of machine tags linked to the object with a context

Parameters

$object
$context

Returns

array —

of matching tags and values, tag is key, value is value

get_tags()

get_tags() : array

Lists all known tags

Returns

array —

list of tags and urls, tag is key, url is value

get_objects_with_tags()

get_objects_with_tags(array  $tags, array  $classes, string  $match = 'OR', string  $order = 'ASC') : array

Gets all objects of given classes with given tags

Parameters

array $tags

tags to search for

array $classes

classes to search in

string $match

AND or OR, depending if you require all of the given tags on any of them, defaults to 'OR'

string $order

ASC or DESC, to set the order of the returned list, defaults to 'ASC'

Returns

array —

of objects or false on critical failure

string2tag_array()

string2tag_array(string  $from_string) : array

Parses a string into tag_array usable with tag_object

Parameters

string $from_string

String to parse tags from

Returns

array —

Array of correct format

tag_array2string()

tag_array2string(array  $tags) : string

Creates string representation of the tag array

Parameters

array $tags

Returns

string —

representation

merge_tags()

merge_tags(string  $from, string  $to, boolean  $delete = true) : boolean

Move all objects connected to a tag to another

Parameters

string $from

Tag to move from

string $to

Tag to move to

boolean $delete

Whether to delete the from tag

Returns

boolean —

indicating success

_create_tag()

_create_tag(  $tagname,   $url,   $object,   $component) 

Parameters

$tagname
$url
$object
$component

_update_tag()

_update_tag(  $tagname,   $url,   $object_guid) 

Parameters

$tagname
$url
$object_guid

_remove_tag()

_remove_tag(  $tagname,   $object_guid) 

Parameters

$tagname
$object_guid