ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilExAssTypeWikiTeamGUI Class Reference

Team wiki type gui implementations. More...

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

Public Member Functions

 __construct (protected InternalDomainService $domain, protected InternalGUIService $gui)
 
 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

ilLanguage $lng
 
ilCtrl $ctrl
 
ilTree $tree
 
ilAccessHandler $access
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Detailed Description

Team wiki type gui implementations.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypeWikiTeamGUI::__construct ( protected InternalDomainService  $domain,
protected InternalGUIService  $gui 
)

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

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

43  {
44  $this->main_tpl = $gui->ui()->mainTemplate();
45  $this->lng = $domain->lng();
46  $this->ctrl = $gui->ctrl();
47  $this->tree = $domain->repositoryTree();
48  $this->access = $domain->access();
49  }
+ 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 class represents an option in a radio group.
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.
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 286 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().

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

Referenced by createWiki().

◆ $ctrl

ilCtrl ilExAssTypeWikiTeamGUI::$ctrl
protected

◆ $lng

ilLanguage ilExAssTypeWikiTeamGUI::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ilExAssTypeWikiTeamGUI::$main_tpl
private

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

◆ $tree

ilTree ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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


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