ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilExAssTypeWikiTeamGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExAssTypeWikiTeamGUI:
+ Collaboration diagram for ilExAssTypeWikiTeamGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 Execute command. More...
 
 addEditFormCustomProperties (ilPropertyFormGUI $form)
 Add custom form properties to edit form. More...
 
 importFormToAssignment (ilExAssignment $ass, ilPropertyFormGUI $form)
 Get values from form and put them into assignment. More...
 
 getFormValuesArray (ilExAssignment $ass)
 Get form values array from assignment.
Returns
array
More...
 
 getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Add overview content of submission to info screen object. More...
 
 getHTML (array $par)
 Get HTML. More...
 
 buildSubmissionPropertiesAndActions (\ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI $builder)
 
- Public Member Functions inherited from ilExAssignmentTypeGUIInterface
 setSubmission (ilExSubmission $a_submission)
 Set submission. More...
 
 setExercise (ilObjExercise $a_exercise)
 Set exercise. More...
 

Data Fields

const MODE_OVERVIEW = "overview"
 

Protected Member Functions

 renderOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Render overview content. More...
 
 createWiki ()
 Create wiki for assignment. More...
 

Protected Attributes

ILIAS Exercise InternalGUIService $gui
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTree $tree
 
ilAccessHandler $access
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Team wiki type gui implementations

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilExAssTypeWikiTeamGUI: ilExSubmissionGUI

Definition at line 25 of file class.ilExAssTypeWikiTeamGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypeWikiTeamGUI::__construct ( )

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

