diff --git a/main/inc/lib/hook/HookMyStudentsQuizTracking.php b/main/inc/lib/hook/HookMyStudentsQuizTracking.php new file mode 100644 index 0000000000..8c3e451777 --- /dev/null +++ b/main/inc/lib/hook/HookMyStudentsQuizTracking.php @@ -0,0 +1,54 @@ +observers as $observer) { + $results[] = $observer->trackingHeader($this); + } + + return $results; + } + + /** + * @param int $quizId + * @param int $studentId + * + * @return array + */ + public function notifyTrackingContent($quizId, $studentId) + { + $this->eventData['quiz_id'] = $quizId; + $this->eventData['student_id'] = $studentId; + + $results = []; + + /** @var HookMyStudentsQuizTrackingObserverInterface $observer */ + foreach ($this->observers as $observer) { + $results[] = $observer->trackingContent($this); + } + + return $results; + } +} diff --git a/main/inc/lib/hook/interfaces/HookMyStudentsQuizTrackingEventInterface.php b/main/inc/lib/hook/interfaces/HookMyStudentsQuizTrackingEventInterface.php new file mode 100644 index 0000000000..7a340a1514 --- /dev/null +++ b/main/inc/lib/hook/interfaces/HookMyStudentsQuizTrackingEventInterface.php @@ -0,0 +1,21 @@ + + * [ + * 'value' => 'Users online', + * 'attrs' => ['class' => 'text-center'], + * ] + * + * + * @param HookMyStudentsQuizTrackingEventInterface $hook + * + * @return array + */ + public function trackingHeader(HookMyStudentsQuizTrackingEventInterface $hook); + + /** + * Return an associative array this value and attributes. + * + * [ + * 'value' => '5 connected users ', + * 'attrs' => ['class' => 'text-center text-success'], + * ] + * + * + * @param HookMyStudentsQuizTrackingEventInterface $hook + * + * @return array + */ + public function trackingContent(HookMyStudentsQuizTrackingEventInterface $hook); +}