Ejemplo n.º 1
0
 public function getAllActive($lng = 'nl', $paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('ty' => 'SheetsType'), array('*'))->join(array('tyt' => 'SheetsTypeTsl'), 'ty.type_id = tyt.type_id', array('*'))->where('tyt.lng = ?', $_SESSION['System']['lng'])->where('ty.active = ?', 1)->order('ty.position ASC');
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     $proxy = new SxModule_Sheets_Subtype_Proxy();
     $subtypes = $proxy->getAll();
     foreach ($data as $type) {
         foreach ($subtypes as $subtype) {
             if ($type->getId() == $subtype->getType()) {
                 $type->addSubtype($subtypes);
             }
         }
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
Ejemplo n.º 2
0
 public function deleteAction()
 {
     SxCms_Acl::requireAcl('sheets', 'sheets.delete');
     $type_id = $this->_getParam('id');
     $proxy = new SxModule_Sheets_Subtype_Proxy();
     $this->_subtype = $proxy->getTypeById($type_id);
     $this->_subtype->delete();
     $cache = Zend_Registry::get('cache');
     $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Sheets_Subtype'));
     $proxyAction = new SxModule_Sheets_Proxy();
     $proxyAction->deleteByType($type_id);
     $flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $flashMessenger->addMessage($this->admin_tmx->_('itemdeleted'));
     $this->_helper->redirector->gotoSimple('index', 'sheets_subtype', 'admin', array('type' => $this->_getParam('type')));
 }
Ejemplo n.º 3
0
 public function getSubtypeAction()
 {
     $subcat = new SxModule_Sheets_Subtype_Proxy();
     $type = $this->_getParam('typeid');
     $this->view->subcat = $subcat->getAllbyTypeActive($type, $_SESSION['System']['lng'], true);
     $view = utf8_encode($this->view->render('sheets/get-subtype.phtml'));
     $results = Zend_Json::encode(array('subcat' => utf8_encode($view)));
     $this->view->results = $results;
     $this->render('json');
     $this->_helper->layout->disableLayout();
 }