Completed
Push — 1.11.x ( 60645e...aacf46 )
by José
76:05 queued 37:57
created
main/survey/survey_invite.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 $tool_name = get_lang('SurveyPublication');
65 65
 
66 66
 // Displaying the header
67
-Display::display_header($tool_name,'Survey');
67
+Display::display_header($tool_name, 'Survey');
68 68
 
69 69
 echo '<script>
70 70
 $(function() {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 );
133 133
 
134 134
 $form->addElement('html', '<div id="check_mail">');
135
-$form->addElement('checkbox', 'send_mail','', get_lang('SendMail'));
135
+$form->addElement('checkbox', 'send_mail', '', get_lang('SendMail'));
136 136
 $form->addElement('html', '</div>');
137 137
 
138 138
 $form->addElement('html', '<div id="mail_text_wrapper">');
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	);
220 220
 
221 221
 	// Saving the invitations for the additional users
222
-	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
-	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
222
+	$values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email
223
+	$temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators
224 224
 	$additional_users = explode(';', $temp);
225 225
 	for ($i = 0; $i < count($additional_users); $i++) {
226 226
 		$additional_users[$i] = trim($additional_users[$i]);
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 $this_section = SECTION_COURSES;
19 19
 
20 20
 if (!api_is_allowed_to_edit(false, true)) {
21
-	Display :: display_header(get_lang('ToolSurvey'));
22
-	Display :: display_error_message(get_lang('NotAllowed'), false);
23
-	Display :: display_footer();
24
-	exit;
21
+    Display :: display_header(get_lang('ToolSurvey'));
22
+    Display :: display_error_message(get_lang('NotAllowed'), false);
23
+    Display :: display_footer();
24
+    exit;
25 25
 }
26 26
 
27 27
 // Database table definitions
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 $survey_id = Security::remove_XSS($_GET['survey_id']);
38 38
 $survey_data = SurveyManager::get_survey($survey_id);
39 39
 if (empty($survey_data)) {
40
-	Display :: display_header(get_lang('ToolSurvey'));
41
-	Display :: display_error_message(get_lang('InvallidSurvey'), false);
42
-	Display :: display_footer();
43
-	exit;
40
+    Display :: display_header(get_lang('ToolSurvey'));
41
+    Display :: display_error_message(get_lang('InvallidSurvey'), false);
42
+    Display :: display_footer();
43
+    exit;
44 44
 }
45 45
 
46 46
 $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
47 47
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
48
-	$urlname .= '...';
48
+    $urlname .= '...';
49 49
 }
50 50
 
51 51
 // Breadcrumbs
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 		WHERE c_id = $course_id AND code='".Database::escape_string($survey_data['code'])."'";
81 81
 $result = Database::query($sql);
82 82
 if (Database::num_rows($result) > 1) {
83
-	Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
83
+    Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
84 84
 }
85 85
 
86 86
 // Invited / answered message
87 87
 if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) {
88
-	$message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
89
-	$message .= get_lang('HaveAnswered').' ';
90
-	$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
91
-	$message .= get_lang('WereInvited');
92
-	Display::display_normal_message($message, false);
88
+    $message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
89
+    $message .= get_lang('HaveAnswered').' ';
90
+    $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
91
+    $message .= get_lang('WereInvited');
92
+    Display::display_normal_message($message, false);
93 93
 }
94 94
 
95 95
 // Building the form for publishing the survey
96 96
 $form = new FormValidator(
97
-	'publish_form',
98
-	'post',
99
-	api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq()
97
+    'publish_form',
98
+    'post',
99
+    api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq()
100 100
 );
101 101
 $form->addElement('header', '', $tool_name);
102 102
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 );
110 110
 $possible_users = array();
111 111
 foreach ($complete_user_list as & $user) {
112
-	$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
112
+    $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
113 113
 }
114 114
 
115 115
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
 // Additional users
127 127
 $form->addElement(
128
-	'textarea',
129
-	'additional_users',
130
-	array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
131
-	array('rows' => 5)
128
+    'textarea',
129
+    'additional_users',
130
+    array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
131
+    array('rows' => 5)
132 132
 );
133 133
 
134 134
 $form->addElement('html', '<div id="check_mail">');
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 $form->addText('mail_title', get_lang('MailTitle'), false);
142 142
 // The text of the mail
143 143
 $form->addHtmlEditor(
144
-	'mail_text',
145
-	array(get_lang('MailText'), get_lang('UseLinkSyntax')),
146
-	false,
147
-	array('ToolbarSet' => 'Survey', 'Height' => '150')
144
+    'mail_text',
145
+    array(get_lang('MailText'), get_lang('UseLinkSyntax')),
146
+    false,
147
+    array('ToolbarSet' => 'Survey', 'Height' => '150')
148 148
 );
149 149
 $form->addElement('html', '</div>');
150 150
 // You cab send a reminder to unanswered people if the survey is not anonymous
151 151
 if ($survey_data['anonymous'] != 1) {
152
-	$form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered'));
152
+    $form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered'));
153 153
 }
154 154
 // Allow resending to all selected users
155 155
 $form->addElement('checkbox', 'resend_to_all', '', get_lang('ReminderResendToAllUsers'));
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 }*/
164 164
 $portal_url = api_get_path(WEB_PATH);
165 165
 if (api_is_multiple_url_enabled()) {
166
-	$access_url_id = api_get_current_access_url_id();
167
-	if ($access_url_id != -1) {
168
-		$url = api_get_access_url($access_url_id);
169
-		$portal_url = $url['url'];
170
-	}
166
+    $access_url_id = api_get_current_access_url_id();
167
+    if ($access_url_id != -1) {
168
+        $url = api_get_access_url($access_url_id);
169
+        $portal_url = $url['url'];
170
+    }
171 171
 }
172 172
 
173 173
 // Show the URL that can be used by users to fill a survey without invitation
@@ -177,56 +177,56 @@  discard block
 block discarded – undo
177 177
 $form->addElement('label', null, $auto_survey_link);
178 178
 
179 179
 if ($form->validate()) {
180
-   	$values = $form->exportValues();
180
+        $values = $form->exportValues();
181 181
     if (isset($values['send_mail']) && $values['send_mail'] == 1) {
182 182
         if (empty($values['mail_title']) || empty($values['mail_text'])) {
183 183
             Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete'));
184 184
             // Getting the invited users
185
-        	$defaults = SurveyUtil::get_invited_users($survey_data['code']);
186
-
187
-        	// Getting the survey mail text
188
-        	if (!empty($survey_data['reminder_mail'])) {
189
-        		$defaults['mail_text'] = $survey_data['reminder_mail'];
190
-        	} else {
191
-        		$defaults['mail_text'] = $survey_data['invite_mail'];
192
-        	}
193
-        	$defaults['mail_title'] = $survey_data['mail_subject'];
194
-        	$defaults['send_mail'] = 1;
195
-        	$form->setDefaults($defaults);
185
+            $defaults = SurveyUtil::get_invited_users($survey_data['code']);
186
+
187
+            // Getting the survey mail text
188
+            if (!empty($survey_data['reminder_mail'])) {
189
+                $defaults['mail_text'] = $survey_data['reminder_mail'];
190
+            } else {
191
+                $defaults['mail_text'] = $survey_data['invite_mail'];
192
+            }
193
+            $defaults['mail_title'] = $survey_data['mail_subject'];
194
+            $defaults['send_mail'] = 1;
195
+            $form->setDefaults($defaults);
196 196
             $form->display();
197 197
             return;
198 198
         }
199 199
     }
200 200
     // Save the invitation mail
201
-	SurveyUtil::save_invite_mail(
202
-		$values['mail_text'],
203
-		$values['mail_title'],
204
-		!empty($survey_data['invite_mail'])
205
-	);
201
+    SurveyUtil::save_invite_mail(
202
+        $values['mail_text'],
203
+        $values['mail_title'],
204
+        !empty($survey_data['invite_mail'])
205
+    );
206 206
 
207 207
     $resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : '';
208 208
     $sendMail = isset($values['send_mail']) ? $values['send_mail'] : '';
209 209
     $remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : '';
210 210
 
211
-	// Saving the invitations for the course users
212
-	$count_course_users = SurveyUtil::saveInvitations(
213
-		$values['users'],
214
-		$values['mail_title'],
215
-		$values['mail_text'],
211
+    // Saving the invitations for the course users
212
+    $count_course_users = SurveyUtil::saveInvitations(
213
+        $values['users'],
214
+        $values['mail_title'],
215
+        $values['mail_text'],
216 216
         $resendAll,
217 217
         $sendMail,
218 218
         $remindUnAnswered
219
-	);
219
+    );
220 220
 
221
-	// Saving the invitations for the additional users
222
-	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
-	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
224
-	$additional_users = explode(';', $temp);
225
-	for ($i = 0; $i < count($additional_users); $i++) {
226
-		$additional_users[$i] = trim($additional_users[$i]);
227
-	}
221
+    // Saving the invitations for the additional users
222
+    $values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
+    $temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
224
+    $additional_users = explode(';', $temp);
225
+    for ($i = 0; $i < count($additional_users); $i++) {
226
+        $additional_users[$i] = trim($additional_users[$i]);
227
+    }
228 228
 
229
-	$counter_additional_users = SurveyUtil::saveInvitations(
229
+    $counter_additional_users = SurveyUtil::saveInvitations(
230 230
         $additional_users,
231 231
         $values['mail_title'],
232 232
         $values['mail_text'],
@@ -235,43 +235,43 @@  discard block
 block discarded – undo
235 235
         $remindUnAnswered
236 236
     );
237 237
 
238
-	// Updating the invited field in the survey table
239
-	SurveyUtil::update_count_invited($survey_data['code']);
240
-	$total_count = $count_course_users + $counter_additional_users;
238
+    // Updating the invited field in the survey table
239
+    SurveyUtil::update_count_invited($survey_data['code']);
240
+    $total_count = $count_course_users + $counter_additional_users;
241 241
     $table_survey = Database :: get_course_table(TABLE_SURVEY);
242
-	// Counting the number of people that are invited
243
-	$sql = "SELECT * FROM $table_survey
242
+    // Counting the number of people that are invited
243
+    $sql = "SELECT * FROM $table_survey
244 244
 	        WHERE
245 245
 	        	c_id = $course_id AND
246 246
 	        	code = '".Database::escape_string($survey_data['code'])."'
247 247
 			";
248
-	$result = Database::query($sql);
249
-	$row = Database::fetch_array($result);
250
-	$total_invited = $row['invited'];
248
+    $result = Database::query($sql);
249
+    $row = Database::fetch_array($result);
250
+    $total_invited = $row['invited'];
251 251
     if ($total_invited > 0) {
252
-    	$message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.
253
-			$survey_data['answered'].'</a> ';
254
-    	$message .= get_lang('HaveAnswered').' ';
255
-    	$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
256
-			$total_invited.'</a> ';
257
-    	$message .= get_lang('WereInvited');
258
-    	Display::display_normal_message($message, false);
259
-    	Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend'));
252
+        $message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.
253
+            $survey_data['answered'].'</a> ';
254
+        $message .= get_lang('HaveAnswered').' ';
255
+        $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
256
+            $total_invited.'</a> ';
257
+        $message .= get_lang('WereInvited');
258
+        Display::display_normal_message($message, false);
259
+        Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend'));
260 260
     }
261 261
 } else {
262
-	// Getting the invited users
263
-	$defaults = SurveyUtil::get_invited_users($survey_data['code']);
264
-
265
-	// Getting the survey mail text
266
-	if (!empty($survey_data['reminder_mail'])) {
267
-		$defaults['mail_text'] = $survey_data['reminder_mail'];
268
-	} else {
269
-		$defaults['mail_text'] = $survey_data['invite_mail'];
270
-	}
271
-	$defaults['mail_title'] = $survey_data['mail_subject'];
272
-	$defaults['send_mail'] = 1;
273
-
274
-	$form->setDefaults($defaults);
262
+    // Getting the invited users
263
+    $defaults = SurveyUtil::get_invited_users($survey_data['code']);
264
+
265
+    // Getting the survey mail text
266
+    if (!empty($survey_data['reminder_mail'])) {
267
+        $defaults['mail_text'] = $survey_data['reminder_mail'];
268
+    } else {
269
+        $defaults['mail_text'] = $survey_data['invite_mail'];
270
+    }
271
+    $defaults['mail_title'] = $survey_data['mail_subject'];
272
+    $defaults['send_mail'] = 1;
273
+
274
+    $form->setDefaults($defaults);
275 275
     $form->display();
276 276
 }
277 277
 Display :: display_footer();
Please login to merge, or discard this patch.
main/survey/fillsurvey.php 3 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 * @author unknown, the initial survey that did not make it in 1.8 because of bad code
7 7
 * @author Patrick Cool <[email protected]>, Ghent University: cleanup, refactoring and rewriting large parts of the code
8 8
 * @author Julio Montoya Armas <[email protected]>, Chamilo: Personality Test modification and rewriting large parts of the code as well
9
-
10
-* @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again.
9
+ * @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again.
11 10
 * @todo performance could be improved if not the survey_id was stored with the invitation but the survey_code
12 11
  */
13 12
 // Unsetting the course id (because it is in the URL)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $now = api_get_utc_datetime();
113 113
         if (Database :: num_rows($result) == 0) {
114 114
             $params = [
115
-                'c_id' => $course_id ,
115
+                'c_id' => $course_id,
116 116
                 'survey_code' => $surveyCode,
117 117
                 'user' => $userid,
118 118
                 'invitation_code' => $autoInvitationcode,
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $jquery_ready_content = $returnParams['jquery_ready_content'];
472 472
 
473 473
 // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
474
-    $htmlHeadXtra[] ='<script>
474
+    $htmlHeadXtra[] = '<script>
475 475
     $(document).ready(function(){
476 476
         '.$jquery_ready_content.'
477 477
     });
@@ -904,16 +904,16 @@  discard block
 block discarded – undo
904 904
                             $group2 = $groups[0];
905 905
                             $secondary .= " OR ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
906 906
                             $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
907
-                            $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
907
+                            $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
908 908
                         } else {
909 909
                             if ($i != 0) {
910 910
                                 $secondary .= " OR ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
911 911
                                 $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
912
-                                $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
912
+                                $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
913 913
                             } else {
914 914
                                 $secondary .= " ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
915 915
                                 $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
916
-                                $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
916
+                                $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
917 917
                             }
918 918
                         }
919 919
                     }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                         $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
1133 1133
                         $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
1134 1134
                         $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
1135
-                    }  else {
1135
+                    } else {
1136 1136
                         // If the type is a page break we are finished loading the questions for this page
1137 1137
                         break;
1138 1138
                     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1132,7 +1132,7 @@
 block discarded – undo
1132 1132
                         $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
1133 1133
                         $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
1134 1134
                         $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
1135
-                    }  else {
1135
+                    } else {
1136 1136
                         // If the type is a page break we are finished loading the questions for this page
1137 1137
                         break;
1138 1138
                     }
