Passed
Push — 1.10.x ( 5654d2...115d5a )
by Yannick
263:14 queued 212:07
created
main/admin/special_exports.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 require_once '../coursecopy/classes/CourseSelectForm.class.php';
29 29
 
30 30
 if (function_exists('ini_set')) {
31
-	api_set_memory_limit('256M');
32
-	ini_set('max_execution_time',0);
31
+    api_set_memory_limit('256M');
32
+    ini_set('max_execution_time',0);
33 33
 }
34 34
 
35 35
 // Displaying the header
@@ -50,36 +50,36 @@  discard block
 block discarded – undo
50 50
 if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
51 51
     (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup')
52 52
 ) {
53
-	$export = false;
54
-	if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') {
55
-		$FileZip = create_zip();
56
-		$to_group_id = 0;
57
-		$sql_session = "SELECT id, name FROM $tbl_session ";
58
-		$query_session = Database::query($sql_session);
59
-		$ListSession = array();
60
-		while ($rows_session = Database::fetch_assoc($query_session)) {
61
-			$ListSession[$rows_session['id']] = $rows_session['name'];
62
-		}
53
+    $export = false;
54
+    if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') {
55
+        $FileZip = create_zip();
56
+        $to_group_id = 0;
57
+        $sql_session = "SELECT id, name FROM $tbl_session ";
58
+        $query_session = Database::query($sql_session);
59
+        $ListSession = array();
60
+        while ($rows_session = Database::fetch_assoc($query_session)) {
61
+            $ListSession[$rows_session['id']] = $rows_session['name'];
62
+        }
63 63
 
64 64
         $groupCondition = " props.to_group_id = $to_group_id";
65 65
         if (empty($to_group_id)) {
66 66
             $groupCondition = " (props.to_group_id = 0 OR props.to_group_id IS NULL)";
67 67
         }
68 68
 
69
-		$zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']);
70
-		if(!isset($_POST['resource']) || count($_POST['resource']) == 0 ) {
71
-			Display::display_error_message(get_lang('ErrorMsgSpecialExport'));
72
-		} else {
73
-			$Resource = $_POST['resource'];
69
+        $zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']);
70
+        if(!isset($_POST['resource']) || count($_POST['resource']) == 0 ) {
71
+            Display::display_error_message(get_lang('ErrorMsgSpecialExport'));
72
+        } else {
73
+            $Resource = $_POST['resource'];
74 74
 
75
-			foreach ($Resource as $Code_course => $Sessions) {
76
-				$_course 		= api_get_course_info($Code_course);
77
-				$tbl_document 	= Database::get_course_table(TABLE_DOCUMENT);
78
-				$tbl_property 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
79
-				$course_id 		= $_course['real_id'];
75
+            foreach ($Resource as $Code_course => $Sessions) {
76
+                $_course 		= api_get_course_info($Code_course);
77
+                $tbl_document 	= Database::get_course_table(TABLE_DOCUMENT);
78
+                $tbl_property 	= Database::get_course_table(TABLE_ITEM_PROPERTY);
79
+                $course_id 		= $_course['real_id'];
80 80
 
81
-				//Add item to the zip file course
82
-				$sql = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props
81
+                //Add item to the zip file course
82
+                $sql = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props
83 83
                         WHERE props.tool='".TOOL_DOCUMENT."'
84 84
 						AND docs.id=props.ref
85 85
 						AND docs.path LIKE '".$querypath."/%'
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 						AND $groupCondition
90 90
 						AND docs.c_id = $course_id
91 91
 						AND props.c_id = $course_id";
92
-				$query = Database::query($sql );
93
-				while ($rows_course_file = Database::fetch_assoc($query)) {
92
+                $query = Database::query($sql );
93
+                while ($rows_course_file = Database::fetch_assoc($query)) {
94 94
                     $zip_folder->add(
95 95
                         $FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'],
96 96
                         PCLZIP_OPT_ADD_PATH,
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
                         PCLZIP_OPT_REMOVE_PATH,
99 99
                         $FileZip['PATH_COURSE'].$_course['directory']."/document".$FileZip['PATH_REMOVE']
100 100
                     );
101
-				}
101
+                }
102 102
 
103
-				foreach ($Sessions as $IdSession => $value){
104
-					$session_id = Security::remove_XSS($IdSession);
105
-					//Add tem to the zip file session course
106
-					$sql_session_doc = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props
103
+                foreach ($Sessions as $IdSession => $value){
104
+                    $session_id = Security::remove_XSS($IdSession);
105
+                    //Add tem to the zip file session course
106
+                    $sql_session_doc = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props
107 107
 						WHERE props.tool='".TOOL_DOCUMENT."'
108 108
 							AND docs.id=props.ref
109 109
 							AND docs.path LIKE '".$querypath."/%'
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 							AND $groupCondition
114 114
 							AND docs.c_id = $course_id
115 115
 							AND props.c_id = $course_id";
116
-					$query_session_doc = Database::query($sql_session_doc);
117
-					while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
116
+                    $query_session_doc = Database::query($sql_session_doc);
117
+                    while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
118 118
                         $zip_folder->add(
119 119
                             $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'],
120 120
                             PCLZIP_OPT_ADD_PATH,
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
                             PCLZIP_OPT_REMOVE_PATH,
123 123
                             $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']
124 124
                         );
125
-					}
126
-				}
127
-			}
128
-			$name = rename_zip($FileZip);
129
-			$export = true;
130
-		}
131
-	} else {
132
-		$name = fullexportspecial();
133
-	}
125
+                    }
126
+                }
127
+            }
128
+            $name = rename_zip($FileZip);
129
+            $export = true;
130
+        }
131
+    } else {
132
+        $name = fullexportspecial();
133
+    }
134 134
 ?>
