PHP Class TagModel, vanilla

Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Свойство Type Description
$StringTags

Protected Properties

Свойство Type Description
$Types
$instance

Méthodes publiques

Méthode 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 méthode

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

addDiscussion() public méthode

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 méthode

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

canAddTagForType() public méthode

public canAddTagForType ( $Type ) : boolean
$Type
Résultat boolean

counts() public méthode

public counts ( $Column, null $UserID = null ) : array
$Column
$UserID null
Résultat array

defaultTypes() public méthode

public defaultTypes ( ) : array
Résultat array

getChildTags() public méthode

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.
Résultat array All child tag rows

getDiscussionTags() public méthode

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
Résultat array

getDiscussions() public méthode

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

getRelatedTags() public méthode

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

getTagTypes() public méthode

public getTagTypes ( ) : array
Résultat array

instance() public static méthode

The singleton instance of this object.
public static instance ( ) : TagModel
Résultat TagModel

joinTags() public méthode

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

save() public méthode

public save ( array $FormPostValues, boolean $Settings = false ) : boolean | unknown
$FormPostValues array
$Settings boolean
Résultat boolean | unknown

saveDiscussion() public méthode

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 méthode

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

splitTags() public static méthode

public static splitTags ( $TagsString ) : array
$TagsString
Résultat array

tagSlug() public static méthode

public static tagSlug ( $Str ) : string
$Str
Résultat string

types() public méthode

Get the available tag types.
public types ( )

unpivot() public méthode

Unpivot tags that are grouped by type.
public unpivot ( array $tags ) : array
$tags array
Résultat array

updateTagCountDiscussions() public méthode

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

validateTag() public static méthode

public static validateTag ( $Tag ) : boolean
$Tag
Résultat boolean

validateTags() public static méthode

public static validateTags ( $Tags ) : boolean
$Tags
Résultat boolean

validateType() public méthode

public validateType ( $Type ) : boolean
$Type
Résultat boolean

Property Details

$StringTags public_oe property

public $StringTags

$Types protected_oe property

protected $Types

$instance protected_oe static_oe property

protected static $instance