Please login to merge, or discard this patch.
main/survey/ch_yesno.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
                 $class = 'radio-inline';
44 44
             }
45 45
 
46
-            $name = 'question' . $questionData['question_id'];
46
+            $name = 'question'.$questionData['question_id'];
47 47
 
48 48
             $form->addRadio(
49 49
                 $name,
Please login to merge, or discard this patch.
main/survey/reporting.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,15 +83,15 @@
 block discarded – undo
83 83
 
84 84
 /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
85 85
 if (!api_is_allowed_to_edit(false, true) || $isDrhOfCourse) {
86
-	Display :: display_header(get_lang('ToolSurvey'));
86
+    Display :: display_header(get_lang('ToolSurvey'));
87 87
     // Show error message if the survey can be seen only by tutors
88 88
     if ($survey_data['visible_results'] != SURVEY_VISIBLE_TUTOR) {
89 89
         SurveyUtil::handle_reporting_actions($survey_data, $people_filled);
90 90
     } else {
91 91
         Display :: display_error_message(get_lang('NotAllowed'), false);
92 92
     }
93
-	Display :: display_footer();
94
-	exit;
93
+    Display :: display_footer();
94
+    exit;
95 95
 }
96 96
 
97 97
 // Database table definitions
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 // Actions bar
150 150
 echo '<div class="actions">';
151 151
 echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'">'.
152
-    Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
152
+    Display::return_icon('back.png', get_lang('BackToSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
153 153
 echo '</div>';
154 154
 
155 155
 // Content
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 ) {
160 160
     $myweb_survey_id = $survey_id;
161 161
     echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'&amp;'.$cidReq.'&amp;single_page=1">'.
162
-        Display::return_icon('survey_reporting_overall.png',get_lang('QuestionsOverallReport')).' '.get_lang('QuestionsOverallReport').'</a></div><div class="sectioncomment">'.get_lang('QuestionsOverallReportDetail').' </div>';
162
+        Display::return_icon('survey_reporting_overall.png', get_lang('QuestionsOverallReport')).' '.get_lang('QuestionsOverallReport').'</a></div><div class="sectioncomment">'.get_lang('QuestionsOverallReportDetail').' </div>';
163 163
     echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
164
-        Display::return_icon('survey_reporting_question.gif',get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
164
+        Display::return_icon('survey_reporting_question.gif', get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
165 165
     echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
166
-        Display::return_icon('survey_reporting_user.gif',get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';
166
+        Display::return_icon('survey_reporting_user.gif', get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';
167 167
     echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=comparativereport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
168
-        Display::return_icon('survey_reporting_comparative.gif',get_lang('ComparativeReport')).' '.get_lang('ComparativeReport').'</a></div><div class="sectioncomment">'.get_lang('ComparativeReportDetail').'.</div>';
168
+        Display::return_icon('survey_reporting_comparative.gif', get_lang('ComparativeReport')).' '.get_lang('ComparativeReport').'</a></div><div class="sectioncomment">'.get_lang('ComparativeReportDetail').'.</div>';
169 169
     echo '<div class="sectiontitle"><a href="reporting.php?action=completereport&amp;survey_id='.$myweb_survey_id.'&'.$cidReq.'">'.
170
-        Display::return_icon('survey_reporting_complete.gif',get_lang('CompleteReport')).' '.get_lang('CompleteReport').'</a></div><div class="sectioncomment">'.get_lang('CompleteReportDetail').'</div>';
170
+        Display::return_icon('survey_reporting_complete.gif', get_lang('CompleteReport')).' '.get_lang('CompleteReport').'</a></div><div class="sectioncomment">'.get_lang('CompleteReportDetail').'</div>';
171 171
 }
172 172
 
173 173
 // Footer
Please login to merge, or discard this patch.
main/survey/ch_multiplechoice.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             foreach ($formData['answers'] as $key => $value) {
32 32
                 $this->getForm()->addHtmlEditor('answers['.$key.']', null, false, false, $config);
33 33
 
34
-                if ($key < $total-1) {
34
+                if ($key < $total - 1) {
35 35
                     //$this->getForm()->addButton("move_down[$key]", get_lang('Down'));
36 36
                 }
37 37
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
                     //$this->getForm()->addButton("move_up[$key]", get_lang('Up'));
40 40
                 }
41 41
 
42
-                if ($total> 2) {
42
+                if ($total > 2) {
43 43
                     $this->getForm()->addButton("delete_answer[$key]", get_lang('Delete'), 'trash', 'danger');
44 44
                 }
45 45
             }
Please login to merge, or discard this patch.
main/survey/question.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
 /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
21 21
 if (!api_is_allowed_to_edit(false, true)) {
22
-	Display :: display_header();
23
-	Display :: display_error_message(get_lang('NotAllowed'), false);
24
-	Display :: display_footer();
25
-	exit;
22
+    Display :: display_header();
23
+    Display :: display_error_message(get_lang('NotAllowed'), false);
24
+    Display :: display_footer();
25
+    exit;
26 26
 }
27 27
 
28 28
 // Is valid request
@@ -42,30 +42,30 @@  discard block
 block discarded – undo
42 42
 $surveyData = SurveyManager::get_survey($_GET['survey_id']);
43 43
 
44 44
 if (empty($surveyData)) {
45
-	Display :: display_header(get_lang('ToolSurvey'));
46
-	Display :: display_error_message(get_lang('InvallidSurvey'), false);
47
-	Display :: display_footer();
48
-	exit;
45
+    Display :: display_header(get_lang('ToolSurvey'));
46
+    Display :: display_error_message(get_lang('InvallidSurvey'), false);
47
+    Display :: display_footer();
48
+    exit;
49 49
 }
50 50
 
51 51
 $urlname = api_substr(api_html_entity_decode($surveyData['title'], ENT_QUOTES), 0, 40);
52 52
 if (api_strlen(strip_tags($surveyData['title'])) > 40) {
53
-	$urlname .= '...';
53
+    $urlname .= '...';
54 54
 }
55 55
 
56 56
 if ($surveyData['survey_type'] == 1) {
57
-	$sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
57
+    $sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
58 58
 	        WHERE
59 59
                 c_id = '.$course_id.' AND
60 60
                 survey_id = '.(int)$_GET['survey_id'].' LIMIT 1';
61
-	$rs = Database::query($sql);
62
-	if (Database::num_rows($rs)===0) {
61
+    $rs = Database::query($sql);
62
+    if (Database::num_rows($rs)===0) {
63 63
         Display::addFlash(
64 64
             Display::return_message(get_lang('YouNeedToCreateGroups'))
65 65
         );
66
-		header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']);
67
-		exit;
68
-	}
66
+        header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']);
67
+        exit;
68
+    }
69 69
 }
70 70
 
71 71
 // Breadcrumbs
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 
81 81
 // Tool name
82 82
 if ($_GET['action'] == 'add') {
83
-	$tool_name = get_lang('AddQuestion');
83
+    $tool_name = get_lang('AddQuestion');
84 84
 }
85 85
 if ($_GET['action'] == 'edit') {
86
-	$tool_name = get_lang('EditQuestion');
86
+    $tool_name = get_lang('EditQuestion');
87 87
 }
88 88
 
89 89
 // The possible question types
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 // Actions
104 104
 $actions = '<div class="actions">';
105 105
 $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'.
106
-	Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
106
+    Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
107 107
 $actions .= '</div>';
108 108
 // Checking if it is a valid type
109 109
 if (!in_array($_GET['type'], $possible_types)) {
110
-	Display :: display_header($tool_name, 'Survey');
111
-	echo $actions;
112
-	Display :: display_error_message(get_lang('TypeDoesNotExist'), false);
113
-	Display :: display_footer();
110
+    Display :: display_header($tool_name, 'Survey');
111
+    echo $actions;
112
+    Display :: display_error_message(get_lang('TypeDoesNotExist'), false);
113
+    Display :: display_footer();
114 114
 }
115 115
 
116 116
 $error_message = '';
@@ -126,27 +126,27 @@  discard block
 block discarded – undo
126 126
 $formData['answers'] = array('', '');
127 127
 
128 128
 if ($_GET['type'] == 'yesno') {
129
-	$formData['answers'][0] = get_lang('Yes');
130
-	$formData['answers'][1] = get_lang('No');
129
+    $formData['answers'][0] = get_lang('Yes');
130
+    $formData['answers'][1] = get_lang('No');
131 131
 }
132 132
 
133 133
 if ($_GET['type'] == 'personality') {
134
-	$formData['answers'][0] = 1;
135
-	$formData['answers'][1] = 2;
136
-	$formData['answers'][2] = 3;
137
-	$formData['answers'][3] = 4;
138
-	$formData['answers'][4] = 5;
139
-
140
-	$formData['values'][0] = 0;
141
-	$formData['values'][1] = 0;
142
-	$formData['values'][2] = 1;
143
-	$formData['values'][3] = 2;
144
-	$formData['values'][4] = 3;
134
+    $formData['answers'][0] = 1;
135
+    $formData['answers'][1] = 2;
136
+    $formData['answers'][2] = 3;
137
+    $formData['answers'][3] = 4;
138
+    $formData['answers'][4] = 5;
139
+
140
+    $formData['values'][0] = 0;
141
+    $formData['values'][1] = 0;
142
+    $formData['values'][2] = 1;
143
+    $formData['values'][3] = 2;
144
+    $formData['values'][4] = 3;
145 145
 }
146 146
 
147 147
 // We are editing a question
148 148
 if (isset($_GET['question_id']) && !empty($_GET['question_id'])) {
149
-	$formData = SurveyManager::get_question($_GET['question_id']);
149
+    $formData = SurveyManager::get_question($_GET['question_id']);
150 150
 }
151 151
 
152 152
 $formData = $surveyQuestion->preSave($formData);
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 $surveyQuestion->renderForm();
156 156
 
157 157
 if ($surveyQuestion->getForm()->validate()) {
158
-	$values = $surveyQuestion->getForm()->getSubmitValues();
159
-	$surveyQuestion->save($surveyData, $values);
158
+    $values = $surveyQuestion->getForm()->getSubmitValues();
159
+    $surveyQuestion->save($surveyData, $values);
160 160
 }
161 161
 
162 162
 Display::display_header($tool_name, 'Survey');
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 	$sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
58 58
 	        WHERE
59 59
                 c_id = '.$course_id.' AND
60
-                survey_id = '.(int)$_GET['survey_id'].' LIMIT 1';
60
+                survey_id = '.(int) $_GET['survey_id'].' LIMIT 1';
61 61
 	$rs = Database::query($sql);
62
-	if (Database::num_rows($rs)===0) {
62
+	if (Database::num_rows($rs) === 0) {
63 63
         Display::addFlash(
64 64
             Display::return_message(get_lang('YouNeedToCreateGroups'))
65 65
         );
66
-		header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']);
66
+		header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int) $_GET['survey_id']);
67 67
 		exit;
68 68
 	}
69 69
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 // Actions
104 104
 $actions = '<div class="actions">';
105 105
 $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'.
106
-	Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
106
+	Display::return_icon('back.png', get_lang('BackToSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
107 107
 $actions .= '</div>';
108 108
 // Checking if it is a valid type
109 109
 if (!in_array($_GET['type'], $possible_types)) {
Please login to merge, or discard this patch.
main/survey/survey.lib.php 4 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1207,16 +1207,16 @@
 block discarded – undo
1207 1207
     }
1208 1208
 
1209 1209
     /**
1210
-    * This function saves the question in the shared database
1211
-    *
1212
-    * @param array $form_content all the information of the form
1213
-    * @param array $survey_data all the information of the survey
1214
-    *
1215
-    * @author Patrick Cool <[email protected]>, Ghent University
1216
-    * @version February 2007
1217
-    *
1218
-    * @todo editing of a shared question
1219
-    */
1210
+     * This function saves the question in the shared database
1211
+     *
1212
+     * @param array $form_content all the information of the form
1213
+     * @param array $survey_data all the information of the survey
1214
+     *
1215
+     * @author Patrick Cool <[email protected]>, Ghent University
1216
+     * @version February 2007
1217
+     *
1218
+     * @todo editing of a shared question
1219
+     */
1220 1220
     public function save_shared_question($form_content, $survey_data)
1221 1221
     {
1222 1222
         $_course = api_get_course_info();
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
                     '".Database::escape_string($_course['id'])."')";
1248 1248
             Database::query($sql);
1249 1249
             $shared_question_id = Database::insert_id();
1250
-        }  else {
1250
+        } else {
1251 1251
             // Updating an existing question
1252 1252
             // adding the question to the survey_question table
1253 1253
             $sql = "UPDATE $tbl_survey_question SET
@@ -2776,14 +2776,12 @@  discard block
 block discarded – undo
2776 2776
                                 echo $answers_of_user[$question_id][$option_id]['value'];
2777 2777
                                 echo "</td>";
2778 2778
                             }
2779
-                        }
2780
-                        else {
2779
+                        } else {
2781 2780
                             echo '<td align="center">';
2782 2781
                             if (!empty($answers_of_user[$question_id][$option_id])) {
2783 2782
                                 if ($answers_of_user[$question_id][$option_id]['value'] != 0) {
2784 2783
                                     echo $answers_of_user[$question_id][$option_id]['value'];
2785
-                                }
2786
-                                else {
2784
+                                } else {
2787 2785
                                     echo 'v';
2788 2786
                                 }
2789 2787
                             }
Please login to merge, or discard this patch.
Doc Comments   +17 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * Deletes all survey invitations of a user
48 48
      * @param int $user_id
49 49
      *
50
-     * @return boolean
50
+     * @return false|null
51 51
      * @assert ('') === false
52 52
      */
53 53
     public static function delete_all_survey_invitations_by_user($user_id)
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * Retrieves all the survey information
105 105
      *
106 106
      * @param integer $survey_id the id of the survey
107
-     * @param boolean $shared this parameter determines if
107
+     * @param integer $shared this parameter determines if
108 108
      * we have to get the information of a survey from the central (shared) database or from the
109 109
      * 		  course database
110 110
      * @param string course code optional
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
      * This function deletes a survey (and also all the question in that survey
572 572
      *
573 573
      * @param int $survey_id id of the survey that has to be deleted
574
-     * @return true
574
+     * @return boolean
575 575
      *
576 576
      * @author Patrick Cool <[email protected]>, Ghent University
577 577
      * @version January 2007
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
      *
757 757
      * @param int $survey_id id of the survey that has to be duplicated
758 758
      * @param int $courseId id of the course which survey has to be duplicated
759
-     * @return true
759
+     * @return boolean
760 760
      *
761 761
      * @author Eric Marguin <[email protected]>, Elixir Interactive
762 762
      * @version October 2007
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
     /**
797 797
      * This function recalculates the number of people who have taken the survey (=filled at least one question)
798 798
      *
799
-     * @param int $survey_id the id of the survey somebody
799
+     * @param int $survey_data the id of the survey somebody
800 800
      * @return true
801 801
      *
802 802
      * @author Patrick Cool <[email protected]>, Ghent University
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
      * This function deletes a shared survey question from the main database and all its options
1368 1368
      *
1369 1369
      * @param int $question_id the id of the question
1370
-     * @param int $shared
1370
+     * @param integer $survey_id
1371 1371
      *
1372 1372
      * @todo delete all the options of this question
1373 1373
      *
@@ -1494,8 +1494,8 @@  discard block
 block discarded – undo
1494 1494
      * This function deletes all the options of the questions of a given survey
1495 1495
      * This function is normally only called when a survey is deleted
1496 1496
      *
1497
-     * @param $survey_id the id of the survey that has to be deleted
1498
-     * @return true
1497
+     * @param integer $survey_id the id of the survey that has to be deleted
1498
+     * @return boolean
1499 1499
      *
1500 1500
      * @author Patrick Cool <[email protected]>, Ghent University
1501 1501
      * @version January 2007
@@ -1562,8 +1562,8 @@  discard block
 block discarded – undo
1562 1562
      * This function deletes all the answers anyone has given on this survey
1563 1563
      * This function is normally only called when a survey is deleted
1564 1564
      *
1565
-     * @param $survey_id the id of the survey that has to be deleted
1566
-     * @return true
1565
+     * @param integer $survey_id the id of the survey that has to be deleted
1566
+     * @return boolean
1567 1567
      *
1568 1568
      * @todo write the function
1569 1569
      *
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
     /**
1833 1833
      * This function checks the parameters that are used in this page
1834 1834
      *
1835
-     * @return 	string 	The header, an error and the footer if any parameter fails, else it returns true
1835
+     * @return 	null|boolean 	The header, an error and the footer if any parameter fails, else it returns true
1836 1836
      * @author Patrick Cool <[email protected]>, Ghent University
1837 1837
      * @version February 2007
1838 1838
      */
@@ -2383,6 +2383,7 @@  discard block
 block discarded – undo
2383 2383
      * Display score data about a survey question
2384 2384
      * @param	array	Question info
2385 2385
      * @param	integer	The offset of results shown
2386
+     * @param integer $offset
2386 2387
      * @return	void 	(direct output)
2387 2388
      */
2388 2389
     public static function display_question_report_score($survey_data, $question, $offset)
@@ -3223,7 +3224,7 @@  discard block
 block discarded – undo
3223 3224
      * @param	array	User's answers
3224 3225
      * @param 	mixed	User ID or user details as string - Used as a string in the result string
3225 3226
      * @param	boolean	Whether to display user fields or not
3226
-     * @return	string	One line of the csv file
3227
+     * @return	string[]	One line of the csv file
3227 3228
      */
3228 3229
     public static function export_complete_report_row_xls(
3229 3230
         $survey_data,
@@ -3532,6 +3533,7 @@  discard block
 block discarded – undo
3532 3533
      *
3533 3534
      * @param	integer	Survey ID
3534 3535
      * @param	integer	Question ID
3536
+     * @param integer $survey_id
3535 3537
      * @return 	Array	Array containing all answers of all users, grouped by user
3536 3538
      *
3537 3539
      * @author Patrick Cool <[email protected]>, Ghent University
@@ -3826,7 +3828,7 @@  discard block
 block discarded – undo
3826 3828
 
3827 3829
     /**
3828 3830
      * @param $params
3829
-     * @return bool|int
3831
+     * @return false|string
3830 3832
      */
3831 3833
     public static function save_invitation($params)
3832 3834
     {
@@ -3880,6 +3882,7 @@  discard block
 block discarded – undo
3880 3882
      *
3881 3883
      * @param int invitedUser - the userId (course user) or emailaddress of additional user
3882 3884
      * $param string $invitation_code - the unique invitation code for the URL
3885
+     * @param string|null $invitation_text
3883 3886
      * @return	void
3884 3887
      */
3885 3888
     public static function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text)
@@ -4786,7 +4789,7 @@  discard block
 block discarded – undo
4786 4789
      * @author Isaac Flores Paz <[email protected]>
4787 4790
      * @param int $user_id - User ID
4788 4791
      * @param string $survey_code
4789
-     * @param int $user_id_answer - User in survey answer table (user id or anonymus)
4792
+     * @param int $user_answer - User in survey answer table (user id or anonymus)
4790 4793
      *
4791 4794
      * @return boolean
4792 4795
      */
Please login to merge, or discard this patch.
Spacing   +159 added lines, -160 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $result = Database::query($sql);
36 36
             if (Database::num_rows($result)) {
37 37
                 $num++;
38
-                $new_code = $code . $num;
38
+                $new_code = $code.$num;
39 39
             } else {
40 40
                 break;
41 41
             }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $sql = "SELECT survey_invitation_id, survey_code
64 64
                 FROM $table_survey_invitation WHERE user = '$user_id' AND c_id <> 0 ";
65 65
         $result = Database::query($sql);
66
-        while ($row = Database::fetch_array($result ,'ASSOC')){
66
+        while ($row = Database::fetch_array($result, 'ASSOC')) {
67 67
             $survey_invitation_id = $row['survey_invitation_id'];
68 68
             $survey_code = $row['survey_code'];
69 69
             $sql2 = "DELETE FROM $table_survey_invitation
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $table_survey = Database :: get_course_table(TABLE_SURVEY);
130 130
 
131 131
         if ($shared != 0) {
132
-            $table_survey	= Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
132
+            $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
133 133
             $sql = "SELECT * FROM $table_survey
134 134
                     WHERE survey_id='".intval($survey_id)."' ";
135 135
         } else {
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
         $result = Database::query($sql);
143 143
         $return = array();
144 144
 
145
-        if (Database::num_rows($result)> 0) {
146
-            $return = Database::fetch_array($result,'ASSOC');
145
+        if (Database::num_rows($result) > 0) {
146
+            $return = Database::fetch_array($result, 'ASSOC');
147 147
             if ($simple_return) {
148 148
                 return $return;
149 149
             }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $course_id = api_get_course_int_id();
188 188
         $session_id = api_get_session_id();
189 189
         $courseCode = api_get_course_id();
190
-        $table_survey 	= Database :: get_course_table(TABLE_SURVEY);
190
+        $table_survey = Database :: get_course_table(TABLE_SURVEY);
191 191
         $shared_survey_id = 0;
192 192
 
193 193
         if (!isset($values['survey_id'])) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
                             if ($values[$field] == '') {
234 234
                                 $values[$field] = 0;
235 235
                             }
236
-                            $field_values.= $field.':'.$values[$field].'@';
236
+                            $field_values .= $field.':'.$values[$field].'@';
237 237
                         }
238 238
                     }
239 239
                     $extraParams['form_fields'] = $field_values;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             if ($values['anonymous'] == 0) {
386 386
                 $extraParams['show_form_profile'] = $values['show_form_profile'];
387 387
                 if ($values['show_form_profile'] == 1) {
388
-                    $fields = explode(',',$values['input_name_list']);
388
+                    $fields = explode(',', $values['input_name_list']);
389 389
                     $field_values = '';
390 390
                     foreach ($fields as &$field) {
391 391
                         if ($field != '') {
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                             ) {
395 395
                                 $values[$field] = 0;
396 396
                             }
397
-                            $field_values.= $field.':'.$values[$field].'@';
397
+                            $field_values .= $field.':'.$values[$field].'@';
398 398
                         }
399 399
                     }
400 400
                     $extraParams['form_fields'] = $field_values;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $_course = api_get_course_info();
527 527
 
528 528
         // Table definitions
529
-        $table_survey	= Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY);
529
+        $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY);
530 530
 
531 531
         if (!$values['survey_id'] ||
532 532
             !is_numeric($values['survey_id']) ||
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
                     '".api_get_utc_datetime()."',
545 545
                     '".$_course['id']."')";
546 546
             Database::query($sql);
547
-            $return	= Database::insert_id();
547
+            $return = Database::insert_id();
548 548
 
549 549
             $sql = "UPDATE $table_survey SET survey_id = $return WHERE iid = $return";
550 550
             Database::query($sql);
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                         surveythanks	= '".Database::escape_string($values['survey_thanks'])."'
562 562
 					WHERE survey_id = '".Database::escape_string($values['survey_share']['survey_share'])."'";
563 563
             Database::query($sql);
564
-            $return	= $values['survey_share']['survey_share'];
564
+            $return = $values['survey_share']['survey_share'];
565 565
         }
566 566
 
567 567
         return $return;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
             $params['c_id'] = $targetCourseId;
660 660
             unset($params['survey_id']);
661 661
             $params['session_id'] = api_get_session_id();
662
-            $params['title'] = $params['title'] . ' ' . get_lang('Copy');
662
+            $params['title'] = $params['title'].' '.get_lang('Copy');
663 663
             unset($params['iid']);
664 664
             Database::insert($table_survey, $params);
665 665
             $new_survey_id = Database::insert_id();
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
         $sql = "SELECT * FROM $table_survey_question_group
686 686
                 WHERE c_id = $course_id AND  survey_id='".$survey_id."'";
687 687
         $res = Database::query($sql);
688
-        while($row = Database::fetch_array($res, 'ASSOC')) {
688
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
689 689
             $params = array(
690 690
                 'c_id' =>  $targetCourseId,
691 691
                 'name' => $row['name'],
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
                 WHERE c_id = $course_id AND survey_id='".$survey_id."'";
733 733
 
734 734
         $res = Database::query($sql);
735
-        while ($row = Database::fetch_array($res ,'ASSOC')) {
735
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
736 736
             $params = array(
737 737
                 'c_id' =>  $targetCourseId,
738 738
                 'question_id' => $question_id[$row['question_id']],
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
     {
898 898
         // Table definitions
899 899
         $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
900
-        $table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
900
+        $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
901 901
         $course_id = api_get_course_int_id();
902 902
 
903 903
         $sql = "SELECT * FROM $tbl_survey_question
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
         // Getting the information of the question
924 924
 
925 925
         $result = Database::query($sql);
926
-        $row = Database::fetch_array($result,'ASSOC');
926
+        $row = Database::fetch_array($result, 'ASSOC');
927 927
 
928 928
         $return['survey_id'] = $row['survey_id'];
929 929
         $return['question_id'] = $row['question_id'];
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
     public static function get_questions($survey_id, $course_id = '')
972 972
     {
973 973
         // Table definitions
974
-        $tbl_survey_question 			= Database :: get_course_table(TABLE_SURVEY_QUESTION);
975
-        $table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
974
+        $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
975
+        $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
976 976
 
977 977
         if (empty($course_id)) {
978 978
             $course_id = api_get_course_int_id();
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 					        FROM $tbl_survey_question
1077 1077
                             WHERE c_id = $course_id AND survey_id='".intval($form_content['survey_id'])."'";
1078 1078
                     $result = Database::query($sql);
1079
-                    $row = Database::fetch_array($result,'ASSOC');
1079
+                    $row = Database::fetch_array($result, 'ASSOC');
1080 1080
                     $max_sort = $row['max_sort'];
1081 1081
 
1082 1082
                     // Some variables defined for survey-test type
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
                     WHERE survey_id='".intval($survey_data['survey_share'])."'
1214 1214
                     AND code='".Database::escape_string($_course['id'])."'";
1215 1215
             $result = Database::query($sql);
1216
-            $row = Database::fetch_array($result,'ASSOC');
1216
+            $row = Database::fetch_array($result, 'ASSOC');
1217 1217
             $max_sort = $row['max_sort'];
1218 1218
 
1219 1219
             // Adding the question to the survey_question table
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
                     '".Database::escape_string($form_content['question_comment'])."',
1224 1224
                     '".Database::escape_string($form_content['type'])."',
1225 1225
                     '".Database::escape_string($form_content['horizontalvertical'])."',
1226
-                    '".Database::escape_string($max_sort+1)."',
1226
+                    '".Database::escape_string($max_sort + 1)."',
1227 1227
                     '".Database::escape_string($_course['id'])."')";
1228 1228
             Database::query($sql);
1229 1229
             $shared_question_id = Database::insert_id();
1230
-        }  else {
1230
+        } else {
1231 1231
             // Updating an existing question
1232 1232
             // adding the question to the survey_question table
1233 1233
             $sql = "UPDATE $tbl_survey_question SET
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
     public static function move_survey_question($direction, $survey_question_id, $survey_id)
1258 1258
     {
1259 1259
         // Table definition
1260
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
1260
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
1261 1261
         $course_id = api_get_course_int_id();
1262 1262
 
1263 1263
         if ($direction == 'moveup') {
@@ -1309,11 +1309,11 @@  discard block
 block discarded – undo
1309 1309
         $course_id = api_get_course_int_id();
1310 1310
 
1311 1311
         // Table definitions
1312
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
1312
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
1313 1313
         $course_condition = " c_id = $course_id AND ";
1314 1314
         if ($shared) {
1315 1315
             $course_condition = "";
1316
-            $table_survey_question 	= Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
1316
+            $table_survey_question = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
1317 1317
         }
1318 1318
 
1319 1319
         $sql = "DELETE FROM $table_survey_question
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
     {
1347 1347
         $course_id = api_get_course_int_id();
1348 1348
         // Table definitions
1349
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
1349
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
1350 1350
         if ($shared) {
1351 1351
             SurveyManager::delete_shared_survey_question($survey_id, $question_id);
1352 1352
         }
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
         $course_id = api_get_course_int_id();
1409 1409
         // A percentage question type has options 1 -> 100
1410 1410
         if ($form_content['type'] == 'percentage') {
1411
-            for($i = 1; $i < 101; $i++) {
1411
+            for ($i = 1; $i < 101; $i++) {
1412 1412
                 $form_content['answers'][] = $i;
1413 1413
             }
1414 1414
         }
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
     {
1590 1590
         $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
1591 1591
 
1592
-        $user_id	= intval($user_id);
1592
+        $user_id = intval($user_id);
1593 1593
         $course_id	= intval($course_id);
1594 1594
         $survey_id	= intval($survey_id);
1595 1595
 
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
     public static function remove_answer($user, $survey_id, $question_id, $course_id) {
1775 1775
         $course_id = intval($course_id);
1776 1776
         // table definition
1777
-        $table_survey_answer 		= Database :: get_course_table(TABLE_SURVEY_ANSWER);
1777
+        $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
1778 1778
         $sql = "DELETE FROM $table_survey_answer
1779 1779
 				WHERE
1780 1780
 				    c_id = $course_id AND
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
         if (!empty($survey_id) && !empty($user_id)) {
1957 1957
             // delete data from survey_answer by user_id and survey_id
1958 1958
             $sql = "DELETE FROM $table_survey_answer
1959
-			        WHERE c_id = $course_id AND survey_id = '".(int)$survey_id."' AND user = '".(int)$user_id."'";
1959
+			        WHERE c_id = $course_id AND survey_id = '".(int) $survey_id."' AND user = '".(int) $user_id."'";
1960 1960
             Database::query($sql);
1961 1961
             // update field answered from survey_invitation by user_id and survey_id
1962 1962
             $sql = "UPDATE $table_survey_invitation SET answered = '0'
@@ -1966,9 +1966,9 @@  discard block
 block discarded – undo
1966 1966
                             SELECT code FROM $table_survey
1967 1967
                             WHERE
1968 1968
                                 c_id = $course_id AND
1969
-                                survey_id = '".(int)$survey_id."'
1969
+                                survey_id = '".(int) $survey_id."'
1970 1970
                         ) AND
1971
-			            user = '".(int)$user_id."'";
1971
+			            user = '".(int) $user_id."'";
1972 1972
             $result = Database::query($sql);
1973 1973
         }
1974 1974
 
@@ -2000,19 +2000,19 @@  discard block
 block discarded – undo
2000 2000
         // Actions bar
2001 2001
         echo '<div class="actions">';
2002 2002
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
2003
-            Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
2003
+            Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
2004 2004
         if (isset($_GET['user'])) {
2005 2005
             if (api_is_allowed_to_edit()) {
2006 2006
                 // The delete link
2007 2007
                 echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.$surveyId.'&'.api_get_cidreq().'&user='.Security::remove_XSS($_GET['user']).'" >'.
2008
-                    Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_MEDIUM).'</a>';
2008
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>';
2009 2009
             }
2010 2010
 
2011 2011
             // Export the user report
2012 2012
             echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'.
2013
-                Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
2013
+                Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
2014 2014
             echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.
2015
-                Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
2015
+                Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
2016 2016
             echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='.Security::remove_XSS($_GET['user']).'">';
2017 2017
             echo '<input type="hidden" name="export_report" value="export_report">';
2018 2018
             echo '<input type="hidden" name="export_format" value="csv">';
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
                     $name = $person['invited_user'];
2046 2046
                 }
2047 2047
             } else {
2048
-                $name  = get_lang('Anonymous') . ' ' . ($key + 1);
2048
+                $name = get_lang('Anonymous').' '.($key + 1);
2049 2049
                 $id = $person;
2050 2050
             }
2051 2051
             echo '<option value="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($id).'" ';
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 
2189 2189
         echo '<div class="actions">';
2190 2190
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'">'.
2191
-            Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
2191
+            Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
2192 2192
         echo '</div>';
2193 2193
 
2194 2194
         if ($survey_data['number_of_questions'] > 0) {
@@ -2196,18 +2196,18 @@  discard block
 block discarded – undo
2196 2196
             if (!$singlePage) {
2197 2197
                 echo '<div id="question_report_questionnumbers" class="pagination">';
2198 2198
                 if ($currentQuestion != 0) {
2199
-                    echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset - 1) . '">' . get_lang('PreviousQuestion') . '</a></li>';
2199
+                    echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset - 1).'">'.get_lang('PreviousQuestion').'</a></li>';
2200 2200
                 }
2201 2201
 
2202 2202
                 for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) {
2203 2203
                     if ($offset != $i - 1) {
2204
-                        echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($i - 1) . '">' . $i . '</a></li>';
2204
+                        echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($i - 1).'">'.$i.'</a></li>';
2205 2205
                     } else {
2206
-                        echo '<li class="disabled"s><a href="#">' . $i . '</a></li>';
2206
+                        echo '<li class="disabled"s><a href="#">'.$i.'</a></li>';
2207 2207
                     }
2208 2208
                 }
2209 2209
                 if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
2210
-                    echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset + 1) . '">' . get_lang('NextQuestion') . '</li></a>';
2210
+                    echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset + 1).'">'.get_lang('NextQuestion').'</li></a>';
2211 2211
                 }
2212 2212
                 echo '</ul>';
2213 2213
                 echo '</div>';
@@ -2245,19 +2245,19 @@  discard block
 block discarded – undo
2245 2245
                 $sql = "SELECT * FROM $table_survey_answer
2246 2246
                         WHERE
2247 2247
                             c_id = $course_id AND
2248
-                            survey_id='" . intval($_GET['survey_id']) . "' AND
2249
-                            question_id = '" . intval($question['question_id']) . "'";
2248
+                            survey_id='".intval($_GET['survey_id'])."' AND
2249
+                            question_id = '" . intval($question['question_id'])."'";
2250 2250
                 $result = Database::query($sql);
2251 2251
                 while ($row = Database::fetch_array($result)) {
2252
-                    echo $row['option_id'] . '<hr noshade="noshade" size="1" />';
2252
+                    echo $row['option_id'].'<hr noshade="noshade" size="1" />';
2253 2253
                 }
2254 2254
             } else {
2255 2255
                 // Getting the options ORDER BY sort ASC
2256 2256
                 $sql = "SELECT * FROM $table_survey_question_option
2257 2257
                         WHERE
2258 2258
                             c_id = $course_id AND
2259
-                            survey_id='" . intval($_GET['survey_id']) . "'
2260
-                            AND question_id = '" . intval($question['question_id']) . "'
2259
+                            survey_id='".intval($_GET['survey_id'])."'
2260
+                            AND question_id = '" . intval($question['question_id'])."'
2261 2261
                         ORDER BY sort ASC";
2262 2262
                 $result = Database::query($sql);
2263 2263
                 while ($row = Database::fetch_array($result)) {
@@ -2267,8 +2267,8 @@  discard block
 block discarded – undo
2267 2267
                 $sql = "SELECT *, count(answer_id) as total FROM $table_survey_answer
2268 2268
                         WHERE
2269 2269
                             c_id = $course_id AND
2270
-                            survey_id='" . intval($_GET['survey_id']) . "'
2271
-                            AND question_id = '" . intval($question['question_id']) . "'
2270
+                            survey_id='".intval($_GET['survey_id'])."'
2271
+                            AND question_id = '" . intval($question['question_id'])."'
2272 2272
                         GROUP BY option_id, value";
2273 2273
                 $result = Database::query($sql);
2274 2274
                 $number_of_answers = array();
@@ -2285,8 +2285,7 @@  discard block
 block discarded – undo
2285 2285
                     $optionText = strip_tags($option['option_text']);
2286 2286
                     $optionText = html_entity_decode($optionText);
2287 2287
                     $votes = isset($data[$option['question_option_id']]['total']) ?
2288
-                        $data[$option['question_option_id']]['total'] :
2289
-                        '0';
2288
+                        $data[$option['question_option_id']]['total'] : '0';
2290 2289
                     array_push($chartData, array('option' => $optionText, 'votes' => $votes));
2291 2290
                 }
2292 2291
                 $chartContainerId = 'chartContainer'.$question['question_id'];
@@ -2298,9 +2297,9 @@  discard block
 block discarded – undo
2298 2297
                 echo '<table class="display-survey table">';
2299 2298
                 echo '	<tr>';
2300 2299
                 echo '		<th>&nbsp;</th>';
2301
-                echo '		<th>' . get_lang('AbsoluteTotal') . '</th>';
2302
-                echo '		<th>' . get_lang('Percentage') . '</th>';
2303
-                echo '		<th>' . get_lang('VisualRepresentation') . '</th>';
2300
+                echo '		<th>'.get_lang('AbsoluteTotal').'</th>';
2301
+                echo '		<th>'.get_lang('Percentage').'</th>';
2302
+                echo '		<th>'.get_lang('VisualRepresentation').'</th>';
2304 2303
                 echo '	<tr>';
2305 2304
 
2306 2305
                 // Displaying the table: the content
@@ -2320,22 +2319,22 @@  discard block
 block discarded – undo
2320 2319
                             $answers_number = $absolute_number / $number_of_answers[$option['question_id']] * 100;
2321 2320
                         }
2322 2321
                         echo '	<tr>';
2323
-                        echo '		<td class="center">' . $value['option_text'] . '</td>';
2322
+                        echo '		<td class="center">'.$value['option_text'].'</td>';
2324 2323
                         echo '		<td class="center">';
2325 2324
                         if ($absolute_number != 0) {
2326
-                            echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&survey_id=' . $surveyId . '&question=' . $offset . '&viewoption=' . $value['question_option_id'] . '">' . $absolute_number . '</a>';
2325
+                            echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.$surveyId.'&question='.$offset.'&viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a>';
2327 2326
                         } else {
2328 2327
                             echo '0';
2329 2328
                         }
2330 2329
 
2331 2330
                         echo '      </td>';
2332
-                        echo '		<td class="center">' . round($answers_number, 2) . ' %</td>';
2331
+                        echo '		<td class="center">'.round($answers_number, 2).' %</td>';
2333 2332
                         echo '		<td class="center">';
2334 2333
                         $size = $answers_number * 2;
2335 2334
                         if ($size > 0) {
2336
-                            echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:' . $size . 'px">&nbsp;</div>';
2335
+                            echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
2337 2336
                         } else {
2338
-                            echo '<div style="text-align: left;">' . get_lang("NoDataAvailable") . '</div>';
2337
+                            echo '<div style="text-align: left;">'.get_lang("NoDataAvailable").'</div>';
2339 2338
                         }
2340 2339
                         echo ' </td>';
2341 2340
                         echo ' </tr>';
@@ -2343,8 +2342,8 @@  discard block
 block discarded – undo
2343 2342
                 }
2344 2343
                 // displaying the table: footer (totals)
2345 2344
                 echo '	<tr>';
2346
-                echo '		<td class="total"><b>' . get_lang('Total') . '</b></td>';
2347
-                echo '		<td class="total"><b>' . ($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]) . '</b></td>';
2345
+                echo '		<td class="total"><b>'.get_lang('Total').'</b></td>';
2346
+                echo '		<td class="total"><b>'.($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]).'</b></td>';
2348 2347
                 echo '		<td class="total">&nbsp;</td>';
2349 2348
                 echo '		<td class="total">&nbsp;</td>';
2350 2349
                 echo '	</tr>';
@@ -2388,8 +2387,8 @@  discard block
 block discarded – undo
2388 2387
     public static function display_question_report_score($survey_data, $question, $offset)
2389 2388
     {
2390 2389
         // Database table definitions
2391
-        $table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
2392
-        $table_survey_answer 			= Database :: get_course_table(TABLE_SURVEY_ANSWER);
2390
+        $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
2391
+        $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
2393 2392
 
2394 2393
         $course_id = api_get_course_int_id();
2395 2394
 
@@ -2459,9 +2458,9 @@  discard block
 block discarded – undo
2459 2458
                 echo '		<td>'.$value['option_text'].'</td>';
2460 2459
                 echo '		<td>'.$i.'</td>';
2461 2460
                 echo '		<td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset).'&viewoption='.$value['question_option_id'].'&value='.$i.'">'.$absolute_number.'</a></td>';
2462
-                echo '		<td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>';
2461
+                echo '		<td>'.round($absolute_number / $number_of_answers * 100, 2).' %</td>';
2463 2462
                 echo '		<td>';
2464
-                $size = ($absolute_number/$number_of_answers*100*2);
2463
+                $size = ($absolute_number / $number_of_answers * 100 * 2);
2465 2464
                 if ($size > 0) {
2466 2465
                     echo '			<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
2467 2466
                 }
@@ -2500,11 +2499,11 @@  discard block
 block discarded – undo
2500 2499
         // Actions bar
2501 2500
         echo '<div class="actions">';
2502 2501
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">
2503
-		'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
2502
+		'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
2504 2503
         echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">
2505
-		'.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
2504
+		'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
2506 2505
         echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">
2507
-		'.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>';
2506
+		'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
2508 2507
         echo '</div>';
2509 2508
 
2510 2509
         // The form
@@ -2539,8 +2538,8 @@  discard block
 block discarded – undo
2539 2538
             // Show user fields section with a big th colspan that spans over all fields
2540 2539
             $extra_user_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false, true);
2541 2540
             $num = count($extra_user_fields);
2542
-            if ($num > 0 ) {
2543
-                echo '<th '.($num>0?' colspan="'.$num.'"':'').'>';
2541
+            if ($num > 0) {
2542
+                echo '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>';
2544 2543
                 echo '<label><input type="checkbox" name="fields_filter" value="1" checked="checked"/> ';
2545 2544
                 echo get_lang('UserFields');
2546 2545
                 echo '</label>';
@@ -2593,7 +2592,7 @@  discard block
 block discarded – undo
2593 2592
         if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] ||
2594 2593
                 isset($_POST['export_report']) && $_POST['export_report']) || !empty($_POST['fields_filter'])) {
2595 2594
             //show the fields names for user fields
2596
-            foreach($extra_user_fields as & $field) {
2595
+            foreach ($extra_user_fields as & $field) {
2597 2596
                 echo '<th>'.$field[3].'</th>';
2598 2597
             }
2599 2598
         }
@@ -2614,7 +2613,7 @@  discard block
 block discarded – undo
2614 2613
 				ORDER BY sq.sort ASC, sqo.sort ASC";
2615 2614
         $result = Database::query($sql);
2616 2615
 
2617
-        $display_percentage_header = 1;	// in order to display only once the cell option (and not 100 times)
2616
+        $display_percentage_header = 1; // in order to display only once the cell option (and not 100 times)
2618 2617
         while ($row = Database::fetch_array($result)) {
2619 2618
             // We show the options if
2620 2619
             // 1. there is no question filter and the export button has not been clicked
@@ -2674,7 +2673,7 @@  discard block
 block discarded – undo
2674 2673
                     $questions,
2675 2674
                     $display_extra_user_fields
2676 2675
                 );
2677
-                $answers_of_user=array();
2676
+                $answers_of_user = array();
2678 2677
             }
2679 2678
             if (isset($questions[$row['question_id']]) && $questions[$row['question_id']]['type'] != 'open') {
2680 2679
                 $answers_of_user[$row['question_id']][$row['option_id']] = $row;
@@ -2736,7 +2735,7 @@  discard block
 block discarded – undo
2736 2735
                 echo '<th>'.$user.'</th>'; // the user column
2737 2736
             }
2738 2737
         } else {
2739
-            echo '<th>' . get_lang('Anonymous') . ' ' . $user . '</th>';
2738
+            echo '<th>'.get_lang('Anonymous').' '.$user.'</th>';
2740 2739
         }
2741 2740
 
2742 2741
         if ($display_extra_user_fields) {
@@ -2833,10 +2832,10 @@  discard block
 block discarded – undo
2833 2832
                 // We do not show comment and pagebreak question types
2834 2833
                 if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
2835 2834
                     if ($row['number_of_options'] == 0 && $row['type'] == 'open') {
2836
-                        $return .= str_replace("\r\n",'  ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
2835
+                        $return .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
2837 2836
                     } else {
2838 2837
                         for ($ii = 0; $ii < $row['number_of_options']; $ii++) {
2839
-                            $return .= str_replace("\r\n",'  ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
2838
+                            $return .= str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';';
2840 2839
                         }
2841 2840
                     }
2842 2841
                 }
@@ -2850,7 +2849,7 @@  discard block
 block discarded – undo
2850 2849
         // Show the fields names for user fields
2851 2850
         if (!empty($extra_user_fields)) {
2852 2851
             foreach ($extra_user_fields as & $field) {
2853
-                $return .= '"'.str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";';
2852
+                $return .= '"'.str_replace("\r\n", '  ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";';
2854 2853
             }
2855 2854
         }
2856 2855
 
@@ -2886,7 +2885,7 @@  discard block
 block discarded – undo
2886 2885
             ) {
2887 2886
                 // We do not show comment and pagebreak question types
2888 2887
                 if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') {
2889
-                    $row['option_text'] = str_replace(array("\r","\n"),array('',''),$row['option_text']);
2888
+                    $row['option_text'] = str_replace(array("\r", "\n"), array('', ''), $row['option_text']);
2890 2889
                     $return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';';
2891 2890
                     $possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
2892 2891
                     $possible_answers_type[$row['question_id']] = $row['type'];
@@ -2916,9 +2915,9 @@  discard block
 block discarded – undo
2916 2915
                     $old_user,
2917 2916
                     true
2918 2917
                 );
2919
-                $answers_of_user=array();
2918
+                $answers_of_user = array();
2920 2919
             }
2921
-            if($possible_answers_type[$row['question_id']] == 'open') {
2920
+            if ($possible_answers_type[$row['question_id']] == 'open') {
2922 2921
                 $temp_id = 'open'.$open_question_iterator;
2923 2922
                 $answers_of_user[$row['question_id']][$temp_id] = $row;
2924 2923
                 $open_question_iterator++;
@@ -2977,7 +2976,7 @@  discard block
 block discarded – undo
2977 2976
 
2978 2977
         if ($display_extra_user_fields) {
2979 2978
             // Show user fields data, if any, for this user
2980
-            $user_fields_values = UserManager::get_extra_user_data($user,false,false, false, true);
2979
+            $user_fields_values = UserManager::get_extra_user_data($user, false, false, false, true);
2981 2980
             foreach ($user_fields_values as & $value) {
2982 2981
                 $return .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES)).'";';
2983 2982
             }
@@ -3076,9 +3075,9 @@  discard block
 block discarded – undo
3076 3075
                                 ENT_QUOTES
3077 3076
                             )
3078 3077
                         );
3079
-                        $column ++;
3078
+                        $column++;
3080 3079
                     } else {
3081
-                        for ($ii = 0; $ii < $row['number_of_options']; $ii ++) {
3080
+                        for ($ii = 0; $ii < $row['number_of_options']; $ii++) {
3082 3081
                             $worksheet->SetCellValueByColumnAndRow(
3083 3082
                                 $line,
3084 3083
                                 $column,
@@ -3087,7 +3086,7 @@  discard block
 block discarded – undo
3087 3086
                                     ENT_QUOTES
3088 3087
                                 )
3089 3088
                             );
3090
-                            $column ++;
3089
+                            $column++;
3091 3090
                         }
3092 3091
                     }
3093 3092
                 }
@@ -3155,7 +3154,7 @@  discard block
 block discarded – undo
3155 3154
         }
3156 3155
 
3157 3156
         // Getting all the answers of the users
3158
-        $line ++;
3157
+        $line++;
3159 3158
         $column = 0;
3160 3159
         $old_user = '';
3161 3160
         $answers_of_user = array();
@@ -3164,7 +3163,7 @@  discard block
 block discarded – undo
3164 3163
         if ($user_id != 0) {
3165 3164
             $sql .= "AND user='".intval($user_id)."' ";
3166 3165
         }
3167
-        $sql .=	"ORDER BY user ASC";
3166
+        $sql .= "ORDER BY user ASC";
3168 3167
 
3169 3168
         $open_question_iterator = 1;
3170 3169
         $result = Database::query($sql);
@@ -3239,7 +3238,7 @@  discard block
 block discarded – undo
3239 3238
                         FROM '.Database::get_main_table(TABLE_MAIN_USER).'
3240 3239
                         WHERE user_id='.intval($user);
3241 3240
                 $rs = Database::query($sql);
3242
-                if($row = Database::fetch_array($rs)) {
3241
+                if ($row = Database::fetch_array($rs)) {
3243 3242
                     $user_displayed = api_get_person_name($row['firstname'], $row['lastname']);
3244 3243
                 } else {
3245 3244
                     $user_displayed = '-';
@@ -3254,7 +3253,7 @@  discard block
 block discarded – undo
3254 3253
 
3255 3254
         if ($display_extra_user_fields) {
3256 3255
             //show user fields data, if any, for this user
3257
-            $user_fields_values = UserManager::get_extra_user_data(intval($user),false,false, false, true);
3256
+            $user_fields_values = UserManager::get_extra_user_data(intval($user), false, false, false, true);
3258 3257
             foreach ($user_fields_values as $value) {
3259 3258
                 $return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES);
3260 3259
             }
@@ -3315,7 +3314,7 @@  discard block
 block discarded – undo
3315 3314
         // Actions bar
3316 3315
         echo '<div class="actions">';
3317 3316
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
3318
-                Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
3317
+                Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>';
3319 3318
         echo '</div>';
3320 3319
 
3321 3320
         // Displaying an information message that only the questions with predefined answers can be used in a comparative report
@@ -3380,17 +3379,17 @@  discard block
 block discarded – undo
3380 3379
             $tableHtml .= '<tr>';
3381 3380
             for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
3382 3381
                 if ($ii == 0) {
3383
-                    $tableHtml .=  '<th>&nbsp;</th>';
3382
+                    $tableHtml .= '<th>&nbsp;</th>';
3384 3383
                 } else {
3385 3384
                     if ($question_x['type'] == 'score') {
3386 3385
                         for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
3387
-                            $tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>';
3386
+                            $tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'<br />'.$x.'</th>';
3388 3387
                         }
3389 3388
                         $x = '';
3390 3389
                     } else {
3391
-                        $tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'</th>';
3390
+                        $tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'</th>';
3392 3391
                     }
3393
-                    $optionText = strip_tags($question_x['answers'][$ii-1]);
3392
+                    $optionText = strip_tags($question_x['answers'][$ii - 1]);
3394 3393
                     $optionText = html_entity_decode($optionText);
3395 3394
                     array_push($xOptions, trim($optionText));
3396 3395
                 }
@@ -3405,15 +3404,15 @@  discard block
 block discarded – undo
3405 3404
                 // The Y axis is a scoring question type so we have more rows than the options (actually options * maximum score)
3406 3405
                 if ($question_y['type'] == 'score') {
3407 3406
                     for ($y = 1; $y <= $question_y['maximum_score']; $y++) {
3408
-                        $tableHtml .=  '<tr>';
3407
+                        $tableHtml .= '<tr>';
3409 3408
                         for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
3410 3409
                             if ($question_x['type'] == 'score') {
3411 3410
                                 for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
3412 3411
                                     if ($ii == 0) {
3413
-                                        $tableHtml .=  '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
3412
+                                        $tableHtml .= '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
3414 3413
                                         break;
3415 3414
                                     } else {
3416
-                                        $tableHtml .=  '<td align="center">';
3415
+                                        $tableHtml .= '<td align="center">';
3417 3416
                                         $votes = SurveyUtil::comparative_check(
3418 3417
                                             $answers_x,
3419 3418
                                             $answers_y,
@@ -3422,16 +3421,16 @@  discard block
 block discarded – undo
3422 3421
                                             $x,
3423 3422
                                             $y
3424 3423
                                         );
3425
-                                        $tableHtml .=  $votes;
3424
+                                        $tableHtml .= $votes;
3426 3425
                                         array_push(
3427 3426
                                             $chartData,
3428 3427
                                             array(
3429
-                                                'serie' => array($currentYQuestion, $xOptions[$ii-1]),
3428
+                                                'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
3430 3429
                                                 'option' => $x,
3431 3430
                                                 'votes' => $votes
3432 3431
                                             )
3433 3432
                                         );
3434
-                                        $tableHtml .=  '</td>';
3433
+                                        $tableHtml .= '</td>';
3435 3434
                                     }
3436 3435
                                 }
3437 3436
                             } else {
@@ -3451,33 +3450,33 @@  discard block
 block discarded – undo
3451 3450
                                     array_push(
3452 3451
                                         $chartData,
3453 3452
                                         array(
3454
-                                            'serie' => array($currentYQuestion, $xOptions[$ii-1]),
3453
+                                            'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
3455 3454
                                             'option' => $y,
3456 3455
                                             'votes' => $votes
3457 3456
                                         )
3458 3457
                                     );
3459
-                                    $tableHtml .=  '</td>';
3458
+                                    $tableHtml .= '</td>';
3460 3459
                                 }
3461 3460
                             }
3462 3461
                         }
3463
-                        $tableHtml .=  '</tr>';
3462
+                        $tableHtml .= '</tr>';
3464 3463
                     }
3465 3464
                 }
3466 3465
                 // The Y axis is NOT a score question type so the number of rows = the number of options
3467 3466
                 else {
3468
-                    $tableHtml .=  '<tr>';
3467
+                    $tableHtml .= '<tr>';
3469 3468
                     for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
3470 3469
                         if ($question_x['type'] == 'score') {
3471 3470
                             for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
3472 3471
                                 if ($ii == 0) {
3473
-                                    $tableHtml .=  '<th>'.$question_y['answers'][$ij].'</th>';
3472
+                                    $tableHtml .= '<th>'.$question_y['answers'][$ij].'</th>';
3474 3473
                                     break;
3475 3474
                                 } else {
3476
-                                    $tableHtml .=  '<td align="center">';
3477
-                                    $votes =  SurveyUtil::comparative_check(
3475
+                                    $tableHtml .= '<td align="center">';
3476
+                                    $votes = SurveyUtil::comparative_check(
3478 3477
                                         $answers_x,
3479 3478
                                         $answers_y,
3480
-                                        $question_x['answersid'][($ii-1)],
3479
+                                        $question_x['answersid'][($ii - 1)],
3481 3480
                                         $question_y['answersid'][($ij)],
3482 3481
                                         $x,
3483 3482
                                         0
@@ -3486,25 +3485,25 @@  discard block
 block discarded – undo
3486 3485
                                     array_push(
3487 3486
                                         $chartData,
3488 3487
                                         array(
3489
-                                            'serie' => array($currentYQuestion, $xOptions[$ii-1]),
3488
+                                            'serie' => array($currentYQuestion, $xOptions[$ii - 1]),
3490 3489
                                             'option' => $x,
3491 3490
                                             'votes' => $votes
3492 3491
                                         )
3493 3492
                                     );
3494
-                                    $tableHtml .=  '</td>';
3493
+                                    $tableHtml .= '</td>';
3495 3494
                                 }
3496 3495
                             }
3497 3496
                         } else {
3498 3497
                             if ($ii == 0) {
3499
-                                $tableHtml .=  '<th>'.$question_y['answers'][($ij)].'</th>';
3498
+                                $tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>';
3500 3499
                             } else {
3501
-                                $tableHtml .=  '<td align="center">';
3502
-                                $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
3500
+                                $tableHtml .= '<td align="center">';
3501
+                                $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii - 1)], $question_y['answersid'][($ij)]);
3503 3502
                                 $tableHtml .= $votes;
3504 3503
                                 array_push(
3505 3504
                                     $chartData,
3506 3505
                                     array(
3507
-                                        'serie' => $xOptions[$ii-1],
3506
+                                        'serie' => $xOptions[$ii - 1],
3508 3507
                                         'option' => $currentYQuestion,
3509 3508
                                         'votes' => $votes
3510 3509
                                     )
@@ -3516,7 +3515,7 @@  discard block
 block discarded – undo
3516 3515
                     $tableHtml .= '</tr>';
3517 3516
                 }
3518 3517
             }
3519
-            $tableHtml .=  '</table>';
3518
+            $tableHtml .= '</table>';
3520 3519
             echo '<div id="chartContainer" class="col-md-12">';
3521 3520
             echo self::drawChart($chartData, true);
3522 3521
             echo '</div>';
@@ -3659,7 +3658,7 @@  discard block
 block discarded – undo
3659 3658
                     survey_id='".intval($_GET['survey_id'])."' AND
3660 3659
                     session_id='".api_get_session_id()."' ";
3661 3660
         $res = Database::query($sql);
3662
-        $row = Database::fetch_array($res,'ASSOC');
3661
+        $row = Database::fetch_array($res, 'ASSOC');
3663 3662
 
3664 3663
         return $row['total'];
3665 3664
     }
@@ -3733,7 +3732,7 @@  discard block
 block discarded – undo
3733 3732
             $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']);
3734 3733
         }
3735 3734
 
3736
-        $counter = 0;  // Nr of invitations "sent" (if sendmail option)
3735
+        $counter = 0; // Nr of invitations "sent" (if sendmail option)
3737 3736
         $course_id = api_get_course_int_id();
3738 3737
         $session_id = api_get_session_id();
3739 3738
 
@@ -3889,7 +3888,7 @@  discard block
 block discarded – undo
3889 3888
         $text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link;
3890 3889
 
3891 3890
         $replace_count = 0;
3892
-        $full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
3891
+        $full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count);
3893 3892
         if ($replace_count < 1) {
3894 3893
             $full_invitation_text = $full_invitation_text."<br />\r\n<br />\r\n".$text_link;
3895 3894
         }
@@ -3961,8 +3960,8 @@  discard block
 block discarded – undo
3961 3960
         $course_id = api_get_course_int_id();
3962 3961
 
3963 3962
         // Database table definition
3964
-        $table_survey_invitation 	= Database :: get_course_table(TABLE_SURVEY_INVITATION);
3965
-        $table_survey 				= Database :: get_course_table(TABLE_SURVEY);
3963
+        $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
3964
+        $table_survey = Database :: get_course_table(TABLE_SURVEY);
3966 3965
 
3967 3966
         // Counting the number of people that are invited
3968 3967
         $sql = "SELECT count(user) as total
@@ -4076,7 +4075,7 @@  discard block
 block discarded – undo
4076 4075
     {
4077 4076
         $course_id = api_get_course_int_id();
4078 4077
         // Database table definition
4079
-        $table_survey_invitation 	= Database :: get_course_table(TABLE_SURVEY_INVITATION);
4078
+        $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
4080 4079
 
4081 4080
         $sql = "SELECT * FROM $table_survey_invitation
4082 4081
 		        WHERE
@@ -4185,7 +4184,7 @@  discard block
 block discarded – undo
4185 4184
     public static function display_survey_list_for_coach()
4186 4185
     {
4187 4186
         $parameters = array();
4188
-        $parameters['cidReq']=api_get_course_id();
4187
+        $parameters['cidReq'] = api_get_course_id();
4189 4188
         if (isset($_GET['do_search'])) {
4190 4189
             $message = get_lang('DisplaySearchResults').'<br />';
4191 4190
             $message .= '<a href="'.api_get_self().'?'.api_get_cidreq().'">'.get_lang('DisplayAll').'</a>';
@@ -4229,17 +4228,17 @@  discard block
 block discarded – undo
4229 4228
 
4230 4229
         if ($drh) {
4231 4230
             return '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
4232
-            Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>';
4231
+            Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
4233 4232
         }
4234 4233
 
4235 4234
         // Coach can see that only if the survey is in his session
4236 4235
         if (api_is_allowed_to_edit() ||
4237 4236
             api_is_element_in_the_session(TOOL_SURVEY, $survey_id)
4238 4237
         ) {
4239
-            $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
4238
+            $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
4240 4239
             if (SurveyManager::survey_generation_hash_available()) {
4241
-                $return .=  Display::url(
4242
-                    Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'),'',ICON_SIZE_SMALL),
4240
+                $return .= Display::url(
4241
+                    Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL),
4243 4242
                     api_get_path(WEB_CODE_PATH).'survey/generate_link.php?survey_id='.$survey_id.'&'.api_get_cidreq()
4244 4243
                 );
4245 4244
             }
@@ -4249,20 +4248,20 @@  discard block
 block discarded – undo
4249 4248
             );
4250 4249
 
4251 4250
             $return .= ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.
4252
-                Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4251
+                Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4253 4252
         }
4254 4253
         $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
4255
-            Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4254
+            Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4256 4255
         $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
4257
-            Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4256
+            Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4258 4257
         $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
4259
-            Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>';
4258
+            Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
4260 4259
 
4261 4260
         if (api_is_allowed_to_edit() ||
4262 4261
             api_is_element_in_the_session(TOOL_SURVEY, $survey_id)
4263 4262
         ) {
4264 4263
             $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.
4265
-                Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4264
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4266 4265
         }
4267 4266
 
4268 4267
         return $return;
@@ -4275,9 +4274,9 @@  discard block
 block discarded – undo
4275 4274
         //$return .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
4276 4275
         //$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
4277 4276
         //$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
4278
-        $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4279
-        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4280
-        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
4277
+        $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4278
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4279
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
4281 4280
 
4282 4281
         return $return;
4283 4282
     }
@@ -4432,7 +4431,7 @@  discard block
 block discarded – undo
4432 4431
 
4433 4432
             // Validation when belonging to a session
4434 4433
             $session_img = api_get_session_image($survey['session_id'], $_user['status']);
4435
-            $array[2] = $survey[2] . $session_img;
4434
+            $array[2] = $survey[2].$session_img;
4436 4435
             $array[3] = $survey[3];
4437 4436
             $array[4] = $survey[4];
4438 4437
             $array[5] = $survey[5];
@@ -4474,10 +4473,10 @@  discard block
 block discarded – undo
4474 4473
         $last_version_surveys = $survey_tree->surveylist;
4475 4474
         $list = array();
4476 4475
         foreach ($last_version_surveys as & $survey) {
4477
-            $list[]=$survey['id'];
4476
+            $list[] = $survey['id'];
4478 4477
         }
4479 4478
         if (count($list) > 0) {
4480
-            $list_condition = " AND survey.survey_id IN (".implode(',',$list).") ";
4479
+            $list_condition = " AND survey.survey_id IN (".implode(',', $list).") ";
4481 4480
         } else {
4482 4481
             $list_condition = '';
4483 4482
         }
@@ -4606,16 +4605,16 @@  discard block
 block discarded – undo
4606 4605
                     )
4607 4606
             ";
4608 4607
             $result_answer = Database::query($sql);
4609
-            $row_answer = Database::fetch_array($result_answer,'ASSOC');
4608
+            $row_answer = Database::fetch_array($result_answer, 'ASSOC');
4610 4609
             echo '<tr>';
4611 4610
             if ($row['answered'] == 0) {
4612 4611
                 echo '<td>';
4613
-                echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY);
4612
+                echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array('style'=>'inline-block'), ICON_SIZE_TINY);
4614 4613
                 echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>';
