aboutsummaryrefslogtreecommitdiff
path: root/www/ajax/getadminlinkedtags.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2010-10-09 10:20:14 +0200
committerChristian Weiske <cweiske@cweiske.de>2010-10-09 10:20:14 +0200
commit22e46a9b45810bae480aea72b16680d715a57ff4 (patch)
tree4fad97378581ef4361c2f733ac38a0c6af91ccf3 /www/ajax/getadminlinkedtags.php
parentaaf293b18da42e41cfcaed16d13f1d25157fd7cb (diff)
downloadsemanticscuttle-22e46a9b45810bae480aea72b16680d715a57ff4.tar.gz
semanticscuttle-22e46a9b45810bae480aea72b16680d715a57ff4.tar.bz2
make linkedtags sidebar tree menu work with jquery/jstree now
Diffstat (limited to 'www/ajax/getadminlinkedtags.php')
-rw-r--r--www/ajax/getadminlinkedtags.php16
1 files changed, 13 insertions, 3 deletions
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')
);