ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 34 of file class.ilExerciseSubmissionFeedbackGUI.php.

39 {
40 $this->domain = $domain;
41 $this->gui = $gui;
42 $lng = $domain->lng();
43 $lng->loadLanguageModule("exc");
44 $this->exercise = $exercise;
46 }
ILIAS Exercise Notification NotificationManager $notification
global $lng
Definition: privfeed.php:31

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilExerciseSubmissionFeedbackGUI::executeCommand ( )

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

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

◆ getComponents()

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

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

67 : array
68 {
69 $lng = $this->domain->lng();
70 $ctrl = $this->gui->ctrl();
71
72 $ctrl->setParameter($this, "ass_id", $ass_id);
73 $ctrl->setParameter($this, "member_id", $usr_id);
74
75 $components = $this
76 ->gui
77 ->modal($lng->txt("exc_tbl_action_feedback_text"))
78 ->getAsyncTriggerButtonComponents(
79 $lng->txt("exc_tbl_action_feedback_text"),
80 $ctrl->getLinkTarget($this, "showFeedbackForm", "", true),
81 true
82 );
83
84 return $components;
85 }
$components

References $ass_id, $components, and $lng.

◆ getFeedbackForm()

ilExerciseSubmissionFeedbackGUI::getFeedbackForm ( )
protected

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

97 {
98 $lng = $this->domain->lng();
99 $ctrl = $this->gui->ctrl();
100 $request = $this->gui->request();
101
102 $ass_id = $request->getAssId();
103 $ass = $this->domain->assignment()->getAssignment($ass_id);
104 $user_id = $request->getMemberId();
105
106 $ctrl->setParameter($this, "ass_id", $ass_id);
107 $ctrl->setParameter($this, "member_id", $user_id);
108
109 $form = $this
110 ->gui
111 ->form(self::class, "validateAndSubmitFeedbackForm")
112 ->asyncModal()
113 ->textarea(
114 "comment",
115 $lng->txt("exc_comment_for_learner"),
116 $lng->txt("exc_comment_for_learner_info"),
117 $ass->getMemberStatus($user_id)->getComment()
118 );
119
120 return $form;
121 }

References $ass_id, $lng, and $user_id.

Referenced by showFeedbackForm(), and validateAndSubmitFeedbackForm().

+ Here is the caller graph for this function:

◆ saveCommentForLearners()

ilExerciseSubmissionFeedbackGUI::saveCommentForLearners ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ showFeedbackForm()

ilExerciseSubmissionFeedbackGUI::showFeedbackForm ( )
protected

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

87 : void
88 {
89 $lng = $this->domain->lng();
90 $this->gui
91 ->modal($lng->txt("exc_tbl_action_feedback_text"))
92 ->form($this->getFeedbackForm())
93 ->send();
94 }

References $lng, and getFeedbackForm().

+ Here is the call graph for this function:

◆ validateAndSubmitFeedbackForm()

ilExerciseSubmissionFeedbackGUI::validateAndSubmitFeedbackForm ( )
protected

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

123 : void
124 {
125 $lng = $this->domain->lng();
126 $ctrl = $this->gui->ctrl();
127 $request = $this->gui->request();
128 $form = $this->getFeedbackForm();
129 if (!$form->isValid()) {
130 $this->gui->modal($lng->txt("exc_tbl_action_feedback_text"))
131 ->form($form)
132 ->send();
133 }
134
135 $user_id = $request->getMemberId();
136 $ass_id = $request->getAssId();
137 $comment = $form->getData("comment");
138
139 $ctrl->setParameter($this, "member_id", $user_id);
140 $ctrl->setParameter($this, "ass_id", $ass_id);
141 $ctrl->setParameter($this, "comment", $comment);
142
143 $target = $ctrl->getLinkTarget($this, "saveCommentForLearners");
144 $this->gui->send("<script>window.location.href = '" . $target . "';</script>");
145 }

References $ass_id, $comment, $lng, $user_id, and getFeedbackForm().

+ Here is the call graph for this function:

Field Documentation

◆ $domain

InternalDomainService ilExerciseSubmissionFeedbackGUI::$domain
protected

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

Referenced by __construct().

◆ $exercise

ilObjExercise ilExerciseSubmissionFeedbackGUI::$exercise
protected

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

Referenced by __construct().

◆ $gui

InternalGUIService ilExerciseSubmissionFeedbackGUI::$gui
protected

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

Referenced by __construct().

◆ $notification

ILIAS Exercise Notification NotificationManager ilExerciseSubmissionFeedbackGUI::$notification
protected

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

Referenced by __construct().


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