Completed
Push — 1.10.x ( f84186...ed25ba )
by Angel Fernando Quiroz
115:51 queued 67:47
created
main/exercice/question_list_admin.inc.php 1 patch
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             .sortable({
141 141
                 cursor: "move", // works?
142 142
                 update: function(event, ui) {
143
-                    var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']);?>";
143
+                    var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']); ?>";
144 144
                     $.post("<?php echo $ajax_url ?>", order, function(reponse){
145 145
                         $("#message").html(reponse);
146 146
                     });
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
     echo "<div class='table-responsive'>";
177 177
     echo "<table class='table table-condensed'>";
178 178
     echo "<tr>";
179
-    echo "<th style=\"width: 50%;\">" .get_lang('Questions'). "</th>";
180
-    echo "<th style=\"width: 6%;\">" .get_lang('Type'). "</th>";
181
-    echo "<th style=\"width: 22%; text-align:center;\">" .get_lang('Category'). "</th>";
182
-    echo "<th style=\"width: 6%;\">" .get_lang('Difficulty'). "</th>";
183
-    echo "<th style=\"width: 16%; float:left;\">" .get_lang('Score'). "</th>";
179
+    echo "<th style=\"width: 50%;\">".get_lang('Questions')."</th>";
180
+    echo "<th style=\"width: 6%;\">".get_lang('Type')."</th>";
181
+    echo "<th style=\"width: 22%; text-align:center;\">".get_lang('Category')."</th>";
182
+    echo "<th style=\"width: 6%;\">".get_lang('Difficulty')."</th>";
183
+    echo "<th style=\"width: 16%; float:left;\">".get_lang('Score')."</th>";
184 184
     echo "</tr>";
185 185
     echo "</table>";
186 186
     echo "</div>";
@@ -220,15 +220,14 @@  discard block
 block discarded – undo
220 220
                 $question_class = get_class($objQuestionTmp);
221 221
 
222 222
                 $clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.
223
-                    Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
223
+                    Display::return_icon('cd.gif', get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
224 224
                 $edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ?
225 225
                     '<a>'.Display::return_icon(
226 226
                         'edit_na.png',
227 227
                         get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'),
228 228
                         array(),
229 229
                         ICON_SIZE_SMALL
230
-                    ).'</a>' :
231
-                    '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
230
+                    ).'</a>' : '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
232 231
                     $objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.
233 232
                     Display::return_icon(
234 233
                         'edit.png',
@@ -238,16 +237,16 @@  discard block
 block discarded – undo
238 237
                     ).'</a>';
239 238
                 $delete_link = null;
240 239
                 if ($objExercise->edit_exercise_in_lp == true) {
241
-                    $delete_link = '<a id="delete_'.$id.'" class="opener"  href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
240
+                    $delete_link = '<a id="delete_'.$id.'" class="opener"  href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png', get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
242 241
                 }
243 242
 
244
-                $edit_link = Display::tag('div', $edit_link,   array('style'=>'float:left; padding:0px; margin:0px'));
245
-                $clone_link = Display::tag('div', $clone_link,  array('style'=>'float:left; padding:0px; margin:0px'));
243
+                $edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
244
+                $clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
246 245
                 $delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
247 246
                 $actions = Display::tag(
248 247
                     'div',
249 248
                     $edit_link.$clone_link.$delete_link,
250
-                    array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;')
249
+                    array('class'=>'edition', 'style'=>'width:100px; right:10px; margin-top: 8px; position: absolute; top: 10%;')
251 250
                 );
252 251
 
253 252
                 $title = Security::remove_XSS($objQuestionTmp->selectTitle());
@@ -287,7 +286,7 @@  discard block
 block discarded – undo
287 286
                 $questionScore = Display::tag('div', $objQuestionTmp->selectWeighting(), array('style'=>$styleScore));
288 287
 
289 288
                 echo '<div id="question_id_list_'.$id.'" >';
290
-                echo '<div class="header_operations" data-exercise="' . $objExercise->selectId() . '" data-question="' . $id . '">';
289
+                echo '<div class="header_operations" data-exercise="'.$objExercise->selectId().'" data-question="'.$id.'">';
291 290
                 echo $questionName;
292 291
                 echo $questionType;
293 292
                 echo $questionCategory;
Please login to merge, or discard this patch.
main/inc/ajax/exercise.ajax.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
         $exercise_id = intval($_GET['exercise_id']);
31 31
         $page = intval($_REQUEST['page']); //page
32 32
         $limit = intval($_REQUEST['rows']); //quantity of rows
33
-        $sidx = $_REQUEST['sidx'];         //index to filter
34
-        $sord = $_REQUEST['sord'];         //asc or desc
33
+        $sidx = $_REQUEST['sidx']; //index to filter
34
+        $sord = $_REQUEST['sord']; //asc or desc
35 35
 
36
-        if (!in_array($sord, array('asc','desc'))) {
36
+        if (!in_array($sord, array('asc', 'desc'))) {
37 37
             $sord = 'desc';
38 38
         }
39 39
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $total_pages = 0;
63 63
         if ($count > 0) {
64 64
             if (!empty($limit)) {
65
-                $total_pages = ceil($count/$limit);
65
+                $total_pages = ceil($count / $limit);
66 66
             }
67 67
         }
68 68
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $response->page = $page;
125 125
         $response->total = $total_pages;
126 126
         $response->records = $count;
127
-        $i=0;
127
+        $i = 0;
128 128
 
129 129
         if (!empty($results)) {
130 130
             foreach ($results as $row) {
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
                             GROUP by question_id
139 139
                         ) as count_table";
140 140
                 $result_count = Database::query($sql);
141
-                $count_questions = Database::fetch_array($result_count,'ASSOC');
141
+                $count_questions = Database::fetch_array($result_count, 'ASSOC');
142 142
                 $count_questions = $count_questions['count_question_id'];
143 143
 
144 144
                 $row['count_questions'] = $count_questions;
145 145
 
146 146
                 $response->rows[$i]['id'] = $row['exe_id'];
147
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
148
-                $h = floor($remaining/3600);
149
-                $m = floor(($remaining - ($h*3600))/60);
150
-                $s = ($remaining - ($h*3600) - ($m*60));
147
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
148
+                $h = floor($remaining / 3600);
149
+                $m = floor(($remaining - ($h * 3600)) / 60);
150
+                $s = ($remaining - ($h * 3600) - ($m * 60));
151 151
                 $array = array(
152 152
                     $row['firstname'],
153 153
                     $row['lastname'],
154
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
154
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
155 155
                     $row['count_questions'],
156
-                    round($row['score']*100).'%'
156
+                    round($row['score'] * 100).'%'
157 157
                 );
158 158
                 $response->rows[$i]['cell'] = $array;
159 159
                 $i++;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         break;
210 210
     case 'add_question_to_reminder':
211 211
         /** @var Exercise $objExercise */
212
-        $objExercise  = $_SESSION['objExercise'];
212
+        $objExercise = $_SESSION['objExercise'];
213 213
         if (empty($objExercise)) {
214 214
             echo 0;
215 215
             exit;
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
                 $objQuestionTmp = Question::read($my_question_id, $course_id);
361 361
 
362 362
                 // Getting free choice data.
363
-                if ($objQuestionTmp->type  == FREE_ANSWER && $type == 'all') {
364
-                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id]: null;
363
+                if ($objQuestionTmp->type == FREE_ANSWER && $type == 'all') {
364
+                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id] : null;
365 365
                 }
366 366
 
367 367
                 if ($type == 'all') {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                         $session_id,
406 406
                         $my_question_id
407 407
                     );
408
-                    if ($objQuestionTmp->type  == HOT_SPOT) {
408
+                    if ($objQuestionTmp->type == HOT_SPOT) {
409 409
                         Event::delete_attempt_hotspot(
410 410
                             $exe_id,
411 411
                             api_get_user_id(),
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
         $objQuestion = Question::read($questionId);
518 518
         $objQuestion->get_question_type_name();
519 519
 
520
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
520
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
521 521
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
522 522
         ExerciseLib::showQuestion(
523 523
             $questionId,
Please login to merge, or discard this patch.