public function sendCommentApprovalEmail($commentid, $postid) { $read = Mage::getSingleton('core/resource')->getConnection('core_read'); $write = Mage::getSingleton('core/resource')->getConnection('core_write'); $blogColl = Mage::getModel('gallery/week')->getCollection()->addFieldToSelect(array('item_title'))->addFieldToFilter('main_table.gallery_id', array('eq' => $postid))->addFieldToFilter('cmnt.comment_id', array('eq' => $commentid)); $blogColl->getSelect()->join(array('cmnt' => Mage::getSingleton('core/resource')->getTableName('gallery/comment')), 'main_table.gallery_id = cmnt.post_id', array('cmnt.comment', 'cmnt.email')); foreach ($blogColl as $blogCollec) { $block = new MLogix_Gallery_Block_Week(); $postUrl = $block->getViewUrl($postid); $module = Mage::app()->getRequest()->getModuleName(); $cntrlr = Mage::app()->getRequest()->getControllerName(); $data['post_name'] = $blogCollec->getTitle(); $data['post_url'] = $postUrl; $data['comment_detail'] = $blogCollec->getComment(); } $select = 'SELECT email_id FROM `galleryweek_comment_notification` where post_id="' . $postid . '" '; $result = $read->fetchAll($select); foreach ($result as $key => $arr) { $translate = Mage::getSingleton('core/translate'); $translate->setTranslateInline(false); try { $data['unsubscribe_url'] = Mage::getBaseUrl() . "gallery/week/unsubscribe/postid/" . $postid . "/email/" . $arr['email_id']; $postObject = new Varien_Object(); $postObject->setData($data); $mailTemplate = Mage::getModel('core/email_template'); $mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId())); $mailTemplate->sendTransactional(Mage::getStoreConfig('gallery/weekcomments/email_comment_approve_notify'), Mage::getStoreConfig('gallery/weekcomments/sender_email_identity'), $arr['email_id'], $arr['email_id'], array('data' => $postObject)); $translate->setTranslateInline(true); } catch (Exception $e) { $translate->setTranslateInline(true); } } }
public function unsubscribeAction() { $write = Mage::getSingleton('core/resource')->getConnection('core_write'); try { $delSql = 'Delete FROM `galleryweek_comment_notification` where post_id="' . $this->getRequest()->getParam('postid') . '" and email_id="' . $this->getRequest()->getParam('email') . '" '; $write->query($delSql); $block = new MLogix_Gallery_Block_Week(); $postUrl = $block->getViewUrl($this->getRequest()->getParam('postid')); Mage::getSingleton('core/session')->addSuccess($this->__('Unsubscription successful.')); $this->_redirectSuccess($postUrl); return; } catch (Exception $e) { Mage::getSingleton('core/session')->addError("Unable to unsubscribe, please try later."); $this->_redirect('*/*/index'); } }
public function _construct() { parent::_construct(); return $this->setTemplate('gallery/rightblock.phtml'); }
public function _construct() { parent::_construct(); return $this->setTemplate('gallery/archivebox.phtml'); }