ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 28 of file class.ilExAssTypeWikiTeamGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

42  {
43  $this->main_tpl = $gui->ui()->mainTemplate();
44  $this->lng = $domain->lng();
45  $this->ctrl = $gui->ctrl();
46  $this->tree = $domain->repositoryTree();
47  $this->access = $domain->access();
48  }
+ 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 71 of file class.ilExAssTypeWikiTeamGUI.php.

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

71  : void
72  {
73  $lng = $this->lng;
74 
75  // template
76  $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
77  $rd_template->setRequired(true);
78  $radio_no_template = new ilRadioOption($lng->txt("exc_without_wiki_template"), "0", $lng->txt("exc_without_wiki_template_info"));
79  $radio_with_template = new ilRadioOption($lng->txt("exc_with_wiki_template"), "1", $lng->txt("exc_with_wiki_template_info"));
80 
81  $repo = new ilRepositorySelector2InputGUI($lng->txt("wiki_exc_template"), "template_ref_id");
82  $repo->setRequired(true);
83  $repo->getExplorerGUI()->setSelectableTypes(array("wiki"));
84  $repo->getExplorerGUI()->setTypeWhiteList(array("root", "wiki", "cat", "crs", "grp", "fold"));
85  $radio_with_template->addSubItem($repo);
86 
87  $rd_template->addOption($radio_no_template);
88  $rd_template->addOption($radio_with_template);
89  $form->addItem($rd_template);
90 
91  // container
92  $cont = new ilRepositorySelector2InputGUI($lng->txt("exc_wiki_container"), "container_ref_id");
93  $cont->setRequired(true);
94  $cont->setInfo($lng->txt("exc_wiki_container_info"));
95  $cont->getExplorerGUI()->setSelectableTypes(array("cat", "crs", "grp", "fold"));
96  $cont->getExplorerGUI()->setTypeWhiteList(array("root", "cat", "crs", "grp", "fold"));
97  $form->addItem($cont);
98  }
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 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->getTitle();
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->getId());
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.
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:22
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 221 of file class.ilExAssTypeWikiTeamGUI.php.

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

