The Taglist Class
A taglist is a sortable collection of tags. It allows you to create a list of selected tags and arrange them in the order you choose. With the taglist you can then create lists of tag-related content, ordered by the taglist, rather than the default order of tags.
Functions
Taglist::getAllTags
Definition
- Name
- Taglist::getAllTags
- Syntax
- Array|False = Taglist::getAllTags();
Description
Get all the tags from the entire system.
Parameters
- None
-
None
Return values
Array|false An array of at least one tag object. False on error.
Examples
$TC = new Taglist();
$tags = $TC->getAllTags();
Get all the tags from the entire system. Return value/s:
Array
(
[0] => Array
(
[id] => 168
[context] => test
[value] => tag1
[description] =>
)
[1] => Array
(
[id] => 169
[context] => test
[value] => tag2
[description] =>
)
[2] => Array
(
[id] => 170
[context] => test
[value] => tag3
[description] =>
)
)
Dependencies
PHP
- if
Janitor
- Query::sql
- Query::results
Taglist::getTaglists
Definition
- Name
- Taglist::getTaglists
- Syntax
- Array|False = Taglist::getTaglists();
Description
Get all the taglists from the entire system.
Parameters
- None
-
None
Return values
Array|false An array of at least one taglist object. False on error.
Examples
$TC = new Taglist();
$taglists = $TC->getTaglists();
Get all the tags from the entire system. Return value/s:
Array
(
[0] => Array
(
[id] => 213
[name] => taglist1
[handle] => taglist1
)
[1] => Array
(
[id] => 229
[name] => TagList3
[handle] => taglist3
)
[2] => Array
(
[id] => 230
[name] => Taglist2
[handle] => taglist2
)
[3] => Array
(
[id] => 408
[name] => Taglist4
[handle] => taglist4
)
)
Dependencies
PHP
- if
Janitor
- Query::sql
- Query::results
Taglist::getTaglist
Definition
- Name
- Taglist::getTaglist
- Syntax
- Array|False = Taglist::getTaglist( Array $_options = false );
Description
Get a specific taglist, specified in the parameter by the taglist_id or handle.
Parameters
- $_options
-
Array|false Options array
Options
Return values
Array|false An array of one taglist object. False on error.
Examples
Get taglist for taglist_id
$TC = new Taglist();
$taglist = $TC->getTaglist(["taglist_id" => $taglist_id]);
Get the taglist. Return value:
Array
(
[id] => 408
[name] => Taglist4
[handle] => taglist4
[tags] => Array
(
[0] => Array
(
[id] => 168
[context] => test
[value] => tag1
[position] => 0
)
[1] => Array
(
[id] => 169
[context] => test
[value] => tag2
[position] => 0
)
)
)
Get taglist for handle
$TC = new Taglist();
$taglist = $TC->getTaglist(["handle" => $handle]);
Get the taglist. Return value:
Array
(
[id] => 408
[name] => Taglist4
[handle] => taglist4
[tags] => Array
(
[0] => Array
(
[id] => 168
[context] => test
[value] => tag1
[position] => 0
)
[1] => Array
(
[id] => 169
[context] => test
[value] => tag2
[position] => 0
)
)
)
Dependencies
PHP
- foreach
- if...else
- switch...case
Janitor
- Query::sql
- Query::results
Taglist::addTaglistTag
Definition
- Name
- Taglist::addTaglistTag
- Syntax
- Boolean = Taglist::addTaglistTag( Array $action );
Description
Add a specific tag to a specific taglist. Specifications are sent through the action parameter.
/#controller#/addTaglistTag/#taglist_id#/#tag_id#
Parameters
- $action
-
Array of REST parameters sent in current request
Action parameters
Return values
Boolean True on successful addition of a specific tag to a specific tagliat. False on error.
Examples
$TC = new Taglist();
$TC->addTaglistTag($action);
Dependencies
PHP
- if
Janitor
- Query::sql
- Query::results
- Query::checkDbExistence
- Message::addMessage
Taglist::removeTaglistTag
Definition
- Name
- Taglist::removeTaglistTag
- Syntax
- Boolean = Taglist::removeTaglistTag( Array $action );
Description
Remove a specific tag from a specific taglist. Specifications are sent through the action parameter.
/#controller#/removeTaglistTag/#taglist_id#/#tag_id#
Parameters
- $action
-
Array Action array.
Action parameters
Return values
Boolean True on successful deletion of a specific tag from a specific tagliat. False on error.
Examples
$TC = new Taglist();
$TC->removeTaglistTag($action);
Dependencies
PHP
- if
Janitor
- Query::sql
- Query::results
- Query::checkDbExistence
- Message::addMessage
Taglist::updateTaglist
Definition
- Name
- Taglist::updateTaglist
- Syntax
- Boolean = Taglist::updateTaglist( Array $action );
Description
Update a specific taglist. Specification is sent through the action parameter.
User input information is in $_POST
/#controller#/updateTaglist/#taglist_id#
Parameters
- $action
-
Array Action array.
Action parameters
Parameters in $_POST
Return values
Boolean True on successful update of a specific tagliat. False on error.
Examples
$TC = new Taglist();
$TC->updateTaglist($action);
Dependencies
PHP
- count
- if...else
Janitor
- Query::sql
- Query::results
- Query::checkDbExistence
- Model::getPostedEntities
- Model::validateList
- Model::getProperty
- Model::getPostedEntities
- Message::addMessage
- superNormalize
Taglist::saveTaglist
Definition
- Name
- Taglist::saveTaglist
- Syntax
- Boolean = Taglist::saveTaglist( Array $action );
Description
Save a taglist.
User input information is in $_POST
/#controller#/saveTaglist
Parameters
- $action
-
Array Action array.
Action parameters
Parameters in $_POST
Return values
Boolean True on successful save of a tagliat. False on error.
Examples
$TC = new Taglist();
$TC->saveTaglist($action);
Save the taglist. Return value:
Array
(
[id] => 460
)
Dependencies
PHP
- count
- if...else
Janitor
- Query::sql
- Query::results
- Query::checkDbExistence
- Model::getPostedEntities
- Model::validateList
- Model::getProperty
- Model::getPostedEntities
- superNormalize
- Message::addMessage
Taglist::deleteTaglist
Definition
- Name
- Taglist::deleteTaglist
- Syntax
- Boolean = Taglist::deleteTaglist( Array $action );
Description
Delete a specific taglist. Specification is sent through the action parameter.
/#controller#/deleteTaglist/#taglist_id#
Parameters
- $action
-
Array Action array.
Action parameters
Return values
Boolean True on successful deletion of a specific tagliat. False on error.
Examples
$TC = new Taglist();
$TC->deleteTaglist($action);
Dependencies
PHP
- count
- if
Janitor
- Query::sql
- Query::results
- PageCore::addLog
- Message::addMessage
Taglist::duplicateTaglist
Definition
- Name
- Taglist::duplicateTaglist
- Syntax
- Array|False = Taglist::duplicateTaglist( Array $action );
Description
Duplicate a specific taglist. Specification is sent through the action parameter.
Information is in $_POST
/#controller#/duplicateTaglist/#taglist_id#
Parameters
- $action
-
Array Action array.
Action parameters
Parameters in $_POST
Return values
Array|False An array of the duplicated taglist. False on error.
Examples
$TC = new Taglist();
$TC->duplicateTaglist($action);
Get the duplicated taglist. Return value:
Array
(
[id] => 531
[name] => Test1 (cloned 2020-04-21 15:56:39)
[handle] => test1-cloned-2020-04-21-15-56-39
[tags] => Array
(
[0] => Array
(
[id] => 262
[context] => test
[value] => tag1
[position] => 0
)
[1] => Array
(
[id] => 263
[context] => test
[value] => tag2
[position] => 0
)
)
)
Dependencies
PHP
- if
- foreach
- count
- unset
- date
- array
Janitor
- Taglist::getTaglist
- Taglist::saveTaglist
- Taglist::addTaglistTag
- Message::addMessage
Taglist::updateOrder
Definition
- Name
- Taglist::updateOrder
- Syntax
- Boolean = Taglist::updateOrder( Array $action );
Description
Update order of the tags of a specific taglist. Specification is sent through the action parameter.
/#controller#/updateOrder/#taglist_id#
Parameters
- $action
-
Array Action array.
Action parameters
Parameters in $_POST
Return values
Boolean True on successfully updating tag orders of a specific tagliat. False on error.
Examples
$TC = new Taglist();
$TC->updateOrder($action);
Dependencies
PHP
- if
- for
- count
- explode
Janitor
- Query::sql
- Query::results
- getPost
- Message::addMessage