Mage_Adminhtml_System_Email_TemplateController Class Reference

Inheritance diagram for Mage_Adminhtml_System_Email_TemplateController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 gridAction ()
 newAction ()
 editAction ()
 saveAction ()
 deleteAction ()
 previewAction ()
 defaultTemplateAction ()

Protected Member Functions

 _isAllowed ()


Detailed Description

Definition at line 34 of file TemplateController.php.


Member Function Documentation

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 149 of file TemplateController.php.

00150     {
00151         return Mage::getSingleton('admin/session')->isAllowed('system/email_template');
00152     }

defaultTemplateAction (  ) 

Definition at line 140 of file TemplateController.php.

00141     {
00142         $template = Mage::getModel('core/email_template');
00143 
00144         $template->loadDefault($this->getRequest()->getParam('code'), $this->getRequest()->getParam('locale'));
00145 
00146         $this->getResponse()->setBody(Zend_Json::encode($template->getData()));
00147     }

deleteAction (  ) 

Definition at line 118 of file TemplateController.php.

00118                                    {
00119 
00120         $template = Mage::getModel('core/email_template');
00121         $id = (int)$this->getRequest()->getParam('id');
00122         $template->load($id);
00123         if($template->getId()) {
00124             try {
00125                 $template->delete();
00126             }
00127             catch (Exception $e) {
00128                 // Nothing
00129             }
00130         }
00131         $this->_redirect('*/*');
00132     }

editAction (  ) 

Definition at line 74 of file TemplateController.php.

00075     {
00076         $this->_forward('new');
00077     }

gridAction (  ) 

Definition at line 51 of file TemplateController.php.

00052     {
00053         $this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/system_email_template_grid')->toHtml());
00054     }

indexAction (  ) 

Definition at line 36 of file TemplateController.php.

00037     {
00038         if ($this->getRequest()->getQuery('ajax')) {
00039             $this->_forward('grid');
00040             return;
00041         }
00042 
00043         $this->loadLayout();
00044         $this->_setActiveMenu('system/email_template');
00045         $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Transactional Emails'), Mage::helper('adminhtml')->__('Transactional Emails'));
00046 
00047         $this->_addContent($this->getLayout()->createBlock('adminhtml/system_email_template', 'template'));
00048         $this->renderLayout();
00049     }

newAction (  ) 

Definition at line 57 of file TemplateController.php.

00058     {
00059         $this->loadLayout();
00060         $this->_setActiveMenu('system/email_template');
00061         $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Transactional Emails'), Mage::helper('adminhtml')->__('Transactional Emails'), $this->getUrl('*/*'));
00062 
00063         if ($this->getRequest()->getParam('id')) {
00064             $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Edit Template'), Mage::helper('adminhtml')->__('Edit System Template'));
00065         } else {
00066             $this->_addBreadcrumb(Mage::helper('adminhtml')->__('New Template'), Mage::helper('adminhtml')->__('New System Template'));
00067         }
00068 
00069         $this->_addContent($this->getLayout()->createBlock('adminhtml/system_email_template_edit', 'template_edit')
00070                                                             ->setEditMode((bool)$this->getRequest()->getParam('id')));
00071         $this->renderLayout();
00072     }

previewAction (  ) 

Definition at line 134 of file TemplateController.php.

00135     {
00136         $this->loadLayout('systemPreview');
00137         $this->renderLayout();
00138     }

saveAction (  ) 

Definition at line 79 of file TemplateController.php.

00080     {
00081         $request = $this->getRequest();
00082         $template = Mage::getModel('core/email_template');
00083         if ($id = (int)$request->getParam('id')) {
00084             $template->load($id);
00085         }
00086 
00087         try {
00088             $template->setTemplateSubject($request->getParam('template_subject'))
00089                 ->setTemplateCode($request->getParam('template_code'))
00090 /*
00091                 ->setTemplateSenderEmail($request->getParam('sender_email'))
00092                 ->setTemplateSenderName($request->getParam('sender_name'))
00093 */
00094                 ->setTemplateText($request->getParam('template_text'))
00095                 ->setModifiedAt(Mage::getSingleton('core/date')->gmtDate());
00096 
00097             if (!$template->getId()) {
00098                 $type = constant(Mage::getConfig()->getModelClassName('core/email_template') . "::TYPE_HTML");
00099                 $template->setTemplateType($type);
00100             }
00101 
00102             if($this->getRequest()->getParam('_change_type_flag')) {
00103                 $type = constant(Mage::getConfig()->getModelClassName('core/email_template') . "::TYPE_TEXT");
00104                 $template->setTemplateType($type);
00105             }
00106 
00107             $template->save();
00108             $this->_redirect('*/*');
00109         }
00110         catch (Exception $e) {
00111             Mage::getSingleton('adminhtml/session')->setData('email_template_form_data', $this->getRequest()->getParams());
00112             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
00113             $this->_forward('new');
00114         }
00115 
00116     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:30 2009 for Magento by  doxygen 1.5.8