ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LSUrlBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23class LSUrlBuilder implements URLBuilder
24{
25 public const PARAM_LSO_COMMAND = 'lsocmd';
26 public const PARAM_LSO_PARAMETER = 'lsov';
27
29
30 public function __construct(ILIAS\Data\URI $base_url)
31 {
32 $this->base_url = $base_url;
33 }
34
35 public function getURL(string $command, ?int $param = null): ILIAS\Data\URI
36 {
37 $query = $this->base_url->getQuery();
38 if (!$query) {
39 $params = [];
40 } else {
41 parse_str($this->base_url->getQuery(), $params);
42 }
43
45 if (is_null($param)) {
46 unset($params[self::PARAM_LSO_PARAMETER]);
47 } else {
49 }
50 return $this->base_url->withQuery(http_build_query($params));
51 }
52
53 public function getHref(string $command, ?int $param = null): string
54 {
55 $url = $this->getURL($command, $param);
56 return $url->getBaseURI() . '?' . $url->getQuery();
57 }
58}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
const PARAM_LSO_COMMAND
getHref(string $command, ?int $param=null)
ILIAS Data URI $base_url
__construct(ILIAS\Data\URI $base_url)
const PARAM_LSO_PARAMETER
getURL(string $command, ?int $param=null)
Get an URL for the provided command and params.
The URLBuilder allows views to get links that are used somewhere inline in the content.
Definition: URLBuilder.php:30
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$url
Definition: shib_logout.php:68
$param
Definition: xapitoken.php:46