Completed
Push — master ( 766493...8be9e6 )
by Angel Fernando Quiroz
216:20 queued 183:31
created
main/inc/ajax/exercise.ajax.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $exercise_id = intval($_GET['exercise_id']);
33 33
         $page = intval($_REQUEST['page']); //page
34 34
         $limit = intval($_REQUEST['rows']); //quantity of rows
35
-        $sidx = $_REQUEST['sidx'];         //index to filter
36
-        $sord = $_REQUEST['sord'];         //asc or desc
35
+        $sidx = $_REQUEST['sidx']; //index to filter
36
+        $sord = $_REQUEST['sord']; //asc or desc
37 37
 
38
-        if (!in_array($sord, array('asc','desc'))) {
38
+        if (!in_array($sord, array('asc', 'desc'))) {
39 39
             $sord = 'desc';
40 40
         }
41 41
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $total_pages = 0;
65 65
         if ($count > 0) {
66 66
             if (!empty($limit)) {
67
-                $total_pages = ceil($count/$limit);
67
+                $total_pages = ceil($count / $limit);
68 68
             }
69 69
         }
70 70
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $response->page = $page;
127 127
         $response->total = $total_pages;
128 128
         $response->records = $count;
129
-        $i=0;
129
+        $i = 0;
130 130
 
131 131
         if (!empty($results)) {
132 132
             foreach ($results as $row) {
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
                             GROUP by question_id
141 141
                         ) as count_table";
142 142
                 $result_count = Database::query($sql);
143
-                $count_questions = Database::fetch_array($result_count,'ASSOC');
143
+                $count_questions = Database::fetch_array($result_count, 'ASSOC');
144 144
                 $count_questions = $count_questions['count_question_id'];
145 145
 
146 146
                 $row['count_questions'] = $count_questions;
147 147
 
148 148
                 $response->rows[$i]['id'] = $row['exe_id'];
149
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
150
-                $h = floor($remaining/3600);
151
-                $m = floor(($remaining - ($h*3600))/60);
152
-                $s = ($remaining - ($h*3600) - ($m*60));
149
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
150
+                $h = floor($remaining / 3600);
151
+                $m = floor(($remaining - ($h * 3600)) / 60);
152
+                $s = ($remaining - ($h * 3600) - ($m * 60));
153 153
                 $array = array(
154 154
                     $row['firstname'],
155 155
                     $row['lastname'],
156
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
156
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
157 157
                     $row['count_questions'],
158
-                    round($row['score']*100).'%'
158
+                    round($row['score'] * 100).'%'
159 159
                 );
160 160
                 $response->rows[$i]['cell'] = $array;
161 161
                 $i++;
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
                 // Getting free choice data.
362 362
                 if (
363
-                    ($objQuestionTmp->type  == FREE_ANSWER || $objQuestionTmp->type  == ORAL_EXPRESSION)
363
+                    ($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION)
364 364
                     && $type == 'all'
365 365
                 ) {
366 366
                     $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
         $objQuestion = Question::read($questionId);
529 529
         $objQuestion->get_question_type_name();
530 530
 
531
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
531
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
532 532
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
533 533
         ExerciseLib::showQuestion(
534 534
             $questionId,
Please login to merge, or discard this patch.