Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/exercise/hotspot_lang_conversion.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 $hotspot_lang_file = api_get_path(SYS_LANG_PATH);
15 15
 
16 16
 if(isset($_GET['lang'])) {
17
-	//$search = array('../','\\0','\\');
18
-	$lang = urldecode($_GET['lang']);
19
-	if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20
-		//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
-		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
-			$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
-		else
24
-			$hotspot_lang_file .= 'english/hotspot.inc.php';
25
-	} else {
26
-		$hotspot_lang_file .= 'english/hotspot.inc.php';
27
-	}
17
+    //$search = array('../','\\0','\\');
18
+    $lang = urldecode($_GET['lang']);
19
+    if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20
+        //$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
+        if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
+            $hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
+        else
24
+            $hotspot_lang_file .= 'english/hotspot.inc.php';
25
+    } else {
26
+        $hotspot_lang_file .= 'english/hotspot.inc.php';
27
+    }
28 28
 } else {
29
-	$hotspot_lang_file .= 'english/hotspot.inc.php';
29
+    $hotspot_lang_file .= 'english/hotspot.inc.php';
30 30
 }
31 31
 
32 32
 $file = file($hotspot_lang_file);
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
 
36 36
 foreach($file as $value)
37 37
 {
38
-	$explode = explode('=', $value);
38
+    $explode = explode('=', $value);
39 39
 
40
-	if(count($explode) > 1)
41
-	{
42
-		$explode[0] = trim($explode[0]);
43
-		$explode[0] = '&' . substr($explode[0], 1, strlen($explode[0]));
40
+    if(count($explode) > 1)
41
+    {
42
+        $explode[0] = trim($explode[0]);
43
+        $explode[0] = '&' . substr($explode[0], 1, strlen($explode[0]));
44 44
 
45
-		$explode[1] = trim($explode[1]);
46
-		$explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
47
-		$explode[1] = str_replace('"', '', $explode[1]);
45
+        $explode[1] = trim($explode[1]);
46
+        $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
47
+        $explode[1] = str_replace('"', '', $explode[1]);
48 48
 
49
-		$temp[] = $explode[0] . '=' . $explode[1];
50
-	}
49
+        $temp[] = $explode[0] . '=' . $explode[1];
50
+    }
51 51
 }
52 52
 
53 53
 foreach($temp as $value)
54 54
 {
55
-	echo $value . ' ';
55
+    echo $value . ' ';
56 56
 }
57 57
 ?>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 
14 14
 $hotspot_lang_file = api_get_path(SYS_LANG_PATH);
15 15
 
16
-if(isset($_GET['lang'])) {
16
+if (isset($_GET['lang'])) {
17 17
 	//$search = array('../','\\0','\\');
18 18
 	$lang = urldecode($_GET['lang']);
19 19
 	if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20 20
 		//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
-		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
-			$hotspot_lang_file .= $lang . '/hotspot.inc.php';
21
+		if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php'))
22
+			$hotspot_lang_file .= $lang.'/hotspot.inc.php';
23 23
 		else
24 24
 			$hotspot_lang_file .= 'english/hotspot.inc.php';
25 25
 	} else {
@@ -33,25 +33,25 @@  discard block
 block discarded – undo
33 33
 
34 34
 $temp = array();
35 35
 
36
-foreach($file as $value)
36
+foreach ($file as $value)
37 37
 {
38 38
 	$explode = explode('=', $value);
39 39
 
40
-	if(count($explode) > 1)
40
+	if (count($explode) > 1)
41 41
 	{
42 42
 		$explode[0] = trim($explode[0]);
43
-		$explode[0] = '&' . substr($explode[0], 1, strlen($explode[0]));
43
+		$explode[0] = '&'.substr($explode[0], 1, strlen($explode[0]));
44 44
 
45 45
 		$explode[1] = trim($explode[1]);
46 46
 		$explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
47 47
 		$explode[1] = str_replace('"', '', $explode[1]);
48 48
 
49
-		$temp[] = $explode[0] . '=' . $explode[1];
49
+		$temp[] = $explode[0].'='.$explode[1];
50 50
 	}
51 51
 }
52 52
 
53
-foreach($temp as $value)
53
+foreach ($temp as $value)
54 54
 {
55
-	echo $value . ' ';
55
+	echo $value.' ';
56 56
 }
57 57
 ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
 	$lang = urldecode($_GET['lang']);
19 19
 	if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20 20
 		//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
-		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
-			$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
-		else
24
-			$hotspot_lang_file .= 'english/hotspot.inc.php';
21
+		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) {
22
+					$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
+		} else {
24
+					$hotspot_lang_file .= 'english/hotspot.inc.php';
25
+		}
25 26
 	} else {
26 27
 		$hotspot_lang_file .= 'english/hotspot.inc.php';
27 28
 	}
Please login to merge, or discard this patch.
main/exercise/question_create.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@
 block discarded – undo
51 51
 $result = Database::query($sql);
52 52
 $exercises['-'] = '-'.get_lang('SelectExercise').'-';
53 53
 while ($row = Database :: fetch_array($result)) {
54
-	$exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
54
+    $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE);
55 55
 }
56 56
 $form->addElement('select', 'exercise', get_lang('Exercise'), $exercises);
57 57
 
58 58
 // generate default content
59 59
 $form->addElement(
60
-	'checkbox',
61
-	'is_content',
62
-	null,
63
-	get_lang('GenerateDefaultContent'),
64
-	array('checked' => true)
60
+    'checkbox',
61
+    'is_content',
62
+    null,
63
+    get_lang('GenerateDefaultContent'),
64
+    array('checked' => true)
65 65
 );
