public function validate(SxModule_News $object) { $this->validateTextRequired($object->getTitle(), 'title', 'content'); //$this->validateTextRequired($object->getSummary(), 'summary', 'content', $this->_namespace); $this->validateTextareaRequired($object->getContent(), 'content', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function toArray(SxModule_News $item, $type = '*') { $identity = Zend_Auth::getInstance()->getIdentity(); $data = array('nid' => $item->getId(), 'author_id' => $identity->getId(), 'date_created' => $item->getDateCreated(), 'date_published' => $item->getDatePublished(), 'date_expired' => $item->getDateExpired(), 'date_message' => $item->getDateByMessage(), 'picture' => $item->getPicture()); $tsl = array('lng' => $item->getLng(), 'title' => $item->getTitle(), 'summary' => $item->getSummary(), 'content' => $item->getContent(), 'url' => $item->_createUrl(), 'seo_keywords' => $item->getSeoKeywords(), 'seo_title' => $item->getSeoTitle(), 'seo_description' => $item->getSeoDescription(), 'active' => (int) $item->getActive()); if ($type == 'item') { return $data; } elseif ($type == 'tsl') { return $tsl; } return array_merge($data, $tsl); }