Model/Spotlight.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_Spotlight
00029 
00042 // }}}
00043 class FF_Model_Spotlight extends FF_Model {
00044     // {{{ properties
00045 
00050     var $title;
00051 
00056     var $text1;
00057 
00062     var $text2;
00063 
00068     var $text3;
00069 
00074     var $footer;
00075     
00080     var $image1;
00081 
00086     var $image2;
00087 
00092     var $image3;
00093 
00098     var $mimeType1;
00099 
00104     var $mimeType2;
00105 
00110     var $mimeType3;
00111 
00116     var $frontpage = false;
00117 
00122     var $timestamp;
00123 
00128     var $uploadResult;
00129 
00130     // }}}
00131     // {{{ reset()
00132 
00139     function reset()
00140     {
00141         $this->id = null;
00142         $this->title = null;
00143         $this->text1 = null;
00144         $this->text2 = null;
00145         $this->text3 = null;
00146         $this->footer = null;
00147         $this->image1 = null;
00148         $this->image2 = null;
00149         $this->image3 = null;
00150         $this->mimeType1 = null;
00151         $this->mimeType2 = null;
00152         $this->mimeType3 = null;
00153         $this->frontpage = false;
00154     }
00155 
00156     // }}}
00157     // {{{ importFromArray()
00158 
00167     function importFromArray($in_data)
00168     {
00169         $this->setId($in_data['id']);
00170         $this->setTitle($in_data['title']);
00171         $this->setText1($in_data['text1']);
00172         $this->setText2($in_data['text2']);
00173         $this->setText3($in_data['text3']);
00174         $this->setFooter($in_data['footer']);
00175         $this->setFrontpage($in_data['frontpage']);
00176         $this->setTimestamp($in_data['timestamp']);
00177         // Image data usually isn't brought in from the database
00178         if (isset($in_data['image1'])) {
00179             $this->setImage1($in_data['image1']);
00180             $this->setImage2($in_data['image2']);
00181             $this->setImage3($in_data['image3']);
00182             $this->setMimeType1($in_data['mime_type1']);
00183             $this->setMimeType2($in_data['mime_type2']);
00184             $this->setMimeType3($in_data['mime_type3']);
00185         }
00186     }
00187 
00188     // }}}
00189     // {{{ exportToArray()
00190 
00199     function exportToArray()
00200     {
00201         $a_data = array();
00202         $a_data['id'] = $this->getId();
00203         $a_data['title'] = $this->getTitle();
00204         $a_data['text1'] = $this->getText1();
00205         $a_data['text2'] = $this->getText2();
00206         $a_data['text3'] = $this->getText3();
00207         $a_data['footer'] = $this->getFooter();
00208         $a_data['image1'] = $this->getImage1();
00209         $a_data['image2'] = $this->getImage2();
00210         $a_data['image3'] = $this->getImage3();
00211         $a_data['mime_type1'] = $this->getMimeType1();
00212         $a_data['mime_type2'] = $this->getMimeType2();
00213         $a_data['mime_type3'] = $this->getMimeType3();
00214         $a_data['frontpage'] = $this->getFrontpage();
00215         $a_data['timestamp'] = $this->getTimestamp();
00216         return $a_data;
00217     }
00218 
00219     // }}}
00220     // {{{ setUploadImage()
00221 
00234     function setUploadImage($in_imageData, $in_imageRemove, $in_imageNum)
00235     {
00236         if (!is_object($this->uploadResult)) {
00237             $this->uploadResult = new FF_Result();
00238         }
00239 
00240         $s_mimeMethod = 'setMimeType' . $in_imageNum;
00241         $s_imageMethod = 'setImage' . $in_imageNum;
00242         if ($in_imageRemove) {
00243             $this->$s_mimeMethod('');
00244             $this->$s_imageMethod('');
00245         }
00246 
00247         if (is_array($in_imageData) && is_uploaded_file($in_imageData['tmp_name'])) {
00248             $this->$s_mimeMethod($in_imageData['type']);
00249             require_once 'File.php';
00250             $this->$s_imageMethod(File::readAll($in_imageData['tmp_name']));
00251         }
00252     }
00253 
00254     // }}}
00255     // {{{ loadImageData()
00256 
00266     function loadImageData($in_id, $in_num)
00267     {
00268         // Make sure the number is always valid
00269         $a_data = $this->o_dataAccess->getImageData($in_id, $in_num);
00270         if (!is_array($a_data)) {
00271             return false;
00272         }
00273         else {
00274             $s_method = 'setImage' . $in_num;
00275             $this->$s_method($a_data[0]);
00276             $s_method = 'setMimeType' . $in_num;
00277             $this->$s_method($a_data[1]);
00278             return true;
00279         }
00280     }
00281 
00282     // }}}
00283     // {{{ getTitle()
00284 
00285     function getTitle()
00286     {
00287         return $this->title;
00288     }
00289 
00290     // }}}
00291     // {{{ setTitle()
00292 
00293     function setTitle($in_value)
00294     {
00295         $this->title = $in_value;
00296     }
00297 
00298     // }}}
00299     // {{{ getText1()
00300 
00301     function getText1()
00302     {
00303         return $this->text1;
00304     }
00305 
00306     // }}}
00307     // {{{ setText1()
00308 
00309     function setText1($in_value)
00310     {
00311         $this->text1 = $in_value;
00312     }
00313 
00314     // }}}
00315     // {{{ getText2()
00316 
00317     function getText2()
00318     {
00319         return $this->text2;
00320     }
00321 
00322     // }}}
00323     // {{{ setText2()
00324 
00325     function setText2($in_value)
00326     {
00327         $this->text2 = $in_value;
00328     }
00329 
00330     // }}}
00331     // {{{ getText3()
00332 
00333     function getText3()
00334     {
00335         return $this->text3;
00336     }
00337 
00338     // }}}
00339     // {{{ setText3()
00340 
00341     function setText3($in_value)
00342     {
00343         $this->text3 = $in_value;
00344     }
00345 
00346     // }}}
00347     // {{{ getFooter()
00348 
00349     function getFooter()
00350     {
00351         return $this->footer;
00352     }
00353 
00354     // }}}
00355     // {{{ setFooter()
00356 
00357     function setFooter($in_value)
00358     {
00359         $this->footer = $in_value;
00360     }
00361 
00362     // }}}
00363     // {{{ getImage1()
00364 
00365     function getImage1()
00366     {
00367         return $this->image1;
00368     }
00369 
00370     // }}}
00371     // {{{ setImage1()
00372 
00373     function setImage1($in_value)
00374     {
00375         $this->image1 = $in_value;
00376     }
00377 
00378     // }}}
00379     // {{{ getImage2()
00380 
00381     function getImage2()
00382     {
00383         return $this->image2;
00384     }
00385 
00386     // }}}
00387     // {{{ setImage2()
00388 
00389     function setImage2($in_value)
00390     {
00391         $this->image2 = $in_value;
00392     }
00393 
00394     // }}}
00395     // {{{ getImage3()
00396 
00397     function getImage3()
00398     {
00399         return $this->image3;
00400     }
00401 
00402     // }}}
00403     // {{{ setImage3()
00404 
00405     function setImage3($in_value)
00406     {
00407         $this->image3 = $in_value;
00408     }
00409 
00410     // }}}
00411     // {{{ getMimeType1()
00412 
00413     function getMimeType1()
00414     {
00415         return $this->mimeType1;
00416     }
00417 
00418     // }}}
00419     // {{{ setMimeType1()
00420 
00421     function setMimeType1($in_value)
00422     {
00423         $this->mimeType1 = $in_value;
00424     }
00425 
00426     // }}}
00427     // {{{ getMimeType2()
00428 
00429     function getMimeType2()
00430     {
00431         return $this->mimeType2;
00432     }
00433 
00434     // }}}
00435     // {{{ setMimeType2()
00436 
00437     function setMimeType2($in_value)
00438     {
00439         $this->mimeType2 = $in_value;
00440     }
00441 
00442     // }}}
00443     // {{{ getMimeType3()
00444 
00445     function getMimeType3()
00446     {
00447         return $this->mimeType3;
00448     }
00449 
00450     // }}}
00451     // {{{ setMimeType3()
00452 
00453     function setMimeType3($in_value)
00454     {
00455         $this->mimeType3 = $in_value;
00456     }
00457 
00458     // }}}
00459     // {{{ getFrontpageId()
00460 
00467     function getFrontpageId()
00468     {
00469         return $this->o_dataAccess->getFrontpageId();
00470     }
00471 
00472     // }}}
00473     // {{{ getFormattedFrontpage()
00474 
00475     function getFormattedFrontpage()
00476     {
00477         return $this->getFrontpage() ? _('Yes') : _('No');
00478     }
00479 
00480     // }}}
00481     // {{{ getFrontpage()
00482 
00483     function getFrontpage()
00484     {
00485         return $this->frontpage;
00486     }
00487 
00488     // }}}
00489     // {{{ setFrontpage()
00490 
00491     function setFrontpage($in_value)
00492     {
00493         $this->frontpage = $this->_scalarToBool($in_value);
00494     }
00495 
00496     // }}}
00497     // {{{ getFormattedTimestamp()
00498 
00499     function getFormattedTimestamp()
00500     {
00501         return date('m/d/Y h:i a', $this->getTimestamp());
00502     }
00503 
00504     // }}}
00505     // {{{ getTimestamp()
00506 
00507     function getTimestamp()
00508     {
00509         return $this->timestamp;
00510     }
00511 
00512     // }}}
00513     // {{{ setTimestamp()
00514 
00515     function setTimestamp($in_value)
00516     {
00517         $this->timestamp = $in_value;
00518     }
00519 
00520     // }}}
00521     // {{{ _initDataAccess()
00522 
00529     function _initDataAccess()
00530     {
00531         $this->o_dataAccess =& FF_DataAccess::factory('Spotlight');
00532     }
00533 
00534     // }}}
00535 }
00536 ?>

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