ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDerivedTasksGUI Class Reference

Derived tasks list. More...

+ Collaboration diagram for ilDerivedTasksGUI:

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $dic
 
 $ctrl
 
 $main_tpl
 
 $task
 
 $user
 
 $ui
 
 $lng
 
 $help
 

Detailed Description

Derived tasks list.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilDerivedTasksGUI::__construct ( \ILIAS\DI\Container  $di_container = null)

Constructor.

Parameters
\ILIAS\DI\Container | null$dic

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

References $DIC, help(), ui(), and user().

58  {
59  global $DIC;
60 
61  if (is_null($di_container)) {
62  $di_container = $DIC;
63  }
64  $this->dic = $di_container;
65  $this->ctrl = $DIC->ctrl();
66  $this->main_tpl = $DIC->ui()->mainTemplate();
67  $this->task = $DIC->task();
68  $this->user = $DIC->user();
69  $this->ui = $DIC->ui();
70  $this->lng = $DIC->language();
71  $this->help = $DIC->help();
72 
73  $this->help->setScreenIdComponent('task');
74  $this->lng->loadLanguageModule("task");
75  }
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilDerivedTasksGUI::executeCommand ( )

Execute command.

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

References $ctrl, and $main_tpl.

81  {
84  $main_tpl->loadStandardTemplate();
85 
86  $next_class = $ctrl->getNextClass($this);
87  $cmd = $ctrl->getCmd("show");
88 
89  switch ($next_class) {
90  default:
91  if (in_array($cmd, array("show"))) {
92  $this->$cmd();
93  }
94  }
95  $main_tpl->printToStdout();
96  }

◆ show()

ilDerivedTasksGUI::show ( )
protected

Show list of tasks.

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

References Vendor\Package\$f, $i, $lng, $main_tpl, $ui, ilLink\_getStaticLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilDatePresentation\formatDate(), ilUtil\getImagePath(), help(), IL_CAL_UNIX, ilWorkspaceTree\lookupObjectId(), ilUtil\sendInfo(), and user().

102  {
103  $ui = $this->ui;
104  $lng = $this->lng;
106 
107  $main_tpl->setTitle($lng->txt("task_derived_tasks"));
108  $main_tpl->setTitleIcon(ilUtil::getImagePath("icon_task.svg"));
109  $this->help->setScreenId('derived_tasks');
110 
111  $f = $ui->factory();
112  $renderer = $ui->renderer();
113 
114  $collector = $this->task->derived()->factory()->collector();
115 
116  $entries = $collector->getEntries($this->user->getId());
117 
118  $list_items_with_deadline = [];
119  $list_items_without_deadline = [];
120  $item_groups = [];
121 
122  // item groups from tasks
123  foreach ($entries as $i) {
124  $props = [];
125 
126  $title = $i->getTitle();
127  $link = '';
128 
129  if ($i->getRefId() > 0) {
130  $obj_id = ilObject::_lookupObjId($i->getRefId());
131  $obj_type = ilObject::_lookupType($obj_id);
132  $props[$lng->txt("obj_" . $obj_type)] = ilObject::_lookupTitle($obj_id);
133 
134  $link = ilLink::_getStaticLink($i->getRefId());
135  }
136 
137  if ($i->getWspId() > 0) {
138  $wst = new ilWorkspaceTree($this->user->getId());
139  $obj_id = $wst->lookupObjectId($i->getWspId());
140  $obj_type = ilObject::_lookupType($obj_id);
141  $props[$lng->txt("obj_" . $obj_type)] = ilObject::_lookupTitle($obj_id);
142  }
143 
144  if (strlen($i->getUrl()) > 0) {
145  $link = $i->getUrl();
146  }
147 
148  if (strlen($link) > 0) {
149  $title = $f->button()->shy($title, $link);
150  }
151 
152  if ($i->getStartingTime() > 0) {
153  $start = new ilDateTime($i->getStartingTime(), IL_CAL_UNIX);
154  $props[$lng->txt("task_start")] = ilDatePresentation::formatDate($start);
155  }
156  if ($i->getDeadline() > 0) {
157  $end = new ilDateTime($i->getDeadline(), IL_CAL_UNIX);
158  $props[$lng->txt("task_deadline")] = ilDatePresentation::formatDate($end);
159  }
160  $item = $f->item()->standard($title)->withProperties($props);
161  if ($i->getDeadline() > 0) {
162  $list_items_with_deadline[] = $item;
163  } else {
164  $list_items_without_deadline[] = $item;
165  }
166  }
167 
168  // output list panel or info message
169  if (count($list_items_with_deadline) > 0 || count($list_items_without_deadline) > 0) {
170  $panels = [];
171 
172  if (count($list_items_with_deadline) > 0) {
173  $panels[] = $f->panel()->listing()->standard(
174  $lng->txt("task_tasks_with_deadline"),
175  [$f->item()->group("", $list_items_with_deadline)]
176  );
177  }
178  if (count($list_items_without_deadline) > 0) {
179  $panels[] = $f->panel()->listing()->standard(
180  $lng->txt("task_tasks_without_deadline"),
181  [$f->item()->group("", $list_items_without_deadline)]
182  );
183  }
184 
185 
186  $main_tpl->setContent($renderer->render($panels));
187  } else {
188  ilUtil::sendInfo($lng->txt("task_no_tasks"));
189  }
190  }
static _lookupTitle($a_id)
lookup object title
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
user()
Definition: user.php:4
Tree handler for personal workspace.
help()
Definition: help.php:2
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDerivedTasksGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $dic

ilDerivedTasksGUI::$dic
protected

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

◆ $help

ilDerivedTasksGUI::$help
protected

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

◆ $lng

ilDerivedTasksGUI::$lng
protected

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

Referenced by show().

◆ $main_tpl

ilDerivedTasksGUI::$main_tpl
protected

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

Referenced by executeCommand(), and show().

◆ $task

ilDerivedTasksGUI::$task
protected

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

◆ $ui

ilDerivedTasksGUI::$ui
protected

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

Referenced by show().

◆ $user

ilDerivedTasksGUI::$user
protected

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


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