66 66
 
67 67
 // the submit button
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 require_once '../inc/global.inc.php';
9 9
 
10 10
 // the section (tabs)
11
-$this_section=SECTION_COURSES;
11
+$this_section = SECTION_COURSES;
12 12
 
13 13
 // notice for unauthorized people.
14 14
 api_protect_course_script(true);
15 15
 
16 16
 // breadcrumbs
17
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
17
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
18 18
 
19 19
 // Tool name
20
-$nameTools=get_lang('AddQuestionToExercise');
20
+$nameTools = get_lang('AddQuestionToExercise');
21 21
 
22 22
 // The form
23
-$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq());
23
+$form = new FormValidator('add_question', 'post', api_get_self().'?'.api_get_cidreq());
24 24
 // form title
25
-$form->addElement('header','',get_lang('AddQuestionToExercise'));
25
+$form->addElement('header', '', get_lang('AddQuestionToExercise'));
26 26
 
27 27
 $question_list = Question::get_question_type_list();
28 28
 $question_list_options = array();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 );
39 39
 
40 40
 //session id
41
-$session_id  = api_get_session_id();
41
+$session_id = api_get_session_id();
42 42
 
43 43
 // the exercises
44 44
 $tbl_exercises = Database :: get_course_table(TABLE_QUIZ_TEST);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     Display::display_header($nameTools);
99 99
 
100 100
     echo '<div class="actions">';
101
-    echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
101
+    echo '<a href="exercise.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
102 102
     echo '</div>';
103 103
 
104 104
     // displaying the form
Please login to merge, or discard this patch.
main/exercise/hotpotatoes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 }
32 32
 // The breadcrumbs.
33 33
 $interbreadcrumb[] = array(
34
-    'url' => api_get_path(WEB_CODE_PATH) . '.exercise/exercise.php?' . api_get_cidreq(),
34
+    'url' => api_get_path(WEB_CODE_PATH).'.exercise/exercise.php?'.api_get_cidreq(),
35 35
     'name' => get_lang('Exercises')
36 36
 );
37 37
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $_course,
154 154
                 $_FILES['userFile'],
155 155
                 $document_sys_path,
156
-                $uploadPath . '/' . $fld,
156
+                $uploadPath.'/'.$fld,
157 157
                 api_get_user_id(),
158 158
                 null,
159 159
                 null,
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                     $imgparams = $_POST['imgparams'];
166 166
                     $checked = CheckImageName($imgparams, $filename);
167 167
                     if ($checked) {
168
-                        $imgcount = $imgcount-1;
168
+                        $imgcount = $imgcount - 1;
169 169
                     } else {
170 170
                         $dialogBox .= $filename.' '.get_lang('NameNotEqual');
171 171
                         my_delete($document_sys_path.$uploadPath.'/'.$fld.'/'.$filename);
Please login to merge, or discard this patch.
main/exercise/multiple_answer.class.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
     }
167 167
 
168 168
 
169
-	/**
170
-	 * abstract function which creates the form to create / edit the answers of the question
171
-	 * @param the formvalidator instance
172
-	 * @param the answers number to display
173
-	 */
174
-	function processAnswersCreation($form)
169
+    /**
170
+     * abstract function which creates the form to create / edit the answers of the question
171
+     * @param the formvalidator instance
172
+     * @param the answers number to display
173
+     */
174
+    function processAnswersCreation($form)
175 175
     {
176 176
         $questionWeighting = $nbrGoodAnswers = 0;
177 177
         $objAnswer  = new Answer($this->id);
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
         // sets the total weighting of the question
202 202
         $this->updateWeighting($questionWeighting);
203 203
         $this->save();
204
-	}
204
+    }
205 205
 
206
-	function return_header($feedback_type = null, $counter = null, $score = null)
206
+    function return_header($feedback_type = null, $counter = null, $score = null)
207 207
     {
208
-	    $header = parent::return_header($feedback_type, $counter, $score);
209
-	    $header .= '<table class="'.$this->question_table_class .'">
208
+        $header = parent::return_header($feedback_type, $counter, $score);
209
+        $header .= '<table class="'.$this->question_table_class .'">
210 210
 			<tr>
211 211
 				<th>'.get_lang("Choice").'</th>
212 212
 				<th>'. get_lang("ExpectedChoice").'</th>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $header .= '<th>'.get_lang("Comment").'</th>';
215 215
         $header .= '</tr>';
216 216
         return $header;
217
-	}
217
+    }
218 218
 
219 219
 
220 220
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             'Height' => '125'
39 39
         );
40 40
 
41
-        $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;  // The previous default value was 2. See task #1759.
41
+        $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759.
42 42
         $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
43 43
 
44 44
         $obj_ex = $_SESSION['objExercise'];
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         $html = '<table class="table table-striped table-hover">
49 49
             <thead>
50 50
                 <tr>
51
-                    <th width="10">' . get_lang('Number') . '</th>
52
-                    <th width="10">' . get_lang('True') . '</th>
53
-                    <th width="50%">' . get_lang('Answer') . '</th>
54
-                    <th width="50%">' . get_lang('Comment') . '</th>
55
-                    <th width="10">' . get_lang('Weighting') . '</th>
51
+                    <th width="10">' . get_lang('Number').'</th>
52
+                    <th width="10">' . get_lang('True').'</th>
53
+                    <th width="50%">' . get_lang('Answer').'</th>
54
+                    <th width="50%">' . get_lang('Comment').'</th>
55
+                    <th width="10">' . get_lang('Weighting').'</th>
56 56
                 </tr>
