Пример #1
0
function get_node_data($params, $get_array = false)
{
    $ret = array();
    $click_level = $params['TREE']['depth'];
    if (isset($params['TREE']['caller']) and $params['TREE']['caller'] == 'Tags') {
        $href = false;
    }
    if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'browse') {
        $clickdepth = $params['TREE']['depth'];
        $nodes = get_tag_nodes_for_browsing($params['NODES'][$clickdepth]['id']);
    } else {
        if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'admin') {
            $clickdepth = $params['TREE']['depth'];
            $nodes = get_tags_nodes(false, true, $params['NODES'][$clickdepth]['id']);
        } else {
            if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'modal') {
                $clickdepth = $params['TREE']['depth'];
                $nodes = get_tags_nodes(false, false, $params['NODES'][$clickdepth]['id']);
                //$nodes=get_tags_nodes_cached(false);
            } else {
                if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'modalMoveDocs') {
                    $clickdepth = $params['TREE']['depth'];
                    $nodes = get_tags_modal_nodes($params['NODES'][$clickdepth]['id'], false);
                } else {
                    if (isset($params['TREE']['moduleview']) and $params['TREE']['moduleview'] == 'applyTags') {
                        $clickdepth = $params['TREE']['depth'];
                        $nodes = get_tags_modal_nodes($params['NODES'][$clickdepth]['id'], true);
                    }
                }
            }
        }
    }
    foreach ($nodes as $node) {
        $ret['nodes'][] = $node->get_definition();
    }
    $json = new JSON(JSON_LOOSE_TYPE);
    $str = $json->encode($ret);
    return $str;
}
}
if ($tagsMode == 'Move Tags') {
    $tagstreeModal = new Tree('tagstreeMoveDocsModal');
    $tagstreeModal->set_param('module', 'KBTags');
    $tagstreeModal->set_param('moduleview', 'modalMoveDocs');
    $nodes = get_tags_modal_nodes(null, false);
    foreach ($nodes as $node) {
        $tagstreeModal->add_node($node);
    }
    $response = $tagstreeModal->generate_nodes_array();
}
if ($tagsMode == 'Apply Tags') {
    $tagstreeApply = new Tree('tagstreeApplyTags');
    $tagstreeApply->set_param('module', 'KBTags');
    $tagstreeApply->set_param('moduleview', 'applyTags');
    $nodes = get_tags_modal_nodes(null, true);
    foreach ($nodes as $node) {
        $tagstreeApply->add_node($node);
    }
    $response = $tagstreeApply->generate_nodes_array();
}
//ADDING FOR SEARCH
if ($tagsMode == 'Search Tags') {
    global $mod_strings;
    if (!empty($search_tag_name)) {
        $search_tag_name = $GLOBALS['db']->quote($search_tag_name[0]);
        $query = "select id,tag_name from kbtags where tag_name='{$search_tag_name}' and deleted = 0";
        $result = $GLOBALS['db']->query($query);
        //$searched_tagIds  =  $GLOBALS['db']->fetchByAssoc($result);
        $searched_and_related_Ids = array();
        $searched_ids = array();