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/Model.php';
00026
00027
00028
00029
00042
00043 class FF_Model_News extends FF_Model {
00044
00045
00050 var $title;
00051
00056 var $content;
00057
00062 var $createDate;
00063
00068 var $requiresAuth;
00069
00070
00071
00072
00079 function reset()
00080 {
00081 $this->id = null;
00082 $this->title = null;
00083 $this->content = null;
00084 $this->createDate = null;
00085 $this->requiresAuth = null;
00086 }
00087
00088
00089
00090
00099 function importFromArray($in_data)
00100 {
00101 $this->setId($in_data['id']);
00102 $this->setTitle($in_data['title']);
00103 $this->setContent($in_data['content']);
00104 $this->setCreateDate($in_data['create_date']);
00105 $this->setRequiresAuth($in_data['requires_auth']);
00106 }
00107
00108
00109
00110
00119 function exportToArray()
00120 {
00121 $a_data = array();
00122 $a_data['id'] = $this->getId();
00123 $a_data['title'] = $this->getTitle();
00124 $a_data['content'] = $this->getContent();
00125 $a_data['create_date'] = $this->getCreateDate();
00126 $a_data['requires_auth'] = (int) $this->getRequiresAuth();
00127 return $a_data;
00128 }
00129
00130
00131
00132
00141 function &getNewsArticles($in_auth)
00142 {
00143 $s_where = $in_auth ? '1=1' : 'requires_auth=0';
00144 return $this->o_dataAccess->getListData($s_where, 'create_date', false);
00145 }
00146
00147
00148
00149
00150 function getTitle()
00151 {
00152 return $this->title;
00153 }
00154
00155
00156
00157
00158 function setTitle($in_value)
00159 {
00160 $this->title = $in_value;
00161 }
00162
00163
00164
00165
00166 function getContent()
00167 {
00168 return $this->content;
00169 }
00170
00171
00172
00173
00174 function setContent($in_value)
00175 {
00176 $this->content = $in_value;
00177 }
00178
00179
00180
00181
00182 function getFormattedCreateDate()
00183 {
00184 return date('M d, Y', $this->getCreateDate());
00185 }
00186
00187
00188
00189
00190 function getCreateDate()
00191 {
00192 return $this->createDate;
00193 }
00194
00195
00196
00197
00198 function setCreateDate($in_value)
00199 {
00200 $this->createDate = $in_value;
00201 }
00202
00203
00204
00205
00206 function getRequiresAuth()
00207 {
00208 return $this->requiresAuth;
00209 }
00210
00211
00212
00213
00214 function setRequiresAuth($in_value)
00215 {
00216 $this->requiresAuth = (bool) $in_value;
00217 }
00218
00219
00220
00221
00228 function _initDataAccess()
00229 {
00230 $this->o_dataAccess =& FF_DataAccess::factory('News');
00231 }
00232
00233
00234 }
00235 ?>