示例#1
0
 protected function initNewsletter()
 {
     if ($this->id == '') {
         $this->app->relocate('Newsletter');
     }
     $class_name = SwatDBClassMap::get('DeliveranceNewsletter');
     $this->newsletter = new $class_name();
     $this->newsletter->setDatabase($this->app->db);
     if (!$this->newsletter->load($this->id)) {
         throw new AdminNotFoundException(sprintf('A newsletter with the id of ‘%s’ does not exist', $this->id));
     }
     // prevent editing of already sent newsletters
     if ($this->newsletter->isSent()) {
         $this->app->messages->add(new SwatMessage(Deliverance::_('Newsletters can not be re-sent.')));
         $this->relocate();
     }
 }
示例#2
0
 protected function initNewsletter()
 {
     if ($this->id == '') {
         $this->app->relocate('Newsletter');
     }
     $class_name = SwatDBClassMap::get('DeliveranceNewsletter');
     $this->newsletter = new $class_name();
     $this->newsletter->setDatabase($this->app->db);
     if (!$this->newsletter->load($this->id)) {
         throw new AdminNotFoundException(sprintf('A newsletter with the id of ‘%s’ does not exist', $this->id));
     }
     // Can't send a preview of a newsletter that has been scheduled. This
     // check will also cover the case where the newsletter has been sent.
     if ($this->newsletter->isScheduled()) {
         $this->relocate();
     }
 }