public function viewAction() { $typeName = $this->_getParam('typename'); $typeId = $this->_getParam('typeid'); $this->view->items = ""; $proxy = new SxCms_Page_Proxy(); $this->view->page = $proxy->getPageById('286', null, $this->_getParam('lng', 'nl')); $proxy = new SxModule_Sheets_Type_Proxy(); $types = $proxy->getAllActive(); $this->view->types = $types; $masterArray = array(); $typesAr = array(); $xi = 0; $subtypesArray = array(); foreach ($types as $type) { if (count($type->getSubtypes()) != 0) { $proxy = new SxModule_Sheets_Proxy(); $items = $proxy->getAllActiveByType($type->getId()); $typesAr[$xi]['id'] = $type->getId(); $typesAr[$xi]['name'] = $type->getName(); $xi++; //geef items en subtitles door if ($type->getId() == $typeId) { $this->view->items = $type->getSubtypes(); } } } $this->view->typeid = $typeId; $this->view->types = $typesAr; $this->_helper->layout->setLayout('12col'); }
public function editAction() { SxCms_Acl::requireAcl('sheets', 'sheets.edit'); $proxy = new SxModule_Sheets_Type_Proxy(); $this->view->types = $proxy->getAllActive($_SESSION['System']['lng']); $proxy = new SxModule_Sheets_Proxy(); $sheets = $proxy->getById((int) $this->_getParam('id')); $subcat = new SxModule_Sheets_Subtype_Proxy(); $this->view->subcat = $subcat->getAllbyType($sheets->getType(), $_SESSION['System']['lng'], true); if ($this->getRequest()->isPost()) { $mapper = new SxModule_Sheets_Mapper(); $fields = $mapper->fromInput($this->_getAllParams(), $this->_editablefields()); $data = $mapper->toObject($fields, $sheets); $this->uploadFile($data, $this->_getParam('type'), $this->_getParam('subtype')); $validator = new SxModule_Sheets_Validator(); if ($validator->validate($data)) { $data->save(); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Sheets')); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage($this->admin_tmx->_('itemedited')); $this->_helper->redirector->gotoSimple('index', 'sheets'); } $sheets = $data; } $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Sheets'); $this->view->item = $sheets; }