57 57
             </thead>
58 58
             <tbody>';
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
             $form->addHtml('<tr>');
83 83
 
84 84
             if (is_object($answer)) {
85
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
86
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
87
-                $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1);
88
-                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
85
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
86
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
87
+                $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1);
88
+                $defaults['correct['.$i.']'] = $answer->correct[$i];
89 89
             } else {
90 90
                 $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2');
91 91
                 $defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
@@ -101,38 +101,38 @@  discard block
 block discarded – undo
101 101
 
102 102
             $renderer->setElementTemplate(
103 103
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
104
-                'correct[' . $i . ']'
104
+                'correct['.$i.']'
105 105
             );
106 106
             $renderer->setElementTemplate(
107 107
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
108
-                'counter[' . $i . ']'
108
+                'counter['.$i.']'
109 109
             );
110 110
             $renderer->setElementTemplate(
111 111
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
112
-                'answer[' . $i . ']'
112
+                'answer['.$i.']'
113 113
             );
114 114
             $renderer->setElementTemplate(
115 115
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
116
-                'comment[' . $i . ']'
116
+                'comment['.$i.']'
117 117
             );
118 118
             $renderer->setElementTemplate(
119 119
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
120
-                'weighting[' . $i . ']'
120
+                'weighting['.$i.']'
121 121
             );
122 122
 
123
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
123
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
124 124
             $answer_number->freeze();
125 125
 
126
-            $form->addElement('checkbox', 'correct[' . $i . ']', null, null,
126
+            $form->addElement('checkbox', 'correct['.$i.']', null, null,
127 127
                 'class="checkbox" style="margin-left: 0em;"');
128
-            $boxes_names[] = 'correct[' . $i . ']';
128
+            $boxes_names[] = 'correct['.$i.']';
129 129
 
130 130
             $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig);
131
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
131
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
132 132
 
133 133
             $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig);
134 134
 
135
-            $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => "width: 60px;", 'value' => '0'));
135
+            $form->addElement('text', 'weighting['.$i.']', null, array('style' => "width: 60px;", 'value' => '0'));
136 136
             $form->addHtml('</tr>');
137 137
         }
138 138
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $objAnswer  = new Answer($this->id);
178 178
         $nb_answers = $form->getSubmitValue('nb_answers');
179 179
 
180
-        for($i=1 ; $i <= $nb_answers ; $i++) {
180
+        for ($i = 1; $i <= $nb_answers; $i++) {
181 181
             $answer = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('answer['.$i.']')));
182 182
             $comment = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('comment['.$i.']')));
183 183
             $weighting = trim($form -> getSubmitValue('weighting['.$i.']'));
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
                 $weighting = abs($weighting);
190 190
                 $weighting = -$weighting;
191 191
             }
192
-            if($weighting > 0) {
192
+            if ($weighting > 0) {
193 193
                 $questionWeighting += $weighting;
194 194
             }
195
-            $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i);
195
+            $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i);
196 196
         }
197 197
 
198 198
         // saves the answers into the data base
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	function return_header($feedback_type = null, $counter = null, $score = null)
207 207
     {
208 208
 	    $header = parent::return_header($feedback_type, $counter, $score);
209
-	    $header .= '<table class="'.$this->question_table_class .'">
209
+	    $header .= '<table class="'.$this->question_table_class.'">
210 210
 			<tr>
211 211
 				<th>'.get_lang("Choice").'</th>
212 212
 				<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.
main/exercise/question_pool.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 }
173 173
 
174 174
 if (isset($_SESSION['gradebook'])){
175
-	$gradebook=	$_SESSION['gradebook'];
175
+    $gradebook=	$_SESSION['gradebook'];
176 176
 }
177 177
 
178 178
 if (!empty($gradebook) && $gradebook=='view') {
179
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
179
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
180 180
 }
181 181
 
182 182
 // if admin of course
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 echo '</div>';
228 228
 
229 229
 if ($displayMessage != "") {
230
-	Display::display_confirmation_message($displayMessage);
231
-	$displayMessage = "";
230
+    Display::display_confirmation_message($displayMessage);
231
+    $displayMessage = "";
232 232
 }
233 233
 
234 234
 // Form
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 // Title
237 237
 echo '<legend>'.$nameTools.' - '.$titleAdd.'</legend>';
238 238
 if (isset($type)) {
239
-	echo '<input type="hidden" name="type" value="1">';
239
+    echo '<input type="hidden" name="type" value="1">';
240 240
 }
241 241
 echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">';
242 242
 
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 foreach ($course_list as $item) {
284 284
     $courseItemId = $item['real_id'];
285 285
     $courseInfo = api_get_course_info_by_id($courseItemId);
286
-	$course_select_list[$courseItemId] = "";
287
-	if ($courseItemId == api_get_course_int_id()) {
288
-		$course_select_list[$courseItemId] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
289
-	}
290
-	$course_select_list[$courseItemId] .= $courseInfo['title'];
286
+    $course_select_list[$courseItemId] = "";
287
+    if ($courseItemId == api_get_course_int_id()) {
288
+        $course_select_list[$courseItemId] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
289
+    }
290
+    $course_select_list[$courseItemId] .= $courseInfo['title'];
291 291
 }
292 292
 
293 293
 $select_course_html =  Display::select(
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
     // no course selected, reset menu test / difficult� / type de reponse
305 305
     reset_menu_exo_lvl_type();
306 306
 } else {
307
-	$course_info = api_get_course_info_by_id($selected_course);
307
+    $course_info = api_get_course_info_by_id($selected_course);
308 308
 }
