ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExAssTypeWikiTeamGUI Class Reference

Team wiki type gui implementations. 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.
Parameters
ilPropertyFormGUI$form
More...
 
 importFormToAssignment (ilExAssignment $ass, ilPropertyFormGUI $form)
 Get values from form and put them into assignment.
Parameters
ilExAssignment$ass
ilPropertyFormGUI$form
More...
 
 getFormValuesArray (ilExAssignment $ass)
 Get form values array from assignment.
Parameters
ilExAssignment$ass
Returns
array
More...
 
 getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Add overview content of submission to info screen object.
Parameters
ilInfoScreenGUI$a_info
ilExSubmission$a_submission
More...
 
 getHTML ($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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypeWikiTeamGUI::__construct ( )

Constructor.

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

44 {
45 global $DIC;
46
47 $this->lng = $DIC->language();
48 $this->ctrl = $DIC->ctrl();
49 $this->tree = $DIC->repositoryTree();
50 $this->access = $DIC->access();
51 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addEditFormCustomProperties()

ilExAssTypeWikiTeamGUI::addEditFormCustomProperties ( ilPropertyFormGUI  $form)

Add custom form properties to edit form.

Parameters
ilPropertyFormGUI$form

Implements ilExAssignmentTypeGUIInterface.

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

75 {
77
78 // template
79 $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
80 $rd_template->setRequired(true);
81 $radio_no_template = new ilRadioOption($lng->txt("exc_without_wiki_template"), 0, $lng->txt("exc_without_wiki_template_info"));
82 $radio_with_template = new ilRadioOption($lng->txt("exc_with_wiki_template"), 1, $lng->txt("exc_with_wiki_template_info"));
83
84 include_once "Services/Form/classes/class.ilRepositorySelector2InputGUI.php";
85 $repo = new ilRepositorySelector2InputGUI($lng->txt("wiki_exc_template"), "template_ref_id");
86 $repo->setRequired(true);
87 $repo->getExplorerGUI()->setSelectableTypes(array("wiki"));
88 $repo->getExplorerGUI()->setTypeWhiteList(array("root", "wiki", "cat", "crs", "grp", "fold"));
89 $radio_with_template->addSubItem($repo);
90
91 $rd_template->addOption($radio_no_template);
92 $rd_template->addOption($radio_with_template);
93 $form->addItem($rd_template);
94
95 // container
96 include_once "Services/Form/classes/class.ilRepositorySelector2InputGUI.php";
97 $cont = new ilRepositorySelector2InputGUI($lng->txt("exc_wiki_container"), "container_ref_id");
98 $cont->setRequired(true);
99 $cont->setInfo($lng->txt("exc_wiki_container_info"));
100 $cont->getExplorerGUI()->setSelectableTypes(array("cat", "crs", "grp", "fold"));
101 $cont->getExplorerGUI()->setTypeWhiteList(array("root", "cat", "crs", "grp", "fold"));
102 $form->addItem($cont);
103 }
This class represents a property in a property form.
This class represents an option in a radio group.
if(isset($_POST['submit'])) $form

References $form, and $lng.

◆ createWiki()

ilExAssTypeWikiTeamGUI::createWiki ( )
protected

Create wiki for assignment.

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

233 {
236
237 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssWikiTeamAR.php");
238 $ar = new ilExAssWikiTeamAR($this->submission->getAssignment()->getId());
239 $template_ref_id = $ar->getTemplateRefId();
240 $container_ref_id = $ar->getContainerRefId();
241
242 // @todo: move checks to central place
243 // check if team exists
244 $team_members = $this->submission->getTeam()->getMembers();
245 $team_available = (sizeof($team_members));
246 if (!$team_available) {
247 $lng->loadLanguageModule("exc");
248 ilUtil::sendInfo($lng->txt("exc_team_needed_first"), true);
249 $this->ctrl->returnToParent($this);
250 }
251
252 // check if submission is possible
253 if (!$this->submission->canSubmit()) {
254 $lng->loadLanguageModule("exc");
255 ilUtil::sendInfo($lng->txt("exercise_time_over"), true);
256 $this->ctrl->returnToParent($this);
257 }
258
259 // check create permission of exercise owner
260 if (!$access->checkAccessOfUser($this->exercise->getOwner(), "create", "", $container_ref_id, "wiki")) {
261 $lng->loadLanguageModule("exc");
262 ilUtil::sendInfo($lng->txt("exc_owner_has_no_permission_to_create_wiki"), true);
263 $this->ctrl->returnToParent($this);
264 }
265
266 if ($template_ref_id > 0 && ilObject::_exists($template_ref_id, true, "wiki")) {
267 $template_wiki = new ilObjWiki($template_ref_id);
268 $wiki = $template_wiki->cloneObject($container_ref_id);
269 $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
270 } else {
271 include_once "Modules/Wiki/classes/class.ilObjWiki.php";
272 $wiki = new ilObjWiki();
273 $wiki->setTitle($this->exercise->getTitle() . " - " . $this->submission->getAssignment()->getTitle());
274 $wiki->create();
275 $wiki->setStartPage($this->submission->getAssignment()->getTitle());
276
277 $wiki->createReference();
278 $wiki->putInTree($container_ref_id);
279 $wiki->setPermissions($container_ref_id);
280 }
281
282 $wiki->setOwner($this->exercise->getOwner());
283 $wiki->setOnline(true);
284 $wiki->update();
285 $wiki->updateOwner();
286
287 $this->submission->deleteAllFiles();
288 //$this->handleRemovedUpload();
289
290 $this->submission->addResourceObject($wiki->getRefId());
291
292 $lng->loadLanguageModule("wiki");
293 ilUtil::sendSuccess($lng->txt("wiki_exc_wiki_created"), true);
294 $this->ctrl->returnToParent($this);
295 }
Item group active record class.
Class ilObjWiki.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $access, $lng, ilObject\_exists(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeCommand()

ilExAssTypeWikiTeamGUI::executeCommand ( )

Execute command.

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

57 {
59
60 $next_class = $ctrl->getNextClass($this);
61 $cmd = $ctrl->getCmd();
62
63 switch ($next_class) {
64 default:
65 if (in_array($cmd, array("createWiki"))) {
66 $this->$cmd();
67 }
68 }
69 }

References $ctrl.

◆ getFormValuesArray()

ilExAssTypeWikiTeamGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Parameters
ilExAssignment$ass
Returns
array

Implements ilExAssignmentTypeGUIInterface.

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

125 {
126 $values = [];
127
128 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssWikiTeamAR.php");
129 $ar = new ilExAssWikiTeamAR($ass->getId());
130
131 if ($ar->getTemplateRefId() > 0) {
132 $values["template_ref_id"] = $ar->getTemplateRefId();
133 $values["template"] = 1;
134 }
135 $values["container_ref_id"] = $ar->getContainerRefId();
136
137 return $values;
138 }
getId()
Get assignment id.
$values

References $values, and ilExAssignment\getId().

+ Here is the call graph for this function:

◆ getHTML()

ilExAssTypeWikiTeamGUI::getHTML (   $par)

Get HTML.

Parameters
array$parparameter

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

154 {
155 switch ($par["mode"]) {
157 $this->renderOverviewContent($par["info"], $par["submission"]);
158 break;
159 }
160 }
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.

Parameters
ilInfoScreenGUI$a_info
ilExSubmission$a_submission

Implements ilExAssignmentTypeGUIInterface.

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

144 {
145 $this->ctrl->getHTML($this, array("mode" => self::MODE_OVERVIEW, "info" => $a_info, "submission" => $a_submission));
146 }

◆ importFormToAssignment()

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

Get values from form and put them into assignment.

Parameters
ilExAssignment$ass
ilPropertyFormGUI$form

Implements ilExAssignmentTypeGUIInterface.

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

109 {
110 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssWikiTeamAR.php");
111 $ar = new ilExAssWikiTeamAR();
112 $ar->setId($ass->getId());
113 $ar->setTemplateRefId(0);
114 if ($form->getInput("template_ref_id") && $form->getInput("template")) {
115 $ar->setTemplateRefId($form->getInput("template_ref_id"));
116 }
117 $ar->setContainerRefId($form->getInput("container_ref_id"));
118 $ar->save();
119 }

References $form, and ilExAssignment\getId().

+ Here is the call graph for this function:

◆ renderOverviewContent()

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

Render overview content.

Parameters
ilInfoScreenGUI$a_info
ilExSubmission$a_submission

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

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

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

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

Referenced by createWiki().

◆ $ctrl

ilExAssTypeWikiTeamGUI::$ctrl
protected

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

Referenced by executeCommand(), and renderOverviewContent().

◆ $lng

ilExAssTypeWikiTeamGUI::$lng
protected

◆ $tree

ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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

Referenced by getHTML().


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