|
ILIAS
release_10 Revision v10.1-43-ga1241a92c2f
|
Collaboration diagram for ILIAS\UI\URLBuilder:Public Member Functions | |
| __construct (URI $uri) | |
| withURI (URI $uri) | |
| Changes the base URI of the Builder. More... | |
| withFragment (?string $fragment) | |
| Change the fragment/hash part of the URL. More... | |
| acquireParameter (array $namespace, string $name, ?string $initial_value=null) | |
| Add a new parameter with a namespace and get its token for subsequent changes. More... | |
| acquireParameters (array $namespace, string ... $names) | |
| deleteParameter (URLBuilderToken $token) | |
| Delete an acquired parameter if the supplied token is valid. More... | |
| withParameter (URLBuilderToken $token, string|array $value) | |
| Change an acquired parameter's value if the supplied token is valid. More... | |
| renderTokens (array $tokens) | |
| Renders a Javascript Map of all given tokens. More... | |
| renderObject (array $tokens) | |
| Renders a Javascript URLBuilder object with changeable parameters for all given tokens. More... | |
| buildURI () | |
| Get a URI representation of the full URL including query string and fragment/hash. More... | |
Data Fields | |
| const | URL_MAX_LENGTH = 8192 |
| A maximum length of 8192 characters should be safe to use in most browsers, even though longer URLs will be supported by some. More... | |
| const | SEPARATOR = '_' |
| Separator for parts of a parameter's namespace. More... | |
Private Member Functions | |
| buildQuery () | |
| Create the query part of the URL from all parameters Claimed parameters overwrite base parameters in array_merge(), numeric indizes of array-parameters are being removed to ensure continous numeration (p[1]=A&p[2]=B –> p[]=A&p[]=B). More... | |
| buildFragment () | |
| Create the fragment/hash part of the URL. More... | |
| parameterExists (string $name) | |
| Check if parameter was already acquired. More... | |
| checkToken (URLBuilderToken $token) | |
| Check if a token is valid. More... | |
| checkLength (URI $uri) | |
| Check the full length of the URI against URL_MAX_LENGTH. More... | |
Private Attributes | |
| URI | $uri |
| Base URI for the URLBuilder. More... | |
| string | $fragment = null |
| Stores the URL fragment/hash (#) (always changeable due to its usage) More... | |
| array | $params = [] |
| Stores all acquired parameters These always take precedence over existing parameters in the base URI. More... | |
| array | $tokens = [] |
| Stores all generated tokens for acquired parameters. More... | |
This provides an abstract representation of an URL and its parameters with the option of changing/removing parameters only by providing a token. These tokens are created when a new parameter is acquired and are therefore controlled by the component that added the parameter. This gives us better control over who gets to change which parameter. Besides that, parameters are always given a namespace so that parameters with the same name can exist beside each other. The in- and output of the URLBuilder are objects.
Along with this class, an equivalent Javascript class is provided in UI/Core that offers a similar functionality. The PHP object can be "transferred" to JS in any renderer by using the provided render...() functions to create JS objects/maps.
Definition at line 39 of file URLBuilder.php.
| ILIAS\UI\URLBuilder::__construct | ( | URI | $uri | ) |
| ILIAS\UI\URLBuilder::acquireParameter | ( | array | $namespace, |
| string | $name, | ||
| ?string | $initial_value = null |
||
| ) |
Add a new parameter with a namespace and get its token for subsequent changes.
The namespace can consists of one or more levels which are noted as an array. They will be joined with the separator (see constant) and used as a prefix for the name, e.g. Namespace: ["ilOrgUnit","filter"] Name: "name" Resulting parameter: "ilOrgUnit_filter_name"
The return value is an array containing both the changed URLBuilder as well as the token for any subsequent changes to the acquired parameter.
Definition at line 118 of file URLBuilder.php.
References $token, and ILIAS\UI\URLBuilder\parameterExists().
Referenced by ILIAS\components\ResourceStorage\Container\View\ActionBuilder\appendNamespaceToURIBuilder(), and ILIAS\Test\Results\Presentation\AttemptResultsTable\getViewControls().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::acquireParameters | ( | array | $namespace, |
| string ... | $names | ||
| ) |
Definition at line 137 of file URLBuilder.php.
References $token, and ILIAS\UI\URLBuilder\$tokens.
Referenced by ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\__construct(), ILIAS\Test\Scoring\Marks\MarkSchemaGUI\__construct(), ilStudyProgrammeTypeGUI\__construct(), and ILIAS\Bibliographic\FieldFilter\Table\initURIBuilder().
Here is the caller graph for this function:
|
private |
Create the fragment/hash part of the URL.
Definition at line 237 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\$fragment.
Referenced by ILIAS\UI\URLBuilder\buildURI().
Here is the caller graph for this function:
|
private |
Create the query part of the URL from all parameters Claimed parameters overwrite base parameters in array_merge(), numeric indizes of array-parameters are being removed to ensure continous numeration (p[1]=A&p[2]=B –> p[]=A&p[]=B).
Definition at line 226 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\$params.
Referenced by ILIAS\UI\URLBuilder\buildURI().
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::buildURI | ( | ) |
Get a URI representation of the full URL including query string and fragment/hash.
Definition at line 213 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\$uri, ILIAS\UI\URLBuilder\buildFragment(), ILIAS\UI\URLBuilder\buildQuery(), and ILIAS\UI\URLBuilder\checkLength().
Referenced by ILIAS\UI\Implementation\Component\Table\Action\Action\__construct(), ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction\getModal(), ILIAS\Test\Participants\ParticipantTableIpRangeAction\getModal(), ILIAS\Test\Participants\ParticipantTableDeleteResultsAction\getModal(), ILIAS\Test\Participants\ParticipantTableExtraTimeAction\getModal(), ILIAS\Test\Participants\ParticipantTableFinishTestAction\getModal(), ilStudyProgrammeTypeGUI\getUrl(), ilObjLanguageFolderGUI\getUrl(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getViewControls(), and ILIAS\UI\URLBuilder\renderObject().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Check the full length of the URI against URL_MAX_LENGTH.
Definition at line 276 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\buildURI().
Here is the caller graph for this function:
|
private |
Check if a token is valid.
Definition at line 260 of file URLBuilder.php.
References ILIAS\UI\URLBuilderToken\getName(), ILIAS\UI\URLBuilderToken\getToken(), and ILIAS\UI\URLBuilder\parameterExists().
Referenced by ILIAS\UI\URLBuilder\deleteParameter(), and ILIAS\UI\URLBuilder\withParameter().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::deleteParameter | ( | URLBuilderToken | $token | ) |
Delete an acquired parameter if the supplied token is valid.
Definition at line 152 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\checkToken(), and ILIAS\UI\URLBuilderToken\getName().
Here is the call graph for this function:
|
private |
Check if parameter was already acquired.
Definition at line 249 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\acquireParameter(), and ILIAS\UI\URLBuilder\checkToken().
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::renderObject | ( | array | $tokens | ) |
Renders a Javascript URLBuilder object with changeable parameters for all given tokens.
Note: By providing only the tokens that need to be changed on the JS side, all other parameters will be passed as unchangeable.
| array<URLBuilderToken> | $tokens |
Definition at line 202 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\buildURI(), and ILIAS\UI\URLBuilder\renderTokens().
Here is the call graph for this function:| ILIAS\UI\URLBuilder::renderTokens | ( | array | $tokens | ) |
Renders a Javascript Map of all given tokens.
Note: Only the tokens needed for changing parameters on the JS side should be used here.
| array<URLBuilderToken> | $tokens |
Definition at line 182 of file URLBuilder.php.
References $token.
Referenced by ILIAS\UI\URLBuilder\renderObject().
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::withFragment | ( | ?string | $fragment | ) |
Change the fragment/hash part of the URL.
Definition at line 91 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\$fragment.
| ILIAS\UI\URLBuilder::withParameter | ( | URLBuilderToken | $token, |
| string|array | $value | ||
| ) |
Change an acquired parameter's value if the supplied token is valid.
Definition at line 165 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\checkToken(), and ILIAS\UI\URLBuilderToken\getName().
Referenced by ilMediaCastManageTableGUI\get(), ilBadgePersonalTableGUI\getActions(), ILIAS\Test\Participants\ParticipantTableShowResultsAction\getTableAction(), ILIAS\Test\Participants\ParticipantTableDeleteParticipantAction\getTableAction(), ILIAS\Test\Participants\ParticipantTableIpRangeAction\getTableAction(), ILIAS\Test\Participants\ParticipantTableDeleteResultsAction\getTableAction(), ILIAS\Test\Participants\ParticipantTableExtraTimeAction\getTableAction(), ILIAS\Test\Participants\ParticipantTableFinishTestAction\getTableAction(), ilStudyProgrammeTypeGUI\getUrl(), ilObjLanguageFolderGUI\getUrl(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getViewControls(), ilOrgUnitTypeGUI\setSubTabsEdit(), and ILIAS\Test\Participants\ParticipantTableActions\showModal().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\UI\URLBuilder::withURI | ( | URI | $uri | ) |
Changes the base URI of the Builder.
Definition at line 81 of file URLBuilder.php.
References ILIAS\UI\URLBuilder\$uri.
|
private |
Stores the URL fragment/hash (#) (always changeable due to its usage)
Definition at line 58 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\buildFragment(), and ILIAS\UI\URLBuilder\withFragment().
|
private |
Stores all acquired parameters These always take precedence over existing parameters in the base URI.
array<string, string>
Definition at line 65 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\buildQuery().
|
private |
Stores all generated tokens for acquired parameters.
array<string, URLBuilderToken>
Definition at line 71 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\acquireParameters().
|
private |
Base URI for the URLBuilder.
Definition at line 53 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilder\__construct(), ILIAS\UI\URLBuilder\buildURI(), and ILIAS\UI\URLBuilder\withURI().
| const ILIAS\UI\URLBuilder::SEPARATOR = '_' |
Separator for parts of a parameter's namespace.
Definition at line 49 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilderToken\getName(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getViewControls(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getViewControlsParameter(), ILIAS\UI\URLBuilderTest\testAcquireParam(), ILIAS\UI\URLBuilderTest\testAcquireParamWithLongNamespace(), ILIAS\UI\URLBuilderTest\testAcquireParamWithSameName(), ILIAS\UI\URLBuilderTest\testAcquireParamWithValue(), ILIAS\UI\URLBuilderTest\testDeleteParam(), ILIAS\UI\URLBuilderTest\testRenderObject(), ILIAS\UI\URLBuilderTest\testWithUri(), and ILIAS\UI\URLBuilderTest\testWriteParam().
| const ILIAS\UI\URLBuilder::URL_MAX_LENGTH = 8192 |
A maximum length of 8192 characters should be safe to use in most browsers, even though longer URLs will be supported by some.
Definition at line 45 of file URLBuilder.php.
Referenced by ILIAS\UI\URLBuilderTest\testUrlTooLong().