ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilExerciseSubmissionFeedbackGUI Class Reference
+ Collaboration diagram for ilExerciseSubmissionFeedbackGUI:

Public Member Functions

 __construct (InternalDomainService $domain, InternalGUIService $gui, ?ilObjExercise $exercise, ILIAS\Exercise\Notification\NotificationManager $notification)
 
 executeCommand ()
 
 getComponents (int $ass_id, int $usr_id)
 

Protected Member Functions

 showFeedbackForm ()
 
 getFeedbackForm ()
 
 validateAndSubmitFeedbackForm ()
 
 saveCommentForLearners ()
 

Protected Attributes

InternalDomainService $domain
 
InternalGUIService $gui
 
ilObjExercise $exercise
 
ILIAS Exercise Notification NotificationManager $notification
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExerciseSubmissionFeedbackGUI::__construct ( InternalDomainService  $domain,
InternalGUIService  $gui,
?ilObjExercise  $exercise,
ILIAS\Exercise\Notification\NotificationManager  $notification 
)

Definition at line 31 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $domain, $exercise, $gui, $lng, $notification, and ILIAS\UI\examples\Symbol\Glyph\Notification\notification().

36  {
37  $this->domain = $domain;
38  $this->gui = $gui;
39  $lng = $domain->lng();
40  $lng->loadLanguageModule("exc");
41  $this->exercise = $exercise;
42  $this->notification = $notification;
43  }
ILIAS Exercise Notification NotificationManager $notification
notification()
description: > Example for rendring a notification glyph.
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilExerciseSubmissionFeedbackGUI::executeCommand ( )

Definition at line 45 of file class.ilExerciseSubmissionFeedbackGUI.php.

45  : void
46  {
47  $ctrl = $this->gui->ctrl();
48 
49  $next_class = $ctrl->getNextClass($this);
50  $cmd = $ctrl->getCmd("showFeedbackForm");
51 
52  switch ($next_class) {
53  default:
54  if (in_array($cmd, [
55  "showFeedbackForm",
56  "validateAndSubmitFeedbackForm",
57  "saveCommentForLearners"
58  ])) {
59  $this->$cmd();
60  }
61  }
62  }

◆ getComponents()

ilExerciseSubmissionFeedbackGUI::getComponents ( int  $ass_id,
int  $usr_id 
)

Definition at line 64 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $components, and $lng.

64  : array
65  {
66  $lng = $this->domain->lng();
67  $ctrl = $this->gui->ctrl();
68 
69  $ctrl->setParameter($this, "ass_id", $ass_id);
70  $ctrl->setParameter($this, "member_id", $usr_id);
71 
72  $components = $this
73  ->gui
74  ->modal($lng->txt("exc_tbl_action_feedback_text"))
75  ->getAsyncTriggerButtonComponents(
76  $lng->txt("exc_tbl_action_feedback_text"),
77  $ctrl->getLinkTarget($this, "showFeedbackForm", "", true),
78  true
79  );
80 
81  return $components;
82  }
$components
global $lng
Definition: privfeed.php:32

◆ getFeedbackForm()

ilExerciseSubmissionFeedbackGUI::getFeedbackForm ( )
protected

Definition at line 93 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $ass_id, $lng, and $user_id.

Referenced by showFeedbackForm(), and validateAndSubmitFeedbackForm().

93  : \ILIAS\Repository\Form\FormAdapterGUI
94  {
95  $lng = $this->domain->lng();
96  $ctrl = $this->gui->ctrl();
97  $request = $this->gui->request();
98 
99  $ass_id = $request->getAssId();
100  $ass = $this->domain->assignment()->getAssignment($ass_id);
101  $user_id = $request->getMemberId();
102 
103  $ctrl->setParameter($this, "ass_id", $ass_id);
104  $ctrl->setParameter($this, "member_id", $user_id);
105 
106  $form = $this
107  ->gui
108  ->form(self::class, "validateAndSubmitFeedbackForm")
109  ->asyncModal()
110  ->textarea(
111  "comment",
112  $lng->txt("exc_comment_for_learner"),
113  $lng->txt("exc_comment_for_learner_info"),
114  $ass->getMemberStatus($user_id)->getComment()
115  );
116 
117  return $form;
118  }
global $lng
Definition: privfeed.php:32
+ Here is the caller graph for this function:

◆ saveCommentForLearners()

ilExerciseSubmissionFeedbackGUI::saveCommentForLearners ( )
protected

