Exemplo n.º 1
0
 /** Get the content tree for this kind of content */
 static function getTree(&$xmap, &$parent, &$params)
 {
     $tag = null;
     $limit = null;
     $id = null;
     $link_query = parse_url($parent->link);
     parse_str(html_entity_decode($link_query['query']), $link_vars);
     $parm_vars = $parent->params->toArray();
     $option = xmap_com_k2::getParam($link_vars, 'option', "");
     if ($option != "com_k2") {
         return;
     }
     $view = xmap_com_k2::getParam($link_vars, 'view', "");
     $showMode = xmap_com_k2::getParam($params, 'showk2items', "always");
     if ($showMode == "never" || $showMode == "xml" && $xmap->view == "html" || $showMode == "html" && $xmap->view == "xml") {
         return;
     }
     self::$suppressDups = xmap_com_k2::getParam($params, 'suppressdups', 'yes') == "yes";
     self::$suppressSub = xmap_com_k2::getParam($params, 'subcategories', "yes") != "yes";
     if ($view == "item") {
         if (!isset($xmap->IDS)) {
             $xmap->IDS = "";
         }
         $xmap->IDS = $xmap->IDS . "|" . xmap_com_k2::getParam($link_vars, 'id', $id);
         return;
     }
     if ($xmap->view == "xml") {
         self::$maxAccess = 1;
     } else {
         self::$maxAccess = implode(",", JFactory::getUser()->getAuthorisedViewLevels());
     }
     switch (xmap_com_k2::getParam($link_vars, 'task', "")) {
         case "user":
             $tag = xmap_com_k2::getParam($link_vars, 'id', $id);
             $ids = array_key_exists('userCategoriesFilter', $parm_vars) ? $parm_vars['userCategoriesFilter'] : array("");
             $mode = "single user";
             break;
         case "tag":
             $tag = xmap_com_k2::getParam($link_vars, 'tag', "");
             $ids = array_key_exists('categoriesFilter', $parm_vars) ? $parm_vars['categoriesFilter'] : array("");
             $mode = "tag";
             break;
         case "category":
             $ids = explode("|", xmap_com_k2::getParam($link_vars, 'id', ""));
             $mode = "category";
             break;
         case "":
             switch (xmap_com_k2::getParam($link_vars, 'layout', "")) {
                 case "category":
                     if (array_key_exists('categories', $parm_vars)) {
                         $ids = $parm_vars["categories"];
                     } else {
                         $ids = '';
                     }
                     $mode = "categories";
                     break;
                 case "latest":
                     $limit = xmap_com_k2::getParam($parm_vars, 'latestItemsLimit', "");
                     if (xmap_com_k2::getParam($parm_vars, 'source', "") == "0") {
                         $ids = array_key_exists("userIDs", $parm_vars) ? $parm_vars["userIDs"] : '';
                         $mode = "latest user";
                     } else {
                         $ids = array_key_exists("categoryIDs", $parm_vars) ? $parm_vars["categoryIDs"] : '';
                         $mode = "latest category";
                     }
                     break;
                 default:
                     return;
             }
             break;
         default:
             return;
     }
     $priority = xmap_com_k2::getParam($params, 'priority', $parent->priority);
     $changefreq = xmap_com_k2::getParam($params, 'changefreq', $parent->changefreq);
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['priority'] = $priority;
     $params['changefreq'] = $changefreq;
     $db = JFactory::getDBO();
     xmap_com_k2::processTree($db, $xmap, $parent, $params, $mode, $ids, $tag, $limit);
     return;
 }