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
00035 class Mage_GiftMessage_IndexController extends Mage_Core_Controller_Front_Action
00036 {
00037 public function saveAction()
00038 {
00039 $giftMessage = Mage::getModel('giftmessage/message');
00040 if($this->getRequest()->getParam('message')) {
00041 $giftMessage->load($this->getRequest()->getParam('message'));
00042 }
00043 try {
00044 $entity = $giftMessage->getEntityModelByType($this->_getMappedType($this->getRequest()->getParam('type')));
00045
00046 $giftMessage->setSender($this->getRequest()->getParam('sender'))
00047 ->setRecipient($this->getRequest()->getParam('recipient'))
00048 ->setMessage($this->getRequest()->getParam('messagetext'))
00049 ->save();
00050
00051
00052 $entity->load($this->getRequest()->getParam('item'))
00053 ->setGiftMessageId($giftMessage->getId())
00054 ->save();
00055
00056 $this->getRequest()->setParam('message', $giftMessage->getId());
00057 $this->getRequest()->setParam('entity', $entity);
00058 } catch (Exception $e) {
00059
00060 }
00061
00062 $this->loadLayout();
00063 $this->renderLayout();
00064 }
00065
00066 }