135 135
 <!-- Manual download <script language="JavaScript">
136 136
  // setTimeout(\'download_backup()\',2000);
@@ -143,23 +143,23 @@  discard block
 block discarded – undo
143 143
 }
144 144
 
145 145
 if ($export && $name) {
146
-	Display::display_confirmation_message(get_lang('BackupCreated'));
147
-	echo '<br /><a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.urlencode($name).'&session=true">'.get_lang('Download').'</a>';
146
+    Display::display_confirmation_message(get_lang('BackupCreated'));
147
+    echo '<br /><a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.urlencode($name).'&session=true">'.get_lang('Download').'</a>';
148 148
 } else {
149
-	// Display forms especial export
150
-	if (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') {
151
-		$cb = new CourseBuilder();
152
-		$course = $cb->build_session_course();
153
-		if($course === false){
154
-			Display::display_error_message(get_lang('ErrorMsgSpecialExport'));
155
-			form_special_export();
156
-		} else {
157
-			Display::display_normal_message(get_lang('ToExportSpecialSelect'));
158
-			CourseSelectForm :: display_form_session_export($course);
159
-		}
160
-	} else {
161
-		form_special_export();
162
-	}
149
+    // Display forms especial export
150
+    if (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') {
151
+        $cb = new CourseBuilder();
152
+        $course = $cb->build_session_course();
153
+        if($course === false){
154
+            Display::display_error_message(get_lang('ErrorMsgSpecialExport'));
155
+            form_special_export();
156
+        } else {
157
+            Display::display_normal_message(get_lang('ToExportSpecialSelect'));
158
+            CourseSelectForm :: display_form_session_export($course);
159
+        }
160
+    } else {
161
+        form_special_export();
162
+    }
163 163
 }
164 164
 
165 165
 /* FOOTER */
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
     }
201 201
     $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip";  //create zipfile of given directory
202 202
     return array('PATH' => $path,
203
-                 'PATH_TEMP_ARCHIVE' => $temp_zip_dir,
204
-                 'PATH_COURSE' => $sys_course_path,
205
-                 'TEMP_FILE_ZIP' => $temp_zip_file,
206
-                 'PATH_REMOVE' => $remove_dir);
203
+                    'PATH_TEMP_ARCHIVE' => $temp_zip_dir,
204
+                    'PATH_COURSE' => $sys_course_path,
205
+                    'TEMP_FILE_ZIP' => $temp_zip_file,
206
+                    'PATH_REMOVE' => $remove_dir);
207 207
 }
208 208
 
209 209
 function rename_zip($FileZip) {
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
                 $query_session_doc = Database::query($sql_session_doc);
288 288
                 while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
289 289
                     $zip_folder->add($FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'],
290
-                         PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'],
291
-                         PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']
292
-                     );
290
+                            PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'],
291
+                            PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']
292
+                        );
293 293
                 }
294 294
             }
295 295
         }
