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/DataAccess.php';
00026
00027
00028
00029
00030
00031 define('ALUMNI_FILTER_WEB_SITE', 1);
00032 define('ALUMNI_FILTER_EMAILS', 2);
00033
00034
00035
00036
00047
00048 class FF_DataAccess_Alumni_mysql extends FF_DataAccess {
00049
00050
00057 function FF_DataAccess_Alumni_mysql()
00058 {
00059 FF_DataAccess::FF_DataAccess();
00060 $this->table = $this->o_registry->getConfigParam('data/alums_table', 'alumni_alums', 'alum_website');
00061 }
00062
00063
00064
00065
00074 function update($in_data)
00075 {
00076 return parent::update($in_data);
00077 }
00078
00079
00080
00081
00090 function add($in_data)
00091 {
00092 return parent::add($in_data);
00093 }
00094
00095
00096
00097
00107 function getDataByPrimaryKey($in_id, $in_fields = '*')
00108 {
00109 return parent::getDataByPrimaryKey($in_id, $this->_getSelectFields());
00110 }
00111
00112
00113
00114
00126 function getListData($in_where, $in_orderByField, $in_orderByDir, $in_fields = '*')
00127 {
00128 $s_profileTable = $this->o_registry->getConfigParam('data/table', 'profile', 'profile');
00129 $s_query = "SELECT a.id, student_id, maiden_name, title, company, address, city,
00130 state, country, postal_code, p.phone, fax, web_site,
00131 major, degree, concentration, grad_year, grad_month,
00132 UNIX_TIMESTAMP(birth_date) AS birth_date,
00133 p.firstname, p.lastname, p.email
00134 FROM $this->table AS a
00135 INNER JOIN $s_profileTable AS p ON a.id = p.id
00136 WHERE p.lastname != '' AND $in_where ORDER BY $in_orderByField " . $this->_getOrderByDirection($in_orderByDir);
00137 return $this->o_data->query($s_query);
00138 }
00139
00140
00141
00142
00155 function getListFilter($in_searchString, $in_searchFields, $in_filter, $in_filterData)
00156 {
00157
00158
00159 if ($in_filter == ALUMNI_FILTER_WEB_SITE) {
00160 return sprintf('web_site != "" AND lastname LIKE %s',
00161 $this->o_data->quoteSmart($in_searchString . '%'));
00162 }
00163
00164 elseif ($in_filter == ALUMNI_FILTER_EMAILS) {
00165 $s_filter = 'is_public = 1 AND ';
00166 }
00167 else {
00168 $s_filter = '';
00169 }
00170
00171 return $s_filter . '(' . parent::getListFilter($in_searchString, $in_searchFields, $in_filter, $in_filterData) . ')';
00172 }
00173
00174
00175
00176
00184 function _getSelectFields()
00185 {
00186
00187
00188
00189 return '*, DATE_FORMAT(birth_date, "%m/%d/%Y") AS birth_date';
00190 }
00191
00192
00193 }
00194 ?>