4615 4614
             } else {
4616 4615
                 //echo '<td>'.$row['title'].'</td>';
4617 4616
                 echo '<td>';
4618
-                echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY);
4617
+                echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'), array('style'=>'inline-block'), ICON_SIZE_TINY);
4619 4618
                 echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&cidReq='.$_course['sysCode'].'&id_session='.$row['session_id'].'&gidReq='.'0'.'&origin='.''.'&survey_id='.$row['survey_id'].'">'.$row['title'].'</a></td>';
4620 4619
             }
4621 4620
             echo '<td class="center">';
@@ -4627,7 +4626,7 @@  discard block
 block discarded – undo
4627 4626
             } else {
4628 4627
                 $current_user_id = api_get_user_id();
4629 4628
             }
4630
-            $link_available = self::show_link_available(api_get_user_id(),$row['code'],$current_user_id);
4629
+            $link_available = self::show_link_available(api_get_user_id(), $row['code'], $current_user_id);
4631 4630
         }
4632 4631
         echo '</table>';
4633 4632
     }
@@ -4768,7 +4767,7 @@  discard block
 block discarded – undo
4768 4767
                     if ($field_details[7] == 0) {
4769 4768
                         $field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
4770 4769
                     } else {
4771
-                        $field_list_array['extra_'.$field_details[1]]['visibility']=1;
4770
+                        $field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
4772 4771
                     }
