From 22e46a9b45810bae480aea72b16680d715a57ff4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 9 Oct 2010 10:20:14 +0200 Subject: make linkedtags sidebar tree menu work with jquery/jstree now --- www/ajax/getadminlinkedtags.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'www/ajax/getadminlinkedtags.php') diff --git a/www/ajax/getadminlinkedtags.php b/www/ajax/getadminlinkedtags.php index 1004f29..5f939a6 100644 --- a/www/ajax/getadminlinkedtags.php +++ b/www/ajax/getadminlinkedtags.php @@ -22,7 +22,16 @@ $httpContentType = 'application/json'; require_once '../www-header.php'; -function assembleTagData($tag, SemanticScuttle_Service_Tag2Tag $t2t) +/** + * Creates and returns an array of tags for the jsTree ajax loader. + * If the tag is empty, the configured menu2 (admin) main tags are used. + * + * @param string $tag Tag name to fetch subtags for + * @param SemanticScuttle_Service_Tag2Tag $t2t Tag relation service + * + * @return array Array of tag data suitable for the jsTree ajax loader + */ +function assembleAdminTagData($tag, SemanticScuttle_Service_Tag2Tag $t2t) { if ($tag == '') { $linkedTags = $GLOBALS['menu2Tags']; @@ -45,7 +54,8 @@ function assembleTagData($tag, SemanticScuttle_Service_Tag2Tag $t2t) * Creates an jsTree json array for the given tag * * @param string $tag Tag name - * @param boolean $hasChildren If the tag has subtags (children) or not + * @param boolean $hasChildren If the tag has subtags (children) or not. + * If unsure, set it to "true". * * @return array Array to be sent back to the browser as json */ @@ -74,7 +84,7 @@ function createTagArray($tag, $hasChildren = true) $tag = isset($_GET['tag']) ? trim($_GET['tag']) : ''; -$tagData = assembleTagData( +$tagData = assembleAdminTagData( $tag, SemanticScuttle_Service_Factory::get('Tag2Tag') ); -- cgit v1.2.3