ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 11 of file class.ilExAssTypeWikiTeamGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypeWikiTeamGUI::__construct ( )

Constructor.

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

41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->ctrl = $DIC->ctrl();
46 $this->tree = $DIC->repositoryTree();
47 $this->access = $DIC->access();
48 }
$DIC
Definition: xapitoken.php:46

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

72 {
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 }
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.

References $lng, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ createWiki()

ilExAssTypeWikiTeamGUI::createWiki ( )
protected

Create wiki for assignment.

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

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

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

References $ctrl.

◆ getFormValuesArray()

ilExAssTypeWikiTeamGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Parameters
ilExAssignment$ass
Returns
array

Implements ilExAssignmentTypeGUIInterface.

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

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 }
128 $values["container_ref_id"] = $ar->getContainerRefId();
129
130 return $values;
131 }
getId()
Get assignment id.

References ilExAssignment\getId().

+ Here is the call graph for this function:

◆ getHTML()

ilExAssTypeWikiTeamGUI::getHTML (   $par)

Get HTML.

Parameters
array$parparameter

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

147 {
148 switch ($par["mode"]) {
150 $this->renderOverviewContent($par["info"], $par["submission"]);
151 break;
152 }
153 }
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 136 of file class.ilExAssTypeWikiTeamGUI.php.

137 {
138 $this->ctrl->getHTML($this, array("mode" => self::MODE_OVERVIEW, "info" => $a_info, "submission" => $a_submission));
139 }

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

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($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

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.

Parameters
ilInfoScreenGUI$a_info
ilExSubmission$a_submission

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

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

Referenced by createWiki().

◆ $ctrl

ilExAssTypeWikiTeamGUI::$ctrl
protected

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

Referenced by executeCommand(), and renderOverviewContent().

◆ $lng

ilExAssTypeWikiTeamGUI::$lng
protected

◆ $tree

ilExAssTypeWikiTeamGUI::$tree
protected

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

◆ MODE_OVERVIEW

const ilExAssTypeWikiTeamGUI::MODE_OVERVIEW = "overview"

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

Referenced by getHTML().


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