當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NewsStory::GetOlderRecentNews方法代碼示例

本文整理匯總了PHP中NewsStory::GetOlderRecentNews方法的典型用法代碼示例。如果您正苦於以下問題:PHP NewsStory::GetOlderRecentNews方法的具體用法?PHP NewsStory::GetOlderRecentNews怎麽用?PHP NewsStory::GetOlderRecentNews使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NewsStory的用法示例。


在下文中一共展示了NewsStory::GetOlderRecentNews方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: b_news_archives_edit

function b_news_archives_edit($options)
{
    global $xoopsDB;
    $syear = $smonth = $eyear = $emonth = $older = $recent = 0;
    $selsyear = $selsmonth = $seleyear = $selemonth = 0;
    $form = '';
    $selsyear = $options[1];
    $selsmonth = $options[2];
    $seleyear = $options[3];
    $selemonth = $options[4];
    $tmpstory = new NewsStory();
    $tmpstory->GetOlderRecentNews($older, $recent);
    // We are searching for the module's older and more recent article's date
    // Min and max value for the two dates selectors
    // We are going to use the older news for the starting date
    $syear = date('Y', $older);
    $smonth = date('n', $older);
    $eyear = date('Y', $recent);
    $emonth = date('n', $recent);
    // Verify parameters
    if ($selsyear == 0 && $selsmonth == 0) {
        $selsyear = $syear;
        $selsmonth = $smonth;
    }
    if ($seleyear == 0 && $selemonth == 0) {
        $seleyear = $eyear;
        $selemonth = $emonth;
    }
    // Sort order *************************************************************
    // (0=older first, 1=newer first)
    $form .= '<b>' . _MB_NEWS_ORDER . "</b>&nbsp;<select name='options[]'>";
    $form .= "<option value='0'";
    if ($options[0] == 0) {
        $form .= " selected='selected'";
    }
    $form .= '>' . _MB_NEWS_OLDER_FIRST . "</option>\n";
    $form .= "<option value='1'";
    if ($options[0] == 1) {
        $form .= " selected='selected'";
    }
    $form .= '>' . _MB_NEWS_RECENT_FIRST . '</option>';
    $form .= "</select>\n";
    // Starting and ending dates **********************************************
    $form .= '<br /><br /><b>' . _MB_NEWS_STARTING_DATE . '</b><br />';
    $form .= _MB_NEWS_CAL_YEAR . "&nbsp;<select name='options[]'>";
    for ($i = $syear; $i <= $eyear; $i++) {
        $selected = $i == $selsyear ? "selected='selected'" : '';
        $form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
    }
    $form .= '</select>&nbsp;' . _MB_NEWS_CAL_MONTH . "&nbsp;<select name='options[]'>";
    for ($i = 1; $i <= 12; $i++) {
        $selected = $i == $selsmonth ? "selected='selected'" : '';
        $form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
    }
    $form .= '</select>';
    $form .= '<br /><br /><b>' . _MB_NEWS_ENDING_DATE . '</b><br />';
    $form .= _MB_NEWS_CAL_YEAR . "&nbsp;<select name='options[]'>";
    for ($i = $syear; $i <= $eyear; $i++) {
        $selected = $i == $seleyear ? "selected='selected'" : '';
        $form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
    }
    $form .= '</select>&nbsp;' . _MB_NEWS_CAL_MONTH . "&nbsp;<select name='options[]'>";
    for ($i = 1; $i <= 12; $i++) {
        $selected = $i == $selemonth ? "selected='selected'" : '';
        $form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
    }
    $form .= '</select>';
    // Or until today *********************************************************
    $form .= '<br />';
    $checked = $options[5] == 1 ? " checked='checked'" : '';
    $form .= "<input type='checkbox' value='1' name='options[]'" . $checked . '>';
    $form .= ' <b>' . _MB_NEWS_UNTIL_TODAY . '</b>';
    return $form;
}
開發者ID:trabisdementia,項目名稱:xuups,代碼行數:74,代碼來源:news_archives.php


注:本文中的NewsStory::GetOlderRecentNews方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。