309 309
 // If course has changed, reset the menu default
310 310
 if ($course_id_changed) {
311
-	reset_menu_exo_lvl_type();
311
+    reset_menu_exo_lvl_type();
312 312
 }
313 313
 
314 314
 $course_id = $course_info['real_id'];
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 }
357 357
 
358 358
 if ($exercise_id_changed == 1) {
359
-	reset_menu_lvl_type();
359
+    reset_menu_lvl_type();
360 360
 }
361 361
 $select_exercise_html =  Display::select(
362 362
     'exerciseId',
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
 // if we have selected an exercise in the list-box 'Filter'
435 435
 
436 436
 if ($exerciseId > 0) {
437
-	$where = '';
438
-	$from = '';
439
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
440
-		$from = ", $TBL_COURSE_REL_CATEGORY crc ";
441
-		$where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
442
-	}
443
-	if (isset($exerciseLevel) && $exerciseLevel != -1) {
444
-		$where .= ' AND level='.$exerciseLevel;
445
-	}
446
-	if (isset($answerType) && $answerType > 0) {
447
-		$where .= ' AND type='.$answerType;
448
-	}
449
-	$sql = "SELECT DISTINCT
437
+    $where = '';
438
+    $from = '';
439
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
440
+        $from = ", $TBL_COURSE_REL_CATEGORY crc ";
441
+        $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
442
+    }
443
+    if (isset($exerciseLevel) && $exerciseLevel != -1) {
444
+        $where .= ' AND level='.$exerciseLevel;
445
+    }
446
+    if (isset($answerType) && $answerType > 0) {
447
+        $where .= ' AND type='.$answerType;
448
+    }
449
+    $sql = "SELECT DISTINCT
450 450
 	            id,
451 451
 	            question,
452 452
 	            type,
@@ -468,22 +468,22 @@  discard block
 block discarded – undo
468 468
         $mainQuestionList[] = $row;
469 469
     }
470 470
 } elseif ($exerciseId == -1) {
471
-	// If we have selected the option 'Orphan questions' in the list-box 'Filter'
472
-	$level_where = '';
473
-	$from = '';
474
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
475
-		$from = " INNER JOIN  $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id ";
476
-		$level_where .= " AND
471
+    // If we have selected the option 'Orphan questions' in the list-box 'Filter'
472
+    $level_where = '';
473
+    $from = '';
474
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
475
+        $from = " INNER JOIN  $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id ";
476
+        $level_where .= " AND
477 477
 		        crc.c_id = $selected_course AND
478 478
 		        crc.category_id = $courseCategoryId";
479
-	}
480
-	if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
481
-		$level_where = ' AND level='.$exerciseLevel;
482
-	}
483
-	$answer_where = '';
484
-	if (isset($answerType) && $answerType >0 -1 ) {
485
-		$answer_where = ' AND type='.$answerType;
486
-	}
479
+    }
480
+    if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
481
+        $level_where = ' AND level='.$exerciseLevel;
482
+    }
483
+    $answer_where = '';
484
+    if (isset($answerType) && $answerType >0 -1 ) {
485
+        $answer_where = ' AND type='.$answerType;
486
+    }
487 487
 
488 488
     // @todo fix this query with the new id field
489 489
     $sql = " (
@@ -525,24 +525,24 @@  discard block
 block discarded – undo
525 525
         $mainQuestionList[] = $row;
526 526
     }
527 527
 } else {
528
-	// All tests for selected course
528
+    // All tests for selected course
529 529
     // If we have not selected any option in the list-box 'Filter'
530
-	$filter = '';
531
-	$from = '';
530
+    $filter = '';
531
+    $from = '';
532 532
 
533
-	if (isset($courseCategoryId) && $courseCategoryId > 0) {
534
-		$from = ", $TBL_COURSE_REL_CATEGORY crc ";
535
-		$filter .= " AND
533
+    if (isset($courseCategoryId) && $courseCategoryId > 0) {
534
+        $from = ", $TBL_COURSE_REL_CATEGORY crc ";
535
+        $filter .= " AND
536 536
 		            crc.c_id = $selected_course AND
537 537
 		            crc.question_id = qu.id AND
538 538
 		            crc.category_id = $courseCategoryId";
539
-	}
540
-	if (isset($exerciseLevel) && $exerciseLevel != -1) {
541
-		$filter .= ' AND level='.$exerciseLevel.' ';
542
-	}
543
-	if (isset($answerType) && $answerType > 0) {
544
-		$filter .= ' AND qu.type='.$answerType.' ';
545
-	}
539
+    }
540
+    if (isset($exerciseLevel) && $exerciseLevel != -1) {
541
+        $filter .= ' AND level='.$exerciseLevel.' ';
542
+    }
543
+    if (isset($answerType) && $answerType > 0) {
544
+        $filter .= ' AND qu.type='.$answerType.' ';
545
+    }
546 546
 
547 547
     if (!empty($session_id) && $session_id != '-1') {
548 548
         $mainQuestionList = array();
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $mainQuestionList[] = $row;
645 645
         }
646 646
     }
647
-	// forces the value to 0
647
+    // forces the value to 0
648 648
     $exerciseId = 0;
649 649
 }
650 650
 
@@ -670,33 +670,33 @@  discard block
 block discarded – undo
670 670
 //