4773 4772
                     break;
4774 4773
                 case UserManager::USER_FIELD_TYPE_DIVIDER:
@@ -4854,7 +4853,7 @@  discard block
 block discarded – undo
4854 4853
         $htmlChart = '';
4855 4854
         if (api_browser_support("svg")) {
4856 4855
             $htmlChart .= api_get_js("d3/d3.v3.5.4.min.js");
4857
-            $htmlChart .= api_get_js("dimple.v2.1.2.min.js") . '
4856
+            $htmlChart .= api_get_js("dimple.v2.1.2.min.js").'
4858 4857
             <script type="text/javascript">
4859 4858
             var svg = dimple.newSvg("#'.$chartContainerId.'", "100%", 400);
4860 4859
             var data = [';
@@ -4863,40 +4862,40 @@  discard block
 block discarded – undo
4863 4862
             foreach ($chartData as $chartDataElement) {
4864 4863
                 $htmlChart .= '{"';
4865 4864
                 if (!$hasSerie) {
4866
-                    $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "';
4865
+                    $htmlChart .= get_lang("Option").'":"'.$chartDataElement['option'].'", "';
4867 4866
                     array_push($order, $chartDataElement['option']);
4868 4867
                 } else {
4869 4868
                     if (!is_array($chartDataElement['serie'])) {
4870
-                        $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' .
4871
-                            get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
4869
+                        $htmlChart .= get_lang("Option").'":"'.$chartDataElement['serie'].'", "'.
4870
+                            get_lang("Score").'":"'.$chartDataElement['option'].'", "';
4872 4871
                         array_push($serie, $chartDataElement['serie']);
4873 4872
                     } else {
4874
-                        $htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' .
4875
-                            get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' .
4876
-                            get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
4873
+                        $htmlChart .= get_lang("Serie").'":"'.$chartDataElement['serie'][0].'", "'.
4874
+                            get_lang("Option").'":"'.$chartDataElement['serie'][1].'", "'.
4875
+                            get_lang("Score").'":"'.$chartDataElement['option'].'", "';
4877 4876
                     }
4878 4877
                 }
4879
-                $htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] .
4878
+                $htmlChart .= get_lang("Votes").'":"'.$chartDataElement['votes'].
4880 4879
                     '"},';
4881 4880
             }
4882 4881
             rtrim($htmlChart, ",");
4883 4882
             $htmlChart .= '];
4884 4883
                 var myChart = new dimple.chart(svg, data);
4885
-                myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");';
4884
+                myChart.addMeasureAxis("y", "' . get_lang("Votes").'");';
4886 4885
             if (!$hasSerie) {
4887
-                $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '");
4888
-                    xAxisCategory.addOrderRule(' . json_encode($order) . ');
4889
-                    myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
4886
+                $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "'.get_lang("Option").'");
4887
+                    xAxisCategory.addOrderRule(' . json_encode($order).');
4888
+                    myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);';
4890 4889
             } else {
4891 4890
                 if (!is_array($chartDataElement['serie'])) {
4892 4891
                     $serie = array_values(array_unique($serie));
4893
-                    $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
4894
-                        xAxisCategory.addOrderRule(' . json_encode($serie) . ');
4895
-                        xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '");
4896
-                        myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
4892
+                    $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]);
4893
+                        xAxisCategory.addOrderRule(' . json_encode($serie).');
4894
+                        xAxisCategory.addGroupOrderRule("' . get_lang("Score").'");
4895
+                        myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);';
4897 4896
                 } else {
4898
-                    $htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
4899
-                        myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);';
4897
+                    $htmlChart .= 'myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]);
4898
+                        myChart.addSeries("' . get_lang("Serie").'", dimple.plot.bar);';
4900 4899
                 }
