Ejemplo n.º 1
0
 public function executeListEditBulkSentEmail(sfWebRequest $request)
 {
     #Security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri());
         $this->redirect('dashboard/index');
     }
     $this->max_array = array(5, 10, 20, 30);
     $this->max = $this->getMaxBulkQueuedEmailValuePerPage($request, $this->max_array);
     $this->page = $request->getParameter('page', 1);
     $c = new Criteria();
     $c->add(EmailQueuePeer::SEND_STATUS, 'SENT');
     $c->addJoin(EmailQueuePeer::LETTER_ID, EmailLetterPeer::ID, Criteria::LEFT_JOIN);
     $c->setOffset(($this->page - 1) * $this->max);
     $c->setLimit($this->max);
     $this->email_letters = EmailLetterPeer::doSelect($c);
     $this->email_sents = EmailQueuePeer::doSelect($c);
     $this->pager = EmailQueuePeer::getPager($this->max, $this->page, $c);
     $this->sent_email_lists = array();
     foreach ($this->email_letters as $key => $item) {
         $this->sent_email_lists[$key]['send_date'] = $this->email_sents[$key]->getSendDate();
         $this->sent_email_lists[$key]['subject'] = $item->getSubject();
         $this->sent_email_lists[$key]['sender_name'] = $item->getSenderName();
         $this->sent_email_lists[$key]['sender_email'] = $item->getSenderEmail();
         $this->sent_email_lists[$key]['body'] = $item->getBody();
         $this->sent_email_lists[$key]['attach_file_path'] = $item->getAttachFilePath();
         $this->sent_email_lists[$key]['recipients'] = explode(',', $item->getRecipients());
         if ($key >= $this->max - 1) {
             break;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(EmailLetterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(EmailLetterPeer::DATABASE_NAME);
         $criteria->add(EmailLetterPeer::ID, $pks, Criteria::IN);
         $objs = EmailLetterPeer::doSelect($criteria, $con);
     }
     return $objs;
 }