AlumniLinks.php

Go to the documentation of this file.
00001 <?php
00003 // {{{ license
00004 
00005 // +----------------------------------------------------------------------+
00006 // | FastFrame Application Framework                                      |
00007 // +----------------------------------------------------------------------+
00008 // | Copyright (c) 2002-2006 The Codejanitor Group                        |
00009 // +----------------------------------------------------------------------+
00010 // | This source file is subject to the GNU Lesser Public License (LGPL), |
00011 // | that is bundled with this package in the file LICENSE, and is        |
00012 // | available at through the world-wide-web at                           |
00013 // | http://www.fsf.org/copyleft/lesser.html                              |
00014 // | If you did not receive a copy of the LGPL and are unable to          |
00015 // | obtain it through the world-wide-web, you can get it by writing the  |
00016 // | Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
00017 // | MA 02111-1307, USA.                                                  |
00018 // +----------------------------------------------------------------------+
00019 // | Authors: Jason Rust <jrust@codejanitor.com>                          |
00020 // | Authors: Greg Gilbert <ggilbert@codejanitor.com>                     |
00021 // +----------------------------------------------------------------------+
00022 
00023 // }}}
00024 // {{{ requires
00025 
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Display.php';
00027 
00028 // }}}
00029 // {{{ class FF_Action_Display_Links 
00030 
00041 // }}}
00042 class FF_Action_Display_Links extends FF_Action {
00043     // {{{ run()
00044 
00052     function run()
00053     {
00054         $this->o_output->setPageName($this->getPluralText());
00055         // If the letter to show is invalid or not present, start with a
00056         $s_searchLetter = strtolower(FF_Request::getParam('letter', 'g', 'a'));
00057         if (!preg_match('/[a-z]/', $s_searchLetter)) {
00058             $s_searchLetter = 'a';
00059         }
00060 
00061         // Search widget
00062         $o_widget =& new FF_Smarty('linksNav');
00063         $o_widget->assign(array(
00064                     'T_links_navTitle' => _('Alumni web sites sorted by last name'),
00065                     'T_links_navHelp' => sprintf(_('If you are an alumnus of %s and would like to have your web site linked here select "update" from the menu at the left.'), $this->o_registry->getConfigParam('alumni/school_name'))));
00066 
00067         $s_count = 0;
00068         foreach(range('A', 'Z') as $s_letter) {
00069             $s_break = (++$s_count % 6 == 0) ? '<br />' : '';
00070             $o_widget->append('links_navLetter', $this->o_output->link(
00071                         FastFrame::selfURL(array('letter' => $s_letter)), $s_letter) . $s_break);
00072         }
00073 
00074         $this->o_output->o_tpl->append('content_right', $o_widget->fetch());
00075 
00076         // Links widget
00077         $o_widget =& new FF_Smarty('links');
00078         $o_widget->assign('I_letter', $this->o_output->imgTag(
00079                     $s_searchLetter . '.gif', 'letters', 
00080                     array('app' => 'alum_website', 'name' => $s_searchLetter)));
00081 
00082         $o_result =& $this->o_model->getWebSites($s_searchLetter);
00083         if ($o_result->numRows() == 0) {
00084             $o_widget->append('links_row', array('T_alumni_site' => '',
00085                         'T_alumni_name' => '<span style="font-style: italic;">' . 
00086                         sprintf(_('There are no %s to display'), strtolower($this->getPluralText())) . 
00087                         '</span>'));
00088         }
00089         else {
00090             while ($a_row = $o_result->fetchRow()) {
00091                 $this->o_model->reset();
00092                 $this->o_model->importFromArray($a_row);
00093                 $o_widget->append('links_row', array(
00094                             'T_alumni_name' => $this->o_model->getFirstName() . ' ' . $this->o_model->getLastName(),
00095                             'T_alumni_site' => $this->o_output->link($this->o_model->getWebSite(), 
00096                                 $this->o_model->getWebSite(), array('target' => '_blank'))));
00097             }
00098         }
00099 
00100         $this->o_output->o_tpl->append('content_middle', $o_widget->fetch());
00101         return $this->o_nextAction;
00102     }
00103 
00104     // }}}
00105     // {{{ getPluralText()
00106 
00113     function getPluralText()
00114     {
00115         return _('Links');
00116     }
00117 
00118     // }}}
00119 }
00120 ?>

Generated on Fri Jun 23 11:38:14 2006 for FastFrame by  doxygen 1.4.4