예제 #1
0
 public function getAll($lng = 'nl', $active = false, $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('a' => 'WebTv'), array('*'))->join(array('t' => 'WebTvTsl'), 'a.id = t.webtv_id', array('url', 'lng', 'title', 'description', 'active'))->where('t.lng = ?', $lng)->order('a.date_published DESC');
     if ($active) {
         $select->where('t.active = 1')->where('a.date_published <= CURDATE()');
     }
     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);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #2
0
 public function getAll($paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = 'SxModule_Pageform_Subscription_Meta_getAll_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('i' => $this->_tablename()), array('*'));
     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);
     }
     if ($cache == true) {
         $cacheTags = array('SxModule_Pageform_Subscription_Meta', 'SxModule_Pageform_Subscription_Meta_getAll', 'SxModule_Pageform_Subscription', 'SxModule_Pageform');
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #3
0
 public function getAll($active = false, $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('n' => 'News'), array('*'))->joinLeft(array('t' => 'NewsTsl', array('lng', 'title', 'summary', 'content', 'url', 'seo_keywords', 'seo_title', 'seo_description', 'active')), 'n.nid = t.nid')->where('t.lng = ?', $lng);
     if ($active) {
         $select->where('t.active = 1')->where('n.date_published <= NOW()')->where('n.date_expired > NOW() OR n.date_expired is NULL')->order('n.date_message DESC')->order('n.date_published DESC');
     } else {
         $select->order('n.date_published DESC')->order('n.date_created DESC');
     }
     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);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #4
0
 public function getAll($lng, $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('a' => 'ContentBlocks'), array('a.*'))->join(array('t' => 'ContentBlocksTsl'), 'a.id = t.b_id', array('t.*'))->where('t.lng = ?', $lng);
     $results = $db->fetchAll($select);
     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);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #5
