File indexing completed on 2024-12-29 05:24:44
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 $helperFetchCategory = new Default_View_Helper_CatTitle(); 0024 $helperFetchCatParent = new Default_View_Helper_CatParent(); 0025 $getAuthUser = new Default_View_Helper_GetAuthUser(); 0026 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl(); 0027 $helperBuildBaseUrl = new Default_View_Helper_BuildBaseUrl(); 0028 $helperImage = new Default_View_Helper_Image(); 0029 $auth = Zend_Auth::getInstance(); 0030 $member = $getAuthUser->getAuthUser(); 0031 $phash = null; 0032 $ltat = null; 0033 0034 if ($auth->hasIdentity()) { 0035 $sess = new Zend_Session_Namespace('ocs_meta'); 0036 $phash = $sess->phash; 0037 $ltat = $sess->openid; 0038 } 0039 0040 $helperUserRole = new Backend_View_Helper_UserRole(); 0041 $userRoleName = $helperUserRole->userRole(); 0042 $isAdmin = false; 0043 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { 0044 $isAdmin = true; 0045 } 0046 0047 $jsonmember = null; 0048 if($member && !empty($member->username)){ 0049 $jsonmember=array( 0050 'member_id' => $member->member_id, 0051 'username' => $member->username, 0052 'avatar' => $member->avatar, 0053 'profile_image_url' => $member->profile_image_url, 0054 'isAdmin' => $isAdmin 0055 ); 0056 } 0057 0058 0059 $serverUrl = $this->serverUrl(); 0060 0061 $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl; 0062 //$baseurl = $helperBuildBaseUrl->buildBaserUrl(); 0063 // $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl_meta; 0064 $baseurlStore = Zend_Registry::get('config')->settings->client->default->baseurl_store; 0065 $searchbaseurl = $this->buildSearchBaseUrl(); 0066 $sname = Zend_Registry::get('store_host'); 0067 $store_config = Zend_Registry::get('store_config'); 0068 $store_order = $store_config->order; 0069 $store_name = $store_config->name; 0070 $is_show_title = $store_config->is_show_title; 0071 $last_char_store_order = substr($store_order, -1); 0072 $is_show_real_domain_as_url = $store_config->is_show_real_domain_as_url; 0073 0074 0075 $url_forum = Zend_Registry::get('config')->settings->client->default->url_forum; 0076 $url_gitlab = Zend_Registry::get('config')->settings->client->default->url_gitlab; 0077 $url_blog = Zend_Registry::get('config')->settings->client->default->url_blog; 0078 $config_domain = $config = Zend_Registry::get('config')->settings->domain; 0079 $url_openid = $config_domain->openid->host; 0080 0081 /** @var Zend_Controller_Request_Http $request */ 0082 $request = Zend_Controller_Front::getInstance()->getRequest(); 0083 $http_scheme = $request->getScheme(); 0084 0085 $json_menu = $this->fetchMetaheaderMenuJson(); 0086 $json_tree = $this->fetchStoresForCatTreeJson(); 0087 0088 0089 $filter = new Local_Filter_Url_Encrypt(); 0090 //$thisurl = $helperBuildBaseUrl->buildBaserUrl(); 0091 $thisurl = "/"; 0092 if(isset($_GET['url'])) { 0093 $thisurl = $_GET['url']; 0094 } 0095 $url_logout = "/logout?redirect=".$filter->filter($thisurl); 0096 $url_login = "/logint?redirect=".$filter->filter($thisurl); 0097 0098 0099 $cat_title = $helperFetchCategory->catTitle($this->cat_id); 0100 $category_id = $this->cat_id; 0101 0102 $category_id_parent = $helperFetchCatParent->getCatParentId(array('project_category_id' => $category_id)); 0103 $cat_title_length = strlen($cat_title); 0104 //check logo-width: 0105 $logoWidth = (int)$this->template['header-logo']['width']; 0106 $cat_title_left = (int)$logoWidth + (int)strlen($store_name)+120; 0107 $tabs_left = (int)$this->template['header-nav-tabs']['absolute-left']; 0108 $tabs_left += $cat_title_length*10; 0109 //$idCat = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null; 0110 0111 //$helperUserRole = new Backend_View_Helper_UserRole(); 0112 //$userRoleName = $helperUserRole->userRole(); 0113 //$forum_url_postfix = Zend_Auth::getInstance()->hasIdentity() ? '/session/sso' : ''; 0114 0115 0116 //Is stayInContext and in Teamplate is set a Footer Header == show the text from tmeplate in page header 0117 $stay_in_context = $store_config->stay_in_context; 0118 $header_links = $this->template['trademark']['text']; 0119 $show_header_links = false; 0120 if($stay_in_context == 1 && $header_links != '') { 0121 $show_header_links = true; 0122 } else { 0123 $header_links = ""; 0124 } 0125 0126 $j_section = null; 0127 if($this->cat_id>0) 0128 { 0129 $sm = new Default_Model_Section(); 0130 $s = $sm->fetchSectionForCategory($this->cat_id); 0131 if($s && $s['section_id']) 0132 { 0133 $sectionStats = $sm->fetchSectionStatsLastMonth($s['section_id']); 0134 $j_section = array(); 0135 $j_section['section_id'] = $s['section_id']; 0136 $j_section['name'] = $s['name']; 0137 $j_section['amount'] = $sm->fetchProbablyPayoutLastMonth($s['section_id']); 0138 $j_section['amount_factor'] = $j_section['amount']*$sectionStats['factor']; 0139 0140 $goal = ceil( $j_section['amount_factor'] / 500 ) * 500; 0141 $j_section['amount'] = number_format($j_section['amount'], 2, '.', ''); 0142 $j_section['amount_factor'] = number_format($j_section['amount_factor'], 2, '.', ''); 0143 $j_section['goal'] = ($goal ==0 ? 500: $goal); 0144 0145 $info = new Default_Model_Info(); 0146 $supporters = $info->getNewActiveSupportersForSectionUnique($s['section_id']); 0147 $supporterMonths = $info->getSectionSupportersActiveMonths($s['section_id']); 0148 0149 0150 0151 $sp = array(); 0152 foreach ($supporters as $s) { 0153 $t = array(); 0154 $t['username'] = $s['username']; 0155 $t['profile_image_url'] = $helperImage->Image($s['profile_image_url'], array('width' => 100, 'height' => 100)); 0156 $t['sum_support'] = $s['sum_support']; 0157 foreach ($supporterMonths as $m) { 0158 if($m['member_id'] == $s['member_id']) 0159 { 0160 $t['active_months'] = $m['active_months']; 0161 0162 break; 0163 } 0164 } 0165 $sp[] = $t; 0166 } 0167 0168 $j_section['supporters'] = $sp; 0169 //$j_section['supportersX'] = $supporters; 0170 } 0171 0172 } 0173 0174 ?> 0175 0176 0177 <style> 0178 0179 0180 header a { 0181 color: <?=$this->template['header-nav-tabs']['link']['color']?>; 0182 } 0183 0184 header div.container.header { 0185 background-image: <?=$this->template['header']['background-image']?>; 0186 background-color: <?=$this->template['header']['background-color']?>; 0187 color: <?=$this->template['header']['color']?>; 0188 height: <?=$this->template['header']['height']?>; 0189 } 0190 0191 header .logo-header { 0192 background-image: <?=$this->template['header-logo']['background-image']?>; 0193 display: block; 0194 height: <?=$this->template['header-logo']['height']?>; 0195 left: <?=$this->template['header-logo']['left']?>; 0196 position: absolute; 0197 top: <?=$this->template['header-logo']['top']?>; 0198 width: <?=$this->template['header-logo']['width']?>; 0199 z-index: 999; 0200 overflow: hidden; 0201 } 0202 0203 0204 0205 0206 #category-tree-container ul li.active > a { 0207 background-color: <?=$this->template['header-nav-tabs']['background-color-hover']?> !important; 0208 color: #ffffff !important; 0209 } 0210 0211 #category-tree-container ul li a:hover { 0212 background-color: <?=$this->template['header-nav-tabs']['background-color-hover']?> !important; 0213 color: #ffffff !important; 0214 } 0215 0216 #category-tree-container ul li a { 0217 display: block; 0218 width: 100%; 0219 float: left; 0220 background-color: transparent !important; 0221 color: <?=$this->template['header-nav-tabs']['background-color-active']?> !important; 0222 padding-left: 3px; 0223 padding-right: 40px; 0224 position: relative; 0225 -webkit-transition: all .2s ease-out; 0226 -moz-transition: all .2s ease-out; 0227 -o-transition: all .2s ease-out; 0228 transition: all .2s ease-out; 0229 } 0230 0231 0232 0233 .absolute-left { 0234 left: <?=$tabs_left?>px; 0235 } 0236 0237 .absolute-right { 0238 right: <?=$this->template['header-nav-tabs']['absolute-right']?>; 0239 } 0240 0241 .header_cat_link { 0242 left: <?= $cat_title_left ?>px; 0243 } 0244 0245 .nav-divider-pling{ 0246 color:#E2E2E2; 0247 } 0248 .nav-pills > li + li { 0249 margin-left: 10px; 0250 } 0251 .dropdown-menu > li > a{ 0252 font-size: 12px; 0253 } 0254 .metamenu .dropdown:hover .dropdown-menu { 0255 margin-left: -16px; 0256 } 0257 .metamenu .dropdown-menu li{ 0258 width: 100%; 0259 } 0260 0261 .metamenu ul.dropdown-menu li span{ color:#999; } 0262 .metamenu ul.dropdown-menu li.active span{ color:#eee; } 0263 0264 0265 @media (max-width:767px){ 0266 0267 header .logo-header { 0268 width: 100%; 0269 text-align: center; 0270 position: relative; 0271 height: 100px; 0272 float: left; 0273 top: 0; 0274 } 0275 0276 header div.container.header { 0277 height: 180px; 0278 padding: 0; 0279 } 0280 0281 header .container.header ul.menu-nav-tabs { 0282 right: 0; 0283 } 0284 0285 header .container.header section.container#first-container { 0286 padding: 0; 0287 height: 180px; 0288 margin: 0; 0289 width: 100%; 0290 } 0291 0292 header .container.header section.container#second-container { 0293 position: absolute; 0294 bottom: 20px; 0295 padding: 0; 0296 } 0297 0298 header .container.header section.container#second-container .wrapper { 0299 padding: 0; 0300 width: 100%; 0301 text-align: center; 0302 } 0303 0304 header .container.header section.container#second-container .wrapper .header_cat_link { 0305 position: relative; 0306 left: 0; 0307 } 0308 0309 header .container.header section.container section.wrapper { 0310 padding: 0; 0311 } 0312 0313 header#page_header nav#nav-top { 0314 margin: 0; 0315 width: 100%; 0316 float: left; 0317 height: 80px; 0318 position: relative; 0319 } 0320 0321 header#page_header nav#nav-top > .pull-right { 0322 height: 100%; 0323 width: 100% !important; 0324 } 0325 0326 header#page_header nav#nav-top > .pull-right .menu { 0327 position: absolute; 0328 bottom: 5px; 0329 right: 0; 0330 z-index: 999; 0331 } 0332 0333 header .container.header nav #search { 0334 position: absolute; 0335 left: 0; 0336 bottom: 0; 0337 width: 50%; 0338 margin: 5px; 0339 } 0340 0341 header .container.header nav #search input.content-search { 0342 width: 100%; 0343 } 0344 } 0345 </style> 0346 0347 0348 <script type="text/javascript"> 0349 var json_hasIdentity = <?php if( $auth->hasIdentity() ) { echo '1' ;} else { echo '0';} ?>; 0350 var json_redirectString = <?php if( $auth->hasIdentity() ) { echo Zend_Json::encode(null);} else { 0351 $helperEncryptUrl = new Default_View_Helper_EncryptUrl(); 0352 $redirectString = '/redirect/' . $helperEncryptUrl->EncryptUrl(Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . Zend_Controller_Front::getInstance()->getRequest()->getHttpHost().$_SERVER["REQUEST_URI"]); 0353 echo Zend_Json::encode($redirectString);} ?>; 0354 var json_serverUri = <?php echo Zend_Json::encode($_SERVER["REQUEST_URI"]);?>; 0355 var json_member = <?php echo Zend_Json::encode($jsonmember); ?>; 0356 var json_member_avatar = <?php if( $auth->hasIdentity() ) { 0357 echo Zend_Json::encode($this->Image($member->profile_image_url,array('width' => 30, 'height' => 30))); 0358 } else { echo Zend_Json::encode(null);}?>; 0359 var json_template = <?php echo Zend_Json::encode($this->template); ?>; 0360 var json_serverUrl = <?php echo Zend_Json::encode($serverUrl); ?>; 0361 var json_baseurl = <?php echo Zend_Json::encode($baseurl);?>; 0362 var json_baseurlStore = <?php echo Zend_Json::encode($baseurlStore);?>; 0363 0364 <?php 0365 $contentTheme = ''; 0366 if (Zend_Auth::getInstance()->hasIdentity()){ 0367 $identity = Zend_Auth::getInstance()->getStorage()->read(); 0368 $settingmodel = new Default_Model_MemberSettingValue(); 0369 $result = $settingmodel->fetchMemberSettingItem($identity->member_id,2); 0370 if($result && $result['value']==1) 0371 { 0372 $contentTheme = 'content-theme-dark'; 0373 } 0374 } 0375 ?> 0376 var json_content_theme = <?php echo Zend_Json::encode($contentTheme);?>; 0377 0378 var json_searchbaseurl = <?php echo Zend_Json::encode($searchbaseurl);?>; 0379 var json_sname = <?php echo Zend_Json::encode($sname);?>; 0380 var json_store_order = <?php echo Zend_Json::encode($store_order);?>; 0381 var json_store_name = <?php echo Zend_Json::encode($store_name);?>; 0382 var json_is_show_title = <?php echo Zend_Json::encode($is_show_title);?>; 0383 var json_last_char_store_order = <?php echo Zend_Json::encode($last_char_store_order);?>; 0384 var json_cat_title = <?php echo Zend_Json::encode($cat_title);?>; 0385 var json_cat_id = <?php echo Zend_Json::encode($category_id);?>; 0386 var json_logoWidth = <?php echo Zend_Json::encode($logoWidth);?>; 0387 var json_cat_title_left = <?php echo Zend_Json::encode($cat_title_left);?>; 0388 var json_tabs_left = <?php echo Zend_Json::encode($tabs_left);?>; 0389 var json_loginurl = <?php echo Zend_Json::encode($url_login); ?>; 0390 var json_logouturl = <?php echo Zend_Json::encode($url_logout); ?>; 0391 var json_section = <?php echo Zend_Json::encode($j_section); ?>; 0392 var json_store_for_tree = <?php echo $json_tree; ?>; 0393 var json_isShowAddProduct = <?php echo $this->showAddProduct && $category_id>0 ? '1': '0'; ?>; 0394 var json_is_show_real_domain_as_url = <?php echo $is_show_real_domain_as_url;?>; 0395 0396 var json_header_links = <?php echo Zend_Json::encode($header_links); ?>; 0397 0398 var json_server_images = <?php echo Zend_Json::encode(IMAGES_MEDIA_SERVER); ?>; 0399 var json_server_videos = <?php echo Zend_Json::encode(VIDEOS_MEDIA_SERVER); ?>; 0400 var json_server_comics = <?php echo Zend_Json::encode(COMICS_MEDIA_SERVER); ?>; 0401 0402 </script> 0403 <link href="/theme/react/assets/css/header.css" type="text/css" rel="stylesheet" /> 0404 <section id="site-header-container"></section> 0405 <script src="/theme/react/bundle/header-bundle.js?<?= APPLICATION_VERSION ?>" type="text/javascript"></script> 0406 0407 <?php $this->inlineScript()->appendScript( 0408 '$(document).ready(function(){ 0409 MenuHover.setup(); 0410 Popuppanel.setup(); 0411 LoginContainer.update(); 0412 PlingsRedirect.setup(); 0413 });' 0414 );