예제 #1
0
/**
 * Shows all automated stories
 *
 * Automated stories are stories that have a publication's date greater than "now"
 * 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, its title, the topic, the author, the
 * programmed date and time, the expiration's date  and two links. The first link is
 * used to edit the story while the second is used to remove the story.
 * The list only contains the last (x) automated news
 */
function autoStories()
{
    global $dateformat;
    $start = isset($_GET['startauto']) ? intval($_GET['startauto']) : 0;
    $storiescount = nw_NewsStory :: getAllStoriesCount(2,false);
    $storyarray = nw_NewsStory :: getAllAutoStory(nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME),true,$start);
    $class='';
    if(count($storyarray) > 0) {
    	$pagenav = new XoopsPageNav($storiescount, nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'startauto', 'op=newarticle');
		nw_collapsableBar('autostories', 'topautostories');
		echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topautostories' name='topautostories' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a>&nbsp;"._AM_NW_AUTOARTICLES."</h4>";
		echo "<div id='autostories'>";
		echo '<br />';
        echo "<div style='text-align: center;'>\n";
        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_PROGRAMMED . "</td><td align='center' class='news'>" . _AM_NW_EXPIRED . "</td><td align='center'>" . _AM_NW_ACTION . "</td></tr>";
        foreach($storyarray as $autostory) {
            $topic = $autostory -> topic();
            $expire = ( $autostory->expired() > 0 ) ? formatTimestamp($autostory->expired(),$dateformat) : '';
            $class = ($class == 'even') ? 'odd' : 'even';
            echo "<tr class='".$class."'>";
        	echo "<td align='center'><b>" . $autostory -> storyid() . "</b>
        		</td><td align='left'><a href='" . NW_MODULE_URL . "/article.php?storyid=" . $autostory->storyid() . "'>" . $autostory->title() . "</a>
        		</td><td align='center'>" . $topic->topic_title() . "
        		</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $autostory->uid() . "'>" . $autostory->uname() . "</a></td><td align='center' class='news'>" . formatTimestamp($autostory->published(),$dateformat) . "</td><td align='center'>" . $expire . "</td><td align='center'><a href='".NW_MODULE_URL . "/submit.php?returnside=1&amp;op=edit&amp;storyid=" . $autostory->storyid() . "'>" . _AM_NW_EDIT . "</a>-<a href='".NW_MODULE_URL . "/admin/index.php?op=delete&amp;storyid=" . $autostory->storyid() . "'>" . _AM_NW_DELETE . "</a>";
            echo "</td></tr>\n";
        }
        echo '</table></div>';
        echo "<div align='right'>".$pagenav->renderNav().'</div><br />';
        echo '</div><br />';
    }
}