4901 4900
             }
4902 4901
             $htmlChart .= 'myChart.draw();
Please login to merge, or discard this patch.
main/survey/survey_invitation.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
15 15
 if (!api_is_allowed_to_edit(false, true)) {
16
-	Display :: display_header(get_lang('ToolSurvey'));
17
-	Display :: display_error_message(get_lang('NotAllowed'), false);
18
-	Display :: display_footer();
19
-	exit;
16
+    Display :: display_header(get_lang('ToolSurvey'));
17
+    Display :: display_error_message(get_lang('NotAllowed'), false);
18
+    Display :: display_footer();
19
+    exit;
20 20
 }
21 21
 
22 22
 // Database table definitions
@@ -33,25 +33,25 @@  discard block
 block discarded – undo
33 33
 // Getting the survey information
34 34
 // We exit here if ther is no valid $_GET parameter
35 35
 if (!isset($_GET['survey_id']) OR !is_numeric($_GET['survey_id'])) {
36
-	Display :: display_header($tool_name);
37
-	Display :: display_error_message(get_lang('InvallidSurvey'), false);
38
-	Display :: display_footer();
39
-	exit;
36
+    Display :: display_header($tool_name);
37
+    Display :: display_error_message(get_lang('InvallidSurvey'), false);
38
+    Display :: display_footer();
39
+    exit;
40 40
 }
