示例#1
0
function getParentList($parent_id, $level, $parent_list = '')
{
    global $languages_id;
    $nav_item_query = tep_db_query('SELECT id, link, custom, sort_order, status, name FROM navigatie WHERE parent_id = "' . $parent_id . '" AND status = "1" ORDER BY sort_order asc');
    $level_count = tep_db_num_rows($nav_item_query);
    $i = 1;
    if ($level > 1) {
        $this_class_level = $level - 1;
        $parent_list .= '<ul class="level_' . $this_class_level . '">';
    }
    while ($nav_item = tep_db_fetch_array($nav_item_query)) {
        $level_class = '';
        $count_columns = tep_count_navigation_children($nav_item['id']);
        $parent_list .= '<li>';
        if (!empty($nav_item['custom'])) {
            if (!empty($nav_item['name'])) {
                $name = $nav_item['name'];
            } else {
                $name = $nav_item['custom'];
            }
            $parent_list .= '<a href="' . tep_href_link($nav_item['custom']) . '" title="' . $name . ' - ' . STORE_NAME . '" class="' . $level_class_count . '">' . $name . '</a>';
        } else {
            $name = $nav_item['link'];
            if (preg_match('/^([i]{1})+([_]{1})+([0-9]+$)/i', $nav_item['link'])) {
                $page_id = explode('_', $nav_item['link']);
                $infopage_name_query = tep_db_query('SELECT infopages_title FROM infopages_text WHERE infopages_id = "' . $page_id[1] . '" AND language_id = "' . (int) $languages_id . '"');
                $infopage_name = tep_db_fetch_array($infopage_name_query);
                /*language fallback*/
                if (LANGUAGE_FALLBACK == 'true' && $infopage_name['infopages_title'] == '') {
                    $language_fallback_query = tep_db_query('SELECT infopages_title FROM infopages_text WHERE infopages_id = "' . $page_id[1] . '" AND language_id = "1"');
                    $language_fallback = tep_db_fetch_array($language_fallback_query);
                    $infopage_name['infopages_title'] = $language_fallback['infopages_title'];
                }
                /*language fallback*/
                $name = $infopage_name['infopages_title'];
                $parent_list .= '<a href="' . tep_href_link(FILENAME_INFOPAGE, 'page=' . $page_id[1]) . '" title="' . $name . ' - ' . STORE_NAME . '" class="' . $level_class_count . '">' . $name . '</a>';
            } else {
                if (preg_match('/^([c]{1})+([_]{1})+([0-9]+$)/i', $nav_item['link'])) {
                    $page_id = explode('_', $nav_item['link']);
                    $categorie_name_query = tep_db_query('SELECT categories_name FROM categories_description WHERE categories_id = "' . $page_id[1] . '" AND language_id = "' . (int) $languages_id . '"');
                    $categorie_name = tep_db_fetch_array($categorie_name_query);
                    /*language fallback*/
                    if (LANGUAGE_FALLBACK == 'true' && $categorie_name['categories_name'] == '') {
                        $language_fallback_query = tep_db_query('SELECT categories_name FROM categories_description WHERE categories_id = "' . $page_id[1] . '" AND language_id = "1"');
                        $language_fallback = tep_db_fetch_array($language_fallback_query);
                        $categorie_name['categories_name'] = $language_fallback['categories_name'];
                    }
                    /*language fallback*/
                    $name = $categorie_name['categories_name'];
                    $parent_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $page_id[1]) . '" title="' . $name . ' - ' . STORE_NAME . '" class="' . $level_class_count . '">' . $name . '</a>';
                } else {
                    if (preg_match('/^([p]{1})+([_]{1})+([0-9]+$)/i', $nav_item['link'])) {
                        $page_id = explode('_', $nav_item['link']);
                        $product_name_query = tep_db_query('SELECT products_name FROM products_description WHERE products_id = "' . $page_id[1] . '" AND language_id = "' . (int) $languages_id . '"');
                        $product_name = tep_db_fetch_array($product_name_query);
                        /*language fallback*/
                        if (LANGUAGE_FALLBACK == 'true' && $product_name['products_name'] == '') {
                            $language_fallback_query = tep_db_query('SELECT products_name FROM products_description WHERE products_id = "' . $page_id[1] . '" AND language_id = "1"');
                            $language_fallback = tep_db_fetch_array($language_fallback_query);
                            $product_name['products_name'] = $language_fallback['products_name'];
                        }
                        /*language fallback*/
                        $name = $product_name['products_name'];
                        $parent_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'products_id=' . $page_id[1]) . '" title="' . $name . ' - ' . STORE_NAME . '" class="' . $level_class_count . '">' . $name . '</a>';
                    } else {
                        if (!empty($nav_item['name'])) {
                            $name = $nav_item['name'];
                        }
                        $parent_list .= '<a href="' . tep_href_link($nav_item['link']) . '" title="' . $name . ' - ' . STORE_NAME . '" class="' . $level_class_count . '">' . $name . '</a>';
                    }
                }
            }
        }
        if (tep_count_navigation_children($nav_item['id']) > 0) {
            $new_level = $level + 1;
            $parent_list .= getParentList($nav_item['id'], $new_level);
        }
        $i++;
    }
    if ($level > 1) {
        $parent_list .= '</ul>';
    }
    return $parent_list;
}
示例#2
0
$isallowed = $rights->isallowed($mod, 'manage');
$smarty->assign('isallowed', $isallowed);
$mode = $_GET['mode'];
$categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0;
$downloadid = isset($_GET['downloadid']) ? (int) $_GET['downloadid'] : 0;
$movieid = isset($_GET['movieid']) ? (int) $_GET['movieid'] : 0;
$smarty->assign('thumbnailwidth', $config->get($mod, 'thumbnailwidth'));
$breadcrumbs->addElement($lang->get('media'), makeURL($mod));
$category = getCategory($categoryid);
if ($category['name'] == '') {
    $category['name'] = $lang->get('media');
}
if ($this->isInstalled('fileadmin')) {
    $smarty->assign('fileadmin_installed', true);
}
$parents = getParentList($categoryid);
foreach ($parents as $parent) {
    $breadcrumbs->addElement($parent['name'], makeURL($mod, array('categoryid' => $parent['categoryid'])));
}
if ($rights->isAllowed($mod, 'upload') && $categoryid > 0 && $downloadid == 0 && $movieid == 0) {
    $menu->addSubElement($mod, $lang->get('adddownload'), 'adddownload', array('categoryid' => $categoryid));
    $menu->addSubElement($mod, $lang->get('addpictures'), 'addpictures', array('categoryid' => $categoryid));
}
if ($isallowed) {
    if ($downloadid == 0 && $movieid == 0) {
        $menu->addSubElement($mod, $lang->get('createcategory'), 'createcategory', array('categoryid' => $categoryid));
        $menu->addSubElement($mod, $lang->get('download_stat'), 'statistic');
        if ($categoryid > 0) {
            $menu->addSubElement($mod, $lang->get('editcategory'), 'editcategory', array('categoryid' => $categoryid));
            $menu->addSubElement($mod, $lang->get('removecategory'), 'removecategory', array('categoryid' => $categoryid));
            $menu->addSubElement($mod, $lang->get('editpictures'), 'editpictures', array('categoryid' => $categoryid));
示例#3
0
                $childId = $mapEntry[$id];
                $children[] = $childId;
                $children = $children + getChildIds($childId, $children, $parents);
            }
        }
        return $children;
    }
}
if (!function_exists('getParentList')) {
    function getParentList()
    {
        global $modx;
        $kids = array();
        foreach ($modx->documentMap as $null => $document) {
            foreach ($document as $parent => $id) {
                $kids[$parent][] = $id;
            }
        }
        $parents = array_keys($kids);
        return $parents;
    }
}
if ($onlyFolders) {
    $allParents = getParentList();
    $childParents = array();
    $childParents = getChildIds($parent, array(), $allParents);
} else {
    //$childParents = array_values($modx->getChildIds($parent));
    $childParents = $modx->getChildIds($parent, $depth);
}
return implode(',', $childParents);