Warning, file /webapps/ocs-webserver/application/modules/default/views/helpers/BuildCollectionUrl.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_BuildCollectionUrl 0024 { 0025 0026 /** 0027 * @param $product_id 0028 * @param string $action 0029 * @param array $params 0030 * @param bool $withHost 0031 * @param string $scheme 0032 * 0033 * @return string 0034 */ 0035 public function buildProductUrl($product_id, $action = '', $params = null, $withHost = false, $scheme = null) 0036 { 0037 if (empty($product_id)) { 0038 return ''; 0039 } 0040 0041 /** @var Zend_Controller_Request_Http $request */ 0042 $request = Zend_Controller_Front::getInstance()->getRequest(); 0043 0044 $host = ''; 0045 if ($withHost) { 0046 // $member_host = Zend_Registry::get('config')->settings->member->page->server; 0047 // $http_host = Zend_Registry::get('config')->settings->member->product->server; // set http_host to product server 0048 // 0049 // if (false === strpos($request->getHttpHost(), $member_host)) { 0050 $http_host = $request->getHttpHost(); 0051 // } 0052 0053 $http_scheme = isset($scheme) ? $scheme : $request->getScheme(); 0054 $host = $http_scheme . '://' . $http_host; 0055 } 0056 0057 $storeId = null; 0058 if (false === isset($params['store_id'])) { 0059 if ($request->getParam('domain_store_id')) { 0060 $storeId = 's/' . $request->getParam('domain_store_id') . '/'; 0061 } 0062 } else { 0063 $storeId = "s/{$params['store_id']}/"; 0064 unset($params['store_id']); 0065 } 0066 0067 $url_param = ''; 0068 if (is_array($params)) { 0069 array_walk($params, create_function('&$i,$k', '$i="$k/$i/";')); 0070 $url_param = implode('/', $params); 0071 } 0072 0073 if ($action != '') { 0074 $action = $action . '/'; 0075 } 0076 0077 return "{$host}/{$storeId}c/{$product_id}/{$action}{$url_param}"; 0078 } 0079 0080 }