41 41
 
42 42
 $survey_id = Security::remove_XSS($_GET['survey_id']);
43 43
 $survey_data = SurveyManager::get_survey($survey_id);
44 44
 
45 45
 if (empty($survey_data)) {
46
-	Display :: display_header($tool_name);
47
-	Display :: display_error_message(get_lang('InvallidSurvey'), false);
48
-	Display :: display_footer();
49
-	exit;
46
+    Display :: display_header($tool_name);
47
+    Display :: display_error_message(get_lang('InvallidSurvey'), false);
48
+    Display :: display_footer();
49
+    exit;
50 50
 }
51 51
 
52 52
 $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
53 53
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
54
-	$urlname .= '...';
54
+    $urlname .= '...';
55 55
 }
56 56
 
57 57
 // Breadcrumbs
@@ -64,32 +64,32 @@  discard block
 block discarded – undo
64 64
 
65 65
 // Checking the parameters
66 66
 if (!is_numeric($survey_id)) {
67
-	Display::display_error_message(get_lang('Error'), false);
68
-	Display::display_footer();
69
-	exit;
67
+    Display::display_error_message(get_lang('Error'), false);
68
+    Display::display_footer();
69
+    exit;
70 70
 }
71 71
 
72 72
 // Getting all the people who have filled this survey
