Tag handling library

package net.nemein.tag

 Methods

copy_tags ($from, $to, $component)

Copy tasks of one object to another object

Parameters

$from

$to

$component

get_object_machine_tags_in_context ($object, $context)

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

Parameters

$object

$context

Returns

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

get_object_tags ($object)

Gets list of tags linked to the object
Static

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

Parameters

$object

Returns

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

get_object_tags_by_contexts ($object)

Gets list of tags linked to the object arranged by context
Static

Parameters

$object

Returns

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

get_objects_with_tags (array $tags, array $classes, string $match)

Gets all objects of given classes with given tags
Static

Parameters

$tags

arrayof tags to search for

$classes

arrayof classes to search in

$match

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

Returns

arrayof objects or false on critical failure

get_tags ()

Lists all known tags
Static

Returns

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

get_tags_by_class ($class, $user)

Gets list of tags linked to objects of a particular class
Static

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

Parameters

$class

$user

Returns

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

get_tags_by_guid ($guid)

Static

Parameters

$guid

merge_tags (string $from, string $to, boolean $delete)

Move all objects connected to a tag to another
Static

Parameters

$from

stringTag to move from

$to

stringTag to move to

$delete

booleanWhether to delete the from tag

Returns

booleanindicating success

resolve_context (string $tagname)

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

Parameters

$tagname

stringUser-inputted tag that may contain a context

Returns

stringContext without tag or empty if no context is found

resolve_tagname (string $tagname)

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

Parameters

$tagname

stringUser-inputted tag that may contain a context or value

Returns

stringTag without context or value

resolve_value (string $tagname)

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

Parameters

$tagname

stringUser-inputted tag that may contain a value

Returns

stringValue without tag or context

separate_machine_tags_in_content (string $content)

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

Parameters

$content

string&$content reference to content

Returns

stringstring of tags, empty for no tags

string2tag_array (string $from_string)

Parses a string into tag_array usable with tag_object
Static
see \net_nemein_tag_handler::tag_object()

Parameters

$from_string

stringString to parse tags from

Returns

arrayArray of correct format

tag_array2string (array $tags)

Creates string representation of the tag array
Static

Parameters

$tags

array

Returns

stringrepresentation

tag_link2tagname ($tag, $value, $context)

Static

Parameters

$tag

$value

$context

tag_object (object $object, array $tags, $component)

Tags given object with the tags in the string
Static

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

todo Set the link->navorder property

Parameters

$object

object&$object MidCOM DBA object

$tags

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

$component

Returns

booleanindicating success/failure

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

Static

Parameters

$tagname

$url

$object

$component

_remove_tag ($tagname, $object_guid)

Static

Parameters

$tagname

$object_guid

_update_tag ($tagname, $url, $object_guid)

Static

Parameters

$tagname

$url

$object_guid