671 671
 if ($fromExercise <= 0) {
672 672
     // NOT IN A TEST - IN THE COURSE
673
-	if ($selected_course == api_get_course_int_id()) {
674
-		$actionLabel = get_lang('Modify');
675
-		$actionIcon1 = "edit";
676
-		$actionIcon2 = "delete";
673
+    if ($selected_course == api_get_course_int_id()) {
674
+        $actionLabel = get_lang('Modify');
675
+        $actionIcon1 = "edit";
676
+        $actionIcon2 = "delete";
677 677
         // We are in the course, question title can be a link to the question edit page
678
-		$questionTagA = 1;
678
+        $questionTagA = 1;
679 679
     } else { // NOT IN A TEST - NOT IN THE COURSE
680
-		$actionLabel = get_lang('Reuse');
681
-		$actionIcon1 = get_lang('MustBeInATest');
682
-		$actionIcon2 = "";
680
+        $actionLabel = get_lang('Reuse');
681
+        $actionIcon1 = get_lang('MustBeInATest');
682
+        $actionIcon2 = "";
683 683
         // We are not in this course, to messy if we link to the question in another course
684
-		$questionTagA = 0;
685
-	}
684
+        $questionTagA = 0;
685
+    }
686 686
 } else {
687 687
     // IN A TEST - IN THE COURSE
688
-	if ($selected_course == api_get_course_int_id()) {
689
-		$actionLabel = get_lang('Reuse');
690
-		$actionIcon1 = "add";
691
-		$actionIcon2 = "";
692
-		$questionTagA = 1;
688
+    if ($selected_course == api_get_course_int_id()) {
689
+        $actionLabel = get_lang('Reuse');
690
+        $actionIcon1 = "add";
691
+        $actionIcon2 = "";
692
+        $questionTagA = 1;
693 693
     } else {
694 694
         // IN A TEST - NOT IN THE COURSE
695
-		$actionLabel = get_lang('Reuse');
696
-		$actionIcon1 = "clone";
697
-		$actionIcon2 = "";
698
-		$questionTagA = 0;
699
-	}
695
+        $actionLabel = get_lang('Reuse');
696
+        $actionIcon1 = "clone";
697
+        $actionIcon2 = "";
698
+        $questionTagA = 0;
699
+    }
700 700
 }
701 701
 // Display table
702 702
 $header = array(
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 );
790 790
 
791 791
 if (!$nbrQuestions) {
792
-	echo get_lang('NoQuestion');
792
+    echo get_lang('NoQuestion');
793 793
 }
794 794
 
795 795
 Display::display_footer();
@@ -801,9 +801,9 @@  discard block
 block discarded – undo
801 801
 */
802 802
 function reset_menu_lvl_type()
803 803
 {
804
-	global $exerciseLevel, $answerType;
805
-	$answerType = -1;
806
-	$exerciseLevel = -1;
804
+    global $exerciseLevel, $answerType;
805
+    $answerType = -1;
806
+    $exerciseLevel = -1;
807 807
 }
808 808
 
809 809
 /**
@@ -813,10 +813,10 @@  discard block
 block discarded – undo
813 813
 */
814 814
 function reset_menu_exo_lvl_type()
815 815
 {
816
-	global $exerciseId, $courseCategoryId;
817
-	reset_menu_lvl_type();
818
-	$exerciseId = 0;
819
-	$courseCategoryId = 0;
816
+    global $exerciseId, $courseCategoryId;
817
+    reset_menu_lvl_type();
818
+    $exerciseId = 0;
819
+    $courseCategoryId = 0;
820 820
 }
821 821
 
822 822
 /**
@@ -838,17 +838,17 @@  discard block
 block discarded – undo
838 838
     $in_questionname,
839 839
     $sessionId
840 840
 ) {
841
-	$res = $in_questionname;
841
+    $res = $in_questionname;
842 842
     $sessionIcon = null;
843
-	if ($in_addA) {
843
+    if ($in_addA) {
844 844
         if (!empty($sessionId) && $sessionId != -1) {
845 845
             $sessionIcon = ' '.Display::return_icon('star.png', get_lang('Session'));
846 846
         }
847
-		$res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>".
847
+        $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>".
848 848
             $res.$sessionIcon.
849 849
             "</a>";
850
-	}
851
-	return $res;
850
+    }
851
+    return $res;
852 852
 }
853 853
 
854 854
 /**
@@ -878,16 +878,16 @@  discard block
 block discarded – undo
878 878
     $in_session_id,
879 879
     $in_exercise_id
880 880
 ) {
881
-	$res = "";
882
-	$getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id";
883
-	switch ($in_action) {
884
-		case "delete" :
885
-			$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>";
886
-			$res .= Display::return_icon("delete.png", get_lang('Delete'));
887
-			$res .= "</a>";
888
-			break;
889
-		case "edit" :
890
-			$res = get_a_tag_for_question(
881
+    $res = "";
882
+    $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id";
883
+    switch ($in_action) {
884
+        case "delete" :
885
+            $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>";
886
+            $res .= Display::return_icon("delete.png", get_lang('Delete'));
887
+            $res .= "</a>";
888
+            break;
889
+        case "edit" :
890
+            $res = get_a_tag_for_question(
891 891
                 1,
892 892
                 $from_exercise,
893 893
                 $in_questionid,
@@ -895,33 +895,33 @@  discard block
 block discarded – undo
895 895
                 Display::return_icon("edit.png", get_lang('Modify')),
896 896
                 $in_session_id
897 897
             );
898
-			break;
899
-		case "add":
900
-			// add if question is not already in test
901
-			$myObjEx = new Exercise();
902
-			$myObjEx->read($from_exercise);
903
-			if (!$myObjEx->isInList($in_questionid)) {
904
-				$res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>";
905
-				$res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
906
-				$res .= "</a>";
898
+            break;
899
+        case "add":
900
+            // add if question is not already in test
901
+            $myObjEx = new Exercise();
902
+            $myObjEx->read($from_exercise);
903
+            if (!$myObjEx->isInList($in_questionid)) {
904
+                $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>";
905
+                $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
906
+                $res .= "</a>";
907 907
             } else {
908
-				$res = "-";
909
-			}
910
-			unset($myObjEx);
911
-			break;
912
-		case "clone":
908
+                $res = "-";
909
+            }
910
+            unset($myObjEx);
911
+            break;
912
+        case "clone":
913 913
             $url = api_get_self()."?".api_get_cidreq().$getParams."&question_copy=$in_questionid&course_id=$in_selected_course&fromExercise=$from_exercise";
914 914
             $res = Display::url(
915 915
                 Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')),
916 916
                 $url
917 917
             );
918
-			break;
919
-		default :
920
-			$res = $in_action;
921
-			break;
922
-	}
918
+            break;
919
+        default :
920
+            $res = $in_action;
921
+            break;
922
+    }
923 923
 
924
-	return $res;
924
+    return $res;
925 925
 }
926 926
 
927 927
 /**
@@ -930,14 +930,14 @@  discard block
 block discarded – undo
930 930
  */
