/** * Constructs a URL that can be recognized by PRADO. * * This method provides the actual implementation used by {@link THttpRequest::constructUrl}. * Override this method if you want to provide your own way of URL formatting. * If you do so, you may also need to override {@link parseUrl} so that the URL can be properly parsed. * * The URL is constructed as the following format: * /entryscript.php?serviceID=serviceParameter&get1=value1&... * If {@link THttpRequest::setUrlFormat THttpRequest.UrlFormat} is 'Path', * the following format is used instead: * /entryscript.php/serviceID/serviceParameter/get1,value1/get2,value2... * @param string service ID * @param string service parameter * @param array GET parameters, null if not provided * @param boolean whether to encode the ampersand in URL * @param boolean whether to encode the GET parameters (their names and values) * @return string URL * @see parseUrl * @since 3.1.1 */ public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) { if ($this->_customUrl) { if (!(is_array($getItems) || $getItems instanceof Traversable)) { $getItems = array(); } $key = $serviceID . ':' . $serviceParam; $wildCardKey = ($pos = strrpos($serviceParam, '.')) !== false ? $serviceID . ':' . substr($serviceParam, 0, $pos) . '.*' : $serviceID . ':*'; if (isset($this->_constructRules[$key])) { foreach ($this->_constructRules[$key] as $rule) { if ($rule->supportCustomUrl($getItems)) { return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems); } } } elseif (isset($this->_constructRules[$wildCardKey])) { foreach ($this->_constructRules[$wildCardKey] as $rule) { if ($rule->supportCustomUrl($getItems)) { $getItems['*'] = $pos ? substr($serviceParam, $pos + 1) : $serviceParam; return $rule->constructUrl($getItems, $encodeAmpersand, $encodeGetItems); } } } } return parent::constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems); }