File indexing completed on 2024-12-15 05:21:36

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: 13.09.2017
0024  */
0025 class Application_Model_ConfigStore
0026 {
0027 
0028     /**
0029      * @inheritDoc
0030      */
0031     public $store_id;
0032     public $host;
0033     public $name;
0034     public $config_id_name;
0035     public $mapping_id_name;
0036     public $order;
0037     public $is_client;
0038     public $google_id;
0039     public $piwik_id;
0040     public $package_type;
0041     public $cross_domain_login;
0042     public $is_show_title;
0043     public $is_show_home;
0044     public $is_show_git_projects;
0045     public $layout_home;
0046     public $layout_explore;
0047     public $layout_pagedetail;
0048     public $layout;
0049     public $render_view_postfix;
0050     public $created_at;
0051     public $changed_at;
0052     public $deleted_at;
0053 
0054     public function __construct($storeHostName)
0055     {
0056         $storeConfigArray = Zend_Registry::get('application_store_config_list');
0057         if (isset($storeConfigArray[$storeHostName])) {
0058             $storeConfig = $storeConfigArray[$storeHostName];
0059             $this->store_id = $storeConfig['store_id'];
0060             $this->host = $storeConfig['host'];
0061             $this->name = $storeConfig['name'];
0062             $this->config_id_name = $storeConfig['config_id_name'];
0063             $this->mapping_id_name = $storeConfig['mapping_id_name'];
0064             $this->order = $storeConfig['order'];
0065             $this->is_client = $storeConfig['is_client'];
0066             $this->google_id = $storeConfig['google_id'];
0067             $this->piwik_id = $storeConfig['piwik_id'];
0068             $this->package_type = $storeConfig['package_type'];
0069             $this->cross_domain_login = $storeConfig['cross_domain_login'];
0070             $this->is_show_title = $storeConfig['is_show_title'];
0071             $this->is_show_home = $storeConfig['is_show_home'];
0072             $this->is_show_git_projects = $storeConfig['is_show_git_projects'];
0073             $this->layout_home = $storeConfig['layout_home'];
0074             $this->layout_explore = $storeConfig['layout_explore'];
0075             $this->layout_pagedetail = $storeConfig['layout_pagedetail'];
0076             $this->layout = $storeConfig['layout'];
0077             $this->render_view_postfix = $storeConfig['render_view_postfix'];
0078             $this->created_at = $storeConfig['created_at'];
0079             $this->changed_at = $storeConfig['changed_at'];
0080             $this->deleted_at = $storeConfig['deleted_at'];
0081         } else {
0082             Zend_Registry::get('logger')->warn(__METHOD__ . '(' . __LINE__ . ') - ' . $host
0083                 . ' :: no domain config context configured')
0084             ;
0085         }
0086     }
0087 
0088     /**
0089      * @return bool
0090      */
0091     public function isShowHomepage()
0092     {
0093         return $this->is_show_home == 1 ? true : false;
0094     }
0095 
0096     /**
0097      * @return bool
0098      */
0099     public function isRenderReact()
0100     {
0101         return $this->render_view_postfix == 'react' ? true : false;
0102     }
0103 
0104 }