931 931
 function get_question_type_for_question($in_selectedcourse, $in_questionid)
932 932
 {
933
-	$myObjQuestion = Question::read($in_questionid, $in_selectedcourse);
933
+    $myObjQuestion = Question::read($in_questionid, $in_selectedcourse);
934 934
     $questionType = null;
935 935
     if (!empty($myObjQuestion)) {
936 936
         list($typeImg, $typeExpl) = $myObjQuestion->get_type_icon_html();
937 937
         $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), 32), array());
938 938
         unset($myObjQuestion);
939 939
     }
940
-	return $questionType;
940
+    return $questionType;
941 941
 }
942 942
 
943 943
 /**
@@ -946,6 +946,6 @@  discard block
 block discarded – undo
946 946
  */
947 947
 function get_question_categorie_for_question($in_courseid, $in_questionid)
948 948
 {
949
-	$cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid);
950
-	return $cat;
949
+    $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid);
950
+    return $cat;
951 951
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 $nameTools = get_lang('QuestionPool');
51
-$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
51
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
52 52
 
53 53
 if (!empty($objExercise)) {
54 54
     $interbreadcrumb[] = array(
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         if ($old_question_obj) {
75 75
             $old_question_obj->updateTitle(
76
-                $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
76
+                $old_question_obj->selectTitle().' - '.get_lang('Copy')
77 77
             );
78 78
             //Duplicating the source question, in the current course
79 79
             $new_id = $old_question_obj->duplicate($current_course);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
         // destruction of the Question object
109 109
         unset($objQuestionTmp);
110
-    } elseif($recup && $fromExercise) {
110
+    } elseif ($recup && $fromExercise) {
111 111
         // gets an existing question and copies it into a new exercise
112 112
         $objQuestionTmp = Question :: read($recup);
113 113
         // if the question exists
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 $old_question_obj = Question::read($old_question_id, $origin_course_id);
140 140
                 if ($old_question_obj) {
141 141
                     $old_question_obj->updateTitle(
142
-                        $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
142
+                        $old_question_obj->selectTitle().' - '.get_lang('Copy')
143 143
                     );
144 144
 
145 145
                     //Duplicating the source question, in the current course
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
                 }
168 168
             }
169 169
         }
170
-        Session::write('objExercise',$objExercise);
170
+        Session::write('objExercise', $objExercise);
171 171
     }
172 172
 }
173 173
 
174
-if (isset($_SESSION['gradebook'])){
175
-	$gradebook=	$_SESSION['gradebook'];
174
+if (isset($_SESSION['gradebook'])) {
175
+	$gradebook = $_SESSION['gradebook'];
176 176
 }
177 177
 
178
-if (!empty($gradebook) && $gradebook=='view') {
179
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
178
+if (!empty($gradebook) && $gradebook == 'view') {
179
+	$interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
180 180
 }
181 181
 
182 182
 // if admin of course
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 }
217 217
 if (isset($fromExercise) && $fromExercise > 0) {
218 218
     echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$fromExercise.'">'.
219
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
219
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
220 220
     $titleAdd = get_lang('AddQuestionToTest');
221 221
 } else {
222 222
     echo '<a href="exercise.php?'.api_get_cidReq().'">'.
223
-        Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
223
+        Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
224 224
     echo "<a href='admin.php?exerciseId=0'>".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM)."</a>";
225 225
     $titleAdd = get_lang('ManageAllQuestions');
226 226
 }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 foreach ($sessionList as $item) {
250 250
     $session_select_list[$item['session_id']] = $item['session_name'];
251 251
 }
252
-$select_session_html =  Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
252
+$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
253 253
 echo Display::form_row($labelFormRow, $select_session_html);
254 254
 
255 255
 // Course list, get course list of session, or for course where user is admin
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	$course_select_list[$courseItemId] .= $courseInfo['title'];
291 291
 }
292 292
 
