Welcompose
[ class tree: Welcompose ] [ index: Welcompose ] [ all elements ]

Class: Content_EventTag

Source Location: /content_classes/eventtag.class.php

Class Overview




Variables

Methods



Class Details

[line 36]


[ Top ]


Class Variables

static $instance =  null

[line 43]

Singleton



Tags:

access:  public

Type:   object


[ Top ]

$base =  null

[line 50]

Reference to base class



Tags:

access:  public

Type:   object


[ Top ]

$_tag_separator =  ','

[line 58]

Tag separator used when converting tag strings to arrays and vice versa.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 65]

Content_EventTag __construct( )

Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.



Tags:

access:  public


[ Top ]

method addEventTag [line 216]

int addEventTag( int $page, int $posting, string $tag)

Inserts a event tag into the event tag database. Takes the page id as first argument, the event posting that the tag will be linked to as second argument and the tag word as third argument.

The amount of occurrences will be set to 1. If the tag already exists in the database, updateEventTag() will be called.




Tags:

return:  Tag id
throws:  Content_EventTagException
access:  protected


Parameters:

int   $page   Page id
int   $posting   Posting id
string   $tag   Tag word

[ Top ]

method addLink [line 738]

int addLink( int $posting, int $tag)

Adds link between posting and tag. Takes the posting 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:

return:  Link id
throws:  Content_EventTagException
access:  protected


Parameters:

int   $posting   Posting id
int   $tag   Tag id

[ Top ]

method addPostingTags [line 93]

bool addPostingTags( int $page, int $posting, array $tags)

Adds tags of a posting. Takes the page id as first argument, the posting id second argument and the tag word list as third argument.



Tags:

throws:  Content_EventTagException
access:  public


Parameters:

int   $page   Page id
int   $posting   Posting id
array   $tags   Tag array

[ Top ]

method deleteEventTag [line 361]

bool deleteEventTag( int $page, int $posting, string $tag)

Removes tag.Takes the page id as first argument, the posting id as second argument and the tag word as third 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 an the posting.




Tags:

throws:  Content_EventTagException
access:  protected


Parameters:

int   $page   Page id
int   $posting   Posting id
string   $tag   Tag word

[ Top ]

method deleteLink [line 775]

bool deleteLink( int $posting, int $tag)

Removes link between posting and tag. Takes the posting 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:

throws:  Content_EventTagException
access:  protected


Parameters:

int   $posting   Posting id
int   $tag   Tag id

[ Top ]

method deletePostingTags [line 181]

bool deletePostingTags( int $page, int $posting, array 2)

Deletes all tags of a posting. Takes the page id as first argument, the posting id as second argument. Returns bool.



Tags:

throws:  blogtagException
access:  public


Parameters:

array   2   Tag array
int   $page   Page id
int   $posting   Posting id

[ Top ]

method getSerializedTagArrayFromTagArray [line 909]

void getSerializedTagArrayFromTagArray( $array)



Tags:

access:  public


Parameters:

   $array  

[ Top ]

method getTagStringFromSerializedArray [line 919]

void getTagStringFromSerializedArray( $str)



Tags:

access:  public


Parameters:

   $str  

[ Top ]

method getTagWordUrlArrayFromSerializedArray [line 930]

void getTagWordUrlArrayFromSerializedArray( $str)



Tags:

access:  public


Parameters:

   $str  

[ Top ]

method link_exists [line 686]

mixed link_exists( int $posting, int $tag)

Check for link between posting id and tag word. Takes posting id as first argument, tag word id as second argument. Return bool on false and int (Link id) on true.



Tags:

throws:  Content_EventTagException
access:  public


Parameters:

int   $posting   Posting id
int   $tag   Tag id

[ Top ]

method prepareTagsForCloud [line 816]

void prepareTagsForCloud( array $tags, int $range)

Prepares tags for tag cloud generation. Calculates relevance for every tag.

Relevance is a number between 0 and the given higher range delimiter.

It's recommend to pass an array of tags that contains the n most relevant tags (so these one with the highest occurrences) in descending order (highest number of occurrences comes first). Alphabetical sorting will be done automatically.




Tags:

access:  public


Parameters:

array   $tags   Tag array
int   $range   Higher range delimiter

[ Top ]

method selectEventTag [line 402]

array selectEventTag( int $id)

Select tag

Takes tag word id as first argument. Returns tag information.




Tags:

throws:  Content_EventTagException
access:  public


Parameters:

int   $id   Tag word id

[ Top ]

method selectEventTagByWordUrl [line 585]

array selectEventTagByWordUrl( string $word_url)

Select tag by word_url

Takes tag word_url as first argument. Returns tag information.




Tags:

throws:  Content_EventTagException
access:  public


Parameters:

string   $word_url   Tag word url

[ Top ]

method selectEventTags [line 468]

array selectEventTags( [array $params = array()])

Selects event tags. Takes array with select params as first argument. Returns array with tags.

List of supported parameters

  • page: int, page id
  • posting: int, posting 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:

throws:  Content_EventTagException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method tag_exists [line 629]

mixed tag_exists( int $page, string $tag)

Function to look up if the tag is already in the database. Takes the page id as first argument, the tag word (some scalar value) as second argument. Returns the tag id in the database (int) or, if the tag wasn't found, boolean false.



Tags:

throws:  Content_EventTagException
access:  public


Parameters:

int   $page   Page id
string   $tag   Tag word

[ Top ]

method updateEventTag [line 273]

void updateEventTag( int $page, int $posting, string $tag, [string $modify_amount = 'increase'])

Function to increase/decrease occurrences of tag words

and to add/remove links between tag words. Takes the page id as first argument, the posting id as second argument, the tag word as third argument and the instruction how to modify the occurrences as fourth argument. modify_amount can be either increase or decrease.




Tags:

throws:  Content_EventTagException
access:  protected


Parameters:

int   $page   Page id
int   $posting   Posting id
string   $tag   Tag word
string   $modify_amount   Modify amount

[ Top ]

method updatePostingTags [line 129]

bool updatePostingTags( int $page, int $posting, array $tags)

Update tags of a posting. Takes the page id as first argument,

the posting id as second argument and the new tag list as third 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:

throws:  Content_EventTagException
access:  public


Parameters:

int   $page   Page id
int   $posting   Posting id
array   $tags   Tag array

[ Top ]

method _tagArrayToString [line 896]

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:

return:  Tag array
throws:  Content_EventTagException
access:  public


Parameters:

string   $array   Tag string

[ Top ]

method _tagStringToArray [line 869]

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:

return:  Tag array
throws:  Content_EventTagException
access:  public


Parameters:

string   $string   Tag string

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:47 +0100 by phpDocumentor 1.4.3