ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.InternalGUIService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\News\Dashboard;
22 
28 
33 {
37  protected \ILIAS\News\InternalGUIService $gui;
39 
40  public function __construct(
41  InternalDataService $data_service,
42  InternalDomainService $domain_service,
43  \ILIAS\News\InternalGUIService $gui_service
44  ) {
45  $this->data = $data_service;
46  $this->domain = $domain_service;
47  $this->gui = $gui_service;
48  $this->manager = $domain_service->dashboard();
49  }
50 
51  public function getFilter($force_re_init = false): FilterAdapterGUI
52  {
53  $gui = $this->gui;
54  $lng = $this->domain->lng();
55  if (is_null($this->filter) || $force_re_init) {
56  $per_options = $this->manager->getPeriodOptions();
57  $context_options = $this->manager->getContextOptions();
58 
59  $this->filter = $gui->filter(
60  "news_dashboard_filter",
61  [\ilDashboardGUI::class, \ilPDNewsGUI::class],
62  "view",
63  false,
64  false
65  )
66  ->select(
67  "news_per",
68  $lng->txt("news_time_period"),
69  $per_options,
70  true,
71  (string) $this->manager->getDashboardNewsPeriod(),
72  true
73  )
74  ->select("news_ref_id", $lng->txt("context"), $context_options, true, null, true);
75  }
76  return $this->filter;
77  }
78 
79  public function getTimelineGUI(): \ilNewsTimelineGUI
80  {
81  $ctrl = $this->gui->ctrl();
82  if ($ctrl->isAsynch() && ! $this->gui->standardRequest()->getFilterOff()) {
83  $period = $this->manager->getDashboardNewsPeriod();
84  $news_ref_id = $this->manager->getDashboardSelectedRefId();
85  } else {
86  $filter = $this->getFilter();
87  $data = $filter->getData();
88  $period = (int) ($data["news_per"] ?? 0);
89  $news_ref_id = (int) ($data["news_ref_id"] ?? 0);
90  }
91  $t = \ilNewsTimelineGUI::getInstance($news_ref_id, true);
92  $t->setPeriod($period);
93  $t->setEnableAddNews(false);
94  $t->setUserEditAll(false);
95  return $t;
96  }
97 }
static getInstance(int $a_ref_id, bool $a_include_auto_entries)
__construct(InternalDataService $data_service, InternalDomainService $domain_service, \ILIAS\News\InternalGUIService $gui_service)
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $lng
Definition: privfeed.php:31
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
Repository internal data service.