00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Display.php';
00027
00028
00029
00030
00041
00042 class FF_Action_Display_News extends FF_Action {
00043
00044
00052 function run()
00053 {
00054 $this->o_output->setPageName($this->getPluralText());
00055 $o_result =& $this->o_model->getNewsArticles((FF_Auth::checkAuth() && $this->o_perms->hasPerm('can_view_protected_news')));
00056 if ($o_result->numRows() == 0) {
00057 $this->o_output->o_tpl->append('page_explanation', '<span style="font-style: italic;">' .
00058 sprintf(_('There are no %s to display'), $this->getPluralText()) .
00059 '</span>');
00060 }
00061 else {
00062 require_once 'HTML/BBCodeParser.php';
00063 $o_bbCodeParser =& new HTML_BBCodeParser(array('filters' => 'Basic,Email,Links'));
00064 $o_widget =& new FF_Smarty('news');
00065 $s_count = 0;
00066 if (FF_Request::getParam('showAll', 'g', false)) {
00067 $s_limit = $o_result->numRows();
00068 }
00069 else {
00070 $s_limit = $this->o_registry->getConfigParam('alumni/news_limit');
00071 }
00072
00073 while (($a_row = $o_result->fetchRow(DB_FETCHMODE_DEFAULT, $s_count)) &&
00074 $s_count < $s_limit) {
00075 $s_count++;
00076 $this->o_model->reset();
00077 $this->o_model->importFromArray($a_row);
00078 $o_widget->append('news_items', array(
00079 'T_news_id' => $this->o_model->getId(),
00080 'T_news_title' => $this->o_model->getTitle(),
00081 'T_news_create_date' => $this->o_model->getFormattedCreateDate(),
00082 'T_news_content' => nl2br($o_bbCodeParser->qparse(htmlspecialchars($this->o_model->getContent())))));
00083 }
00084
00085 $this->o_output->o_tpl->append('content_middle', $o_widget->fetch());
00086 if ($o_result->numRows() > $s_count) {
00087 $this->o_output->o_tpl->append('content_middle',
00088 '<div style="text-align: center;">' .
00089 $this->o_output->link(
00090 FastFrame::selfURL(array('showAll' => 1)),
00091 sprintf(_('View All %s'), $this->getPluralText())) .
00092 '</div>');
00093 }
00094 }
00095
00096 return $this->o_nextAction;
00097 }
00098
00099
00100
00101
00108 function getPluralText()
00109 {
00110 return _('News Articles');
00111 }
00112
00113
00114 }
00115 ?>