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(); $type = $proxy->getTypeById((int) $this->_getParam('type'), $_SESSION['System']['lng']); $this->view->type = $type; $proxy = new SxModule_Sheets_Subtype_Proxy(); $subtype = $proxy->getTypeById((int) $this->_getParam('id'), $_SESSION['System']['lng']); if ($this->getRequest()->isPost()) { $mapper = new SxModule_Sheets_Subtype_Mapper(); $fields = $mapper->fromInput($this->_getAllParams(), $this->_editablefields()); $data = $mapper->toObject($fields, $subtype); $validator = new SxModule_Sheets_Subtype_Validator(); if ($validator->validate($data)) { $data->save((int) $this->_getParam('type')); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Sheets_Subtype')); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage($this->admin_tmx->_('itemedited')); $this->_helper->redirector->gotoSimple('index', 'sheets_subtype', 'admin', array('type' => $this->_getParam('type'))); } $subtype = $data; } $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Sheets_Subtype'); $this->view->subtype = $subtype; }
public function deleteAction() { SxCms_Acl::requireAcl('sheets', 'sheets.delete'); $type_id = $this->_getParam('id'); $proxy = new SxModule_Sheets_Type_Proxy(); $this->_type = $proxy->getTypeById($type_id, $_SESSION['System']['lng']); $this->_type->delete(); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Sheets_Type')); $proxyAction = new SxModule_Sheets_Proxy(); $proxyAction->deleteByType($type_id); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage('Type werd succesvol verwijderd!'); $this->_helper->redirector->gotoSimple('index', 'sheets_type'); }