From: <vo...@us...> - 2012-01-05 10:40:09
|
Revision: 8641 http://xoops.svn.sourceforge.net/xoops/?rev=8641&view=rev Author: voltan1 Date: 2012-01-05 09:06:31 +0000 (Thu, 05 Jan 2012) Log Message: ----------- Add News_SpotlightId function for get spotlight id Modified Paths: -------------- XoopsModules/fmcontent/branches/news/blocks/list.php XoopsModules/fmcontent/branches/news/class/story.php XoopsModules/fmcontent/branches/news/templates/blocks/news_list.html Modified: XoopsModules/fmcontent/branches/news/blocks/list.php =================================================================== --- XoopsModules/fmcontent/branches/news/blocks/list.php 2012-01-05 07:58:55 UTC (rev 8640) +++ XoopsModules/fmcontent/branches/news/blocks/list.php 2012-01-05 09:06:31 UTC (rev 8641) @@ -66,8 +66,13 @@ $options0 = $options[0]; $story_infos ['topics'] = $topic_handler->getall (); - $contents = $story_handler->News_GetContentBlockList($NewsModule, $story_infos ,$options); - + $contents = $story_handler->News_GetContentBlockList($NewsModule, $story_infos ,$options); + + if($show == 'spotlight') { + $spotlightid = $story_handler->News_SpotlightId($contents); + $block['spotlightid'] = $spotlightid; + } + // Add block data $block['show'] = $show; $block['img'] = $showimg; Modified: XoopsModules/fmcontent/branches/news/class/story.php =================================================================== --- XoopsModules/fmcontent/branches/news/class/story.php 2012-01-05 07:58:55 UTC (rev 8640) +++ XoopsModules/fmcontent/branches/news/class/story.php 2012-01-05 09:06:31 UTC (rev 8641) @@ -988,6 +988,29 @@ } return $ret; } + + /** + * Get Spotlight Id + */ + function News_SpotlightId($list) { + $defaultid = array(); + $storyid = array(); + + foreach ( $list as $item ) { + $storyid [] = $item['story_id']; + if($item['story_default'] === '1') { + $defaultid [] = $item['story_id']; + } + } + + if($defaultid) { + $spotlightid = max($defaultid); + } else { + $spotlightid = max($storyid); + } + + return $spotlightid; + } } ?> \ No newline at end of file Modified: XoopsModules/fmcontent/branches/news/templates/blocks/news_list.html =================================================================== --- XoopsModules/fmcontent/branches/news/templates/blocks/news_list.html 2012-01-05 07:58:55 UTC (rev 8640) +++ XoopsModules/fmcontent/branches/news/templates/blocks/news_list.html 2012-01-05 09:06:31 UTC (rev 8641) @@ -70,7 +70,7 @@ <{elseif $block.show == 'spotlight'}> <div class="itemBlock"> <{foreach item=content from=$block.contents}> - <{if $content.story_default == 1}> + <{if $content.story_id == $block.spotlightid}> <div class="itemBlockLeft"> <div class="item"> <div class="itemHead"> @@ -102,7 +102,7 @@ <{/if}> <{/foreach}> <{foreach item=content from=$block.contents}> - <{if $content.story_default == 0}> + <{if $content.story_id != $block.spotlightid}> <div class="itemBlockRight"> <h3><{if $content.story_important}><span class="red bold"><{$smarty.const._NEWS_MB_IMPORTANT}></span><{/if}><a href="<{$content.url}>" title="<{$content.story_title}>"><{$content.story_title|truncate:80}></a></h3> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |