ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPresentationTableGUI Class Reference
+ Collaboration diagram for ilPresentationTableGUI:

Public Member Functions

 __construct ( $parent_object, ilObjGlossary $glossary, bool $offline, int $tax_node=0)
 
 executeCommand ()
 
 show ()
 
 renderPresentationTableForOffline ()
 

Protected Member Functions

 applyFilter ()
 
 initTerms (array $adt_search_bridges)
 
 getADTSearchBridges ()
 
 initFilter ()
 
 initPresentationTable (bool $offline=false)
 
 initViewControl ()
 
 getShortTextForTerm (int $term_id)
 

Protected Attributes

ILIAS Style Content Service $content_style
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs_gui
 
ilNavigationHistory $nav_history
 
UI Factory $ui_fac
 
UI Renderer $ui_ren
 
ServerRequestInterface $request
 
 $parent_obj
 
ilObjGlossary $glossary
 
bool $offline = false
 
int $tax_node = 0
 
Presentation PresentationGUIRequest $pres_gui_request
 
Presentation PresentationManager $manager
 
ilUIFilterService $filter_service
 
ILIAS AdvancedMetaData Services Services $adv_md_service
 
array $filter_data = null
 
array $terms = []
 

Detailed Description

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 32 of file class.ilPresentationTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPresentationTableGUI::__construct (   $parent_object,
ilObjGlossary  $glossary,
bool  $offline,
int  $tax_node = 0 
)

Definition at line 55 of file class.ilPresentationTableGUI.php.

References $DIC, $glossary, $offline, $tax_node, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

