checkout/lib/Model/Comment.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 // +----------------------------------------------------------------------+
00021 
00022 // }}}
00023 // {{{ requires
00024 
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Model.php';
00026 
00027 // }}}
00028 // {{{ class FF_Model_Comment
00029 
00042 // }}}
00043 class FF_Model_Comment extends FF_Model {
00044     // {{{ properties
00045 
00050     var $transactionId;
00051 
00056     var $createdDate;
00057     
00062     var $userId;
00063 
00068     var $comment;
00069 
00070     // }}}
00071     // {{{ reset()
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     // {{{ importFromArray()
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     // {{{ exportToArray()
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     // {{{ getCommentsByTransactionId()
00132 
00141     function getCommentsByTransactionId($in_id)
00142     {
00143         return $this->o_dataAccess->getCommentsByTransactionId($in_id);
00144     }
00145 
00146     // }}}
00147     // {{{ processComments()
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     // {{{ getTransactionId()
00181 
00182     function getTransactionId()
00183     {
00184         return $this->transactionId;
00185     }
00186 
00187     // }}}
00188     // {{{ setTransactionId()
00189 
00190     function setTransactionId($in_value)
00191     {
00192         $this->transactionId = $in_value;
00193     }
00194 
00195     // }}}
00196     // {{{ getUserFullName()
00197 
00204     function getUserFullName()
00205     {
00206         $o_profileDataAccess =& FF_DataAccess::factory('Profile', 'profile');
00207         return $o_profileDataAccess->getFullNameById($this->getUserId());
00208     }
00209 
00210     // }}}
00211     // {{{ getUserId()
00212 
00213     function getUserId()
00214     {
00215         return is_null($this->userId) ? FF_Auth::getCredential('userId') : $this->userId;
00216     }
00217 
00218     // }}}
00219     // {{{ setUserId()
00220 
00221     function setUserId($in_value)
00222     {
00223         $this->userId = $in_value;
00224     }
00225 
00226     // }}}
00227     // {{{ getFormmatedCreatedDate()
00228 
00235     function getFormmatedCreatedDate()
00236     {
00237         return date('m/d/Y h:ia', $this->getCreatedDate());
00238     }
00239 
00240     // }}}
00241     // {{{ getCreatedDate()
00242 
00243     function getCreatedDate()
00244     {
00245         return $this->createdDate;
00246     }
00247 
00248     // }}}
00249     // {{{ setCreatedDate()
00250 
00251     function setCreatedDate($in_value)
00252     {
00253         $this->createdDate = $in_value;
00254     }
00255 
00256     // }}}
00257     // {{{ getComment()
00258 
00259     function getComment()
00260     {
00261         return $this->comment;
00262     }
00263 
00264     // }}}
00265     // {{{ setComment()
00266 
00267     function setComment($in_value)
00268     {
00269         $this->comment = $in_value;
00270     }
00271 
00272     // }}}
00273     // {{{ _initDataAccess()
00274 
00281     function _initDataAccess()
00282     {
00283         $this->o_dataAccess =& FF_DataAccess::factory('Comment');
00284     }
00285 
00286     // }}}
00287 }
00288 ?>

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