ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
 

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 52 of file class.ilDerivedTasksGUI.php.

53 {
54 global $DIC;
55
56 if (is_null($di_container)) {
57 $di_container = $DIC;
58 }
59 $this->dic = $di_container;
60 $this->ctrl = $DIC->ctrl();
61 $this->main_tpl = $DIC->ui()->mainTemplate();
62 $this->task = $DIC->task();
63 $this->user = $DIC->user();
64 $this->ui = $DIC->ui();
65 $this->lng = $DIC->language();
66
67 $this->lng->loadLanguageModule("task");
68 }
user()
Definition: user.php:4
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilDerivedTasksGUI::executeCommand ( )

Execute command.

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

74 {
77 $main_tpl->loadStandardTemplate();
78
79 $next_class = $ctrl->getNextClass($this);
80 $cmd = $ctrl->getCmd("show");
81
82 switch ($next_class) {
83 default:
84 if (in_array($cmd, array("show"))) {
85 $this->$cmd();
86 }
87 }
88 $main_tpl->printToStdout();
89 }

References $ctrl, and $main_tpl.

◆ show()

ilDerivedTasksGUI::show ( )
protected

Show list of tasks.

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

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

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

+ 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.

◆ $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: