public function validate(SxModule_Contentblock $object) { $this->validateTextRequired($object->getTitle(), 'title', 'content'); $this->validateLongTextareaRequired($object->getContent(), 'content', 'content'); $msgr = Sanmax_MessageStack::getInstance($this->_namespace); if (!$msgr->getNamespaceMessages()) { return true; } return false; }
public function toArray(SxModule_Contentblock $item, $type = '*') { $data = array('id' => $item->getId(), 'blockname' => $item->getBlockname(), 'active' => $item->getActive()); $tsl = array('tsl_id' => $item->getTslId(), 'lng' => $item->getLng(), 'title' => $item->getTitle(), 'content' => $item->getContent()); if ($type == 'item') { return $data; } elseif ($type == 'tsl') { return $tsl; } return array_merge($data, $tsl); }
public function addAction() { SxCms_Acl::requireAcl('block', 'block.add'); $item = new SxModule_Contentblock(); $item->setTmx($this->tmx); if ($this->getRequest()->isPost()) { $mapper = new SxModule_Contentblock_Mapper(); $fields = $mapper->fromInput($this->_getAllParams(), $this->_editablefields()); $data = $mapper->toObject($fields); $validator = new SxModule_Contentblock_Validator(); if ($validator->validate($data)) { $data->save(); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Contentblock')); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage($this->admin_tmx->_('contentblockcreated')); $this->_helper->redirector->gotoSimple('index', 'contentblock'); } $item = $data; } $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Contentblock'); $this->view->block = $item; }