19 declare(strict_types=1);
    35     protected \ilLanguage 
$lng;
    39     protected \ILIAS\Data\Factory 
$data;
    51     protected \ILIAS\HTTP\Services 
$http;
    52     protected \ilCtrlInterface 
$ctrl;
    53     protected \ILIAS\DI\UIServices 
$ui;
    56     protected array 
$sections = [self::DEFAULT_SECTION => [
"title" => 
"", 
"description" => 
"", 
"fields" => []]];
    60     protected string $cmd = self::DEFAULT_SECTION;
    61     protected ?Form\Standard 
$form = null;
    75         string $submit_caption = 
""    80         $this->
ui = $DIC->ui();
    81         $this->
ctrl = $DIC->ctrl();
    82         $this->
http = $DIC->http();
    83         $this->
lng = $DIC->language();
    85         $this->
lng = $DIC->language();
    86         $this->main_tpl = $DIC->ui()->mainTemplate();
    87         $this->
user = $DIC->user();
    88         $this->data = new \ILIAS\Data\Factory();
    90         self::initJavascript();
    95         return "il.repository.ui.init();\n" .
    96             "il.repository.core.init('" . ILIAS_HTTP_PATH . 
"')";
   103         if (!isset($DIC[
"ui.factory"])) {
   107         $f = $DIC->ui()->factory();
   108         $r = $DIC->ui()->renderer();
   109         if (!self::$initialised) {
   110             $main_tpl = $DIC->ui()->mainTemplate();
   111             $main_tpl->addJavaScript(
"./Services/Repository/js/repository.js");
   116             $d[] = 
$f->input()->field()->text(
"");
   118             self::$initialised = 
true;
   124         $this->async_mode = self::ASYNC_MODAL;
   125         $this->in_modal = 
true;
   131         $this->async_mode = self::ASYNC_ON;
   137         $this->in_modal = 
true;
   143         return ($this->async_mode !== self::ASYNC_NONE);
   154         string $description = 
""   156         if ($this->title == 
"") {
   160         $this->sections[
$key] = [
   162             "description" => $description,
   165         $this->current_section = 
$key;
   172         string $description = 
"",
   173         ?
string $value = null
   175         $field = $this->
ui->factory()->input()->field()->text($title, $description);
   176         if (!is_null($value)) {
   177             $field = $field->withValue($value);
   186         string $description = 
"",
   189         $field = $this->
ui->factory()->input()->field()->checkbox($title, $description);
   190         if (!is_null($value)) {
   191             $field = $field->withValue($value);
   201         $field = $this->
ui->factory()->input()->field()->hidden();
   202         $field = $field->withValue($value);
   211                 $field = $field->withRequired(
true, 
new NotEmpty(
   216                 $field = $field->withRequired(
true);
   226         string $description = 
"",
   227         ?
string $value = null
   229         $field = $this->
ui->factory()->input()->field()->textarea($title, $description);
   230         if (!is_null($value)) {
   231             $field = $field->withValue($value);
   240         string $description = 
"",
   242         ?
int $min_value = null,
   243         ?
int $max_value = null
   246         if (!is_null($min_value)) {
   247             $trans[] = $this->
refinery->int()->isGreaterThanOrEqual($min_value);
   249         if (!is_null($max_value)) {
   250             $trans[] = $this->
refinery->int()->isLessThanOrEqual($max_value);
   252         $field = $this->
ui->factory()->input()->field()->numeric($title, $description);
   253         if (count($trans) > 0) {
   254             $field = $field->withAdditionalTransformation($this->
refinery->logical()->parallel($trans));
   256         if (!is_null($value)) {
   257             $field = $field->withValue($value);
   266         string $description = 
"",
   269         $field = $this->
ui->factory()->input()->field()->dateTime($title, $description);
   271         $format = $this->
user->getDateFormat();
   272         $dt_format = (string) $format;
   289         $field = $field->withFormat($format);
   290         if (!is_null($value)) {
   291             $field = $field->withValue(
   304         if (is_null($value)) {
   308             return new \ilDateTime($value->format(
"Y-m-d H:i:s"), 
IL_CAL_DATETIME);
   310         return new \ilDate($value->format(
"Y-m-d"), 
IL_CAL_DATE);
   317         string $description = 
"",
   318         ?
string $value = null
   320         $field = $this->
ui->factory()->input()->field()->select($title, $options, $description);
   321         if (!is_null($value)) {
   322             $field = $field->withValue($value);
   334         string $description = 
"",
   335         ?
string $value = null
   337         $field = $this->
ui->factory()->input()->field()->radio($title, $description);
   338         if (!is_null($value)) {
   339             $field = $field->withOption($value, 
"");    
   340             $field = $field->withValue($value);
   349     public function radioOption(
string $value, 
string $title, 
string $description = 
""): self
   352             $field = $field->withOption($value, $title, $description);
   358     public function switch(
   361         string $description = 
"",
   362         ?
string $value = null
   364         $this->current_switch = [
   367             "description" => $description,
   374     public function group(
string $key, 
string $title, 
string $description = 
""): self
   377         $this->current_group = [
   380             "description" => $description,
   388         if (!is_null($this->current_group)) {
   389             if (!is_null($this->current_switch)) {
   390                 $this->current_switch[
"groups"][$this->current_group[
"key"]] =
   391                     $this->
ui->factory()->input()->field()->group(
   392                         $this->current_group[
"fields"],
   393                         $this->current_group[
"title"]
   394                     )->withByline($this->current_group[
"description"]);
   397         $this->current_group = null;
   400     public function end(): self
   403         if (!is_null($this->current_switch)) {
   404             $field = $this->
ui->factory()->input()->field()->switchableGroup(
   405                 $this->current_switch[
"groups"],
   406                 $this->current_switch[
"title"],
   407                 $this->current_switch[
"description"]
   409             if (!is_null($this->current_switch[
"value"])) {
   410                 $field = $field->withValue($this->current_switch[
"value"]);
   412             $key = $this->current_switch[
"key"];
   413             $this->current_switch = null;
   423         string $id_parameter,
   424         string $description = 
"",
   425         ?
int $max_files = null,
   426         array $mime_types = [],
   427         array $ctrl_path = [],
   428         string $logger_id = 
""   430         $this->upload_handler[
$key] = new \ilRepoStandardUploadHandlerGUI(
   437         foreach ([
"application/x-compressed", 
"application/x-zip-compressed"] as $zipmime) {
   438             if (in_array(
"application/zip", $mime_types) &&
   439                 !in_array($zipmime, $mime_types)) {
   440                 $mime_types[] = $zipmime;
   444         if (count($mime_types) > 0) {
   445             $description .= $this->
lng->txt(
"rep_allowed_types") . 
": " .
   446                 implode(
", ", $mime_types);
   449         $field = $this->
ui->factory()->input()->field()->file(
   450             $this->upload_handler[$key],
   456         if (!is_null($max_files)) {
   457             $field = $field->withMaxFiles($max_files);
   459         if (count($mime_types) > 0) {
   460             $field = $field->withAcceptedMimeTypes($mime_types);
   472         if (!isset($this->upload_handler[$key])) {
   473             throw new \ilException(
"Unknown file upload field: " . $key);
   475         return $this->upload_handler[
$key];
   482             throw new \ilException(
"Missing Input Key: " . $key);
   484         if (isset($this->field[$key])) {
   485             throw new \ilException(
"Duplicate Input Key: " . $key);
   488         if ($this->current_section !== self::DEFAULT_SECTION) {
   491         if (!is_null($this->current_group)) {
   492             $this->current_group[
"fields"][
$key] = $field;
   493             if (!is_null($this->current_switch)) {
   494                 $field_path[] = $this->current_switch[
"key"];
   496                 $field_path[] = 
$key;
   500             $field_path[] = 
$key;
   508         $this->fields[
$key] = $field;
   510         $this->last_key = 
$key;
   516         if (!isset($this->fields[$key])) {
   517             throw new \ilException(
"Unknown Key: " . $key);
   519         return $this->fields[
$key];
   529         if ($this->last_key !== 
"") {
   538         if (is_null($this->
form)) {
   539             $async = ($this->async_mode !== self::ASYNC_NONE);
   541             if (!is_null($this->class_path)) {
   545             foreach ($this->sections as $sec_key => $section) {
   546                 if ($sec_key === self::DEFAULT_SECTION) {
   547                     foreach ($this->sections[$sec_key][
"fields"] as $f_key) {
   550                 } elseif (count($this->sections[$sec_key][
"fields"]) > 0) {
   552                     foreach ($this->sections[$sec_key][
"fields"] as $f_key) {
   555                     $inputs[$sec_key] = $this->
ui->factory()->input()->field()->section(
   558                         $section[
"description"]
   562             $this->
form = $this->
ui->factory()->input()->container()->form()->standard(
   566             if ($this->submit_caption !== 
"") {
   567                 $this->
form = $this->
form->withSubmitLabel($this->submit_caption);
   575         return $this->
getForm()->getSubmitLabel() ?? $this->
lng->txt(
"save");
   580         if (is_null($this->raw_data)) {
   581             $request = $this->
http->request();
   582             $this->
form = $this->
getForm()->withRequest($request);
   583             $this->raw_data = $this->
form->getData();
   590         return !(is_null($this->raw_data));
   596     public function getData(
string $key)
   600         if (!isset($this->fields[$key])) {
   601             throw new \ilException(
"Unknown Key: " . $key);
   605         foreach ($this->field_path[$key] as $path_key) {
   606             if (!isset($value[$path_key])) {
   609             $value = $value[$path_key];
   624         if ($this->async_mode === self::ASYNC_NONE && !$this->
ctrl->isAsynch()) {
   625             $html = $this->
ui->renderer()->render($this->
getForm());
   627             $html = $this->
ui->renderer()->renderAsync($this->
getForm()) . 
"<script>" . $this->
getOnLoadCode() . 
"</script>";
   629         if ($this->in_modal) {
   630             if ($this->async_mode === self::ASYNC_MODAL) {
   631                 $html = str_replace(
"<form ", 
"<form data-rep-modal-form='async' ", $html);
   633                 $html = str_replace(
"<form ", 
"<form data-rep-modal-form='sync' ", $html);
 
Class ChatMainBarProvider . 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a link target for the given information. 
 
form( $class_path, string $cmd, string $submit_caption="")