38  {
39  global $DIC;
40  $this->main_tpl = $DIC->ui()->mainTemplate();
41 
42  $this->lng = $DIC->language();
43  $this->ctrl = $DIC->ctrl();
44  $this->tree = $DIC->repositoryTree();
45  $this->access = $DIC->access();
46  $this->gui = $DIC->exercise()
47  ->internal()
48  ->gui();
49  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addEditFormCustomProperties()

ilExAssTypeWikiTeamGUI::addEditFormCustomProperties ( ilPropertyFormGUI  $form)

Add custom form properties to edit form.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 72 of file class.ilExAssTypeWikiTeamGUI.php.

References $lng, ilPropertyFormGUI\addItem(), ilRadioOption\addSubItem(), ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

72  : void
73  {
74  $lng = $this->lng;
75 
76  // template
77  $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
78  $rd_template->setRequired(true);
79  $radio_no_template = new ilRadioOption($lng->txt("exc_without_wiki_template"), "0", $lng->txt("exc_without_wiki_template_info"));
80  $radio_with_template = new ilRadioOption($lng->txt("exc_with_wiki_template"), "1", $lng->txt("exc_with_wiki_template_info"));
81 
82  $repo = new ilRepositorySelector2InputGUI($lng->txt("wiki_exc_template"), "template_ref_id");
83  $repo->setRequired(true);
84  $repo->getExplorerGUI()->setSelectableTypes(array("wiki"));
85  $repo->getExplorerGUI()->setTypeWhiteList(array("root", "wiki", "cat", "crs", "grp", "fold"));
86  $radio_with_template->addSubItem($repo);
87 
88  $rd_template->addOption($radio_no_template);
89  $rd_template->addOption($radio_with_template);
90  $form->addItem($rd_template);
91 
92  // container
93  $cont = new ilRepositorySelector2InputGUI($lng->txt("exc_wiki_container"), "container_ref_id");
94  $cont->setRequired(true);
95  $cont->setInfo($lng->txt("exc_wiki_container_info"));
96  $cont->getExplorerGUI()->setSelectableTypes(array("cat", "crs", "grp", "fold"));
97  $cont->getExplorerGUI()->setTypeWhiteList(array("root", "cat", "crs", "grp", "fold"));
98  $form->addItem($cont);
99  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
+ Here is the call graph for this function:

◆ buildSubmissionPropertiesAndActions()

ilExAssTypeWikiTeamGUI::buildSubmissionPropertiesAndActions ( \ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI  $builder)

Implements ilExAssignmentTypeGUIInterface.

Definition at line 285 of file class.ilExAssTypeWikiTeamGUI.php.

References $ctrl, $DIC, Vendor\Package\$f, $lng, ilObject\_exists(), ilCtrl\getLinkTargetByClass(), getSubmission(), ILIAS\Repository\int(), ilCtrl\setParameterByClass(), and ilLanguage\txt().

285  : void
286  {
287  global $DIC;
288 
289  $f = $DIC->ui()->factory();
290  $lng = $this->lng;
291  $ctrl = $this->ctrl;
292 
293 
294  $files_str = "";
295  $valid_wiki = false;
296 
297  $submission = $this->getSubmission();
298 
299  $team_members = $submission->getTeam()->getMembers();
300  $team_available = (count($team_members));
301 
302  $selected_wiki = $submission->getSelectedObject();
303  if ($selected_wiki) {
304  $wiki_ref_id = (int) $selected_wiki["filetitle"];
305 
306  // #11746
307  if (\ilObject::_exists($wiki_ref_id, true, "wiki") && $this->tree->isInTree($wiki_ref_id)) {
308  $wiki = new \ilObjWiki($wiki_ref_id);
309  if ($wiki->getTitle()) {
310  // #10116 / #12791
311  $ctrl->setParameterByClass("ilobjwikigui", "ref_id", $wiki_ref_id);
312  $wiki_link = ilLink::_getLink($wiki_ref_id);
313  $files_str = '<a href="' . $wiki_link .
314  '">' . $wiki->getTitle() . '</a>';
315  $valid_wiki = true;
316  $builder->addProperty(
317  $builder::SEC_SUBMISSION,
318  $lng->txt("exc_ass_team_wiki"),
319  $wiki->getTitle()
320  );
321  if ($submission->canSubmit()) {
322  $button = $f->button()->primary(
323  $lng->txt("exc_edit_wiki"),
324  $wiki_link
325  );
326  $builder->setMainAction(
327  $builder::SEC_SUBMISSION,
328  $button
329  );
330  } else {
331  $link = $f->link()->standard(
332  $lng->txt("exc_view_wiki"),
333  $wiki_link
334  );
335  $builder->addAction(
336  $builder::SEC_SUBMISSION,
337  $link
338  );
339  }
340  }
341  }
342  // remove invalid resource if no upload yet (see download below)
343  elseif (substr($selected_wiki["filename"], -1) == "/") {
344  // #16887
345  $submission->deleteResourceObject();
346  }
347  }
348  if ($submission->canSubmit()) {
349  if (!$valid_wiki && $team_available) {
350  $button = $f->button()->primary(
351  $lng->txt("exc_create_wiki"),
352  $ctrl->getLinkTargetByClass([ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, self::class], "createWiki")
353  );
354  $builder->setMainAction(
355  $builder::SEC_SUBMISSION,
356  $button
357  );
358  }
359  }
360  if ($submission->hasSubmitted()) {
361  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_wiki["returned_id"]);
362  $dl_link = $ctrl->getLinkTargetByClass([
363  ilAssignmentPresentationGUI::class,
364  ilExSubmissionGUI::class,
365  ilExSubmissionFileGUI::class], "download");
366  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
367 
368  $link = $f->link()->standard(
369  $lng->txt("download"),
370  $dl_link
371  );
372  $builder->addAction(
373  $builder::SEC_SUBMISSION,
374  $link
375  );
376  }
377  }
getSubmission()
Get submission.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
global $DIC
Definition: feed.php:28
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:

◆ createWiki()

ilExAssTypeWikiTeamGUI::createWiki ( )
protected

Create wiki for assignment.

Definition at line 222 of file class.ilExAssTypeWikiTeamGUI.php.

References $access, $lng, ilObject\_exists(), ilRBACAccessHandler\checkAccessOfUser(), ILIAS\Repository\ctrl(), ilExAssWikiTeamAR\getTemplateRefId(), ilLanguage\loadLanguageModule(), and ilLanguage\txt().

222  : void
223  {
225  $lng = $this->lng;
226 
227  $ar = new ilExAssWikiTeamAR($this->submission->getAssignment()->getId());
228  $template_ref_id = $ar->getTemplateRefId();
229  $container_ref_id = $ar->getContainerRefId();
230 
231  // @todo: move checks to central place
232  // check if team exists
233  $team_members = $this->submission->getTeam()->getMembers();
234  $team_available = (sizeof($team_members));
235  if (!$team_available) {
236  $lng->loadLanguageModule("exc");
237  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_team_needed_first"), true);
238  $this->ctrl->returnToParent($this);
239  }
240 
241  // check if submission is possible
242  if (!$this->submission->canSubmit()) {
243  $lng->loadLanguageModule("exc");
244  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exercise_time_over"), true);
245  $this->ctrl->returnToParent($this);
246  }
247 
248  // check create permission of exercise owner
249  if (!$access->checkAccessOfUser($this->exercise->getOwner(), "create", "", $container_ref_id, "wiki")) {
250  $lng->loadLanguageModule("exc");
251  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_owner_has_no_permission_to_create_wiki"), true);
252  $this->ctrl->returnToParent($this);
253  }
254 
255  if ($template_ref_id > 0 && ilObject::_exists($template_ref_id, true, "wiki")) {
256  $template_wiki = new ilObjWiki($template_ref_id);
257  $wiki = $template_wiki->cloneObject($container_ref_id);
258  $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
259  } else {
260  $wiki = new ilObjWiki();
261  $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
262  $wiki->create();
263  $wiki->setStartPage($this->submission->getAssignment()->getTitle());
264 
265  $wiki->createReference();
266  $wiki->putInTree($container_ref_id);
267  $wiki->setPermissions($container_ref_id);
268  }
269 
270  $wiki->setOwner($this->exercise->getOwner());
271  $wiki->setOnline(true);
272  $wiki->update();
273  $wiki->updateOwner();
274 
275  $this->submission->deleteAllFiles();
276  //$this->handleRemovedUpload();
277 
278  $this->submission->addResourceObject($wiki->getRefId());
279 
280  $lng->loadLanguageModule("wiki");
281  $this->main_tpl->setOnScreenMessage('success', $lng->txt("wiki_exc_wiki_created"), true);
282  $this->ctrl->returnToParent($this);
283  }
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...
loadLanguageModule(string $a_module)
Load language module.
getTemplateRefId()
Get template ref id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:

◆ executeCommand()

ilExAssTypeWikiTeamGUI::executeCommand ( )

Execute command.

Definition at line 54 of file class.ilExAssTypeWikiTeamGUI.php.

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

54  : void
55  {
57 
58  $next_class = $ctrl->getNextClass($this);
59  $cmd = $ctrl->getCmd();
60 
61  switch ($next_class) {
62  default:
63  if ($cmd === "createWiki") {
64  $this->$cmd();
65  }
66  }
67  }
getCmd(string $fallback_command=null)
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getFormValuesArray()

ilExAssTypeWikiTeamGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Returns
array

Implements ilExAssignmentTypeGUIInterface.

Definition at line 119 of file class.ilExAssTypeWikiTeamGUI.php.

References ilExAssignment\getId(), and ilExAssWikiTeamAR\getTemplateRefId().

119  : array
120  {
121  $values = [];
122 
123  $ar = new ilExAssWikiTeamAR($ass->getId());
124 
125  if ($ar->getTemplateRefId() > 0) {
126  $values["template_ref_id"] = $ar->getTemplateRefId();
127  $values["template"] = "1";
128  } else {
129  $values["template"] = "0";
130  }
131  $values["container_ref_id"] = $ar->getContainerRefId();
132 
133  return $values;
134  }
getTemplateRefId()
Get template ref id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getHTML()

ilExAssTypeWikiTeamGUI::getHTML ( array  $par)

Get HTML.

Parameters
array$parparameter

Definition at line 146 of file class.ilExAssTypeWikiTeamGUI.php.

References renderOverviewContent().

146  : string
147  {
148  switch ($par["mode"]) {
149  case self::MODE_OVERVIEW:
150  $this->renderOverviewContent($par["info"], $par["submission"]);
151  break;
152  }
153  return "";
154  }
renderOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
Render overview content.
+ Here is the call graph for this function:

◆ getOverviewContent()

ilExAssTypeWikiTeamGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)

