Campustream 1.0
A social network MQP for WPI
application/views/news/show.php
Go to the documentation of this file.
00001 <?=
00002         View::factory('news/_navbar')->
00003                 set('type', $news->category->type)->
00004                 set('category', $news->category)->
00005                 set('sorting', false)->
00006                 render()
00007 ?>
00008 
00009 <? $has_voted = $news->has_voted(); ?>
00010 <div id="news-wrap">
00011 
00012         <div id="content-left">
00013                 <? if($_GET['new']): ?>
00014                 <div id="news-new-notification">
00015                         <p>Here is your new post! Please note that it may take up to 5 minutes for it to be listed on the site.</p>
00016                 </div>
00017                 <? endif; ?>
00018                 
00019                 <div id="news_<?=$news->id?>" class="news-content-wrap">
00020                         <div class="news-vote-wrap">
00021                                 <div class="vote-up <?=$has_voted == 'up' ? 'active' : ''?>"></div>
00022                                 <div class="vote-count <?=$has_voted ? 'active' : ''?>"><?=$news->votes?></div>
00023                                 <div class="vote-down <?=$has_voted == 'down' ? 'active' : ''?>"></div>
00024                         </div>
00025 
00026                         <div class="news-content">
00027                                 <h1><a target="_blank" href="<?=$news->type == 'link' ? $news->post : '#'?>"><?=$news->title?></a></h1>
00028                                 <div class="news-meta">
00029                                         <p><?=ucwords($news->category->type)?> &mdash; <?=$news->upvotes?> upvotes, <?=$news->downvotes?> downvotes</p>
00030                                         <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>
00031                                 </div>
00032                         </div>
00033 
00034                         <div style="clear: both"></div>
00035                         <? if ($news->category->type == 'event' && $news->eventmeta): ?>
00036                         <div id="event-meta">
00037                                 <h1>Event Information</h1>
00038                                 
00039                                 <? if ($news->eventmeta->location): ?>
00040                                         <h2>Where</h2>
00041                                         <p><?=$news->eventmeta->location?></p>
00042                                         <p><small><?=is_numeric($news->eventmeta->location_area) ? 'Room' : ''?> <?=$news->eventmeta->location_area?></small></p>
00043                                 <? endif; ?>
00044                                 
00045                                 <? if (strtotime($news->eventmeta->start_date) > 0 || $news->eventmeta->all_day): ?>
00046                                         <h2>When</h2>
00047                                         <? if ($news->eventmeta->all_day): ?>
00048                                                 <p>Event runs all day <?=date::relative_time($news->eventmeta->start_date)?></p>
00049                                         <? else: ?>
00050                                                 <p>Event starts <?=date::relative_time($news->eventmeta->start_date)?></p>
00051                                                 <p><small>
00052                                                 <? if(strtotime($news->eventmeta->start_date) > 0): ?>
00053                                                         From <?=date('F j, Y g:ia', strtotime($news->eventmeta->start_date))?> 
00054                                                 <? endif; ?>
00055                                                 <? if(strtotime($news->eventmeta->end_date) > 0): ?>
00056                                                         to <?=date('F j, Y g:ia', strtotime($news->eventmeta->end_date))?></small></p>
00057                                                 <? else: ?>
00058                                                         onwards
00059                                                 <? endif; ?>
00060                                         <? endif; ?>
00061                                 <? endif; ?>
00062                         </div>
00063                         <? endif; ?>
00064                         
00065                         <? if ($news->type == 'text'): ?>
00066                         <div style="clear:both"></div>
00067                         <div id="news-content-text">
00068                                 <?=bbparser::bb2html($news->post)?>
00069                         </div>
00070                         <? endif; ?>
00071                                                 
00072                         <div style="clear:both"></div>
00073                 </div>
00074                 
00075                 <div id="news-comments-wrap">
00076                         <h1><?=$news->num_comments?> <?=vocab::plural('Comment', $news->num_comments)?></h1>
00077                         
00078                         <div id="outer-comment-wrap">
00079                                 <?=View::factory('news/_comments')->set('comments', $news->comments)->render(); ?>
00080                         </div>
00081                         
00082                         <div id="reply-to-0" class="news-comment-reply-to" style="display: block">
00083                                 <textarea class="news-comment-reply"></textarea>
00084                                 <div class="comment-reply-button">
00085                                         <input type="button" class="fancy-button-blue" value="Post Comment" />
00086                                 </div>
00087                         </div>
00088                 </div>
00089         </div>
00090         
00091         <div id="content-right">
00092                 <? if (sess::is_logged_in()): ?>
00093                         <?=View::factory('template/_news_sidebar_auth')->render()?>
00094                 <? else: ?>
00095                         <?=View::factory('template/_news_sidebar_unauth')->render()?>
00096                 <? endif; ?>
00097         </div>
00098 
00099         <div style="clear:both;"></div>
00100 </div>