当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Newsletter_Model_Queue::getQueueStatus方法代码示例

本文整理汇总了PHP中Mage_Newsletter_Model_Queue::getQueueStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Newsletter_Model_Queue::getQueueStatus方法的具体用法?PHP Mage_Newsletter_Model_Queue::getQueueStatus怎么用?PHP Mage_Newsletter_Model_Queue::getQueueStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Newsletter_Model_Queue的用法示例。


在下文中一共展示了Mage_Newsletter_Model_Queue::getQueueStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addSubscribersToQueue

 /**
  * Add subscribers to queue
  *
  * @param Mage_Newsletter_Model_Queue $queue
  * @param array $subscriberIds
  */
 public function addSubscribersToQueue(Mage_Newsletter_Model_Queue $queue, array $subscriberIds)
 {
     if (count($subscriberIds) == 0) {
         Mage::throwException(Mage::helper('newsletter')->__('No subscribers selected.'));
     }
     if (!$queue->getId() && $queue->getQueueStatus() != Mage_Newsletter_Model_Queue::STATUS_NEVER) {
         Mage::throwException(Mage::helper('newsletter')->__('Invalid queue selected.'));
     }
     $adapter = $this->_getWriteAdapter();
     $select = $adapter->select();
     $select->from($this->getTable('newsletter/queue_link'), 'subscriber_id')->where('queue_id = ?', $queue->getId())->where('subscriber_id in (?)', $subscriberIds);
     $usedIds = $adapter->fetchCol($select);
     $adapter->beginTransaction();
     try {
         foreach ($subscriberIds as $subscriberId) {
             if (in_array($subscriberId, $usedIds)) {
                 continue;
             }
             $data = array();
             $data['queue_id'] = $queue->getId();
             $data['subscriber_id'] = $subscriberId;
             $adapter->insert($this->getTable('newsletter/queue_link'), $data);
         }
         $adapter->commit();
     } catch (Exception $e) {
         $adapter->rollBack();
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:34,代码来源:Queue.php

示例2: addSubscribersToQueue

 public function addSubscribersToQueue(Mage_Newsletter_Model_Queue $queue, array $subscriberIds)
 {
     $queueData = $queue->getTemplate()->getData();
     if ($queue->getUserGroup()) {
         $subscriberIds = array();
         $groupSubscribers = Mage::getModel("ngroups/ngroups")->getGroupSubscribers($queue->getUserGroup());
         $subscriberIds = Mage::helper("ngroups")->getSubscribersAsArray($groupSubscribers);
         $newsletterGroup = Mage::getModel("ngroups/ngroups")->load($queue->getUserGroup());
         if ($customerGroups = $newsletterGroup->getCustomerGroups()) {
             $customerGroups = explode(",", $customerGroups);
             foreach ($customerGroups as $customerGroup) {
                 $customersCollection = Mage::getResourceModel('newsletter/subscriber_collection');
                 $customersCollection->showCustomerInfo(true)->addSubscriberTypeField()->showStoreInfo();
                 $customersCollection->getSelect()->joinLeft(array('c' => Mage::getConfig()->getTablePrefix() . 'customer_entity'), 'c.entity_id = main_table.customer_id', array("gid" => "group_id"));
                 if ($customerGroup > 0) {
                     $customersCollection->addFieldToFilter("c.group_id", $customerGroup);
                 } else {
                     $customersCollection->addFieldToFilter("main_table.group_id", 0);
                 }
                 foreach ($customersCollection as $subscribers) {
                     if (!in_array($subscribers->getSubscriberId(), $subscriberIds)) {
                         $subscriberIds[] = $subscribers->getSubscriberId();
                     }
                 }
             }
         }
     }
     if (!$queue->getId() && $queue->getQueueStatus() != Mage_Newsletter_Model_Queue::STATUS_NEVER) {
         Mage::throwException(Mage::helper('newsletter')->__('Invalid queue selected'));
     }
     $select = $this->_getWriteAdapter()->select();
     $select->from($this->getTable('queue_link'), 'subscriber_id')->where('queue_id = ?', $queue->getId())->where('subscriber_id in (?)', $subscriberIds);
     $usedIds = $this->_getWriteAdapter()->fetchCol($select);
     $this->_getWriteAdapter()->beginTransaction();
     foreach ($subscriberIds as $subscriberId) {
         if (trim($subscriberId) == '0' || trim($subscriberId) == '') {
             continue;
         }
         if (in_array($subscriberId, $usedIds)) {
             continue;
         }
         $data = array();
         $data['queue_id'] = $queue->getId();
         $data['subscriber_id'] = $subscriberId;
         $data['group_id'] = $queue->getUserGroup();
         try {
             $this->_getWriteAdapter()->insert($this->getTable('queue_link'), $data);
         } catch (Exception $e) {
         }
     }
     $this->_getWriteAdapter()->commit();
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:52,代码来源:Queue.php


注:本文中的Mage_Newsletter_Model_Queue::getQueueStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。