293
-$select_course_html =  Display::select(
293
+$select_course_html = Display::select(
294 294
     'selected_course',
295 295
     $course_select_list,
296 296
     $selected_course,
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 $my_exercise_list['0']  = get_lang('AllExercises');
347 347
 $my_exercise_list['-1'] = get_lang('OrphanQuestions');
348 348
 if (is_array($exercise_list)) {
349
-    foreach($exercise_list as $row) {
349
+    foreach ($exercise_list as $row) {
350 350
         $my_exercise_list[$row['id']] = "";
351
-        if ($row['id'] ==  $fromExercise && $selected_course == api_get_course_int_id()) {
351
+        if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) {
352 352
             $my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
353 353
         }
354 354
         $my_exercise_list[$row['id']] .= $row['title'];
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 if ($exercise_id_changed == 1) {
359 359
 	reset_menu_lvl_type();
360 360
 }
361
-$select_exercise_html =  Display::select(
361
+$select_exercise_html = Display::select(
362 362
     'exerciseId',
363 363
     $my_exercise_list,
364 364
     $exerciseId,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 $question_list = Question::get_question_type_list();
392 392
 
393 393
 $new_question_list = array();
394
-$new_question_list['-1']  = get_lang('All');
394
+$new_question_list['-1'] = get_lang('All');
395 395
 if (!empty($_course)) {
396 396
     $objExercise = new Exercise();
397 397
     $objExercise->read($fromExercise);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             ORDER BY question_order";
465 465
 
466 466
     $result = Database::query($sql);
467
-    while($row = Database::fetch_array($result, 'ASSOC')) {
467
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
468 468
         $mainQuestionList[] = $row;
469 469
     }
470 470
 } elseif ($exerciseId == -1) {
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 		        crc.c_id = $selected_course AND
478 478
 		        crc.category_id = $courseCategoryId";
479 479
 	}
480
-	if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
480
+	if (isset($exerciseLevel) && $exerciseLevel != -1) {
481 481
 		$level_where = ' AND level='.$exerciseLevel;
482 482
 	}
483 483
 	$answer_where = '';
484
-	if (isset($answerType) && $answerType >0 -1 ) {
484
+	if (isset($answerType) && $answerType > 0 - 1) {
485 485
 		$answer_where = ' AND type='.$answerType;
486 486
 	}
487 487
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                     $level_where $answer_where
522 522
              )";
523 523
     $result = Database::query($sql);
524
-    while($row = Database::fetch_array($result, 'ASSOC')) {
524
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
525 525
         $mainQuestionList[] = $row;
526 526
     }
527 527
 } else {
Please login to merge, or discard this patch.
main/exercise/exercise_report.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             Display::addFlash(
249 249
                 Display::return_message(get_lang('MessageSent'))
250 250
             );
251
-            header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
251
+            header('Location: '.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
252 252
             exit;
253 253
         }
254 254
     }
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
         api_is_course_tutor() || api_is_course_coach()
279 279
     ) {
280 280
         $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
281
-        $actions .='<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
282
-        $actions .='<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
281
+        $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
282
+        $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
283 283
 
284 284
         $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&exerciseId='.intval($_GET['exerciseId']).'" >'.
285 285
         Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -400,8 +400,9 @@
 block discarded – undo
400 400
 $extra .= $form->return_form();
401 401
 $extra .= '</div>';
402 402
 
403
-if ($is_allowedToEdit)
403
+if ($is_allowedToEdit) {
404 404
     echo $extra;
405
+}
405 406
 
406 407
 echo $actions;
407 408
 
Please login to merge, or discard this patch.
main/exercise/exercise_result.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 $gradebook = '';
61 61
 if (isset($_SESSION['gradebook'])) {
62
-	$gradebook=	$_SESSION['gradebook'];
62
+	$gradebook = $_SESSION['gradebook'];
63 63
 }
64
-if (!empty($gradebook) && $gradebook=='view') {
64
+if (!empty($gradebook) && $gradebook == 'view') {
65 65
     $interbreadcrumb[] = array(
66 66
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
67 67
         'name' => get_lang('ToolGradebook'),
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
     "name" => get_lang('Exercises'),
76 76
 );
77 77
 
78
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
79
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
78
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
79
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
80 80
 
81 81
 if ($origin != 'learnpath') {
82 82
 	// So we are not in learnpath tool
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         if ($remainingAttempts) {
152 152
             $attemptButton = Display::toolbarButton(
153 153
                 get_lang('AnotherAttempt'),
154
-                api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . api_get_cidreq() . '&' . http_build_query([
154
+                api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.api_get_cidreq().'&'.http_build_query([
155 155
                     'exerciseId' => $objExercise->id
156 156
                 ]),
157 157
                 'pencil-square-o',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 $max_score = $objExercise->get_max_score();
176 176
 
177
-Display::display_normal_message(get_lang('Saved').'<br />',false);
177
+Display::display_normal_message(get_lang('Saved').'<br />', false);
178 178
 
179 179
 // Display and save questions
180 180
 ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 } else {
206 206
 	$lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
207 207
 	$url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
208
-	$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
208
+	$href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'"';
209 209
 
210 210
     if (api_is_allowed_to_session_edit()) {
211 211
         Session::erase('objExercise');
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 $gradebook = '';
61 61
 if (isset($_SESSION['gradebook'])) {
62
-	$gradebook=	$_SESSION['gradebook'];
62
+    $gradebook=	$_SESSION['gradebook'];
63 63
 }
64 64
 if (!empty($gradebook) && $gradebook=='view') {
65 65
     $interbreadcrumb[] = array(
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 $htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
80 80
 
81 81
 if ($origin != 'learnpath') {
82
-	// So we are not in learnpath tool
83
-	Display::display_header($nameTools, get_lang('Exercise'));
82
+    // So we are not in learnpath tool
83
+    Display::display_header($nameTools, get_lang('Exercise'));
84 84
 } else {
85 85
     $htmlHeadXtra[] = "
86 86
     <style>
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
 
95 95
 // I'm in a preview mode as course admin. Display the action menu.
96 96
 if (api_is_course_admin() && $origin != 'learnpath') {
97
-	echo '<div class="actions">';
98
-	echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.
97
+    echo '<div class="actions">';
98
+    echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.
99 99
         Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>';
100
-	echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
100
+    echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
101 101
         Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>';
102
-	echo '</div>';
102
+    echo '</div>';
103 103
 }
104 104
 
105 105
 $feedback_type = $objExercise->feedback_type;
106 106
 $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
107 107
 
108 108
 if (!empty($exercise_stat_info['data_tracking'])) {
109
-	$question_list = explode(',', $exercise_stat_info['data_tracking']);
109
+    $question_list = explode(',', $exercise_stat_info['data_tracking']);
110 110
 }
111 111
 
112 112
 $learnpath_id = $exercise_stat_info['orig_lp_id'];
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
         Session::erase('objExercise');
202 202
         Session::erase('exe_id');
203 203
     }
204
-	Display::display_footer();
204
+    Display::display_footer();
205 205
 } else {
206
-	$lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
207
-	$url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
208
-	$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
206
+    $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null;
207
+    $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
208
+    $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
209 209
 
210 210
     if (api_is_allowed_to_session_edit()) {
211 211
         Session::erase('objExercise');
212 212
         Session::erase('exe_id');
213 213
     }
214 214
 
215
-	// Record the results in the learning path, using the SCORM interface (API)
216
-	echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>";
215
+    // Record the results in the learning path, using the SCORM interface (API)
216
+    echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>";
217 217
     echo '<script type="text/javascript">'.$href.'</script>';
218
-	echo '</body></html>';
218
+    echo '</body></html>';
219 219
 }
Please login to merge, or discard this patch.
main/exercise/Draggable.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
64 64
                     if ($answer->isCorrect($i)) {
65 65
                         $nb_matches++;
66
-                        $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
67
-                        $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
66
+                        $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i);
67
+                        $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1);
68 68
                         $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]);
69
-                        $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
69
+                        $defaults['matches['.$nb_matches.']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
70 70
                     } else {
71 71
                         $nb_options++;
72
-                        $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
72
+                        $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i);
73 73
                     }
74 74
                 }
75 75
             }
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
         $html = '<table class="table table-striped table-hover">
93 93
             <thead>
94 94
                 <tr>
95
-                    <th width="85%">' . get_lang('Answer') . '</th>
96
-                    <th width="15%">' . get_lang('MatchesTo') . '</th>
97
-                    <th width="10">' . get_lang('Weighting') . '</th>
95
+                    <th width="85%">' . get_lang('Answer').'</th>
96
+                    <th width="15%">' . get_lang('MatchesTo').'</th>
97
+                    <th width="10">' . get_lang('Weighting').'</th>
98 98
                 </tr>
99 99
             </thead>
100 100
             <tbody>';
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
         for ($i = 1; $i <= $nb_matches; ++$i) {
190 190
             $position++;
191 191
 
192
-            $answer = $form->getSubmitValue('answer[' . $i . ']');
193
-            $matches = $form->getSubmitValue('matches[' . $i . ']');
194
-            $weighting = $form->getSubmitValue('weighting[' . $i . ']');
192
+            $answer = $form->getSubmitValue('answer['.$i.']');
193
+            $matches = $form->getSubmitValue('matches['.$i.']');
194
+            $weighting = $form->getSubmitValue('weighting['.$i.']');
195 195
             $this->weighting += $weighting;
196 196
             $objAnswer->createAnswer(
197 197
                 $answer,
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
     public function return_header($feedback_type = null, $counter = null, $score = null)
217 217
     {
218 218
         $header = parent::return_header($feedback_type, $counter, $score);
219
-        $header .= '<table class="' . $this->question_table_class . '">
219
+        $header .= '<table class="'.$this->question_table_class.'">
220 220
             <tr>
221
-                <th>' . get_lang('ElementList') . '</th>
222
-                <th>' . get_lang('Status') . '</th>
221
+                <th>' . get_lang('ElementList').'</th>
222
+                <th>' . get_lang('Status').'</th>
223 223
             </tr>';
224 224
 
225 225
         return $header;
Please login to merge, or discard this patch.
main/exercise/qti2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 // the breadcrumbs
24
-$interbreadcrumb[]= array (
25
-    "url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(),
24
+$interbreadcrumb[] = array(
25
+    "url" => api_get_path(WEB_CODE_PATH)."exercise/exercise.php?".api_get_cidreq(),
26 26
     "name" => get_lang('Exercises')
27 27
 );
28 28
 $is_allowedToEdit = api_is_allowed_to_edit(null, true);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 {
35 35
     $name_tools = get_lang('ImportQtiQuiz');
36 36
     $form  = '<div class="actions">';
37
-    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
37
+    $form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
38 38
         Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     $form .= '</div>';
40 40
     $formValidator = new FormValidator(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $imported = ch_qti2_import_file($_FILES['userFile']);
85 85
 
86 86
         if (is_numeric($imported) && !empty($imported)) {
87
-            header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
87
+            header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
88 88
             exit;
89 89
         } else {
90 90
             $message = Display::return_message(get_lang($imported));
Please login to merge, or discard this patch.