Warning, file /webapps/ocs-webserver/application/modules/default/views/helpers/FetchStoreConfigInfo.php was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 <?php 0002 0003 /** 0004 * ocs-webserver 0005 * 0006 * Copyright 2016 by pling GmbH. 0007 * 0008 * This file is part of ocs-webserver. 0009 * 0010 * This program is free software: you can redistribute it and/or modify 0011 * it under the terms of the GNU Affero General Public License as 0012 * published by the Free Software Foundation, either version 3 of the 0013 * License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Affero General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Affero General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 **/ 0023 class Default_View_Helper_FetchStoreConfigInfo 0024 { 0025 0026 /** 0027 * @param string $storeHostName 0028 * @return string 0029 * @throws Zend_Exception 0030 */ 0031 public function getDomainLogo($storeHostName) 0032 { 0033 $configName = $this->getConfigIdName($storeHostName); 0034 $clientConfigData = null; 0035 $clientConfigData = Default_Model_StoreTemplate::getStoreTemplate($configName); 0036 0037 return $clientConfigData['header-logo']['image-src']; 0038 } 0039 0040 0041 /** 0042 * @param string $hostname 0043 * @return string 0044 * @throws Zend_Exception 0045 */ 0046 public function getConfigIdName($hostname) 0047 { 0048 $clientName = Zend_Registry::get('config')->settings->client->default->name; // set to default 0049 0050 $store_config_list = Zend_Registry::get('application_store_config_list'); 0051 0052 if (isset($store_config_list[$hostname])) { 0053 $clientName = $store_config_list[$hostname]['config_id_name']; 0054 0055 return $clientName; 0056 } else { 0057 Zend_Registry::get('logger')->warn(__METHOD__ . ' - ' . $hostname . ' :: no store id name configured'); 0058 } 0059 0060 // search for default config 0061 $result = $this->search($store_config_list, 'default', 1); 0062 0063 if (isset($result[0]['config_id_name'])) { 0064 $clientName = $result[0]['config_id_name']; 0065 } else { 0066 Zend_Registry::get('logger')->warn(__METHOD__ . ' - ' . $hostname . ' :: no default store config configured'); 0067 } 0068 0069 return $clientName; 0070 } 0071 0072 private function search($array, $key, $value) 0073 { 0074 $results = array(); 0075 0076 if (is_array($array)) { 0077 if (isset($array[$key]) && $array[$key] == $value) { 0078 $results[] = $array; 0079 } 0080 0081 foreach ($array as $subarray) { 0082 $results = array_merge($results, $this->search($subarray, $key, $value)); 0083 } 0084 } 0085 0086 return $results; 0087 } 0088 0089 /** 0090 * @param string $storeHostName 0091 * @return int|array 0092 * @throws Zend_Exception 0093 */ 0094 public function getStoreCategories($storeHostName) 0095 { 0096 $idCategory = null; 0097 if (Zend_Registry::isRegistered('application_store_category_list')) { 0098 $store_category_list = Zend_Registry::get('application_store_category_list'); 0099 if (isset($store_category_list[$storeHostName])) { 0100 $idCategory = $store_category_list[$storeHostName]; 0101 } else { 0102 Zend_Registry::get('logger')->warn(__METHOD__ . ' - storeIdName: ' . $storeHostName . ' no categories defined for this context'); 0103 } 0104 } 0105 0106 return $idCategory; 0107 } 0108 0109 }