当前位置: 首页>>代码示例>>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;未经允许,请勿转载。