Campustream 1.0
A social network MQP for WPI
application/views/news/index.php
Go to the documentation of this file.
00001 <?=
00002         View::factory('news/_navbar')->
00003                 set('type', $type)->
00004                 set('category', $category)->
00005                 set('sorting', $sorting)->
00006                 render()
00007 ?>
00008 
00009 <div id="news-wrap">
00010 
00011         <div id="content-left">
00012         <? if (count($posts) > 0): ?>
00013                 <? foreach ($posts as $news): ?>
00014                 <? $has_voted = $news->has_voted(); ?>
00015                 <div id="news_<?=$news->id?>" class="news-content-wrap">
00016                         <div class="news-vote-wrap">
00017                                 <div class="vote-up <?=$has_voted == 'up' ? 'active' : ''?>"></div>
00018                                 <div class="vote-count <?=$has_voted ? 'active' : ''?>"><?=$news->votes?></div>
00019                                 <div class="vote-down <?=$has_voted == 'down' ? 'active' : ''?>"></div>
00020                         </div>
00021 
00022                         <div class="news-content">
00023                                 <h1><a href="/ne/<?=$news->short_id?>"><?=$news->title?></a></h1>
00024                                 <div class="news-meta">
00025                                         <p><?=ucwords($news->category->type)?> &mdash; <?=$news->upvotes?> upvotes, <?=$news->downvotes?> downvotes &mdash; <?=$news->num_comments?> <?=vocab::plural('comment', $news->num_comments)?></p>
00026                                         <p><?=ucwords($news->type)?> submitted by <a href="/user/<?=$news->user->username?>"><?=$news->user->name?></a> to <a href="/<?=$news->category->type?>/<?=$news->category->slug?>"><?=$news->category->name?></a> <?=date::relative_time($news->time_posted)?></p>
00027                                 </div>
00028                         </div>
00029                                                 
00030                         <div style="clear:both"></div>
00031                 </div>
00032                 <? endforeach; ?>
00033         <? else: ?>
00034         <div id="no-statuses">
00035                 <p>No posts have been submitted here yet! Would you like to <a href="/news/new/">create the first</a>?</p>
00036         </div>
00037         <? endif; ?>
00038         </div>
00039         
00040         <div id="content-right">
00041                 <? if (sess::is_logged_in()): ?>
00042                         <?=View::factory('template/_news_sidebar_auth')->render()?>
00043                 <? else: ?>
00044                         <?=View::factory('template/_news_sidebar_unauth')->render()?>
00045                 <? endif; ?>
00046         </div>
00047 
00048         <div style="clear:both;"></div>
00049 </div>