73 73
 $answered_data = SurveyManager::get_people_who_filled_survey($survey_id);
74 74
 if ($survey_data['anonymous'] == 1) {
75
-	Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered'));
76
-	$answered_data = array();
75
+    Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered'));
76
+    $answered_data = array();
77 77
 }
78 78
 
79 79
 if (!isset($_GET['view']) OR $_GET['view'] == 'invited') {
80
-	echo get_lang('ViewInvited'). ' | ';
80
+    echo get_lang('ViewInvited'). ' | ';
81 81
 } else {
82
-	echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |';
82
+    echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |';
83 83
 }
84 84
 if ($_GET['view'] == 'answered') {
85
-	echo get_lang('ViewAnswered').' | ';
85
+    echo get_lang('ViewAnswered').' | ';
86 86
 } else {
87
-	echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=answered">'.get_lang('ViewAnswered').'</a> |';
87
+    echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=answered">'.get_lang('ViewAnswered').'</a> |';
88 88
 }
89 89
 if ($_GET['view'] == 'unanswered') {
90
-	echo get_lang('ViewUnanswered');
90
+    echo get_lang('ViewUnanswered');
91 91
 } else {
92
-	echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=unanswered">'.get_lang('ViewUnanswered').'</a>';
92
+    echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=unanswered">'.get_lang('ViewUnanswered').'</a>';
93 93
 }
94 94
 
95 95
 // Table header
@@ -111,32 +111,32 @@  discard block
 block discarded – undo
111 111
 
112 112
 $res = Database::query($sql);
113 113
 while ($row = Database::fetch_assoc($res)) {
114
-	if (!$_GET['view'] ||
115
-		$_GET['view'] == 'invited' ||
114
+    if (!$_GET['view'] ||
115
+        $_GET['view'] == 'invited' ||
116 116
         ($_GET['view'] == 'answered' && in_array($row['user'], $answered_data)) ||
117 117
         ($_GET['view'] == 'unanswered' && !in_array($row['user'], $answered_data))
118 118
     ) {
119
-		echo '<tr>';
120
-		if (is_numeric($row['user'])) {
119
+        echo '<tr>';
120
+        if (is_numeric($row['user'])) {
121 121
             $userInfo = api_get_user_info($row['user']);
122
-			echo '<td>';
122
+            echo '<td>';
123 123
             echo UserManager::getUserProfileLink($userInfo);
124 124
             echo '</td>';
125
-		} else {
125
+        } else {
126 126
             echo '<td>'.$row['user'].'</td>';
127
-		}
128
-		echo '	<td>'.$row['invitation_date'].'</td>';
129
-		echo '	<td>';
130
-
131
-		if (in_array($row['user'], $answered_data)) {
132
-			echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$survey_id.'&amp;user='.$row['user'].'">'.get_lang('ViewAnswers').'</a>';
133
-		} else {
134
-			echo '-';
135
-		}
136
-
137
-		echo '	</td>';
138
-		echo '</tr>';
139
-	}
127
+        }
128
+        echo '	<td>'.$row['invitation_date'].'</td>';
129
+        echo '	<td>';
130
+
131
+        if (in_array($row['user'], $answered_data)) {
132
+            echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$survey_id.'&amp;user='.$row['user'].'">'.get_lang('ViewAnswers').'</a>';
133
+        } else {
134
+            echo '-';
135
+        }
136
+
137
+        echo '	</td>';
138
+        echo '</tr>';
139
+    }
140 140
 }
141 141
 
142 142
 // Closing the table
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 
22 22
 // Database table definitions
23 23
 $table_survey 					= Database :: get_course_table(TABLE_SURVEY);
24
-$table_survey_question 			= Database :: get_course_table(TABLE_SURVEY_QUESTION);
25
-$table_survey_question_option 	= Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
24
+$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
25
+$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
26 26
 $table_course 					= Database :: get_main_table(TABLE_MAIN_COURSE);
27
-$table_user 					= Database :: get_main_table(TABLE_MAIN_USER);
28
-$table_survey_invitation 		= Database :: get_course_table(TABLE_SURVEY_INVITATION);
27
+$table_user = Database :: get_main_table(TABLE_MAIN_USER);
28
+$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
29 29
 
30 30
 $tool_name = get_lang('SurveyInvitations');
31 31
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 if (!isset($_GET['view']) OR $_GET['view'] == 'invited') {
80
-	echo get_lang('ViewInvited'). ' | ';
80
+	echo get_lang('ViewInvited').' | ';
81 81
 } else {
82 82
 	echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |';
83 83
 }
Please login to merge, or discard this patch.
main/survey/survey.php 3 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require_once '../inc/global.inc.php';
13 13
 
14 14
 $this_section = SECTION_COURSES;
15
-$current_course_tool  = TOOL_SURVEY;
15
+$current_course_tool = TOOL_SURVEY;
16 16
 
17 17
 api_protect_course_script(true);
