Model/News.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_News
00029 
00042 // }}}
00043 class FF_Model_News extends FF_Model {
00044     // {{{ properties
00045 
00050     var $title;
00051 
00056     var $content;
00057     
00062     var $createDate;
00063 
00068      var $requiresAuth;
00069 
00070     // }}}
00071     // {{{ reset()
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     // {{{ importFromArray()
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     // {{{ exportToArray()
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     // {{{ getNewsArticles()
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     // {{{ getTitle()
00149 
00150     function getTitle()
00151     {
00152         return $this->title;
00153     }
00154 
00155     // }}}
00156     // {{{ setTitle()
00157 
00158     function setTitle($in_value)
00159     {
00160         $this->title = $in_value;
00161     }
00162 
00163     // }}}
00164     // {{{ getContent()
00165 
00166     function getContent()
00167     {
00168         return $this->content;
00169     }
00170 
00171     // }}}
00172     // {{{ setContent()
00173 
00174     function setContent($in_value)
00175     {
00176         $this->content = $in_value;
00177     }
00178 
00179     // }}}
00180     // {{{ getFormattedCreateDate()
00181 
00182     function getFormattedCreateDate()
00183     {
00184         return date('M d, Y', $this->getCreateDate());
00185     }
00186 
00187     // }}}
00188     // {{{ getCreateDate()
00189 
00190     function getCreateDate()
00191     {
00192         return $this->createDate;
00193     }
00194 
00195     // }}}
00196     // {{{ setCreateDate()
00197 
00198     function setCreateDate($in_value)
00199     {
00200         $this->createDate = $in_value;
00201     }
00202 
00203     // }}}
00204     // {{{ getRequiresAuth()
00205 
00206     function getRequiresAuth()
00207     {
00208         return $this->requiresAuth;
00209     }
00210 
00211     // }}}
00212     // {{{ setRequiresAuth()
00213 
00214     function setRequiresAuth($in_value)
00215     {
00216         $this->requiresAuth = (bool) $in_value;
00217     }
00218 
00219     // }}}
00220     // {{{ _initDataAccess()
00221 
00228     function _initDataAccess()
00229     {
00230         $this->o_dataAccess =& FF_DataAccess::factory('News');
00231     }
00232 
00233     // }}}
00234 }
00235 ?>

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