PHP Class TagModel, vanilla

Mostrar archivo Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$StringTags

Protected Properties

Property Type Description
$Types
$instance

Public Methods

Method Description
__construct ( string $Name = '' )
addDiscussion ( integer $discussionID, array $tags ) Add existing tags to a discussion.
addType ( string $key, array $row ) Add a tag type.
canAddTagForType ( $Type ) : boolean
counts ( $Column, null $UserID = null ) : array
defaultTypes ( ) : array
getChildTags ( integer $parentTagID ) : array Get the child tags associated with the parent tag id.
getDiscussionTags ( integer $DiscussionID, $indexed = true ) : array Get detailed tag data for a given discussion. An example use case would be when editing discussions: any non-typical tags, that is, ones that may appear to be categories, should have their specific data available, like Type, or Source.
getDiscussions ( $Tag, $Limit, $Offset, string $Op = 'or' ) : Gdn_DataSet
getRelatedTags ( mixed $tag ) Get all of the tags related to the current tag.
getTagTypes ( ) : array
instance ( ) : TagModel The singleton instance of this object.
joinTags ( &$data ) Join the tags to a set of discussions.
save ( array $FormPostValues, boolean $Settings = false ) : boolean | unknown
saveDiscussion ( $discussion_id, $tags, array $types = [''], integer $category_id, string $new_type = '' )
setTagSql ( Gdn_SQLDriver $Sql, $Tag, &$Limit, &$Offset, $Op = 'or' )
splitTags ( $TagsString ) : array
tagSlug ( $Str ) : string
types ( ) Get the available tag types.
unpivot ( array $tags ) : array Unpivot tags that are grouped by type.
updateTagCountDiscussions ( integer $TagID ) Update the tag count per discussion in the Tag table
validateTag ( $Tag ) : boolean
validateTags ( $Tags ) : boolean
validateType ( $Type ) : boolean

Method Details

__construct() public method

public __construct ( string $Name = '' )
$Name string

addDiscussion() public method

Add existing tags to a discussion.
public addDiscussion ( integer $discussionID, array $tags )
$discussionID integer The ID of the discussion to add the tags to.
$tags array An array of tag IDs.

addType() public method

Add a tag type.
public addType ( string $key, array $row )
$key string
$row array

canAddTagForType() public method

public canAddTagForType ( $Type ) : boolean
$Type
return boolean

counts() public method

public counts ( $Column, null $UserID = null ) : array
$Column
$UserID null
return array

defaultTypes() public method

public defaultTypes ( ) : array
return array

getChildTags() public method

Get the child tags associated with the parent tag id.
public getChildTags ( integer $parentTagID ) : array
$parentTagID integer The parent tag ID to check for children.
return array All child tag rows

getDiscussionTags() public method

Get detailed tag data for a given discussion. An example use case would be when editing discussions: any non-typical tags, that is, ones that may appear to be categories, should have their specific data available, like Type, or Source.
public getDiscussionTags ( integer $DiscussionID, $indexed = true ) : array
$DiscussionID integer
return array

getDiscussions() public method

public getDiscussions ( $Tag, $Limit, $Offset, string $Op = 'or' ) : Gdn_DataSet
$Tag
$Limit
$Offset
$Op string
return Gdn_DataSet

getRelatedTags() public method

Get all of the tags related to the current tag.
public getRelatedTags ( mixed $tag )
$tag mixed

getTagTypes() public method

public getTagTypes ( ) : array
return array

instance() public static method

The singleton instance of this object.
public static instance ( ) : TagModel
return TagModel

joinTags() public method

Join the tags to a set of discussions.
public joinTags ( &$data )
$data

save() public method

public save ( array $FormPostValues, boolean $Settings = false ) : boolean | unknown
$FormPostValues array
$Settings boolean
return boolean | unknown

saveDiscussion() public method

public saveDiscussion ( $discussion_id, $tags, array $types = [''], integer $category_id, string $new_type = '' )
$discussion_id
$tags
$types array
$category_id integer
$new_type string

setTagSql() public method

public setTagSql ( Gdn_SQLDriver $Sql, $Tag, &$Limit, &$Offset, $Op = 'or' )
$Sql Gdn_SQLDriver

splitTags() public static method

public static splitTags ( $TagsString ) : array
$TagsString
return array

tagSlug() public static method

public static tagSlug ( $Str ) : string
$Str
return string

types() public method

Get the available tag types.
public types ( )

unpivot() public method

Unpivot tags that are grouped by type.
public unpivot ( array $tags ) : array
$tags array
return array

updateTagCountDiscussions() public method

Update the tag count per discussion in the Tag table
public updateTagCountDiscussions ( integer $TagID )
$TagID integer

validateTag() public static method

public static validateTag ( $Tag ) : boolean
$Tag
return boolean

validateTags() public static method

public static validateTags ( $Tags ) : boolean
$Tags
return boolean

validateType() public method

public validateType ( $Type ) : boolean
$Type
return boolean

Property Details

$StringTags public_oe property

public $StringTags

$Types protected_oe property

protected $Types

$instance protected_oe static_oe property

protected static $instance