Beispiel #1
0
function tep_childs_in_topic_count($topics_id)
{
    $topics_count = 0;
    $topics_query = tep_db_query("select topics_id from " . TABLE_TOPICS . " where parent_id = '" . (int) $topics_id . "'");
    while ($topics = tep_db_fetch_array($topics_query)) {
        $topics_count++;
        $topics_count += tep_childs_in_topic_count($topics['topics_id']);
    }
    return $topics_count;
}
Beispiel #2
0
    $rows = 0;
    if (isset($_GET['search'])) {
        $search = tep_db_prepare_input($_GET['search']);
        $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = td.topics_id and td.language_id = '" . (int) $languages_id . "' and td.topics_name like '%" . tep_db_input($search) . "%' order by t.sort_order, td.topics_name");
    } else {
        $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id, t.sort_order, t.date_added, t.last_modified from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int) $current_topic_id . "' and t.topics_id = td.topics_id and td.language_id = '" . (int) $languages_id . "' order by t.sort_order, td.topics_name");
    }
    while ($topics = tep_db_fetch_array($topics_query)) {
        $topics_count++;
        $rows++;
        // Get parent_id for subtopics if search
        if (isset($_GET['search'])) {
            $tPath = $topics['parent_id'];
        }
        if ((!isset($_GET['tID']) && !isset($_GET['aID']) || isset($_GET['tID']) && $_GET['tID'] == $topics['topics_id']) && !isset($tInfo) && substr($action, 0, 3) != 'new') {
            $topic_childs = array('childs_count' => tep_childs_in_topic_count($topics['topics_id']));
            $topic_articles = array('articles_count' => tep_articles_in_topic_count($topics['topics_id']));
            $tInfo_array = array_merge($topics, $topic_childs, $topic_articles);
            $tInfo = new objectInfo($tInfo_array);
        }
        if (isset($tInfo) && is_object($tInfo) && $topics['topics_id'] == $tInfo->topics_id) {
            echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ARTICLES, tep_get_topic_path($topics['topics_id'])) . '\'">' . "\n";
        } else {
            echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&amp;tID=' . $topics['topics_id']) . '\'">' . "\n";
        }
        ?>
                <td class="dataTableContent"><?php 
        echo '<a href="' . tep_href_link(FILENAME_ARTICLES, tep_get_topic_path($topics['topics_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>&nbsp;<b>' . $topics['topics_name'] . '</b>';
        ?>
</td>
                <td class="dataTableContent" align="center">&nbsp;</td>