本文整理汇总了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> <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 . " <select name='options[]'>";
for ($i = $syear; $i <= $eyear; $i++) {
$selected = $i == $selsyear ? "selected='selected'" : '';
$form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
}
$form .= '</select> ' . _MB_NEWS_CAL_MONTH . " <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 . " <select name='options[]'>";
for ($i = $syear; $i <= $eyear; $i++) {
$selected = $i == $seleyear ? "selected='selected'" : '';
$form .= "<option value='" . $i . "'" . $selected . '>' . $i . '</option>';
}
$form .= '</select> ' . _MB_NEWS_CAL_MONTH . " <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;
}