ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDerivedTasksGUI Class Reference

Derived tasks list. More...

+ Inheritance diagram for ilDerivedTasksGUI:
+ Collaboration diagram for ilDerivedTasksGUI:

Public Member Functions

 __construct (Container $di_container=null)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 show ()
 Show list of tasks. More...
 

Protected Attributes

Container $dic
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $main_tpl
 
ilTaskService $task
 
ilObjUser $user
 
UIServices $ui
 
ilLanguage $lng
 
ilHelpGUI $help
 

Detailed Description

Derived tasks list.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 27 of file class.ilDerivedTasksGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDerivedTasksGUI::__construct ( Container  $di_container = null)

Constructor.

Parameters
Container | null$dic

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

43  {
44  global $DIC;
45 
46  if (is_null($di_container)) {
47  $di_container = $DIC;
48  }
49  $this->dic = $di_container;
50  $this->ctrl = $DIC->ctrl();
51  $this->main_tpl = $DIC->ui()->mainTemplate();
52  $this->task = $DIC->task();
53  $this->user = $DIC->user();
54  $this->ui = $DIC->ui();
55  $this->lng = $DIC->language();
56  $this->help = $DIC->help();
57 
58  $this->help->setScreenIdComponent('task');
59  $this->lng->loadLanguageModule("task");
60  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilDerivedTasksGUI::executeCommand ( )

Execute command.

Definition at line 65 of file class.ilDerivedTasksGUI.php.

References $ctrl, $main_tpl, ilCtrl\getCmd(), ilCtrl\getNextClass(), ilGlobalTemplateInterface\loadStandardTemplate(), and ilGlobalTemplateInterface\printToStdout().

65  : void
66  {
70 
71  $next_class = $ctrl->getNextClass($this);
72  $cmd = $ctrl->getCmd("show");
73 
74  if ($cmd == "show") {
75  $this->$cmd();
76  }
78  }
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
getCmd(string $fallback_command=null)
ilGlobalTemplateInterface $main_tpl
getNextClass($a_gui_class=null)
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
+ Here is the call graph for this function:

◆ show()

ilDerivedTasksGUI::show ( )
protected

Show list of tasks.

Definition at line 83 of file class.ilDerivedTasksGUI.php.

References Vendor\Package\$f, $i, $lng, $main_tpl, $ui, ilLink\_getStaticLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\DI\UIServices\factory(), ilDatePresentation\formatDate(), ilUtil\getImagePath(), ILIAS\Repository\help(), IL_CAL_UNIX, ilWorkspaceTree\lookupObjectId(), ILIAS\DI\UIServices\renderer(), ilGlobalTemplateInterface\setContent(), ilGlobalTemplateInterface\setTitle(), ilGlobalTemplateInterface\setTitleIcon(), ilLanguage\txt(), and ILIAS\Repository\user().

83  : void
84  {
85  $ui = $this->ui;
86  $lng = $this->lng;
88 
89  $main_tpl->setTitle($lng->txt("task_derived_tasks"));
90  $main_tpl->setTitleIcon(ilUtil::getImagePath("icon_task.svg"));
91  $this->help->setScreenId('derived_tasks');
92 
93  $f = $ui->factory();
94  $renderer = $ui->renderer();
95 
96  $collector = $this->task->derived()->factory()->collector();
97 
98  $entries = $collector->getEntries($this->user->getId());
99 
100  $list_items_with_deadline = [];
101  $list_items_without_deadline = [];
102 
103  // item groups from tasks
104  foreach ($entries as $i) {
105  $props = [];
106 
107  $title = $i->getTitle();
108  $link = '';
109 
110  if ($i->getRefId() > 0) {
111  $obj_id = ilObject::_lookupObjId($i->getRefId());
112  $obj_type = ilObject::_lookupType($obj_id);
113  $props[$lng->txt("obj_" . $obj_type)] = ilObject::_lookupTitle($obj_id);
114 
115  $link = ilLink::_getStaticLink($i->getRefId());
116  }
117 
118  if ($i->getWspId() > 0) {
119  $wst = new ilWorkspaceTree($this->user->getId());
120  $obj_id = $wst->lookupObjectId($i->getWspId());
121  $obj_type = ilObject::_lookupType($obj_id);
122  $props[$lng->txt("obj_" . $obj_type)] = ilObject::_lookupTitle($obj_id);
123  }
124 
125  if (strlen($i->getUrl()) > 0) {
126  $link = $i->getUrl();
127  }
128 
129  if (strlen($link) > 0) {
130  $title = $f->button()->shy($title, $link);
131  }
132 
133  if ($i->getStartingTime() > 0) {
134  $start = new ilDateTime($i->getStartingTime(), IL_CAL_UNIX);
135  $props[$lng->txt("task_start")] = ilDatePresentation::formatDate($start);
136  }
137  if ($i->getDeadline() > 0) {
138  $end = new ilDateTime($i->getDeadline(), IL_CAL_UNIX);
139  $props[$lng->txt("task_deadline")] = ilDatePresentation::formatDate($end);
140  }
141  $item = $f->item()->standard($title)->withProperties($props);
142  if ($i->getDeadline() > 0) {
143  $list_items_with_deadline[] = $item;
144  } else {
145  $list_items_without_deadline[] = $item;
146  }
147  }
148 
149  // output list panel or info message
150  if (count($list_items_with_deadline) > 0 || count($list_items_without_deadline) > 0) {
151  $panels = [];
152 
153  if (count($list_items_with_deadline) > 0) {
154  $panels[] = $f->panel()->listing()->standard(
155  $lng->txt("task_tasks_with_deadline"),
156  [$f->item()->group("", $list_items_with_deadline)]
157  );
158  }
159  if (count($list_items_without_deadline) > 0) {
160  $panels[] = $f->panel()->listing()->standard(
161  $lng->txt("task_tasks_without_deadline"),
162  [$f->item()->group("", $list_items_without_deadline)]
163  );
164  }
165 
166 
167  $main_tpl->setContent($renderer->render($panels));
168  } else {
169  $this->main_tpl->setOnScreenMessage('info', $lng->txt("task_no_tasks"));
170  }
171  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
ilGlobalTemplateInterface $main_tpl
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
renderer()
Get a renderer for UI components.
Definition: UIServices.php:43
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
lookupObjectId(int $a_node_id)
Get object id for node id.
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:35
static _lookupType(int $id, bool $reference=false)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDerivedTasksGUI::$ctrl
protected

Definition at line 30 of file class.ilDerivedTasksGUI.php.

Referenced by executeCommand().

◆ $dic

Container ilDerivedTasksGUI::$dic
protected

Definition at line 29 of file class.ilDerivedTasksGUI.php.

◆ $help

ilHelpGUI ilDerivedTasksGUI::$help
protected

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

◆ $lng

ilLanguage ilDerivedTasksGUI::$lng
protected

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

Referenced by show().

◆ $main_tpl

ilGlobalTemplateInterface ilDerivedTasksGUI::$main_tpl
protected

Definition at line 31 of file class.ilDerivedTasksGUI.php.

Referenced by executeCommand(), and show().

◆ $task

ilTaskService ilDerivedTasksGUI::$task
protected

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

◆ $ui

UIServices ilDerivedTasksGUI::$ui
protected

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

Referenced by show().

◆ $user

ilObjUser ilDerivedTasksGUI::$user
protected

Definition at line 33 of file class.ilDerivedTasksGUI.php.


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