ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.InternalGUIService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Notes;
22 
26 
31 {
33 
36 
37  public function __construct(
39  InternalDataService $data_service,
40  InternalDomainService $domain_service
41  ) {
42  $this->data_service = $data_service;
43  $this->domain_service = $domain_service;
44  $this->initGUIServices($DIC);
45  }
46 
48  {
49  return new StandardGUIRequest(
50  $this->http(),
51  $this->domain_service->refinery()
52  );
53  }
54 
55  public function initJavascript(
56  string $ajax_url = "",
57  ?\ilGlobalTemplateInterface $main_tpl = null
58  ): void {
59  $tpl = $main_tpl ?? $this->mainTemplate();
60  $lng = $this->domain_service->lng();
61  $ctrl = $this->ctrl();
62  // temporary patch to make this work...
63  global $DIC;
64  $ref_id = $DIC->repository()->internal()->gui()->standardRequest()->getRefId();
65  $type = \ilObject::_lookupType($ref_id, true);
66  if ($ajax_url === "") {
67  $path = ["ilcommonactiondispatchergui", "ilnotegui"];
68  $ajax_url = $this->ctrl()->getLinkTargetByClass(
69  $path,
70  "",
71  "",
72  true,
73  false
74  );
75  }
76  $lng->loadLanguageModule("notes");
77  \ilModalGUI::initJS($tpl);
78 
79  $lng->toJS(array("private_notes", "notes_public_comments", "cancel", "notes_messages"), $tpl);
80  $tpl->addJavaScript("./Services/Notes/js/ilNotes.js");
81  $tpl->addOnLoadCode("ilNotes.setAjaxUrl('" . $ajax_url . "');");
82  }
83 
84  public function print(): PrintProcessGUI
85  {
87  return new PrintProcessGUI(
88  $provider,
89  $this->http(),
90  $this->ui(),
91  $this->domain_service->lng()
92  );
93  }
94 
95  public function getCommentsGUI(
96  $rep_obj_id,
97  int $obj_id,
98  string $obj_type,
99  int $news_id = 0,
100  bool $include_subs = false,
101  bool $ajax = true,
102  string $search_text = ""
103  ): \ilCommentGUI {
104  return new \ilCommentGUI(
105  $rep_obj_id,
106  $obj_id,
107  $obj_type,
108  $include_subs,
109  $news_id,
110  $ajax,
111  $search_text
112  );
113  }
114 
115  public function getMessagesGUI(
116  int $recipient,
117  int $rep_obj_id,
118  int $obj_id,
119  string $obj_type
120  ): \ilMessageGUI {
121  return new \ilMessageGUI(
122  $recipient,
123  $rep_obj_id,
124  $obj_id,
125  $obj_type
126  );
127  }
128 }
initGUIServices(\ILIAS\DI\Container $DIC)
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
$provider
Definition: ltitoken.php:83
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
static http()
Fetches the global http state from ILIAS.
$lng
__construct(Container $DIC, InternalDataService $data_service, InternalDomainService $domain_service)
Comment GUI.
initJavascript(string $ajax_url="", ?\ilGlobalTemplateInterface $main_tpl=null)
getMessagesGUI(int $recipient, int $rep_obj_id, int $obj_id, string $obj_type)
getCommentsGUI( $rep_obj_id, int $obj_id, string $obj_type, int $news_id=0, bool $include_subs=false, bool $ajax=true, string $search_text="")
Message GUI.
static _lookupType(int $id, bool $reference=false)