Please login to merge, or discard this patch.
main/notebook/index.php 1 patch
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.
main/survey/survey_invite.php 1 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 1 patch
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.
main/survey/reporting.php 1 patch
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.
main/survey/question.php 1 patch
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.
main/survey/survey.lib.php 1 patch
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.
main/survey/survey_invitation.php 1 patch
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.
main/survey/survey.php 1 patch
Indentation   +143 added lines, -143 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) {
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 if (!api_is_allowed_to_edit(false, true) ||
32 32
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
33 33
 ) {
34
-	Display :: display_header(get_lang('ToolSurvey'));
35
-	Display :: display_error_message(get_lang('NotAllowed'), false);
36
-	Display :: display_footer();
37
-	exit;
34
+    Display :: display_header(get_lang('ToolSurvey'));
35
+    Display :: display_error_message(get_lang('NotAllowed'), false);
36
+    Display :: display_footer();
37
+    exit;
38 38
 }
39 39
 
40 40
 // Database table definitions
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 // Breadcrumbs
53 53
 $interbreadcrumb[] = array(
54
-		'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
-		'name' => get_lang('SurveyList'),
54
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
+        'name' => get_lang('SurveyList'),
56 56
 );
57 57
 
58 58
 // Getting the survey information
59 59
 if (!empty($_GET['survey_id'])) {
60
-	$course_code = api_get_course_id();
61
-	if ($course_code!=-1) {
62
-		$survey_data = SurveyManager::get_survey($survey_id);
63
-	} else {
64
-		Display :: display_header(get_lang('ToolSurvey'));
65
-		Display :: display_error_message(get_lang('NotAllowed'), false);
66
-		Display :: display_footer();
67
-		exit;
68
-	}
60
+    $course_code = api_get_course_id();
61
+    if ($course_code!=-1) {
62
+        $survey_data = SurveyManager::get_survey($survey_id);
63
+    } else {
64
+        Display :: display_header(get_lang('ToolSurvey'));
65
+        Display :: display_error_message(get_lang('NotAllowed'), false);
66
+        Display :: display_footer();
67
+        exit;
68
+    }
69 69
 } else {
70 70
     Display :: display_header(get_lang('ToolSurvey'));
71 71
     Display :: display_error_message(get_lang('NotAllowed'), false);
@@ -78,30 +78,30 @@  discard block
 block discarded – undo
78 78
 $is_survey_type_1 = $survey_data['survey_type'] == 1;
79 79
 
80 80
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
81
-	$tool_name .= '...';
81
+    $tool_name .= '...';
82 82
 }
83 83
 
84 84
 if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
85
-	$_POST['name'] = trim($_POST['name']);
86
-	if ($action == 'addgroup') {
87
-		if (!empty($_POST['group_id'])) {
88
-			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
85
+    $_POST['name'] = trim($_POST['name']);
86
+    if ($action == 'addgroup') {
87
+        if (!empty($_POST['group_id'])) {
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
-			$sendmsg = 'GroupUpdatedSuccessfully';
91
-		} elseif(!empty($_POST['name'])) {
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
-			$sendmsg = 'GroupCreatedSuccessfully';
94
-		} else {
95
-			$sendmsg = 'GroupNeedName';
96
-		}
97
-	}
98
-
99
-	if ($action == 'deletegroup') {
100
-		Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
-		$sendmsg = 'GroupDeletedSuccessfully';
102
-	}
103
-	header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
-	exit;
90
+            $sendmsg = 'GroupUpdatedSuccessfully';
91
+        } elseif(!empty($_POST['name'])) {
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
+            $sendmsg = 'GroupCreatedSuccessfully';
94
+        } else {
95
+            $sendmsg = 'GroupNeedName';
96
+        }
97
+    }
98
+
99
+    if ($action == 'deletegroup') {
100
+        Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
+        $sendmsg = 'GroupDeletedSuccessfully';
102
+    }
103
+    header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
+    exit;
105 105
 }
106 106
 
107 107
 // Displaying the header
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 $message_information    = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
116 116
 
117 117
 if (isset($action)) {
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);
120
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
-	}
122
-	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
-		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
-	}
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);
120
+        Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
+    }
122
+    if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
+        SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
+    }
125 125
 }
126 126
 
127 127
 if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
@@ -139,24 +139,24 @@  discard block
 block discarded – undo
139 139
 echo '<div class="actions">'.$survey_actions.'</div>';
140 140
 
141 141
 if ($survey_data['survey_type'] == 0) {
142
-	echo '<div class="panel panel-default">';
142
+    echo '<div class="panel panel-default">';
143 143
         echo '<div class="panel-body">';
144
-	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>';
145
-	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>';
146
-	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>';
147
-	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>';
148
-	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>';
149
-	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>';
150
-	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>';
151
-	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>';
152
-	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>';
153
-	echo '</div>';
144
+    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>';
145
+    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>';
146
+    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>';
147
+    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>';
148
+    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>';
149
+    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>';
150
+    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>';
151
+    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>';
152
+    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>';
153
+    echo '</div>';
154 154
         echo '</div>';
155 155
 } else {
156
-	echo '<div class="panel panel-default">';
156
+    echo '<div class="panel panel-default">';
157 157
         echo '<div class="panel-body">';
158
-	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.'"><img src="../img/icons/22/yesno.png" /></a></div>';
159
-	echo '</div>';
158
+    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.'"><img src="../img/icons/22/yesno.png" /></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.