ILIAS  release_8 Revision v8.24
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 ()
 Constructor. More...
 
 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...
 
- Public Member Functions inherited from ilExAssignmentTypeGUIInterface
 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. More...
 
 getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Add overview content of submission to info screen object. More...
 
 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

 $lng
 
 $ctrl
 
 $tree
 
 $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 @ilCtrl_isCalledBy ilExAssTypeWikiTeamGUI: ilExSubmissionGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypeWikiTeamGUI::__construct ( )

Constructor.

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

56 {
57 global $DIC;
58 $this->main_tpl = $DIC->ui()->mainTemplate();
59
60 $this->lng = $DIC->language();
61 $this->ctrl = $DIC->ctrl();
62 $this->tree = $DIC->repositoryTree();
63 $this->access = $DIC->access();
64 }
global $DIC
Definition: feed.php:28

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

+ 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 87 of file class.ilExAssTypeWikiTeamGUI.php.

87 : void
88 {
90
91 // template
92 $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
93 $rd_template->setRequired(true);
94 $rd_template->setValue("0");
95 $radio_no_template = new ilRadioOption($lng->txt("exc_without_wiki_template"), "0", $lng->txt("exc_without_wiki_template_info"));
96 $radio_with_template = new ilRadioOption($lng->txt("exc_with_wiki_template"), "1", $lng->txt("exc_with_wiki_template_info"));
97
98 $repo = new ilRepositorySelector2InputGUI($lng->txt("wiki_exc_template"), "template_ref_id");
99 $repo->setRequired(true);
100 $repo->getExplorerGUI()->setSelectableTypes(array("wiki"));
101 $repo->getExplorerGUI()->setTypeWhiteList(array("root", "wiki", "cat", "crs", "grp", "fold"));
102 $radio_with_template->addSubItem($repo);
103
104 $rd_template->addOption($radio_no_template);
105 $rd_template->addOption($radio_with_template);
106 $form->addItem($rd_template);
107
108 // container
109 $cont = new ilRepositorySelector2InputGUI($lng->txt("exc_wiki_container"), "container_ref_id");
110 $cont->setRequired(true);
111 $cont->setInfo($lng->txt("exc_wiki_container_info"));
112 $cont->getExplorerGUI()->setSelectableTypes(array("cat", "crs", "grp", "fold"));
113 $cont->getExplorerGUI()->setTypeWhiteList(array("root", "cat", "crs", "grp", "fold"));
114 $form->addItem($cont);
115 }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $lng, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ createWiki()

ilExAssTypeWikiTeamGUI::createWiki ( )
protected

Create wiki for assignment.

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