18 18
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 // Getting the survey information
59 59
 if (!empty($_GET['survey_id'])) {
60 60
 	$course_code = api_get_course_id();
61
-	if ($course_code!=-1) {
61
+	if ($course_code != -1) {
62 62
 		$survey_data = SurveyManager::get_survey($survey_id);
63 63
 	} else {
64 64
 		Display :: display_header(get_lang('ToolSurvey'));
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
89 89
 			                 WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
90 90
 			$sendmsg = 'GroupUpdatedSuccessfully';
91
-		} elseif(!empty($_POST['name'])) {
91
+		} elseif (!empty($_POST['name'])) {
92 92
 			Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
93 93
 			$sendmsg = 'GroupCreatedSuccessfully';
94 94
 		} else {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 if (isset($action)) {
118 118
 	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
119
-		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
119
+		SurveyManager::move_survey_question($my_action_survey, $my_question_id_survey, $my_survey_id_survey);
120 120
 		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121 121
 	}
122 122
 	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 SurveyUtil::check_first_last_question($_GET['survey_id']);
131 131
 
132 132
 // Action links
133
-$survey_actions = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('EditSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
134
-$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('DeleteSurvey').'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('DeleteSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
133
+$survey_actions = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('EditSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
134
+$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('DeleteSurvey').'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('DeleteSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
135 135
 //$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
136
-$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>';
137
-$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_MEDIUM).'</a>';
138
-$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_MEDIUM).'</a>';
136
+$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>';
137
+$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_MEDIUM).'</a>';
138
+$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'</a>';
139 139
 echo '<div class="actions">'.$survey_actions.'</div>';
140 140
 
141 141
 if ($survey_data['survey_type'] == 0) {
@@ -217,24 +217,24 @@  discard block
 block discarded – undo
217 217
 	echo '	<td>'.$tool_name.'</td>';
218 218
 	echo '	<td>'.$row['number_of_options'].'</td>';
219 219
 	echo '	<td>';
220
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
221
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
220
+	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
221
+	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?', ENT_QUOTES, $charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
222 222
 	if ($question_counter > 1) {
223
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
223
+		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>';
224 224
 	} else {
225
-		Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
225
+		Display::display_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
226 226
 	}
227 227
 	if ($question_counter < $question_counter_max) {
228
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
228
+		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>';
229 229
 	} else {
230
-		Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
230
+		Display::display_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
231 231
 	}
232 232
 	echo '	</td>';
233 233
 	$question_counter++;
234 234
 
235 235
 	if ($is_survey_type_1) {
236
-    	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
237
-        echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
236
+    	echo '<td>'.(($row['survey_group_pri'] == 0) ? get_lang('Secondary') : get_lang('Primary')).'</td>';
237
+        echo '<td>'.(($row['survey_group_pri'] == 0) ? $groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']] : $groups[$row['survey_group_pri']]).'</td>';
238 238
     }
239 239
 	echo '</tr>';
240 240
 }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
249 249
 	}
250 250
 
251
-	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
251
+	if (in_array($_GET['sendmsg'], array('GroupNeedName'))) {
252 252
 		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
253 253
 	}
254 254
 	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	if ($_GET['action'] == 'editgroup') {
257 257
 		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
258 258
 		$rs = Database::query($sql);
259
-		$editedrow = Database::fetch_array($rs,'ASSOC');
259
+		$editedrow = Database::fetch_array($rs, 'ASSOC');
260 260
 		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
261 261
 		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
262 262
 		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
279 279
 
280 280
 	$rs = Database::query($sql);
281
-	while($row = Database::fetch_array($rs,ASSOC)){
281
+	while ($row = Database::fetch_array($rs, ASSOC)) {
282 282
 		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
283 283
 		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
284
-		Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
285
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
286
-		Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
284
+		Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> '.
285
+		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'), $row['name']).'?', ENT_QUOTES)).'\')) return false;">'.
286
+		Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
287 287
 		'</td></tr>';
288 288
 	}
289 289
 	echo $grouplist.'</table>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,9 @@
 block discarded – undo
124 124
 	}
125 125
 }
126 126
 
127
-if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
127
+if (!empty($survey_data['survey_version'])) {
128
+    echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
129
+}
128 130
 
129 131
 // We exit here is the first or last question is a pagebreak (which causes errors)
130 132
 SurveyUtil::check_first_last_question($_GET['survey_id']);
Please login to merge, or discard this patch.
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 // Coach can't view this page
21 21
 $extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
22 22
 $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
23
-	api_get_user_id(),
24
-	api_get_course_info()
23
+    api_get_user_id(),
24
+    api_get_course_info()
25 25
 );
26 26
 
27 27
 if ($isDrhOfCourse) {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
33 33
 ) {    
34 34
     api_not_allowed(true);
35
-	exit;
35
+    exit;
36 36
 }
37 37
 
38 38
 // Database table definitions
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
 
50 50
 // Breadcrumbs
51 51
 $interbreadcrumb[] = array(
52
-		'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
53
-		'name' => get_lang('SurveyList'),
52
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
53
+        'name' => get_lang('SurveyList'),
54 54
 );
55 55
 
56 56
 // Getting the survey information
57 57
 if (!empty($_GET['survey_id'])) {
58
-	$course_code = api_get_course_id();
59
-	if ($course_code!=-1) {
60
-		$survey_data = SurveyManager::get_survey($survey_id);
61
-	} else {
62
-		Display :: display_header(get_lang('ToolSurvey'));
63
-		Display :: display_error_message(get_lang('NotAllowed'), false);
64
-		Display :: display_footer();
65
-		exit;
66
-	}
58
+    $course_code = api_get_course_id();
59
+    if ($course_code!=-1) {
60
+        $survey_data = SurveyManager::get_survey($survey_id);
61
+    } else {
62
+        Display :: display_header(get_lang('ToolSurvey'));
63
+        Display :: display_error_message(get_lang('NotAllowed'), false);
64
+        Display :: display_footer();
65
+        exit;
66
+    }
67 67
 } else {
68 68
     Display :: display_header(get_lang('ToolSurvey'));
69 69
     Display :: display_error_message(get_lang('NotAllowed'), false);
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
 $is_survey_type_1 = $survey_data['survey_type'] == 1;
77 77
 
78 78
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
79
-	$tool_name .= '...';
79
+    $tool_name .= '...';
80 80
 }
81 81
 
82 82
 if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
83
-	$_POST['name'] = trim($_POST['name']);
84
-	if ($action == 'addgroup') {
85
-		if (!empty($_POST['group_id'])) {
86
-			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
83
+    $_POST['name'] = trim($_POST['name']);
84
+    if ($action == 'addgroup') {
85
+        if (!empty($_POST['group_id'])) {
86
+            Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
87 87
 			                 WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
88
-			$sendmsg = 'GroupUpdatedSuccessfully';
89
-		} elseif(!empty($_POST['name'])) {
90
-			Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
91
-			$sendmsg = 'GroupCreatedSuccessfully';
92
-		} else {
93
-			$sendmsg = 'GroupNeedName';
94
-		}
95
-	}
96
-
97
-	if ($action == 'deletegroup') {
98
-		Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
99
-		$sendmsg = 'GroupDeletedSuccessfully';
100
-	}
101
-	header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
102
-	exit;
88
+            $sendmsg = 'GroupUpdatedSuccessfully';
89
+        } elseif(!empty($_POST['name'])) {
90
+            Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
91
+            $sendmsg = 'GroupCreatedSuccessfully';
92
+        } else {
93
+            $sendmsg = 'GroupNeedName';
94
+        }
95
+    }
96
+
97
+    if ($action == 'deletegroup') {
98
+        Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
99
+        $sendmsg = 'GroupDeletedSuccessfully';
100
+    }
101
+    header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
102
+    exit;
103 103
 }
104 104
 
105 105
 // Displaying the header
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 $message_information    = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
114 114
 
115 115
 if (isset($action)) {
116
-	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
117
-		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
118
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
119
-	}
120
-	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
121
-		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
122
-	}
116
+    if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
117
+        SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
118
+        Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
119
+    }
120
+    if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
121
+        SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
122
+    }
123 123
 }
124 124
 
125 125
 if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
 echo '<div class="actions">'.$survey_actions.'</div>';
138 138
 
139 139
 if ($survey_data['survey_type'] == 0) {
140
-	echo '<div class="panel panel-default">';
140
+    echo '<div class="panel panel-default">';
141 141
         echo '<div class="panel-body">';
142
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
143
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
144
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
145
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
146
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
147
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
148
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
149
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
150
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
151
-	echo '</div>';
142
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
143
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
144
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
145
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
146
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
147
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
148
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
149
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
150
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
151
+    echo '</div>';
152 152
         echo '</div>';
153 153
 } else {
154
-	echo '<div class="panel panel-default">';
154
+    echo '<div class="panel panel-default">';
155 155
         echo '<div class="panel-body">';
156
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
157
-	echo Display::return_icon("yesno.png");
158
-	echo '</a></div>';
159
-	echo '</div>';
156
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
157
+    echo Display::return_icon("yesno.png");
158
+    echo '</a></div>';
159
+    echo '</div>';
160 160
         echo '</div>';
161 161
 }
162 162
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 echo '		<th width="50" >'.get_lang('NumberOfOptions').'</th>';
170 170
 echo '		<th width="100">'.get_lang('Modify').'</th>';
171 171
 if ($is_survey_type_1) {
172
-	echo '<th width="100">'.get_lang('Condition').'</th>';
172
+    echo '<th width="100">'.get_lang('Condition').'</th>';
173 173
     echo '<th width="40">'.get_lang('Group').'</th>';
174 174
 }
175 175
 echo '	</tr>';
@@ -196,97 +196,97 @@  discard block
 block discarded – undo
196 196
 $result = Database::query($sql);
197 197
 $question_counter_max = Database::num_rows($result);
198 198
 while ($row = Database::fetch_array($result, 'ASSOC')) {
199
-	echo '<tr>';
200
-	echo '	<td>'.$question_counter.'</td>';
201
-	echo '	<td>';
202
-	if (api_strlen($row['survey_question']) > 100) {
203
-		echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
204
-	} else {
205
-		echo $row['survey_question'];
206
-	}
207
-
208
-	if ($row['type'] == 'yesno') {
209
-		$tool_name = get_lang('YesNo');
210
-	} else if ($row['type'] == 'multiplechoice') {
211
-		$tool_name = get_lang('UniqueSelect');
212
-	} else {
213
-		$tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
214
-	}
215
-
216
-	echo '</td>';
217
-	echo '	<td>'.$tool_name.'</td>';
218
-	echo '	<td>'.$row['number_of_options'].'</td>';
219
-	echo '	<td>';
220
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
221
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
222
-	if ($question_counter > 1) {
223
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
224
-	} else {
225
-		Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
226
-	}
227
-	if ($question_counter < $question_counter_max) {
228
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
229
-	} else {
230
-		Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
231
-	}
232
-	echo '	</td>';
233
-	$question_counter++;
234
-
235
-	if ($is_survey_type_1) {
236
-    	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
199
+    echo '<tr>';
200
+    echo '	<td>'.$question_counter.'</td>';
201
+    echo '	<td>';
202
+    if (api_strlen($row['survey_question']) > 100) {
203
+        echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
204
+    } else {
205
+        echo $row['survey_question'];
206
+    }
207
+
208
+    if ($row['type'] == 'yesno') {
209
+        $tool_name = get_lang('YesNo');
210
+    } else if ($row['type'] == 'multiplechoice') {
211
+        $tool_name = get_lang('UniqueSelect');
212
+    } else {
213
+        $tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
214
+    }
215
+
216
+    echo '</td>';
217
+    echo '	<td>'.$tool_name.'</td>';
218
+    echo '	<td>'.$row['number_of_options'].'</td>';
219
+    echo '	<td>';
220
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
221
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
222
+    if ($question_counter > 1) {
223
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
224
+    } else {
225
+        Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
226
+    }
227
+    if ($question_counter < $question_counter_max) {
228
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
229
+    } else {
230
+        Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
231
+    }
232
+    echo '	</td>';
233
+    $question_counter++;
234
+
235
+    if ($is_survey_type_1) {
236
+        echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
237 237
         echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
238 238
     }
239
-	echo '</tr>';
239
+    echo '</tr>';
240 240
 }
241 241
 
242 242
 echo '</table>';
243 243
 
244 244
 if ($is_survey_type_1) {
245
-	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
246
-
247
-	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
248
-		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
249
-	}
250
-
251
-	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
252
-		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
253
-	}
254
-	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
255
-	echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
256
-	if ($_GET['action'] == 'editgroup') {
257
-		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
258
-		$rs = Database::query($sql);
259
-		$editedrow = Database::fetch_array($rs,'ASSOC');
260
-		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
261
-		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
262
-		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
263
-		echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
264
-	} else {
265
-		echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
266
-		echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
267
-		echo	'<input type="submit" value="'.get_lang('Create').'"';
268
-	}
269
-	echo	'</form><br />';
270
-
271
-	echo '<table class="data_table">';
272
-	echo '	<tr class="row_odd">';
273
-	echo '		<th width="200">'.get_lang('Name').'</th>';
274
-	echo '		<th>'.get_lang('Description').'</th>';
275
-	echo '		<th width="100">'.get_lang('Modify').'</th>';
276
-	echo '	</tr>';
277
-
278
-	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
279
-
280
-	$rs = Database::query($sql);
281
-	while($row = Database::fetch_array($rs,ASSOC)){
282
-		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
283
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
284
-		Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
285
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
286
-		Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
287
-		'</td></tr>';
288
-	}
289
-	echo $grouplist.'</table>';
245
+    echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
246
+
247
+    if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
248
+        echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
249
+    }
250
+
251
+    if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
252
+        echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
253
+    }
254
+    echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
255
+    echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
256
+    if ($_GET['action'] == 'editgroup') {
257
+        $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
258
+        $rs = Database::query($sql);
259
+        $editedrow = Database::fetch_array($rs,'ASSOC');
260
+        echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
261
+        echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
262
+        echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
263
+        echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
264
+    } else {
265
+        echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
266
+        echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
267
+        echo	'<input type="submit" value="'.get_lang('Create').'"';
268
+    }
269
+    echo	'</form><br />';
270
+
271
+    echo '<table class="data_table">';
272
+    echo '	<tr class="row_odd">';
273
+    echo '		<th width="200">'.get_lang('Name').'</th>';
274
+    echo '		<th>'.get_lang('Description').'</th>';
275
+    echo '		<th width="100">'.get_lang('Modify').'</th>';
276
+    echo '	</tr>';
277
+
278
+    $sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
279
+
280
+    $rs = Database::query($sql);
281
+    while($row = Database::fetch_array($rs,ASSOC)){
282
+        $grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
283
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
284
+        Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
285
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
286
+        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
287
+        '</td></tr>';
288
+    }
289
+    echo $grouplist.'</table>';
290 290
 }
291 291
 
292 292
 Session::erase('answer_count');
Please login to merge, or discard this patch.