Completed
Push — 1.10.x ( f409b5...1f80a0 )
by Julito
112:29 queued 56:28
created
main/admin/skill_edit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
         );
95 95
     }
96 96
 
97
-    header('Location: '.api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
97
+    header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_list.php');
98 98
     exit;
99 99
 }
100 100
 
Please login to merge, or discard this patch.
main/notebook/index.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 
38 38
 // Tool name
39 39
 if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
40
-	$tool = 'NoteAddNew';
41
-	$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
40
+    $tool = 'NoteAddNew';
41
+    $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
42 42
 }
43 43
 if (isset($_GET['action']) && $_GET['action'] == 'editnote') {
44
-	$tool = 'ModifyNote';
45
-	$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
44
+    $tool = 'ModifyNote';
45
+    $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
46 46
 }
47 47
 
48 48
 // Displaying the header
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 
54 54
 // Action handling: Adding a note
55 55
 if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
56
-	if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
57
-		api_not_allowed();
58
-	}
56
+    if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
57
+        api_not_allowed();
58
+    }
59 59
 
60
-	if (!empty($_GET['isStudentView'])) {
61
-		NotebookManager::display_notes();
62
-		exit;
63
-	}
60
+    if (!empty($_GET['isStudentView'])) {
61
+        NotebookManager::display_notes();
62
+        exit;
63
+    }
64 64
 
65
-	$_SESSION['notebook_view'] = 'creation_date';
65
+    $_SESSION['notebook_view'] = 'creation_date';
66 66
 
67 67
     $form = new FormValidator(
68 68
         'note',
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 // Including the global initialization file
11 11
 require_once '../inc/global.inc.php';
12 12
 
13
-$current_course_tool  = TOOL_NOTEBOOK;
13
+$current_course_tool = TOOL_NOTEBOOK;
14 14
 
15 15
 // The section (tabs)
16 16
 $this_section = SECTION_COURSES;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         NotebookManager::display_notes();
97 97
     } else {
98 98
         echo '<div class="actions">';
99
-        echo '<a href="index.php">'.Display::return_icon('back.png',get_lang('BackToNotesList'),'',ICON_SIZE_MEDIUM).'</a>';
99
+        echo '<a href="index.php">'.Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).'</a>';
100 100
         echo '</div>';
101 101
         $token = Security::get_token();
102 102
         $form->addElement('hidden', 'sec_token');
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     } else {
148 148
         echo '<div class="actions">';
149 149
         echo '<a href="index.php">'.
150
-            Display::return_icon('back.png',get_lang('BackToNotesList'),'',ICON_SIZE_MEDIUM).'</a>';
150
+            Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).'</a>';
151 151
         echo '</div>';
152 152
         $token = Security::get_token();
153 153
         $form->addElement('hidden', 'sec_token');
Please login to merge, or discard this patch.
main/announcements/download.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $doc_url = str_replace(' ', '+', $doc_url);
29 29
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
30 30
 
31
-if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
31
+if (strpos($doc_url, '../') OR strpos($doc_url, '/..')) {
32 32
     $doc_url = '';
33 33
 }
34 34
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     //remove last slash if present
44 44
     //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
45 45
     //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
46
-    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
46
+    while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul);
47 47
     //create the path
48 48
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
49 49
     //redirect
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 $sql = "SELECT filename FROM $tbl_announcement_attachment
63 63
   	  	WHERE c_id = $course_id AND path LIKE BINARY '$doc_url'";
64 64
 
65
-$result= Database::query($sql);
65
+$result = Database::query($sql);
66 66
 if (Database::num_rows($result) > 0) {
67
-    $row= Database::fetch_array($result);
68
-    $title = str_replace(' ','_', $row['filename']);
67
+    $row = Database::fetch_array($result);
68
+    $title = str_replace(' ', '_', $row['filename']);
69 69
     if (Security::check_abs_path($full_file_name,
70
-        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/')
70
+        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')
71 71
     ) {
72 72
         DocumentManager::file_send_for_download($full_file_name, true, $title);
73 73
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@
 block discarded – undo
43 43
     //remove last slash if present
44 44
     //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
45 45
     //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
46
-    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
46
+    while ($doc_url{$dul = strlen($doc_url)-1}=='/') {
47
+        $doc_url = substr($doc_url,0,$dul);
48
+    }
47 49
     //create the path
48 50
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
49 51
     //redirect
Please login to merge, or discard this patch.
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.