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_Comment extends FF_Model {
00044
00045
00050 var $transactionId;
00051
00056 var $createdDate;
00057
00062 var $userId;
00063
00068 var $comment;
00069
00070
00071
00072
00079 function reset()
00080 {
00081 $this->id = null;
00082 $this->transactionId = null;
00083 $this->createdDate = null;
00084 $this->userId = null;
00085 $this->comment = null;
00086 }
00087
00088
00089
00090
00099 function importFromArray($in_data)
00100 {
00101 $this->setId($in_data['id']);
00102 $this->setTransactionId($in_data['transaction_id']);
00103 $this->setUserId($in_data['user_id']);
00104 $this->setCreatedDate($in_data['created_date']);
00105 $this->setComment($in_data['comment']);
00106 }
00107
00108
00109
00110
00119 function exportToArray()
00120 {
00121 $a_data = array();
00122 $a_data['id'] = $this->getId();
00123 $a_data['transaction_id'] = $this->getTransactionId();
00124 $a_data['user_id'] = $this->getUserId();
00125 $a_data['created_date'] = $this->getCreatedDate();
00126 $a_data['comment'] = $this->getComment();
00127 return $a_data;
00128 }
00129
00130
00131
00132
00141 function getCommentsByTransactionId($in_id)
00142 {
00143 return $this->o_dataAccess->getCommentsByTransactionId($in_id);
00144 }
00145
00146
00147
00148
00160 function processComments($in_transactionId, $in_newComment, $in_removeComments, &$in_resultObj)
00161 {
00162 foreach ($in_removeComments as $s_id) {
00163 $tmp_result =& $this->remove($s_id);
00164 if (!$tmp_result->isSuccess()) {
00165 $in_resultObj->addMessage($tmp_result->getMessages());
00166 }
00167 }
00168
00169 if (!empty($in_newComment)) {
00170 $this->setTransactionId($in_transactionId);
00171 $this->setComment($in_newComment);
00172 $tmp_result =& $this->save(false);
00173 if (!$tmp_result->isSuccess()) {
00174 $in_resultObj->addMessage($tmp_result->getMessages());
00175 }
00176 }
00177 }
00178
00179
00180
00181
00182 function getTransactionId()
00183 {
00184 return $this->transactionId;
00185 }
00186
00187
00188
00189
00190 function setTransactionId($in_value)
00191 {
00192 $this->transactionId = $in_value;
00193 }
00194
00195
00196
00197
00204 function getUserFullName()
00205 {
00206 $o_profileDataAccess =& FF_DataAccess::factory('Profile', 'profile');
00207 return $o_profileDataAccess->getFullNameById($this->getUserId());
00208 }
00209
00210
00211
00212
00213 function getUserId()
00214 {
00215 return is_null($this->userId) ? FF_Auth::getCredential('userId') : $this->userId;
00216 }
00217
00218
00219
00220
00221 function setUserId($in_value)
00222 {
00223 $this->userId = $in_value;
00224 }
00225
00226
00227
00228
00235 function getFormmatedCreatedDate()
00236 {
00237 return date('m/d/Y h:ia', $this->getCreatedDate());
00238 }
00239
00240
00241
00242
00243 function getCreatedDate()
00244 {
00245 return $this->createdDate;
00246 }
00247
00248
00249
00250
00251 function setCreatedDate($in_value)
00252 {
00253 $this->createdDate = $in_value;
00254 }
00255
00256
00257
00258
00259 function getComment()
00260 {
00261 return $this->comment;
00262 }
00263
00264
00265
00266
00267 function setComment($in_value)
00268 {
00269 $this->comment = $in_value;
00270 }
00271
00272
00273
00274
00281 function _initDataAccess()
00282 {
00283 $this->o_dataAccess =& FF_DataAccess::factory('Comment');
00284 }
00285
00286
00287 }
00288 ?>