예제 #1
0
/**
 * Display a list of the expired stories
 *
 * This list can be view in the module's admin when you click on the tab named "Post/Edit News"
 * Actually you can see the story's ID, the title, the topic, the author,
 * the creation and expiration's date and you have two links, one to delete
 * the story and the other to edit the story.
 * The table only contains the last X expired stories.
 * You can modify the number of visible stories with the module's option named
 * "Number of new articles to display in admin area".
 * As the number of displayed stories is limited, below this list you can find a text box
 * that you can use to enter a story's Id, then with the scrolling list you can select
 * if you want to edit or delete the story.
 */
function expStories()
{
    global $dateformat;
    $start = isset($_GET['startexp']) ? intval($_GET['startexp']) : 0;
	$expiredcount = nw_NewsStory :: getAllStoriesCount(1,false);
	$storyarray = nw_NewsStory :: getAllExpired(nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 0, 1 );
	$pagenav = new XoopsPageNav( $expiredcount, nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'startexp', 'op=newarticle');

    if(count($storyarray) > 0) {
    	$class='';
		nw_collapsableBar('expstories', 'topexpstories');
		echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topexpstories' name='topexpstories' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a>&nbsp;"._AM_NW_EXPARTS."</h4>";
		echo "<div id='expstories'>";
		echo '<br />';
    	echo "<div style='text-align: center;'>";
    	echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_NW_STORYID . "</td><td align='center'>" . _AM_NW_TITLE . "</td><td align='center'>" . _AM_NW_TOPIC . "</td><td align='center'>" . _AM_NW_POSTER . "</td><td align='center' class='news'>" . _AM_NW_CREATED . "</td><td align='center' class='news'>" . _AM_NW_EXPIRED . "</td><td align='center'>" . _AM_NW_ACTION . "</td></tr>";
    	foreach( $storyarray as $eachstory ) {
	        $created = formatTimestamp($eachstory->created(),$dateformat);
        	$expired = formatTimestamp($eachstory->expired(),$dateformat);
        	$topic = $eachstory -> topic();
        	// added exired value field to table
        	$class = ($class == 'even') ? 'odd' : 'even';
        	echo "<tr class='".$class."'>";
        	echo "<td align='center'><b>" . $eachstory -> storyid() . "</b>
	        	</td><td align='left'><a href='" . NW_MODULE_URL . "/article.php?returnside=1&amp;storyid=" . $eachstory -> storyid() . "'>" . $eachstory -> title() . "</a>
        		</td><td align='center'>" . $topic -> topic_title() . "
        		</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory -> uid() . "'>" . $eachstory -> uname() . "</a></td><td align='center' class='news'>" . $created . "</td><td align='center' class='news'>" . $expired . "</td><td align='center'><a href='".NW_MODULE_URL . "/submit.php?returnside=1&amp;op=edit&amp;storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_EDIT . "</a>-<a href='".NW_MODULE_URL . "/admin/index.php?op=delete&amp;storyid=" . $eachstory -> storyid() . "'>" . _AM_NW_DELETE . "</a>";
        	echo "</td></tr>\n";
    	}
    	echo '</table><br />';
    	echo "<div align='right'>".$pagenav->renderNav().'</div><br />';
    	echo "<form action='index.php' method='get'>
	    	" . _AM_NW_STORYID . " <input type='text' name='storyid' size='10' />
    		<select name='op'>
	    		<option value='edit' selected='selected'>" . _AM_NW_EDIT . "</option>
    			<option value='delete'>" . _AM_NW_DELETE . "</option>
    		</select>
			<input type='hidden' name='returnside' value='1'>
    		<input type='submit' value='" . _AM_NW_GO . "' />
    		</form>
		</div>";
    	echo '</div><br />';
    }
}