60  {
61  global $DIC;
62 
63  $this->ctrl = $DIC->ctrl();
64  $this->user = $DIC->user();
65  $this->lng = $DIC->language();
66  $this->tpl = $DIC->ui()->mainTemplate();
67  $this->tabs_gui = $DIC->tabs();
68  $this->nav_history = $DIC["ilNavigationHistory"];
69  $this->ui_fac = $DIC->ui()->factory();
70  $this->ui_ren = $DIC->ui()->renderer();
71  $this->request = $DIC->http()->request();
72  $this->parent_obj = $parent_object;
73  $this->glossary = $glossary;
74  $this->offline = $offline;
75  $this->tax_node = $tax_node;
76  $this->pres_gui_request = $DIC->glossary()
77  ->internal()
78  ->gui()
79  ->presentation()
80  ->request();
81  $this->manager = $DIC->glossary()
82  ->internal()
83  ->domain()
84  ->presentation($this->glossary);
85  $this->filter_service = $DIC->uiService()->filter();
86  $this->adv_md_service = new \ILIAS\AdvancedMetaData\Services\Services();
87  $this->content_style = $DIC->contentStyle();
88  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilPresentationTableGUI::applyFilter ( )
protected

Definition at line 137 of file class.ilPresentationTableGUI.php.

References show().

137  : void
138  {
139  $this->manager->setSessionViewControlStart(0);
140  $this->show();
141  }
+ Here is the call graph for this function:

◆ executeCommand()

ilPresentationTableGUI::executeCommand ( )

Definition at line 90 of file class.ilPresentationTableGUI.php.

References ILIAS\Repository\ctrl().

90  : void
91  {
92  $next_class = $this->ctrl->getNextClass($this);
93  $cmd = $this->ctrl->getCmd();
94 
95  switch ($next_class) {
96  default:
97  $cmd = $this->ctrl->getCmd("show");
98  $ret = $this->$cmd();
99  break;
100  }
101  }
+ Here is the call graph for this function:

◆ getADTSearchBridges()

ilPresentationTableGUI::getADTSearchBridges ( )
protected

Definition at line 158 of file class.ilPresentationTableGUI.php.

References ilADTSearchBridgeSingle\getADT(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstance(), ilADTSearchBridgeRange\getLowerADT(), IL_CAL_DATE, and IL_CAL_UNIX.

Referenced by show().

158  : array
159  {
160  $bridges = [];
161  if (is_array($this->filter_data)) {
162  foreach ($this->filter_data as $input_key => $value) {
163  if (substr($input_key, 0, 7) != "adv_md_") {
164  continue;
165  }
166  if (!$value) {
167  continue;
168  }
169 
170  $field_id = substr($input_key, 7);
171  $field = \ilAdvancedMDFieldDefinition::getInstance((int) $field_id);
172  $field_form = \ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance(
173  $field->getADTDefinition(),
174  true,
175  false
176  );
177 
178  if (is_array($value)) {
179  switch (true) {
180  case $field_form instanceof ilADTDateSearchBridgeRange:
181  $start = $value[0];
182  $end = $value[1];
183  if ($start) {
184  $field_form->getLowerADT()->setDate(new ilDate($start, IL_CAL_DATE));
185  }
186  if ($end) {
187  $field_form->getUpperADT()->setDate(new ilDate($end, IL_CAL_DATE));
188  }
189  if ($start || $end) {
190  $bridges[$field_id] = $field_form;
191  }
192  break;
193  case $field_form instanceof ilADTDateTimeSearchBridgeRange:
194  if ($value[0]) {
195  $start = strtotime($value[0]);
196  $field_form->getLowerADT()->setDate(new ilDateTime($start, IL_CAL_UNIX));
197  }
198  if ($value[1]) {
199  $end = strtotime($value[1]);
200  $field_form->getUpperADT()->setDate(new ilDateTime($end, IL_CAL_UNIX));
201  }
202  if ($value[0] || $value[1]) {
203  $bridges[$field_id] = $field_form;
204  }
205  break;
206  case $field_form instanceof ilADTEnumSearchBridgeMulti:
207  $field_form->getADT()->setSelections($value);
208  $bridges[$field_id] = $field_form;
209  break;
210  }
211  } else {
212  switch (true) {
213  case $field_form instanceof ilADTTextSearchBridgeSingle:
214  $field_form->getADT()->setText($value);
215  $bridges[$field_id] = $field_form;
216  break;
217  case $field_form instanceof ilADTFloatSearchBridgeSingle:
218  case $field_form instanceof ilADTIntegerSearchBridgeSingle:
219  // numeric metadata currently not supported as filter inputs
220  $field_form->getADT()->setNumber($value);
221  $bridges[$field_id] = $field_form;
222  break;
223  case $field_form instanceof ilADTEnumSearchBridgeSingle:
224  $field_form->getADT()->setSelection($value);
225  $bridges[$field_id] = $field_form;
226  break;
227  case $field_form instanceof ilADTExternalLinkSearchBridgeSingle:
228  $field_form->getADT()->setUrl($value);
229  $bridges[$field_id] = $field_form;
230  break;
231  case $field_form instanceof ilADTInternalLinkSearchBridgeSingle:
232  $field_form->getADT()->setTargetRefId(1);
233  $field_form->setTitleQuery($value);
234  $bridges[$field_id] = $field_form;
235  break;
236  }
237  }
238  }
239  }
240 
241  return $bridges;
242  }
Class ilADTEnumSearchBridgeMulti.
Class ilADTDateTimeSearchBridgeRange.
const IL_CAL_UNIX
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
Class ilADTDateSearchBridgeRange.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShortTextForTerm()

ilPresentationTableGUI::getShortTextForTerm ( int  $term_id)
protected

Definition at line 380 of file class.ilPresentationTableGUI.php.

References ilGlossaryTerm\_lookShortText(), ilGlossaryTerm\_lookShortTextDirty(), ilMathJax\getInstance(), ilStr\shortenTextExtended(), and ilPCParagraph\xml2output().

Referenced by initPresentationTable().

380  : string
381  {
382  $short_str = \ilGlossaryTerm::_lookShortText($term_id);
383 
384  if (\ilGlossaryTerm::_lookShortTextDirty($term_id)) {
385  // #18022
386  $term_obj = new \ilGlossaryTerm($term_id);
387  $term_obj->updateShortText();
388  $short_str = $term_obj->getShortText();
389  }
390 
391  $page = new \ilGlossaryDefPage($term_id);
392 
393  // replace tex
394  // if a tex end tag is missing a tex end tag
395  $ltexs = strrpos($short_str, "[tex]");
396  $ltexe = strrpos($short_str, "[/tex]");
397  if ($ltexs > $ltexe) {
398  $page->buildDom();
399  $short_str = $page->getFirstParagraphText();
400  $short_str = strip_tags($short_str, "<br>");
401  $ltexe = strpos($short_str, "[/tex]", $ltexs);
402  $short_str = \ilStr::shortenTextExtended($short_str, $ltexe + 6, true);
403  }
404 
405  $short_str = \ilMathJax::getInstance()->insertLatexImages($short_str);
406 
407  $short_str = \ilPCParagraph::xml2output(
408  $short_str,
409  false,
410  true,
411  !$page->getPageConfig()->getPreventHTMLUnmasking()
412  );
413 
414  return $short_str;
415  }
static xml2output(string $a_text, bool $a_wysiwyg=false, bool $a_replace_lists=true, bool $unmask=true)
Converts xml from DB to output in edit textarea.
static _lookShortTextDirty(int $term_id)
get definition short text dirty
static _lookShortText(int $term_id)
get definition short text
static getInstance()
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFilter()

ilPresentationTableGUI::initFilter ( )
protected

Definition at line 244 of file class.ilPresentationTableGUI.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilUtil\stripSlashes().

Referenced by show().

244  : Filter\Standard
245  {
246  $first_letters = $this->glossary->getFirstLetters($this->tax_node);
247  $session_letter = ilUtil::stripSlashes($this->manager->getSessionLetter());
248  if (!empty($session_letter) && !in_array($session_letter, $first_letters)) {
249  $first_letters[$session_letter] = $session_letter;
250  }
251 
252  $default_inputs = [
253  "letter" => $this->ui_fac->input()->field()->select(
254  $this->lng->txt("glo_term_letter"),
255  $first_letters
256  ),
257  "term" => $this->ui_fac->input()->field()->text($this->lng->txt("cont_term")),
258  "definition" => $this->ui_fac->input()->field()->text($this->lng->txt("cont_definition"))
259  ];
260  $adv_md_inputs = $this->adv_md_service->forSubObjects(
261  "glo",
262  $this->glossary->getRefId(),
263  "term"
264  )->inFilter()->getFilterInputs();
265  $inputs = $default_inputs + $adv_md_inputs;
266 
267  $default_inputs_active = [true, true, true];
268  $adv_md_inputs_active = [];
269  for ($i = 0; $i < count($adv_md_inputs); $i++) {
270  $adv_md_inputs_active[] = false;
271  }
272  $inputs_active = array_merge($default_inputs_active, $adv_md_inputs_active);
273 
274  $filter = $this->filter_service->standard(
275  self::class . "_filter_" . $this->glossary->getRefId(),
276  $this->ctrl->getLinkTarget($this, "applyFilter"),
277  $inputs,
278  $inputs_active,
279  false,
280  true
281  );
282 
283  return $filter;
284  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPresentationTable()

ilPresentationTableGUI::initPresentationTable ( bool  $offline = false)
protected

Definition at line 286 of file class.ilPresentationTableGUI.php.

References $data, ILIAS\UI\examples\Chart\Bar\Horizontal\custom(), getShortTextForTerm(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilPageObjectGUI\PRESENTATION.

Referenced by renderPresentationTableForOffline(), and show().

286  : Table\Presentation
287  {
288  $vc_start = 0;
289  $vc_length = 9999;
290  if (!$this->offline) {
291  $vc_start = $this->manager->getSessionViewControlStart();
292  $vc_length = $this->manager->getSessionViewControlLength();
293  }
294 
295  $terms_sliced = array_slice(
296  $this->terms,
297  $vc_start,
298  $vc_length
299  );
300 
301  $data = [];
302  foreach ($terms_sliced as $term) {
303  $data[] = [
304  "term_id" => (int) $term["id"],
305  "term" => $term["term"],
306  "short_txt" => $this->getShortTextForTerm((int) $term["id"]),
307  "definition" => $this->parent_obj->listDefinitions(
308  $this->pres_gui_request->getRefId(),
309  (int) $term["id"],
310  true,
311  false,
313  false
314  )
315  ];
316  }
317 
318  $table = $this->ui_fac->table()->presentation(
319  $this->lng->txt("cont_terms"),
320  [],
321  function ($row, array $record, $ui_factory) {
322  $mdgui = new ilObjectMetaDataGUI($this->glossary, "term", $record["term_id"]);
323  $adv_term_sets = $this->adv_md_service->forObject(
324  "glo",
325  $this->glossary->getRefId(),
326  "term",
327  $record["term_id"]
328  )->custom()->sets();
329  $adv_data = [];
330  foreach ($adv_term_sets as $set) {
331  if (!empty($fields = $set->fields())) {
332  $adv_data[] = "<b>" . $set->presentableTitle() . "</b>";
333  }
334  foreach ($fields as $field) {
335  $adv_data[] = $field->presentableTitle() . ": " . $field->valueAsHTML();
336  }
337  }
338 
339  return $row
340  ->withHeadline($record["term"])
341  ->withImportantFields([$record["short_txt"]])
342  ->withContent(
343  $ui_factory->legacy()->content($record["definition"])
344  )
345  ->withFurtherFieldsHeadline($this->lng->txt("glo_md_advanced"))
346  ->withFurtherFields($adv_data)
347  ;
348  }
349  )->withData($data);
350 
351  return $table;
352  }
Class ilObjectMetaDataGUI.
custom()
expected output: > ILIAS shows a base horizontal bar chart but customized with e.g.
Definition: custom.php:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTerms()

ilPresentationTableGUI::initTerms ( array  $adt_search_bridges)
protected

Definition at line 143 of file class.ilPresentationTableGUI.php.

Referenced by show().

143  : void
144  {
145  $this->terms = $this->glossary->getTermList(
146  $this->filter_data["term"] ?? "",
147  $this->filter_data["letter"] ?? "",
148  $this->filter_data["definition"] ?? "",
149  $this->tax_node,
150  false,
151  true,
152  $adt_search_bridges,
153  false,
154  true
155  );
156  }
+ Here is the caller graph for this function:

◆ initViewControl()

ilPresentationTableGUI::initViewControl ( )
protected

Definition at line 354 of file class.ilPresentationTableGUI.php.

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\UI\Component\Input\Container\Container\withRequest().

Referenced by show().

354  : ViewControl
355  {
356  $offset = $this->manager->getSessionViewControlStart() ?: 0;
357  $limit = $this->manager->getSessionViewControlLength() ?: 25;
358  $pagination = $this->ui_fac->input()->viewControl()->pagination()
359  ->withTotalCount(count($this->terms))
360  ->withValue([Pagination::FNAME_OFFSET => $offset, Pagination::FNAME_LIMIT => $limit]);
361  ;
362  $vc_container = $this->ui_fac->input()->container()->viewControl()->standard([$pagination])
363  ->withRequest($this->request);
364 
365  return $vc_container;
366  }
withRequest(ServerRequestInterface $request)
Get a form like this where data from the request is attached.
This describes a View Control Container.
Definition: ViewControl.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPresentationTableForOffline()

ilPresentationTableGUI::renderPresentationTableForOffline ( )

Definition at line 417 of file class.ilPresentationTableGUI.php.

References initPresentationTable().

417  : string
418  {
419  $pres_table = $this->initPresentationTable(true);
420  $this->tpl->setVariable("ADM_CONTENT", $this->ui_ren->render($pres_table));
421  return $this->tpl->printToString();
422  }
initPresentationTable(bool $offline=false)
+ Here is the call graph for this function:

◆ show()

ilPresentationTableGUI::show ( )

Definition at line 103 of file class.ilPresentationTableGUI.php.

References ILIAS\Repository\ctrl(), getADTSearchBridges(), initFilter(), initPresentationTable(), initTerms(), and initViewControl().

Referenced by applyFilter().

103  : void
104  {
105  $this->ctrl->setParameter($this, "term_id", "");
106  $this->tabs_gui->activateTab("terms");
107 
108  $this->nav_history->addItem(
109  $this->glossary->getRefId(),
110  $this->ctrl->getLinkTargetByClass("ilGlossaryPresentationGUI", "listTerms"),
111  "glo"
112  );
113 
114  $this->content_style->gui()->addCss(
115  $this->tpl,
116  $this->glossary->getRefId()
117  );
118 
119  $filter = $this->initFilter();
120  $this->filter_data = $this->filter_service->getData($filter);
121  $this->manager->setSessionLetter($this->filter_data["letter"] ?? "");
122 
123  $adt_search_bridges = $this->getADTSearchBridges();
124  $this->initTerms($adt_search_bridges);
125 
126  $view_control = $this->initViewControl();
127  if ($vc_data = $view_control->getData()) {
128  $this->setStartAndLengthForViewControl($vc_data);
129  }
130 
131  $pres_table = $this->initPresentationTable();
132 
133  $this->tpl->setContent($this->ui_ren->render([$filter, $view_control, $pres_table]));
134  $this->tpl->setPermanentLink("glo", $this->glossary->getRefId());
135  }
initTerms(array $adt_search_bridges)
initPresentationTable(bool $offline=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $adv_md_service

ILIAS AdvancedMetaData Services Services ilPresentationTableGUI::$adv_md_service
protected

Definition at line 51 of file class.ilPresentationTableGUI.php.

◆ $content_style

ILIAS Style Content Service ilPresentationTableGUI::$content_style
protected

Definition at line 34 of file class.ilPresentationTableGUI.php.

◆ $ctrl

ilCtrl ilPresentationTableGUI::$ctrl
protected

Definition at line 36 of file class.ilPresentationTableGUI.php.

◆ $filter_data

array ilPresentationTableGUI::$filter_data = null
protected

Definition at line 52 of file class.ilPresentationTableGUI.php.

◆ $filter_service

ilUIFilterService ilPresentationTableGUI::$filter_service
protected

Definition at line 50 of file class.ilPresentationTableGUI.php.

◆ $glossary

ilObjGlossary ilPresentationTableGUI::$glossary
protected

Definition at line 45 of file class.ilPresentationTableGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilPresentationTableGUI::$lng
protected

Definition at line 37 of file class.ilPresentationTableGUI.php.

◆ $manager

Presentation PresentationManager ilPresentationTableGUI::$manager
protected

Definition at line 49 of file class.ilPresentationTableGUI.php.

◆ $nav_history

ilNavigationHistory ilPresentationTableGUI::$nav_history
protected

Definition at line 40 of file class.ilPresentationTableGUI.php.

◆ $offline

bool ilPresentationTableGUI::$offline = false
protected

Definition at line 46 of file class.ilPresentationTableGUI.php.

Referenced by __construct().

◆ $parent_obj

ilPresentationTableGUI::$parent_obj
protected

Definition at line 44 of file class.ilPresentationTableGUI.php.

◆ $pres_gui_request

Presentation PresentationGUIRequest ilPresentationTableGUI::$pres_gui_request
protected

Definition at line 48 of file class.ilPresentationTableGUI.php.

◆ $request

ServerRequestInterface ilPresentationTableGUI::$request
protected

Definition at line 43 of file class.ilPresentationTableGUI.php.

◆ $tabs_gui

ilTabsGUI ilPresentationTableGUI::$tabs_gui
protected

Definition at line 39 of file class.ilPresentationTableGUI.php.

◆ $tax_node

int ilPresentationTableGUI::$tax_node = 0
protected

Definition at line 47 of file class.ilPresentationTableGUI.php.

Referenced by __construct().

◆ $terms

array ilPresentationTableGUI::$terms = []
protected

Definition at line 53 of file class.ilPresentationTableGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilPresentationTableGUI::$tpl
protected

Definition at line 38 of file class.ilPresentationTableGUI.php.

◆ $ui_fac

UI Factory ilPresentationTableGUI::$ui_fac
protected

Definition at line 41 of file class.ilPresentationTableGUI.php.

◆ $ui_ren

UI Renderer ilPresentationTableGUI::$ui_ren
protected

Definition at line 42 of file class.ilPresentationTableGUI.php.

◆ $user

ilObjUser ilPresentationTableGUI::$user
protected

Definition at line 35 of file class.ilPresentationTableGUI.php.


The documentation for this class was generated from the following file: