File indexing completed on 2025-05-04 05:29:13
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 * Created: 31.05.2017 0024 */ 0025 class Default_Model_StoreTemplate 0026 { 0027 0028 /** 0029 * @param string $storeConfigName 0030 * @return array 0031 * @throws Zend_Exception 0032 */ 0033 public static function getStoreTemplate($storeConfigName) 0034 { 0035 $templatePath = Zend_Registry::get('config')->settings->store->template->path; 0036 0037 $storeTemplate = self::getStoreDefaultTemplate(); 0038 0039 $fileNameStoreTemplate = $templatePath . 'client_' . $storeConfigName . '.ini.php'; 0040 0041 if (file_exists($fileNameStoreTemplate)) { 0042 $storeTemplate = require $templatePath . 'client_' . $storeConfigName . '.ini.php'; 0043 } else { 0044 Zend_Registry::get('logger')->warn(__METHOD__ . ' - ' . $storeConfigName . ' :: can not access template file for store context. Use default template.'); 0045 } 0046 0047 return $storeTemplate; 0048 } 0049 0050 /** 0051 * @return mixed 0052 * @throws Zend_Exception 0053 */ 0054 public static function getStoreDefaultTemplate() 0055 { 0056 $templatePath = Zend_Registry::get('config')->settings->store->template->path; 0057 $defaultStoreName = Zend_Registry::get('config')->settings->store->template->default; 0058 0059 $fileNameDefaultTemplate = $templatePath . 'client_' . $defaultStoreName . '.ini.php'; 0060 0061 if (file_exists($fileNameDefaultTemplate)) { 0062 $storeTemplate = require $templatePath . 'client_' . $defaultStoreName . '.ini.php'; 0063 } else { 0064 Zend_Registry::get('logger')->warn(__METHOD__ . ' :: can not access default template file for store.'); 0065 throw new Zend_Exception(__METHOD__ . ' :: can not access default template file for store context: ' . $fileNameDefaultTemplate); 0066 } 0067 0068 return $storeTemplate; 0069 } 0070 0071 }