예제 #1
0
/**
 * Show new submissions
 *
 * This list can be view in the module's admin when you click on the tab named "Post/Edit News"
 * Submissions are news that was submit by users but who are not approved, so you need to edit
 * them to approve them.
 * Actually you can see the the story's title, the topic, the posted date, the author and a
 * link to delete the story. If you click on the story's title, you will be able to edit the news.
 * The table contains the last x new submissions.
 * The system's block called "Waiting Contents" is listing the number of those news.
 */
function newSubmissions()
{
    global $dateformat;
    $start = isset($_GET['startnew']) ? intval($_GET['startnew']) : 0;
    $newsubcount = nw_NewsStory :: getAllStoriesCount(3,false);
    $storyarray = nw_NewsStory :: getAllSubmitted(nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME),true,nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME),$start);
    if ( count($storyarray)> 0) {
    	$pagenav = new XoopsPageNav( $newsubcount, nw_getmoduleoption('storycountadmin', NW_MODULE_DIR_NAME), $start, 'startnew', 'op=newarticle');
		nw_collapsableBar('newsub', 'topnewsubicon');
		echo "<img onclick=\"toggle('toptable'); toggleIcon('toptableicon');\" id='topnewsubicon' name='topnewsubicon' src='" . NW_MODULE_URL . "/images/close12.gif' alt='' /></a>&nbsp;"._AM_NW_NEWSUB."</h4>";
		echo "<div id='newsub'>";
		echo '<br />';
        echo "<div style='text-align: center;'><table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'><tr class='bg3'><td align='center'>" . _AM_NW_TITLE . "</td><td align='center'>" . _AM_NW_TOPIC . "</td><td align='center'>" . _AM_NW_POSTED . "</td><td align='center'>" . _AM_NW_POSTER . "</td><td align='center'>" . _AM_NW_ACTION . "</td></tr>\n";
        $class='';
        foreach( $storyarray as $newstory ) {
            $class = ($class == 'even') ? 'odd' : 'even';
            echo "<tr class='".$class."'><td align='left'>\n";
            $title = $newstory->title();
            if (!isset($title) || ($title == '' )) {
                echo "<a href='".NW_MODULE_URL . "/admin/index.php?op=edit&amp;returnside=1&amp;storyid=" . $newstory -> storyid() . "'>" . _AD_NOSUBJECT . "</a>\n";
            } else {
                echo "&nbsp;<a href='".NW_MODULE_URL . "/submit.php?returnside=1&amp;op=edit&amp;storyid=" . $newstory -> storyid() . "'>" . $title . "</a>\n";
            }
            echo "</td><td>" . $newstory->topic_title() . "</td><td align='center' class='news'>" . formatTimestamp($newstory->created(),$dateformat) . "</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory->uid() . "'>" . $newstory->uname() . "</a></td><td align='right'><a href='".NW_MODULE_URL . "/admin/index.php?op=delete&amp;storyid=" . $newstory->storyid() . "'>" . _AM_NW_DELETE . "</a></td></tr>\n";
        }
        echo '</table></div>';
        echo "<div align='right'>".$pagenav->renderNav().'</div><br />';
        echo '<br /></div><br />';
    }
}
예제 #2
0
/**
 * Dispay a block where news moderators can show news that need to be moderated.
 */
function nw_b_news_topics_moderate() {
	include_once NW_MODULE_PATH . '/class/class.newsstory.php';
	include_once NW_MODULE_PATH . '/include/functions.php';
	$block = array();
	$dateformat=nw_getmoduleoption('dateformat', NW_MODULE_DIR_NAME);
	$infotips=nw_getmoduleoption('infotips', NW_MODULE_DIR_NAME);

    $storyarray = nw_NewsStory :: getAllSubmitted(0, true, nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME));
    if ( count( $storyarray ) > 0 )
    {
		$block['lang_story_title'] = _MB_NW_TITLE;
		$block['lang_story_date'] = _MB_NW_POSTED;
		$block['lang_story_author'] =_MB_NW_POSTER;
		$block['lang_story_action'] =_MB_NW_ACTION;
		$block['lang_story_topic'] =_MB_NW_TOPIC;
		$myts =& MyTextSanitizer::getInstance();
        foreach( $storyarray as $newstory )
        {
            $title = $newstory -> title();
			$htmltitle='';
			if($infotips>0) {
				$story['infotips'] = nw_make_infotips($newstory->hometext());
				$htmltitle=' title="'.$story['infotips'].'"';
			}

            if (!isset( $title ) || ($title == '')) {
                $linktitle = "<a href='" . NW_MODULE_URL . "/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "' target='_blank'".$htmltitle.">" . _AD_NOSUBJECT . "</a>";
            } else {
                $linktitle = "<a href='" . NW_MODULE_URL . "/submit.php?op=edit&amp;storyid=" . $newstory->storyid() . "' target='_blank'".$htmltitle.">" . $title . "</a>";
            }
			$story=array();
            $story['title'] = $linktitle;
            $story['date'] = formatTimestamp($newstory->created(),$dateformat);
            $story['author'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory -> uid() . "'>" . $newstory->uname() . "</a>";
            $story['action'] = "<a href='" . NW_MODULE_URL . "/admin/index.php?op=edit&amp;storyid=" . $newstory->storyid() . "'>" . _EDIT. "</a> - <a href='" . NW_MODULE_URL . "/admin/index.php?op=delete&amp;storyid=" . $newstory->storyid() . "'>" . _MB_NW_DELETE . "</a>";
            $story['topic_title'] = $newstory->topic_title();
            $story['topic_color']= '#'.$myts->displayTarea($newstory->topic_color);
            $block['stories'][] =& $story;
            unset($story);
        }
    }
	return $block;
}