Definition at line 144 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $ass_id, $comment, $user_id, ILIAS\UI\examples\Symbol\Glyph\Notification\notification(), and ilUtil\stripSlashes().

144  : void
145  {
146  $ctrl = $this->gui->ctrl();
147  $request = $this->gui->request();
148 
149  $ass_id = $request->getAssId();
150  $ass = $this->domain->assignment()->getAssignment($ass_id);
151  $user_id = $request->getMemberId();
152  $comment = trim($request->getComment());
153 
154  if ($ass_id && $user_id) {
155  $submission = new ilExSubmission($ass, $user_id);
156  $user_ids = $submission->getUserIds();
157 
158  $all_members = new ilExerciseMembers($this->exercise);
159  $all_members = $all_members->getMembers();
160 
161  $reci_ids = array();
162  foreach ($user_ids as $user_id) {
163  if (in_array($user_id, $all_members)) {
164  $member_status = $ass->getMemberStatus($user_id);
165  $member_status->setComment(ilUtil::stripSlashes($comment));
166  $member_status->setFeedback(true);
167  $member_status->update();
168 
169  if (trim($comment) !== '' && trim($comment) !== '0') {
170  $reci_ids[] = $user_id;
171  }
172  }
173  }
174 
175  if ($reci_ids !== []) {
176  // send notification
177  $this->notification->sendFeedbackNotification(
178  $ass_id,
179  $reci_ids,
180  "",
181  true
182  );
183  }
184  }
185 
186  $ctrl->redirectByClass("ilexercisemanagementgui", $request->getParticipantId()
187  ? "showParticipant"
188  : "members");
189  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
notification()
description: > Example for rendring a notification glyph.
$comment
Definition: buildRTE.php:72
Exercise submission //TODO: This class has many static methods related to delivered "files"...
+ Here is the call graph for this function:

◆ showFeedbackForm()

ilExerciseSubmissionFeedbackGUI::showFeedbackForm ( )
protected

Definition at line 84 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $lng, ILIAS\Repository\form(), getFeedbackForm(), and send().

84  : void
85  {
86  $lng = $this->domain->lng();
87  $this->gui
88  ->modal($lng->txt("exc_tbl_action_feedback_text"))
89  ->form($this->getFeedbackForm())
90  ->send();
91  }
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:32
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:97
+ Here is the call graph for this function:

◆ validateAndSubmitFeedbackForm()

ilExerciseSubmissionFeedbackGUI::validateAndSubmitFeedbackForm ( )
protected

Definition at line 120 of file class.ilExerciseSubmissionFeedbackGUI.php.

References $ass_id, $comment, $lng, $user_id, ILIAS\Repository\form(), and getFeedbackForm().

120  : void
121  {
122  $lng = $this->domain->lng();
123  $ctrl = $this->gui->ctrl();
124  $request = $this->gui->request();
125  $form = $this->getFeedbackForm();
126  if (!$form->isValid()) {
127  $this->gui->modal($lng->txt("exc_tbl_action_feedback_text"))
128  ->form($form)
129  ->send();
130  }
131 
132  $user_id = $request->getMemberId();
133  $ass_id = $request->getAssId();
134  $comment = $form->getData("comment");
135 
136  $ctrl->setParameter($this, "member_id", $user_id);
137  $ctrl->setParameter($this, "ass_id", $ass_id);
138  $ctrl->setParameter($this, "comment", $comment);
139 
140  $target = $ctrl->getLinkTarget($this, "saveCommentForLearners");
141  $this->gui->send("<script>window.location.href = '" . $target . "';</script>");
142  }
$comment
Definition: buildRTE.php:72
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

Field Documentation

◆ $domain

InternalDomainService ilExerciseSubmissionFeedbackGUI::$domain
protected

Definition at line 26 of file class.ilExerciseSubmissionFeedbackGUI.php.

Referenced by __construct().

◆ $exercise

ilObjExercise ilExerciseSubmissionFeedbackGUI::$exercise
protected

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

Referenced by __construct().

◆ $gui

InternalGUIService ilExerciseSubmissionFeedbackGUI::$gui
protected

Definition at line 27 of file class.ilExerciseSubmissionFeedbackGUI.php.

Referenced by __construct().

◆ $notification

ILIAS Exercise Notification NotificationManager ilExerciseSubmissionFeedbackGUI::$notification
protected

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

Referenced by __construct().


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