0
 public function getAll($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('a' => 'Sheets'), array('*'))->join(array('t' => 'SheetsTsl'), 'a.id = t.s_id', array('lng', 'name', 't_desc', 't_file'))->join(array('ty' => 'SheetsSubtype'), 'a.subtype = ty.subtype_id', array())->join(array('tyt' => 'SheetsSubtypeTsl'), 'ty.subtype_id = tyt.subtype_id', array('name as subtypename'))->join(array('st' => 'SheetsType'), 'a.type = st.type_id', array())->join(array('stt' => 'SheetsTypeTsl'), 'st.type_id = stt.type_id', array('name as typename'))->where('t.lng = ?', $_SESSION['System']['lng'])->where('tyt.lng = ?', $_SESSION['System']['lng'])->where('stt.lng = ?', $_SESSION['System']['lng'])->order('st.position ASC')->order('ty.position ASC')->order('a.place 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);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #6
0
 public function getAll($lng = 'nl', $active = false, $paginator = true, $pindex = 1, $perpage = 25, $children = false, $cache = true)
 {
     if ($cache) {
         $cacheId = $this->_model() . '_getAll_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
         $cache = Zend_Registry::get('cache');
         if (false !== ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('a' => $this->_table()), array('a.*'))->join(array('t' => $this->_table() . 'Tsl'), 'a.' . $this->_primaryKey() . ' = t.' . $this->_tslKey(), array('t.*'))->where('t.lng = ?', $lng)->order('a.position ASC');
     if ($active) {
         $select->where('t.active = ?', 1);
     }
     $stm = $db->query($select);
     $results = $stm->fetchAll();
     if ($paginator) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $data = $this->_mapper->mapAll($results);
     }
     if (!$paginator && $children && $this->_childProxy()) {
         $proxy = $this->_childProxy();
         $proxy = new $proxy();
         $allchildren = $proxy->getAll($lng, $active, false, 0, 0, true, $cache);
         foreach ($allchildren as $child) {
             if (array_key_exists($child->getCategoryId(), $data)) {
                 $data[$child->getCategoryId()]->addChild($child);
             }
         }
     }
     if ($cache) {
         $cacheTags = array($this->_model());
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #7
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;
 }
예제 #8
0
 public function getAll($lng = "nl", $paginator = true, $pindex = 1, $perpage = 25, $cache = false)
 {
     if ($cache == true) {
         $cacheId = 'SxModule_Pageform_getAll_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('i' => $this->_tablename()), array('*'))->join(array('pft' => 'pageform_tsl'), 'pft.pageform_id = i.pf_id', array('*'))->where('pft.language = ?', $lng);
     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);
     }
     $pageform_ids = array();
     foreach ($data as $pageform) {
         $pageform_ids[] = $pageform->getId();
     }
     if (count($pageform_ids) != 0) {
         $pagesProxy = new SxCms_Page_Pageform_Proxy();
         $pages = $pagesProxy->getByPageformIds($pageform_ids, false);
         foreach ($data as $pageform) {
             foreach ($pages as $page) {
                 if ($page->getPageformId() == $pageform->getId()) {
                     $pageform->addPage($page->getPageid());
                 }
             }
         }
     }
     if ($cache == true) {
         $cacheTags = array('SxModule_Pageform', 'SxModule_Pageform_getAll');
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #9
0
 public function getAllByTypeActive($type, $lng = 'nl', $active = false, $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;
         }
     }
     if ($active == true) {
         $db = Zend_Registry::get('db');
         $select = $db->select()->from(array('ty' => 'SheetsSubtype'), array('*'))->join(array('tyt' => 'SheetsSubtypeTsl'), 'ty.subtype_id = tyt.subtype_id', array('*'))->where('tyt.lng = ?', $lng)->where('ty.type = ?', $type)->where('ty.active = ?', 1)->order('ty.position ASC');
     } else {
         $db = Zend_Registry::get('db');
         $select = $db->select()->from(array('ty' => 'SheetsSubtype'), array('*'))->join(array('tyt' => 'SheetsSubtypeTsl'), 'ty.subtype_id = tyt.subtype_id', array('*'))->where('tyt.lng = ?', $lng)->where('ty.type = ?', $type)->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);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
예제 #10
0
 public function getAllAndPageform($paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = 'SxModule_Pageform_Subscription_getAllAndPageform_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('pfsu' => $this->_tablename()), array('*'))->join(array('pf' => 'pageform'), 'pfsu.pfsu_pageform_id = pf.pf_id')->joinLeft(array('pfsur' => 'pageform_subscription_user'), 'pfsu.pfsu_id = pfsur_subscription_id')->where('pfsu.pfsu_isdone = ?', 0);
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper)->addSecundairyMapper(new SxModule_Pageform_Mapper(), 'setPageform');
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->addSecundairyMapper(new SxModule_Pageform_Mapper(), 'setPageform')->mapAll($results, 'getId');
     }
     $company_ids = array();
     $callcenter_ids = array();
     $subscription_ids = array();
     foreach ($data as $subscription) {
         $subscription_ids[] = $subscription->getId();
         if ($subscription->getType() == 'company') {
             $company_ids[] = $subscription->getUserId();
         } elseif ($subscription->getType() == 'callcenter') {
             $callcenter_ids[] = $subscription->getUserId();
         }
     }
     if (count($subscription_ids) != 0) {
         $metaProxy = new SxModule_Pageform_Subscription_Meta_Proxy();
         $meta_results = $metaProxy->getBySubscriptionIds($subscription_ids, false);
         foreach ($data as $subscription) {
             foreach ($meta_results as $meta) {
                 if ($subscription->getId() == $meta->getSubscriptionId()) {
                     $subscription->addMeta($meta);
                 }
             }
         }
     }
     if (count($company_ids) != 0 || count($callcenter_ids) != 0) {
         if (count($company_ids) != 0) {
             $userProxy = new SxModule_Company_User_Proxy();
             $companyUsers = $userProxy->getByIds($company_ids, false);
         }
         if (count($callcenter_ids) != 0) {
             $userProxy = new SxModule_Callcenter_User_Proxy();
             $callcenterUsers = $userProxy->getByIds($callcenter_ids, false);
         }
         foreach ($data as $subscription) {
             if ($subscription->getType() == 'company') {
                 foreach ($companyUsers as $user) {
                     if ($subscription->getUserId() == $user->getId()) {
                         $subscription->addUser($user);
                         break 1;
                     }
                 }
             } elseif ($subscription->getType() == 'callcenter') {
                 foreach ($callcenterUsers as $user) {
                     if ($subscription->getUserId() == $user->getId()) {
                         $subscription->addUser($user);
                         break 1;
                     }
                 }
             }
         }
     }
     if ($cache == true) {
         $cacheTags = array('SxModule_Pageform_Subscription', 'SxModule_Pageform_Subscription_getAllAndScriptByUserId', 'SxModule_Pageform');
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }