00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Newsletter_Model_Mysql4_Template_Collection extends Varien_Data_Collection_Db
00035 {
00036
00037
00038
00039
00040
00041 protected $_templateTable;
00042
00043 public function __construct()
00044 {
00045 parent::__construct(Mage::getSingleton('core/resource')->getConnection('newsletter_read'));
00046 $this->_templateTable = Mage::getSingleton('core/resource')->getTableName('newsletter/template');
00047 $this->_select->from($this->_templateTable, array('template_id','template_code',
00048 'template_type',
00049 'template_subject','template_sender_name',
00050 'template_sender_email',
00051 'added_at',
00052 'modified_at'
00053 ));
00054 $this->setItemObjectClass(Mage::getConfig()->getModelClassName('newsletter/template'));
00055 }
00056
00057
00058
00059
00060
00061
00062 public function useOnlyActual()
00063 {
00064 $this->_select->where('template_actual=?', 1);
00065
00066 return $this;
00067 }
00068
00069 public function toOptionArray()
00070 {
00071 return $this->_toOptionArray('template_id', 'template_code');
00072 }
00073
00074 }