示例#1
0
 public function toArray(SxModule_Subscribe_Email $item, $type = '*')
 {
     $data = array('id' => $item->getId(), 'from_email' => $item->getFromEmail(), 'from_name' => $item->getFromName(), 'reply' => $item->getReply(), 'reply_name' => $item->getReplyName());
     $tsl = array('subject' => $item->getSubject(), 'content' => $item->getContent());
     if ($type == 'item') {
         return $data;
     } elseif ($type == 'tsl') {
         return $tsl;
     }
     return array_merge($data, $tsl);
 }
示例#2
0
 public function validate(SxModule_Subscribe_Email $object)
 {
     //var_dump($object); exit;
     $this->validateTextRequired($object->getSubject(), 'subject', 'content', $this->_namespace);
     $this->validateTextRequired($object->getContent(), 'content', 'content', $this->_namespace);
     $this->validateTextRequired($object->getFromName(), 'from_name', 'content', $this->_namespace);
     $this->validateTextRequired($object->getReplyName(), 'reply_name', 'content', $this->_namespace);
     $this->validateEmail($object->getFromEmail(), 'from_email', 'content', $this->_namespace);
     $this->validateEmail($object->getReply(), 'reply', 'content', $this->_namespace);
     $msgr = Sanmax_MessageStack::getInstance($this->_namespace);
     if (!$msgr->getNamespaceMessages()) {
         return true;
     } else {
         return false;
     }
 }