55namespace Chamilo \PluginBundle \ExerciseFocused \Controller ;
66
77use Chamilo \CoreBundle \Entity \TrackEExercises ;
8+ use Chamilo \CourseBundle \Entity \CQuizQuestion ;
89use Chamilo \PluginBundle \ExerciseFocused \Entity \Log ;
910use Chamilo \PluginBundle \ExerciseFocused \Traits \DetailControllerTrait ;
1011use Doctrine \ORM \OptimisticLockException ;
@@ -42,7 +43,7 @@ public function __invoke(): HttpResponse
4243 $ objExercise ->read ($ exe ->getExeExoId ());
4344
4445 $ logs = $ this ->logRepository ->findBy (['exe ' => $ exe ], ['updatedAt ' => 'ASC ' ]);
45- $ table = $ this ->getTable ($ logs );
46+ $ table = $ this ->getTable ($ objExercise , $ logs );
4647
4748 $ content = $ this ->generateHeader ($ objExercise , $ user , $ exe )
4849 .'<hr> '
@@ -56,15 +57,27 @@ public function __invoke(): HttpResponse
5657 *
5758 * @return void
5859 */
59- private function getTable (array $ logs ): HTML_Table
60+ private function getTable (Exercise $ objExercise , array $ logs ): HTML_Table
6061 {
6162 $ table = new HTML_Table (['class ' => 'table table-hover table-striped data_table ' ]);
6263 $ table ->setHeaderContents (0 , 0 , get_lang ('Action ' ));
6364 $ table ->setHeaderContents (0 , 1 , get_lang ('DateTime ' ));
65+ $ table ->setHeaderContents (0 , 2 , $ this ->plugin ->get_lang ('LevelReached ' ));
6466
6567 $ row = 1 ;
6668
6769 foreach ($ logs as $ log ) {
70+ $ strLevel = '' ;
71+
72+ if (ONE_PER_PAGE == $ objExercise ->selectType ()) {
73+ try {
74+ $ question = $ this ->em ->find (CQuizQuestion::class, $ log ->getLevel ());
75+
76+ $ strLevel = $ question ->getQuestion ();
77+ } catch (Exception $ exception ) {
78+ }
79+ }
80+
6881 $ table ->setCellContents (
6982 $ row ,
7083 0 ,
@@ -75,6 +88,7 @@ private function getTable(array $logs): HTML_Table
7588 1 ,
7689 api_get_local_time ($ log ->getCreatedAt (), null , null , true , true , true )
7790 );
91+ $ table ->setCellContents ($ row , 2 , $ strLevel );
7892
7993 $ row ++;
8094 }
0 commit comments