Class: Media_Tag
Source Location: /media_classes/tag.class.php
Class Details
[line 38]
Class Variables
Class Methods
constructor __construct [line 67]
Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.
Tags:
method addLink [line 658]
int addLink(
int
$object, int
$tag)
|
|
Adds link between object and tag. Takes the object id as first argument, the tag word id as second argument. First, the function will look up, if the link exists. If it doesn't exists, the function will add one. If it already exist, nothing happens. The function always returns boolean true.
Tags:
Parameters:
method addTag [line 201]
int addTag(
int
$object, string
$tag)
|
|
Inserts a tag into the tag table. Takes the object which the tag will be linked to as first argument and the tag word as third second. The amount of occurrences will be set to 1. If the tag already exists in the database, updateTag() will be called.
Tags:
Parameters:
method addTags [line 94]
bool addTags(
int
$object, array
$tags)
|
|
Adds tags of a object. Takes the object id as first argument, the tag list as second argument. Returns bool.
Tags:
Parameters:
method deleteLink [line 695]
bool deleteLink(
int
$object, int
$tag)
|
|
Removes link between object and tag. Takes the object id as first argument, the tag word id as second argument. First, the function will look up, if the link exists. If it exists, it will be deleted. If it doesn't exist, nothing happens. The function always returns boolean true.
Tags:
Parameters:
method deleteTag [line 349]
bool deleteTag(
int
$object, string
$tag)
|
|
Removes tag. Takes the object id as first argument and the tag word as second argument. First, the function will decrease the occurrences (-1) and then remove every tag where the amount of occurrences is 0 (null). Then it will remove the link between the tag and the object.
Tags:
Parameters:
method deleteTags [line 172]
bool deleteTags(
int
$object, array
1)
|
|
Deletes all tags of a object. Takes the object id as first argument. Returns bool.
Tags:
Parameters:
method link_exists [line 599]
mixed link_exists(
int
$object, int
$tag)
|
|
Check for link between object id and tag word. Takes object id as first argument, tag word id as second argument. Return bool on false and int (Link id) on true.
Tags:
Parameters:
method selectTag [line 385]
array selectTag(
int
$id)
|
|
Selects tag. Takes tag word id as first argument. Returns tag information.
Tags:
Parameters:
method selectTags [line 447]
array selectTags(
[array
$params = array()])
|
|
Selects tags. Takes array with select params as first argument. Returns array with tags. List of supported parameters - project: int, project id
- object: int, object id
- start: int, article offset
- limit: int, amount of articles to return
- order_marco, string, otpional: How to sort the result set.
Supported macros:
- FIRST_CHAR: sort by first char
- WORD: sorty by tag word
- OCCURRENCES: sorty by occurrences
</ul>
Tags:
Parameters:
method tag_exists [line 552]
mixed tag_exists(
string
$tag)
|
|
Function to look up if the tag is already in the database. Takes the tag word (some scalar value) as first argument. Returns the tag id in the database (int) or, if the tag wasn't found, boolean false.
Tags:
Parameters:
method updateTag [line 255]
int updateTag(
int
$object, string
$tag, [string
$modify_amount = 'increase'])
|
|
Function to increase/decrease occurrences of tag words and to add/remove links between tag words. Takes the object id as first argument, the tag word as second argument and the instruction how to modify the occurrences as third argument. modify_amount can be either increase or decrease.
Tags:
Parameters:
method updateTags [line 125]
bool updateTags(
int
$object, array
$tags)
|
|
Update tags of an object. Takes the object id as first argument and the new tag list as second argument. Fetches the old tag list from the database and calculates the differences. Tags that are no longer required will be removed, new ones will be added.
Tags:
Parameters:
method _prepareTagStringForQuery [line 780]
array _prepareTagStringForQuery(
string
$string)
|
|
Prepares tag string for tag query. Takes a string of tags, each separated by Tag::_tag_separator, as first argument. Returns array.
Tags:
Parameters:
method _tagArrayToString [line 759]
array _tagArrayToString(
string
$array)
|
|
Helper function to convert a array of tags into a string of tags, each separated by a comma. Useful when it's required to prepare data for a user input field.
Tags:
Parameters:
method _tagStringToArray [line 732]
array _tagStringToArray(
string
$string)
|
|
Helper function to convert a string of tags, each separated by a comma, into an array. Useful when receiving data from a an user input field.
Tags:
Parameters:
|
|