예제 #1
0
} else {
    $title = $LANG_DIR['title'];
    if ($dir_topic !== 'all') {
        $title .= ': ' . $dir_topicName;
    }
    $headerCode = DIR_canonicalLink($dir_topic);
    $directory = DIR_displayAll($template, $dir_topic);
    $page_navigation = '';
    $block_title = $LANG_DIR['title'];
    $val_year = 0;
    $val_month = 0;
    if ($conf_list_current_month) {
        $currentTime = time();
        $currentYear = date('Y', $currentTime);
        $currentMonth = date('n', $currentTime);
        $thisMonth = COM_startBlock($LANG_MONTH[$currentMonth]) . DIR_displayMonth($template, $dir_topic, $currentYear, $currentMonth) . COM_endBlock();
        if (TEMPLATE_EXISTS) {
            $template->set_var('current_month', $thisMonth);
        } else {
            $display .= $thisMonth;
        }
    }
}
if (TEMPLATE_EXISTS) {
    $topic_list = TOPIC_getTopicListSelect($dir_topic, 2, true);
    $template->set_var(array('url' => $_CONF['site_url'] . '/' . THIS_SCRIPT, 'topic_list' => $topic_list, 'blockheader' => COM_startBlock($block_title), 'val_year' => $val_year, 'val_month' => $val_month, 'directory' => $directory, 'page_navigation' => $page_navigation, 'blockfooter' => COM_endBlock()));
    $template->parse('output', 't_directory');
    $display .= $template->finish($template->get_var('output'));
} else {
    $display .= COM_startBlock($block_title);
    $display .= DIR_topicList($dir_topic, $val_year, $val_month) . LB;
예제 #2
0
/**
* Display main view (list of years)
*
* Displays an overview of all the years and months, starting with the first
* year for which a story has been posted. Can optionally display a list of
* the stories for the current month at the top of the page.
*
* @param    string  $topic                  current topic
* @param    boolean $list_current_month     true = list stories f. current month
* @return   string                          list of all the years in the db
*
*/
function DIR_displayAll($topic, $list_current_month = false)
{
    global $_TABLES, $LANG_DIR;
    $retval = '';
    if ($list_current_month) {
        $currentyear = date('Y', time());
        $currentmonth = date('n', time());
        $retval .= DIR_displayMonth($topic, $currentyear, $currentmonth);
        $retval .= '<hr' . XHTML . '>' . LB;
    }
    $retval .= '<div><h1 style="display:inline">' . $LANG_DIR['title'] . '</h1> ' . DIR_topicList($topic) . '</div>' . LB;
    $yearsql = array();
    $yearsql['mysql'] = "SELECT DISTINCT YEAR(date) AS year,date FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $yearsql['mssql'] = "SELECT YEAR(date) AS year FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $yearsql['pgsql'] = "SELECT EXTRACT( YEAR from date) AS year FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getTopicSql('AND') . COM_getPermSql('AND') . COM_getLangSQL('sid', 'AND');
    $ysql = array();
    $ysql['mysql'] = $yearsql['mysql'] . " GROUP BY YEAR(date) ORDER BY date DESC";
    $ysql['mssql'] = $yearsql['mssql'] . " GROUP BY YEAR(date) ORDER BY YEAR(date) DESC";
    $ysql['pgsql'] = $yearsql['pgsql'] . " GROUP BY year,date ORDER BY year DESC";
    $yresult = DB_query($ysql);
    $numyears = DB_numRows($yresult);
    for ($i = 0; $i < $numyears; $i++) {
        $Y = DB_fetchArray($yresult);
        $retval .= DIR_displayYear($topic, $Y['year']);
    }
    return $retval;
}