221  : void
222  {
224  $lng = $this->lng;
225 
226  $ar = new ilExAssWikiTeamAR($this->submission->getAssignment()->getId());
227  $template_ref_id = $ar->getTemplateRefId();
228  $container_ref_id = $ar->getContainerRefId();
229 
230  // @todo: move checks to central place
231  // check if team exists
232  $team_members = $this->submission->getTeam()->getMembers();
233  $team_available = (sizeof($team_members));
234  if (!$team_available) {
235  $lng->loadLanguageModule("exc");
236  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_team_needed_first"), true);
237  $this->ctrl->returnToParent($this);
238  }
239 
240  // check if submission is possible
241  if (!$this->submission->canSubmit()) {
242  $lng->loadLanguageModule("exc");
243  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exercise_time_over"), true);
244  $this->ctrl->returnToParent($this);
245  }
246 
247  // check create permission of exercise owner
248  if (!$access->checkAccessOfUser($this->exercise->getOwner(), "create", "", $container_ref_id, "wiki")) {
249  $lng->loadLanguageModule("exc");
250  $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_owner_has_no_permission_to_create_wiki"), true);
251  $this->ctrl->returnToParent($this);
252  }
253 
254  if ($template_ref_id > 0 && ilObject::_exists($template_ref_id, true, "wiki")) {
255  $template_wiki = new ilObjWiki($template_ref_id);
256  $wiki = $template_wiki->cloneObject($container_ref_id);
257  $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
258  } else {
259  $wiki = new ilObjWiki();
260  $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
261  $wiki->create();
262  $wiki->setStartPage($this->submission->getAssignment()->getTitle());
263 
264  $wiki->createReference();
265  $wiki->putInTree($container_ref_id);
266  $wiki->setPermissions($container_ref_id);
267  }
268 
269  $wiki->setOwner($this->exercise->getOwner());
270  $wiki->setOnline(true);
271  $wiki->getObjectProperties()->storePropertyIsOnline(new ilObjectPropertyIsOnline(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 53 of file class.ilExAssTypeWikiTeamGUI.php.

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

53  : void
54  {
56 
57  $next_class = $ctrl->getNextClass($this);
58  $cmd = $ctrl->getCmd();
59 
60  switch ($next_class) {
61  default:
62  if ($cmd === "createWiki") {
63  $this->$cmd();
64  }
65  }
66  }
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 118 of file class.ilExAssTypeWikiTeamGUI.php.

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

118  : array
119  {
120  $values = [];
121 
122  $ar = new ilExAssWikiTeamAR($ass->getId());
123 
124  if ($ar->getTemplateRefId() > 0) {
125  $values["template_ref_id"] = $ar->getTemplateRefId();
126  $values["template"] = "1";
127  } else {
128  $values["template"] = "0";
129  }
130  $values["container_ref_id"] = $ar->getContainerRefId();
131 
132  return $values;
133  }
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 145 of file class.ilExAssTypeWikiTeamGUI.php.

References renderOverviewContent().

145  : string
146  {
147  switch ($par["mode"]) {
148  case self::MODE_OVERVIEW:
149  $this->renderOverviewContent($par["info"], $par["submission"]);
150  break;
151  }
152  return "";
153  }
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 135 of file class.ilExAssTypeWikiTeamGUI.php.

References ILIAS\Repository\ctrl().

135  : void
136  {
137  $this->ctrl->getHTML($this, array("mode" => self::MODE_OVERVIEW, "info" => $a_info, "submission" => $a_submission));
138  }
+ 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 103 of file class.ilExAssTypeWikiTeamGUI.php.

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

103  : void
104  {
105  $ar = new ilExAssWikiTeamAR();
106  $ar->setId($ass->getId());
107  $ar->setTemplateRefId(0);
108  if ($form->getInput("template_ref_id") && $form->getInput("template")) {
109  $ar->setTemplateRefId($form->getInput("template_ref_id"));
110  }
111  $ar->setContainerRefId($form->getInput("container_ref_id"));
112  $ar->save();
113  }
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 158 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().

158  : void
159  {
160  $lng = $this->lng;
161  $ctrl = $this->ctrl;
162 
163  $files_str = "";
164  $valid_wiki = false;
165 
166  $team_members = $a_submission->getTeam()->getMembers();
167  $team_available = (count($team_members));
168 
169  $selected_wiki = $a_submission->getSelectedObject();
170  if ($selected_wiki) {
171  $wiki_ref_id = (int) $selected_wiki->getTitle();
172 
173  // #11746
174  if (ilObject::_exists($wiki_ref_id, true, "wiki") && $this->tree->isInTree($wiki_ref_id)) {
175  $wiki = new ilObjWiki($wiki_ref_id);
176  if ($wiki->getTitle()) {
177  // #10116 / #12791
178  $ctrl->setParameterByClass("ilobjwikigui", "ref_id", $wiki_ref_id);
179  $wiki_link = ilLink::_getLink($wiki_ref_id);
180  $files_str = '<a href="' . $wiki_link .
181  '">' . $wiki->getTitle() . '</a>';
182  $valid_wiki = true;
183  }
184  }
185  // remove invalid resource if no upload yet (see download below)
186  elseif (substr($selected_wiki["filename"], -1) == "/") {
187  // #16887
188  $a_submission->deleteResourceObject();
189  }
190  }
191  if ($a_submission->canSubmit()) {
192  if (!$valid_wiki && $team_available) {
193  $files_str .= $this->gui->button(
194  $lng->txt("exc_create_wiki"),
195  $ctrl->getLinkTargetByClass([ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, self::class], "createWiki")
196  )->render();
197  }
198  }
199  if ($files_str) {
200  $a_info->addProperty($lng->txt("exc_ass_team_wiki"), $files_str);
201  }
202  if ($a_submission->hasSubmitted()) {
203  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_wiki->getId());
204  $dl_link = $ctrl->getLinkTargetByClass([
205  ilAssignmentPresentationGUI::class,
206  ilExSubmissionGUI::class,
207  ilExSubmissionFileGUI::class], "download");
208  $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
209 
210  $a_info->addProperty($lng->txt("exc_files_returned"), $this->gui->button(
211  $lng->txt("download"),
212  $dl_link
213  )->render());
214  }
215  }
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 36 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 37 of file class.ilExAssTypeWikiTeamGUI.php.

◆ $tree

ilTree ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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


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