Add overview content of submission to info screen object.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 136 of file class.ilExAssTypeWikiTeamGUI.php.

References ILIAS\Repository\ctrl().

136  : void
137  {
138  $this->ctrl->getHTML($this, array("mode" => self::MODE_OVERVIEW, "info" => $a_info, "submission" => $a_submission));
139  }
+ Here is the call graph for this function:

◆ importFormToAssignment()

ilExAssTypeWikiTeamGUI::importFormToAssignment ( ilExAssignment  $ass,
ilPropertyFormGUI  $form 
)

Get values from form and put them into assignment.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 104 of file class.ilExAssTypeWikiTeamGUI.php.

References ilExAssignment\getId(), and ilPropertyFormGUI\getInput().

104  : void
105  {
106  $ar = new ilExAssWikiTeamAR();
107  $ar->setId($ass->getId());
108  $ar->setTemplateRefId(0);
109  if ($form->getInput("template_ref_id") && $form->getInput("template")) {
110  $ar->setTemplateRefId($form->getInput("template_ref_id"));
111  }
112  $ar->setContainerRefId($form->getInput("container_ref_id"));
113  $ar->save();
114  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ renderOverviewContent()

ilExAssTypeWikiTeamGUI::renderOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
protected

Render overview content.

Definition at line 159 of file class.ilExAssTypeWikiTeamGUI.php.

References $ctrl, $lng, ilObject\_exists(), ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilExSubmission\deleteResourceObject(), ilCtrl\getLinkTargetByClass(), ilExSubmission\getSelectedObject(), ilExSubmission\getTeam(), ilExSubmission\hasSubmitted(), ILIAS\Repository\int(), ilCtrl\setParameterByClass(), and ilLanguage\txt().

Referenced by getHTML().

159  : void
160  {
161  $lng = $this->lng;
162  $ctrl = $this->ctrl;
163 
164  $files_str = "";
165  $valid_wiki = false;
166 
167  $team_members = $a_submission->getTeam()->getMembers();
168  $team_available = (count($team_members));
169 
170  $selected_wiki = $a_submission->getSelectedObject();
171  if ($selected_wiki) {
172  $wiki_ref_id = (int) $selected_wiki["filetitle"];
173 
174  // #11746
175  if (ilObject::_exists($wiki_ref_id, true, "wiki") && $this->tree->isInTree($wiki_ref_id)) {
176  $wiki = new ilObjWiki($wiki_ref_id);
177  if ($wiki->getTitle()) {
178  // #10116 / #12791
179  $ctrl->setParameterByClass("ilobjwikigui", "ref_id", $wiki_ref_id);
180  $wiki_link = ilLink::_getLink($wiki_ref_id);
181  $files_str = '<a href="' . $wiki_link .
182  '">' . $wiki->getTitle() . '</a>';
183  $valid_wiki = true;
184  }
185  }
186  // remove invalid resource if no upload yet (see download below)
187  elseif (substr($selected_wiki["filename"], -1) == "/") {
188  // #16887
189  $a_submission->deleteResourceObject();
190  }
191  }
192  if ($a_submission->canSubmit()) {
193  if (!$valid_wiki && $team_available) {
194  $files_str .= $this->gui->button(
195  $lng->txt("exc_create_wiki"),
196  $ctrl->getLinkTargetByClass([ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, self::class], "createWiki")
197  )->render();
198  }
199  }
200  if ($files_str) {
201  $a_info->addProperty($lng->txt("exc_ass_team_wiki"), $files_str);
202  }
203  if ($a_submission->hasSubmitted()) {
204  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_wiki["returned_id"]);
205  $dl_link = $ctrl->getLinkTargetByClass([
206  ilAssignmentPresentationGUI::class,
207  ilExSubmissionGUI::class,
208  ilExSubmissionFileGUI::class], "download");
209  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
210 
211  $a_info->addProperty($lng->txt("exc_files_returned"), $this->gui->button(
212  $lng->txt("download"),
213  $dl_link
214  )->render());
215  }
216  }
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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...
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilExAssTypeWikiTeamGUI::$access
protected

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

Referenced by createWiki().

◆ $ctrl

ilCtrl ilExAssTypeWikiTeamGUI::$ctrl
protected

◆ $gui

ILIAS Exercise InternalGUIService ilExAssTypeWikiTeamGUI::$gui
protected

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

◆ $lng

ilLanguage ilExAssTypeWikiTeamGUI::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ilExAssTypeWikiTeamGUI::$main_tpl
private

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

◆ $tree

ilTree ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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


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