236 : void
237 {
240
241 $ar = new ilExAssWikiTeamAR($this->submission->getAssignment()->getId());
242 $template_ref_id = $ar->getTemplateRefId();
243 $container_ref_id = $ar->getContainerRefId();
244
245 // @todo: move checks to central place
246 // check if team exists
247 $team_members = $this->submission->getTeam()->getMembers();
248 $team_available = (sizeof($team_members));
249 if (!$team_available) {
250 $lng->loadLanguageModule("exc");
251 $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_team_needed_first"), true);
252 $this->ctrl->returnToParent($this);
253 }
254
255 // check if submission is possible
256 if (!$this->submission->canSubmit()) {
257 $lng->loadLanguageModule("exc");
258 $this->main_tpl->setOnScreenMessage('info', $lng->txt("exercise_time_over"), true);
259 $this->ctrl->returnToParent($this);
260 }
261
262 // check create permission of exercise owner
263 if (!$access->checkAccessOfUser($this->exercise->getOwner(), "create", "", $container_ref_id, "wiki")) {
264 $lng->loadLanguageModule("exc");
265 $this->main_tpl->setOnScreenMessage('info', $lng->txt("exc_owner_has_no_permission_to_create_wiki"), true);
266 $this->ctrl->returnToParent($this);
267 }
268
269 if ($template_ref_id > 0 && ilObject::_exists($template_ref_id, true, "wiki")) {
270 $template_wiki = new ilObjWiki($template_ref_id);
271 $wiki = $template_wiki->cloneObject($container_ref_id);
272 $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
273 } else {
274 $wiki = new ilObjWiki();
275 $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
276 $wiki->create();
277 $wiki->setStartPage($this->submission->getAssignment()->getTitle());
278
279 $wiki->createReference();
280 $wiki->putInTree($container_ref_id);
281 $wiki->setPermissions($container_ref_id);
282 }
283
284 $wiki->setOwner($this->exercise->getOwner());
285 $wiki->setOnline(true);
286 $wiki->update();
287 $wiki->updateOwner();
288
289 $this->submission->deleteAllFiles();
290 //$this->handleRemovedUpload();
291
292 $this->submission->addResourceObject($wiki->getRefId());
293
294 $lng->loadLanguageModule("wiki");
295 $this->main_tpl->setOnScreenMessage('success', $lng->txt("wiki_exc_wiki_created"), true);
296 $this->ctrl->returnToParent($this);
297 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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

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

+ Here is the call graph for this function:

◆ executeCommand()

ilExAssTypeWikiTeamGUI::executeCommand ( )

Execute command.

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

69 : void
70 {
72
73 $next_class = $ctrl->getNextClass($this);
74 $cmd = $ctrl->getCmd();
75
76 switch ($next_class) {
77 default:
78 if ($cmd === "createWiki") {
79 $this->$cmd();
80 }
81 }
82 }

References $ctrl.

◆ getFormValuesArray()

ilExAssTypeWikiTeamGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Returns
array

Implements ilExAssignmentTypeGUIInterface.

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

135 : array
136 {
137 $values = [];
138
139 $ar = new ilExAssWikiTeamAR($ass->getId());
140
141 $values["template"] = "0";
142 if ($ar->getTemplateRefId() > 0) {
143 $values["template_ref_id"] = $ar->getTemplateRefId();
144 $values["template"] = "1";
145 }
146 $values["container_ref_id"] = $ar->getContainerRefId();
147
148 return $values;
149 }

References ilExAssignment\getId().

+ Here is the call graph for this function:

◆ getHTML()

ilExAssTypeWikiTeamGUI::getHTML ( array  $par)

Get HTML.

Parameters
array$parparameter

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

161 : string
162 {
163 switch ($par["mode"]) {
165 $this->renderOverviewContent($par["info"], $par["submission"]);
166 break;
167 }
168 return "";
169 }
renderOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
Render overview content.

References MODE_OVERVIEW, and renderOverviewContent().

+ 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 151 of file class.ilExAssTypeWikiTeamGUI.php.

151 : void
152 {
153 $this->ctrl->getHTML($this, array("mode" => self::MODE_OVERVIEW, "info" => $a_info, "submission" => $a_submission));
154 }

References ILIAS\Repository\ctrl().

+ 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 120 of file class.ilExAssTypeWikiTeamGUI.php.

120 : void
121 {
122 $ar = new ilExAssWikiTeamAR();
123 $ar->setId($ass->getId());
124 $ar->setTemplateRefId(0);
125 if ($form->getInput("template_ref_id") && $form->getInput("template")) {
126 $ar->setTemplateRefId($form->getInput("template_ref_id"));
127 }
128 $ar->setContainerRefId($form->getInput("container_ref_id"));
129 $ar->save();
130 }
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-...

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

+ Here is the call graph for this function:

◆ renderOverviewContent()

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

Render overview content.

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

174 : void
175 {
178
179 $files_str = "";
180 $valid_wiki = false;
181
182 $team_members = $a_submission->getTeam()->getMembers();
183 $team_available = (count($team_members));
184
185 $selected_wiki = $a_submission->getSelectedObject();
186 if ($selected_wiki) {
187 $wiki_ref_id = (int) $selected_wiki["filetitle"];
188
189 // #11746
190 if (ilObject::_exists($wiki_ref_id, true, "wiki") && $this->tree->isInTree($wiki_ref_id)) {
191 $wiki = new ilObjWiki($wiki_ref_id);
192 if ($wiki->getTitle()) {
193 // #10116 / #12791
194 $ctrl->setParameterByClass("ilobjwikigui", "ref_id", $wiki_ref_id);
195 $wiki_link = ilLink::_getLink($wiki_ref_id);
196 $files_str = '<a href="' . $wiki_link .
197 '">' . $wiki->getTitle() . '</a>';
198 $valid_wiki = true;
199 }
200 }
201 // remove invalid resource if no upload yet (see download below)
202 elseif (substr($selected_wiki["filename"], -1) == "/") {
203 // #16887
204 $a_submission->deleteResourceObject();
205 }
206 }
207 if ($a_submission->canSubmit()) {
208 if (!$valid_wiki && $team_available) {
209 $button = ilLinkButton::getInstance();
210 $button->setCaption("exc_create_wiki");
211 $button->setUrl($ctrl->getLinkTarget($this, "createWiki"));
212
213 $files_str .= $button->render();
214 }
215 }
216 if ($files_str) {
217 $a_info->addProperty($lng->txt("exc_ass_team_wiki"), $files_str);
218 }
219 if ($a_submission->hasSubmitted()) {
220 $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_wiki["returned_id"]);
221 $dl_link = $ctrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
222 $ctrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
223
224 $button = ilLinkButton::getInstance();
225 $button->setCaption("download");
226 $button->setUrl($dl_link);
227
228 $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
229 }
230 }
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section

References $ctrl, $lng, ilObject\_exists(), ilLink\_getLink(), ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilExSubmission\deleteResourceObject(), ilLinkButton\getInstance(), ilExSubmission\getSelectedObject(), ilExSubmission\getTeam(), ilExSubmission\hasSubmitted(), and ILIAS\Repository\int().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilExAssTypeWikiTeamGUI::$access
protected

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

Referenced by createWiki().

◆ $ctrl

ilExAssTypeWikiTeamGUI::$ctrl
protected

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

Referenced by executeCommand(), and renderOverviewContent().

◆ $lng

ilExAssTypeWikiTeamGUI::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ilExAssTypeWikiTeamGUI::$main_tpl
private

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

◆ $tree

ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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

Referenced by getHTML().


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