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 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/List.php';
00026
00027
00028
00029
00040
00041 class FF_Action_List_Alumni extends FF_Action_List {
00042
00043
00050 function renderAdditionalLinks()
00051 {
00052 $o_widget =& new FF_Smarty('emailSearch');
00053 $o_widget->assign('T_email_navTitle', _('Search by graduation year'));
00054 foreach(range($this->o_registry->getConfigParam('alumni/first_grad_year'), date('Y')) as $s_year) {
00055 $s_separator = ($s_year % 5 == 4) ? '<br />' : '';
00056 $o_widget->append('email_navYear', $this->o_output->link(
00057 FastFrame::selfURL(
00058 array('searchString[' . $this->o_list->getListId() . ']' => $s_year)),
00059 substr($s_year, -2)) . $s_separator);
00060 }
00061
00062 $this->o_output->o_tpl->append('content_right', $o_widget->fetch());
00063 }
00064
00065
00066
00067
00074 function initList()
00075 {
00076 parent::initList();
00077
00078 $this->o_list->setSearchBoxType(SEARCH_BOX_SIMPLE, false);
00079 $this->o_list->toggleTypeLocked(true);
00080
00081 if (is_null($this->o_list->getSearchString())) {
00082 $this->o_list->setSearchString($this->o_registry->getConfigParam('alumni/email_year'));
00083 }
00084 }
00085
00086
00087
00088
00096 function getFilter()
00097 {
00098 return array(ALUMNI_FILTER_EMAILS, array());
00099 }
00100
00101
00102
00103
00110 function getDefaultSortField()
00111 {
00112 return 'lastname';
00113 }
00114
00115
00116
00117
00124 function getFieldMap()
00125 {
00126 return array(
00127 array('field' => 'firstname', 'description' => _('First Name'), 'method' => 'getFirstName'),
00128 array('field' => 'lastname', 'description' => _('Last Name'), 'method' => 'getLastName'),
00129 array('sort' => 'email', 'description' => _('Email'), 'object' => &$this, 'method' => '_getEmail', 'dataIsSafe' => true),
00130 array('field' => 'grad_year', 'description' => _('Grad Year'), 'method' => 'getGradYear'),
00131 array('field' => 'major', 'description' => _('Major'), 'method' => 'getMajor'),
00132 array('field' => 'state', 'description' => _('State'), 'method' => 'getState'),
00133 array('field' => 'city', 'description' => _('City'), 'method' => 'getCity'),
00134 array('description' => _('Web Site'), 'object' => &$this, 'method' => '_getLinkedWebsite', 'dataIsSafe' => true),
00135 );
00136 }
00137
00138
00139
00140
00147 function getSingularText()
00148 {
00149 return _('Alumnus');
00150 }
00151
00152
00153
00154
00161 function getPluralText()
00162 {
00163 return _('Alumni');
00164 }
00165
00166
00167
00168
00175 function checkPerms()
00176 {
00177 if ($this->o_perms->hasPerm('can_list_alumni')) {
00178 return true;
00179 }
00180 else {
00181 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00182 $this->o_output->setMessage(_('You do not have permission to list alumni.'), FASTFRAME_ERROR_MESSAGE);
00183 return false;
00184 }
00185 }
00186
00187
00188
00189
00198 function _getEmail()
00199 {
00200 if (FastFrame::isEmpty($this->o_model->getEmail())) {
00201 return '';
00202 }
00203
00204 if ($this->o_registry->getConfigParam('alumni/emails_as_img')) {
00205 $o_fileCache =& FF_FileCache::singleton();
00206 $a_parts = array('subdir' => 'email_images', 'name' => md5($this->o_model->getEmail()) . '.gif');
00207 if (!$o_fileCache->exists($a_parts, true)) {
00208 $s_fontNum = 3;
00209 $s_width = imagefontwidth($s_fontNum) * strlen($this->o_model->getEmail());
00210 $im = imagecreate($s_width, imagefontheight($s_fontNum));
00211 $black = imagecolorallocate($im, 0, 0, 0);
00212 $white = imagecolorallocate($im, 255, 255, 255);
00213 $white = imagecolortransparent($im, $white);
00214 imagefill($im, 0, 0, $white);
00215 imagestring($im, $s_fontNum, 0, 0, $this->o_model->getEmail(), $black);
00216 $o_fileCache->checkDir($a_parts, true);
00217 imagegif($im, $o_fileCache->getPath($a_parts, true));
00218 imagedestroy($im);
00219 $o_fileCache->makeViewableFromWeb($a_parts, true);
00220 }
00221
00222 return $this->o_output->imgTag($o_fileCache->getPath($a_parts, true, FASTFRAME_WEBPATH));
00223 }
00224 else {
00225 return $this->o_model->getEmail();
00226 }
00227 }
00228
00229
00230
00231
00238 function _getLinkedWebsite()
00239 {
00240 if (!FastFrame::isEmpty($this->o_model->getWebSite())) {
00241 return $this->o_output->link($this->o_model->getWebSite(),
00242 $this->o_model->getWebSite(), array('target' => '_blank'));
00243 }
00244 else {
00245 return '';
00246 }
00247 }
00248
00249
00250 }
00251 ?>