@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | require_once '../inc/global.inc.php'; |
13 | 13 | |
14 | 14 | $this_section = SECTION_COURSES; |
15 | -$current_course_tool = TOOL_SURVEY; |
|
15 | +$current_course_tool = TOOL_SURVEY; |
|
16 | 16 | |
17 | 17 | api_protect_course_script(true); |
18 | 18 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // Getting the survey information |
59 | 59 | if (!empty($_GET['survey_id'])) { |
60 | 60 | $course_code = api_get_course_id(); |
61 | - if ($course_code!=-1) { |
|
61 | + if ($course_code != -1) { |
|
62 | 62 | $survey_data = SurveyManager::get_survey($survey_id); |
63 | 63 | } else { |
64 | 64 | Display :: display_header(get_lang('ToolSurvey')); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\' |
89 | 89 | WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\''); |
90 | 90 | $sendmsg = 'GroupUpdatedSuccessfully'; |
91 | - } elseif(!empty($_POST['name'])) { |
|
91 | + } elseif (!empty($_POST['name'])) { |
|
92 | 92 | Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') '); |
93 | 93 | $sendmsg = 'GroupCreatedSuccessfully'; |
94 | 94 | } else { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | if (isset($action)) { |
118 | 118 | if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) { |
119 | - SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey); |
|
119 | + SurveyManager::move_survey_question($my_action_survey, $my_question_id_survey, $my_survey_id_survey); |
|
120 | 120 | Display::display_confirmation_message(get_lang('SurveyQuestionMoved')); |
121 | 121 | } |
122 | 122 | if ($action == 'delete' AND is_numeric($_GET['question_id'])) { |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | SurveyUtil::check_first_last_question($_GET['survey_id']); |
131 | 131 | |
132 | 132 | // Action links |
133 | -$survey_actions = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('EditSurvey'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
134 | -$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('DeleteSurvey').'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('DeleteSurvey'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
133 | +$survey_actions = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('EditSurvey'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
134 | +$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('DeleteSurvey').'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('DeleteSurvey'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
135 | 135 | //$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>'; |
136 | -$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
137 | -$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
138 | -$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
136 | +$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
137 | +$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
138 | +$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
139 | 139 | echo '<div class="actions">'.$survey_actions.'</div>'; |
140 | 140 | |
141 | 141 | if ($survey_data['survey_type'] == 0) { |
@@ -217,24 +217,24 @@ discard block |
||
217 | 217 | echo ' <td>'.$tool_name.'</td>'; |
218 | 218 | echo ' <td>'.$row['number_of_options'].'</td>'; |
219 | 219 | echo ' <td>'; |
220 | - echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=edit&type='.$row['type'].'&survey_id='.$survey_id.'&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().'&action=delete&survey_id='.$survey_id.'&question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
220 | + echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=edit&type='.$row['type'].'&survey_id='.$survey_id.'&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().'&action=delete&survey_id='.$survey_id.'&question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?', ENT_QUOTES, $charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
222 | 222 | if ($question_counter > 1) { |
223 | - echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&action=moveup&survey_id='.$survey_id.'&question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>'; |
|
223 | + echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&action=moveup&survey_id='.$survey_id.'&question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL).'</a>'; |
|
224 | 224 | } else { |
225 | - Display::display_icon('up_na.png',' ','',ICON_SIZE_SMALL); |
|
225 | + Display::display_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); |
|
226 | 226 | } |
227 | 227 | if ($question_counter < $question_counter_max) { |
228 | - echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&action=movedown&survey_id='.$survey_id.'&question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>'; |
|
228 | + echo ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&action=movedown&survey_id='.$survey_id.'&question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL).'</a>'; |
|
229 | 229 | } else { |
230 | - Display::display_icon('down_na.png',' ','',ICON_SIZE_SMALL); |
|
230 | + Display::display_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); |
|
231 | 231 | } |
232 | 232 | echo ' </td>'; |
233 | 233 | $question_counter++; |
234 | 234 | |
235 | 235 | if ($is_survey_type_1) { |
236 | - echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>'; |
|
237 | - echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>'; |
|
236 | + echo '<td>'.(($row['survey_group_pri'] == 0) ? get_lang('Secondary') : get_lang('Primary')).'</td>'; |
|
237 | + echo '<td>'.(($row['survey_group_pri'] == 0) ? $groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']] : $groups[$row['survey_group_pri']]).'</td>'; |
|
238 | 238 | } |
239 | 239 | echo '</tr>'; |
240 | 240 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false); |
249 | 249 | } |
250 | 250 | |
251 | - if (in_array($_GET['sendmsg'], array('GroupNeedName'))){ |
|
251 | + if (in_array($_GET['sendmsg'], array('GroupNeedName'))) { |
|
252 | 252 | echo Display::display_warning_message(get_lang($_GET['sendmsg']), false); |
253 | 253 | } |
254 | 254 | echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>'; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | if ($_GET['action'] == 'editgroup') { |
257 | 257 | $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1'; |
258 | 258 | $rs = Database::query($sql); |
259 | - $editedrow = Database::fetch_array($rs,'ASSOC'); |
|
259 | + $editedrow = Database::fetch_array($rs, 'ASSOC'); |
|
260 | 260 | echo '<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>'; |
261 | 261 | echo '<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">'; |
262 | 262 | echo '<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">'; |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | $sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name'; |
279 | 279 | |
280 | 280 | $rs = Database::query($sql); |
281 | - while($row = Database::fetch_array($rs,ASSOC)){ |
|
281 | + while ($row = Database::fetch_array($rs, ASSOC)) { |
|
282 | 282 | $grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'. |
283 | 283 | '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'. |
284 | - Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '. |
|
285 | - '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'. |
|
286 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
284 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> '. |
|
285 | + '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'), $row['name']).'?', ENT_QUOTES)).'\')) return false;">'. |
|
286 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'. |
|
287 | 287 | '</td></tr>'; |
288 | 288 | } |
289 | 289 | echo $grouplist.'</table>'; |
@@ -124,7 +124,9 @@ |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>'; |
|
127 | +if (!empty($survey_data['survey_version'])) { |
|
128 | + echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>'; |
|
129 | +} |
|
128 | 130 | |
129 | 131 | // We exit here is the first or last question is a pagebreak (which causes errors) |
130 | 132 | SurveyUtil::check_first_last_question($_GET['survey_id']); |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | // Coach can't view this page |
21 | 21 | $extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey'); |
22 | 22 | $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( |
23 | - api_get_user_id(), |
|
24 | - api_get_course_info() |
|
23 | + api_get_user_id(), |
|
24 | + api_get_course_info() |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | if ($isDrhOfCourse) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | (api_is_course_coach() && $extend_rights_for_coachs == 'false') |
33 | 33 | ) { |
34 | 34 | api_not_allowed(true); |
35 | - exit; |
|
35 | + exit; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Database table definitions |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | |
50 | 50 | // Breadcrumbs |
51 | 51 | $interbreadcrumb[] = array( |
52 | - 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', |
|
53 | - 'name' => get_lang('SurveyList'), |
|
52 | + 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', |
|
53 | + 'name' => get_lang('SurveyList'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | // Getting the survey information |
57 | 57 | if (!empty($_GET['survey_id'])) { |
58 | - $course_code = api_get_course_id(); |
|
59 | - if ($course_code!=-1) { |
|
60 | - $survey_data = SurveyManager::get_survey($survey_id); |
|
61 | - } else { |
|
62 | - Display :: display_header(get_lang('ToolSurvey')); |
|
63 | - Display :: display_error_message(get_lang('NotAllowed'), false); |
|
64 | - Display :: display_footer(); |
|
65 | - exit; |
|
66 | - } |
|
58 | + $course_code = api_get_course_id(); |
|
59 | + if ($course_code!=-1) { |
|
60 | + $survey_data = SurveyManager::get_survey($survey_id); |
|
61 | + } else { |
|
62 | + Display :: display_header(get_lang('ToolSurvey')); |
|
63 | + Display :: display_error_message(get_lang('NotAllowed'), false); |
|
64 | + Display :: display_footer(); |
|
65 | + exit; |
|
66 | + } |
|
67 | 67 | } else { |
68 | 68 | Display :: display_header(get_lang('ToolSurvey')); |
69 | 69 | Display :: display_error_message(get_lang('NotAllowed'), false); |
@@ -76,30 +76,30 @@ discard block |
||
76 | 76 | $is_survey_type_1 = $survey_data['survey_type'] == 1; |
77 | 77 | |
78 | 78 | if (api_strlen(strip_tags($survey_data['title'])) > 40) { |
79 | - $tool_name .= '...'; |
|
79 | + $tool_name .= '...'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) { |
83 | - $_POST['name'] = trim($_POST['name']); |
|
84 | - if ($action == 'addgroup') { |
|
85 | - if (!empty($_POST['group_id'])) { |
|
86 | - Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\' |
|
83 | + $_POST['name'] = trim($_POST['name']); |
|
84 | + if ($action == 'addgroup') { |
|
85 | + if (!empty($_POST['group_id'])) { |
|
86 | + Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\' |
|
87 | 87 | WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\''); |
88 | - $sendmsg = 'GroupUpdatedSuccessfully'; |
|
89 | - } elseif(!empty($_POST['name'])) { |
|
90 | - Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') '); |
|
91 | - $sendmsg = 'GroupCreatedSuccessfully'; |
|
92 | - } else { |
|
93 | - $sendmsg = 'GroupNeedName'; |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - if ($action == 'deletegroup') { |
|
98 | - Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id)); |
|
99 | - $sendmsg = 'GroupDeletedSuccessfully'; |
|
100 | - } |
|
101 | - header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg); |
|
102 | - exit; |
|
88 | + $sendmsg = 'GroupUpdatedSuccessfully'; |
|
89 | + } elseif(!empty($_POST['name'])) { |
|
90 | + Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') '); |
|
91 | + $sendmsg = 'GroupCreatedSuccessfully'; |
|
92 | + } else { |
|
93 | + $sendmsg = 'GroupNeedName'; |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + if ($action == 'deletegroup') { |
|
98 | + Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id)); |
|
99 | + $sendmsg = 'GroupDeletedSuccessfully'; |
|
100 | + } |
|
101 | + header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg); |
|
102 | + exit; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // Displaying the header |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | $message_information = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null; |
114 | 114 | |
115 | 115 | if (isset($action)) { |
116 | - if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) { |
|
117 | - SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey); |
|
118 | - Display::display_confirmation_message(get_lang('SurveyQuestionMoved')); |
|
119 | - } |
|
120 | - if ($action == 'delete' AND is_numeric($_GET['question_id'])) { |
|
121 | - SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']); |
|
122 | - } |
|
116 | + if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) { |
|
117 | + SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey); |
|
118 | + Display::display_confirmation_message(get_lang('SurveyQuestionMoved')); |
|
119 | + } |
|
120 | + if ($action == 'delete' AND is_numeric($_GET['question_id'])) { |
|
121 | + SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']); |
|
122 | + } |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>'; |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | echo '<div class="actions">'.$survey_actions.'</div>'; |
138 | 138 | |
139 | 139 | if ($survey_data['survey_type'] == 0) { |
140 | - echo '<div class="panel panel-default">'; |
|
140 | + echo '<div class="panel panel-default">'; |
|
141 | 141 | echo '<div class="panel-body">'; |
142 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=yesno&survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>'; |
|
143 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=multiplechoice&survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>'; |
|
144 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=multipleresponse&survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>'; |
|
145 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=open&survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>'; |
|
146 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=dropdown&survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>'; |
|
147 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=percentage&survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>'; |
|
148 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=score&survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>'; |
|
149 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=comment&survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>'; |
|
150 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=pagebreak&survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>'; |
|
151 | - echo '</div>'; |
|
142 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=yesno&survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>'; |
|
143 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=multiplechoice&survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>'; |
|
144 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=multipleresponse&survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>'; |
|
145 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=open&survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>'; |
|
146 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=dropdown&survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>'; |
|
147 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=percentage&survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>'; |
|
148 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=score&survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>'; |
|
149 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=comment&survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>'; |
|
150 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=pagebreak&survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>'; |
|
151 | + echo '</div>'; |
|
152 | 152 | echo '</div>'; |
153 | 153 | } else { |
154 | - echo '<div class="panel panel-default">'; |
|
154 | + echo '<div class="panel panel-default">'; |
|
155 | 155 | echo '<div class="panel-body">'; |
156 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=personality&survey_id='.$survey_id.'">'; |
|
157 | - echo Display::return_icon("yesno.png"); |
|
158 | - echo '</a></div>'; |
|
159 | - echo '</div>'; |
|
156 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&action=add&type=personality&survey_id='.$survey_id.'">'; |
|
157 | + echo Display::return_icon("yesno.png"); |
|
158 | + echo '</a></div>'; |
|
159 | + echo '</div>'; |
|
160 | 160 | echo '</div>'; |
161 | 161 | } |
162 | 162 | |
@@ -169,7 +169,7 @@ discard block |
||
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 |
||
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().'&action=edit&type='.$row['type'].'&survey_id='.$survey_id.'&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().'&action=delete&survey_id='.$survey_id.'&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().'&action=moveup&survey_id='.$survey_id.'&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',' ','',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().'&action=movedown&survey_id='.$survey_id.'&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',' ','',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().'&action=edit&type='.$row['type'].'&survey_id='.$survey_id.'&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().'&action=delete&survey_id='.$survey_id.'&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().'&action=moveup&survey_id='.$survey_id.'&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',' ','',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().'&action=movedown&survey_id='.$survey_id.'&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',' ','',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'); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | if (!SurveyManager::survey_generation_hash_available()) { |
12 | 12 | api_not_allowed(true); |
13 | 13 | } |
14 | -$course_info = api_get_course_info_by_id($_REQUEST['c']); |
|
14 | +$course_info = api_get_course_info_by_id($_REQUEST['c']); |
|
15 | 15 | |
16 | 16 | $hash_is_valid = SurveyManager::validate_survey_hash( |
17 | 17 | $survey_id, |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $options[$key] = $value; |
22 | 22 | } |
23 | 23 | |
24 | - $name = 'question' . $questionData['question_id']; |
|
24 | + $name = 'question'.$questionData['question_id']; |
|
25 | 25 | |
26 | 26 | $form->addSelect( |
27 | 27 | $name, null, $options |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if ($surveyData['survey_type'] == 1) { |
65 | 65 | $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP); |
66 | 66 | $sql = 'SELECT id,name FROM '.$table_survey_question_group.' |
67 | - WHERE survey_id = '.(int)$_GET['survey_id'].' |
|
67 | + WHERE survey_id = '.(int) $_GET['survey_id'].' |
|
68 | 68 | ORDER BY name'; |
69 | 69 | $rs = Database::query($sql); |
70 | 70 | $glist = null; |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | $grouplist = $grouplist1 = $grouplist2 = $glist; |
76 | 76 | |
77 | 77 | if (!empty($formData['assigned'])) { |
78 | - $grouplist = str_replace('<option value="'.$formData['assigned'].'"','<option value="'.$formData['assigned'].'" selected',$glist); |
|
78 | + $grouplist = str_replace('<option value="'.$formData['assigned'].'"', '<option value="'.$formData['assigned'].'" selected', $glist); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (!empty($formData['assigned1'])) { |
82 | - $grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"','<option value="'.$formData['assigned1'].'" selected',$glist); |
|
82 | + $grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"', '<option value="'.$formData['assigned1'].'" selected', $glist); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | if (!empty($formData['assigned2'])) { |
86 | - $grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"','<option value="'.$formData['assigned2'].'" selected',$glist); |
|
86 | + $grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"', '<option value="'.$formData['assigned2'].'" selected', $glist); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $this->html .= ' <tr><td colspan=""> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $this->html .= ' |
97 | 97 | <b>'.get_lang('Secondary').'</b><br /> |
98 | - '.'<input type="radio" name="choose" value="2" '.(($formData['choose']==2)?'checked':''). |
|
98 | + '.'<input type="radio" name="choose" value="2" '.(($formData['choose'] == 2) ? 'checked' : ''). |
|
99 | 99 | '><select name="assigned1">'.$grouplist1.'</select> '. |
100 | 100 | '<select name="assigned2">'.$grouplist2.'</select>' |
101 | 101 | .'</fieldset><br />'; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | // Setting the global file that gets the general configuration, the databases, the languages, ... |
8 | 8 | require_once '../inc/global.inc.php'; |
9 | -$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
9 | +$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
10 | 10 | api_protect_course_script(true); |
11 | 11 | |
12 | 12 | // Notice for unauthorized people. |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $options = array( |
39 | 39 | '--' => '--' |
40 | 40 | ); |
41 | - for ($i=1; $i <= $questionData['maximum_score']; $i++) { |
|
41 | + for ($i = 1; $i <= $questionData['maximum_score']; $i++) { |
|
42 | 42 | $options[$i] = $i; |
43 | 43 | } |
44 | 44 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if (api_is_allowed_to_edit()) { |
76 | 76 | SurveyManager::copy_survey($_GET['survey_id']); |
77 | 77 | $message = get_lang('SurveyCopied'); |
78 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq()); |
|
78 | + header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq()); |
|
79 | 79 | exit; |
80 | 80 | } |
81 | 81 | } |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | if (!api_is_course_coach() || $extend_rights_for_coachs == 'true') { |
163 | 163 | // Action links |
164 | 164 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=add">'. |
165 | - Display::return_icon('new_survey.png', get_lang('CreateNewSurvey'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
165 | + Display::return_icon('new_survey.png', get_lang('CreateNewSurvey'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
166 | 166 | } |
167 | 167 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&search=advanced">'. |
168 | - Display::return_icon('search.png', get_lang('Search'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
168 | + Display::return_icon('search.png', get_lang('Search'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
169 | 169 | echo '</div>'; |
170 | 170 | |
171 | 171 | // Load main content |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | $result = Database::query($sql); |
52 | 52 | if (!list($session_name,$course_title) = Database::fetch_row($result)) { |
53 | - header('Location: session_course_list.php?id_session='.$id_session); |
|
54 | - exit(); |
|
53 | + header('Location: session_course_list.php?id_session='.$id_session); |
|
54 | + exit(); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | switch ($action) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous');?></a> |
123 | 123 | <?php |
124 | 124 | } else { |
125 | - echo get_lang('Previous'); |
|
125 | + echo get_lang('Previous'); |
|
126 | 126 | } |
127 | 127 | ?> |
128 | 128 | | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next');?></a> |
133 | 133 | <?php |
134 | 134 | } else { |
135 | - echo get_lang('Next'); |
|
135 | + echo get_lang('Next'); |
|
136 | 136 | } |
137 | 137 | ?> |
138 | 138 | </div> |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | $i=0; |
155 | 155 | foreach ($users as $key => $enreg) { |
156 | 156 | |
157 | - if ($key == $limit) { |
|
158 | - break; |
|
159 | - } |
|
157 | + if ($key == $limit) { |
|
158 | + break; |
|
159 | + } |
|
160 | 160 | ?> |
161 | 161 | <tr class="<?php echo $i?'row_odd':'row_even'; ?>"> |
162 | 162 | <td><input type="checkbox" name="idChecked[]" value="<?php echo $enreg['user_id']; ?>"></td> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $id_session = intval($_GET['id_session']); |
19 | 19 | SessionManager::protectSession($id_session); |
20 | 20 | |
21 | -if (empty($id_session )) { |
|
21 | +if (empty($id_session)) { |
|
22 | 22 | api_not_allowed(); |
23 | 23 | } |
24 | 24 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | |
29 | 29 | $page = isset($_GET['page']) ? intval($_GET['page']) : null; |
30 | 30 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; |
31 | -$default_sort = api_sort_by_first_name() ? 'firstname':'lastname'; |
|
32 | -$sort = isset($_GET['sort']) && in_array($_GET['sort'], array('lastname','firstname','username')) ? $_GET['sort'] : $default_sort; |
|
31 | +$default_sort = api_sort_by_first_name() ? 'firstname' : 'lastname'; |
|
32 | +$sort = isset($_GET['sort']) && in_array($_GET['sort'], array('lastname', 'firstname', 'username')) ? $_GET['sort'] : $default_sort; |
|
33 | 33 | $idChecked = isset($_GET['idChecked']) && is_array($_GET['idChecked']) ? $_GET['idChecked'] : (isset($_POST['idChecked']) && is_array($_POST['idChecked']) ? $_POST['idChecked'] : null); |
34 | -$direction = isset($_GET['direction']) && in_array($_GET['direction'], array('desc','asc')) ? $_GET['direction'] : 'desc'; |
|
34 | +$direction = isset($_GET['direction']) && in_array($_GET['direction'], array('desc', 'asc')) ? $_GET['direction'] : 'desc'; |
|
35 | 35 | |
36 | 36 | if (is_array($idChecked)) { |
37 | 37 | $my_temp = array(); |
38 | 38 | foreach ($idChecked as $id) { |
39 | 39 | // forcing the intval |
40 | - $my_temp[]= intval($id); |
|
40 | + $my_temp[] = intval($id); |
|
41 | 41 | } |
42 | 42 | $idChecked = $my_temp; |
43 | 43 | } |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | WHERE src.session_id='$id_session' AND src.c_id='$courseId' "; |
50 | 50 | |
51 | 51 | $result = Database::query($sql); |
52 | -if (!list($session_name,$course_title) = Database::fetch_row($result)) { |
|
52 | +if (!list($session_name, $course_title) = Database::fetch_row($result)) { |
|
53 | 53 | header('Location: session_course_list.php?id_session='.$id_session); |
54 | 54 | exit(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | switch ($action) { |
58 | 58 | case 'delete': |
59 | - if (is_array($idChecked) && count($idChecked)>0) { |
|
59 | + if (is_array($idChecked) && count($idChecked) > 0) { |
|
60 | 60 | array_map('intval', $idChecked); |
61 | 61 | $idChecked = implode(',', $idChecked); |
62 | 62 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ON (s.session_id = scru.session_id AND s.user_id = scru.user_id AND scru.c_id = '".$courseId."' ) |
92 | 92 | WHERE s.session_id='$id_session' |
93 | 93 | ORDER BY $sort $direction |
94 | - LIMIT $from,".($limit+1); |
|
94 | + LIMIT $from,".($limit + 1); |
|
95 | 95 | |
96 | 96 | if ($direction == 'desc') { |
97 | 97 | $direction = 'asc'; |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $tool_name = get_lang('Session').': '.$session_name.' - '.get_lang('Course').': '.$course_title; |
108 | 108 | |
109 | 109 | //$interbreadcrumb[] = array("url" => "index.php","name" => get_lang('PlatformAdmin')); |
110 | -$interbreadcrumb[] = array("url" => "session_list.php","name" => get_lang('SessionList')); |
|
111 | -$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview')); |
|
110 | +$interbreadcrumb[] = array("url" => "session_list.php", "name" => get_lang('SessionList')); |
|
111 | +$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session, "name" => get_lang('SessionOverview')); |
|
112 | 112 | |
113 | 113 | Display::display_header($tool_name); |
114 | 114 | |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | <form method="post" action="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=<?php echo $sort; ?>" onsubmit="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;"> |
118 | 118 | <div align="right"> |
119 | 119 | <?php |
120 | -if($page) { |
|
120 | +if ($page) { |
|
121 | 121 | ?> |
122 | -<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous');?></a> |
|
122 | +<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page - 1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous'); ?></a> |
|
123 | 123 | <?php |
124 | 124 | } else { |
125 | 125 | echo get_lang('Previous'); |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | ?> |
128 | 128 | | |
129 | 129 | <?php |
130 | -if($nbr_results > $limit) { |
|
130 | +if ($nbr_results > $limit) { |
|
131 | 131 | ?> |
132 | -<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next');?></a> |
|
132 | +<a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page + 1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next'); ?></a> |
|
133 | 133 | <?php |
134 | 134 | } else { |
135 | 135 | echo get_lang('Next'); |
@@ -141,39 +141,39 @@ discard block |
||
141 | 141 | <tr> |
142 | 142 | <th> </th> |
143 | 143 | <?php if ($is_western_name_order) { ?> |
144 | - <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName');?></a></th> |
|
145 | - <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName');?></a></th> |
|
144 | + <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName'); ?></a></th> |
|
145 | + <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName'); ?></a></th> |
|
146 | 146 | <?php } else { ?> |
147 | - <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName');?></a></th> |
|
148 | - <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName');?></a></th> |
|
147 | + <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('LastName'); ?></a></th> |
|
148 | + <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('FirstName'); ?></a></th> |
|
149 | 149 | <?php } ?> |
150 | - <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('Login');?></a></th> |
|
151 | - <th><?php echo get_lang('Actions');?></th> |
|
150 | + <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username&direction=<?php echo urlencode($direction); ?>"><?php echo get_lang('Login'); ?></a></th> |
|
151 | + <th><?php echo get_lang('Actions'); ?></th> |
|
152 | 152 | </tr> |
153 | 153 | <?php |
154 | -$i=0; |
|
154 | +$i = 0; |
|
155 | 155 | foreach ($users as $key => $enreg) { |
156 | 156 | |
157 | 157 | if ($key == $limit) { |
158 | 158 | break; |
159 | 159 | } |
160 | 160 | ?> |
161 | - <tr class="<?php echo $i?'row_odd':'row_even'; ?>"> |
|
161 | + <tr class="<?php echo $i ? 'row_odd' : 'row_even'; ?>"> |
|
162 | 162 | <td><input type="checkbox" name="idChecked[]" value="<?php echo $enreg['user_id']; ?>"></td> |
163 | 163 | <?php if ($is_western_name_order) { ?> |
164 | - <td><?php echo api_htmlentities($enreg['firstname'],ENT_QUOTES,$charset); ?></td> |
|
165 | - <td><?php echo api_htmlentities($enreg['lastname'],ENT_QUOTES,$charset); ?></td> |
|
164 | + <td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES, $charset); ?></td> |
|
165 | + <td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES, $charset); ?></td> |
|
166 | 166 | <?php } else { ?> |
167 | - <td><?php echo api_htmlentities($enreg['lastname'],ENT_QUOTES,$charset); ?></td> |
|
168 | - <td><?php echo api_htmlentities($enreg['firstname'],ENT_QUOTES,$charset); ?></td> |
|
167 | + <td><?php echo api_htmlentities($enreg['lastname'], ENT_QUOTES, $charset); ?></td> |
|
168 | + <td><?php echo api_htmlentities($enreg['firstname'], ENT_QUOTES, $charset); ?></td> |
|
169 | 169 | <?php } ?> |
170 | - <td><?php echo api_htmlentities($enreg['username'],ENT_QUOTES,$charset); ?></td> |
|
170 | + <td><?php echo api_htmlentities($enreg['username'], ENT_QUOTES, $charset); ?></td> |
|
171 | 171 | <td> |
172 | 172 | <?php if ($enreg['is_subscribed']) { ?> |
173 | 173 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=<?php echo $sort; ?>&action=delete&idChecked[]=<?php echo $enreg['user_id']; ?>" onclick="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;"> |
174 | 174 | <?php Display::display_icon('delete.png', get_lang('Delete')); ?> |
175 | 175 | </a> |
176 | - <?php } else { ?> |
|
176 | + <?php } else { ?> |
|
177 | 177 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=<?php echo $sort; ?>&action=add&idChecked[]=<?php echo $enreg['user_id']; ?>" onclick="javascript:if(!confirm('<?php echo get_lang('ConfirmYourChoice'); ?>')) return false;"> |
178 | 178 | <?php Display::display_icon('add.png', get_lang('Add'), array(), ICON_SIZE_SMALL); ?> |
179 | 179 | </a> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | </td> |
183 | 183 | </tr> |
184 | 184 | <?php |
185 | - $i=$i ? 0 : 1; |
|
185 | + $i = $i ? 0 : 1; |
|
186 | 186 | } |
187 | 187 | unset($users); |
188 | 188 | ?> |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | <br /> |
191 | 191 | <div align="left"> |
192 | 192 | <?php |
193 | - if($page) { |
|
193 | + if ($page) { |
|
194 | 194 | ?> |
195 | - <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous'); ?></a> |
|
195 | + <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page - 1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous'); ?></a> |
|
196 | 196 | <?php |
197 | 197 | } else { |
198 | 198 | echo get_lang('Previous'); |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | ?> |
201 | 201 | | |
202 | 202 | <?php |
203 | - if($nbr_results > $limit) { |
|
203 | + if ($nbr_results > $limit) { |
|
204 | 204 | ?> |
205 | - <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next'); ?></a> |
|
205 | + <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page + 1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next'); ?></a> |
|
206 | 206 | <?php |
207 | 207 | } else { |
208 | 208 | echo get_lang('Next'); |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | </div> |
212 | 212 | <br /> |
213 | 213 | <select name="action"> |
214 | -<option value="delete"><?php echo get_lang('UnsubscribeSelectedUsersFromSession');?></option> |
|
215 | -<option value="add"><?php echo get_lang('AddUsers');?></option> |
|
214 | +<option value="delete"><?php echo get_lang('UnsubscribeSelectedUsersFromSession'); ?></option> |
|
215 | +<option value="add"><?php echo get_lang('AddUsers'); ?></option> |
|
216 | 216 | </select> |
217 | 217 | <button class="save" type="submit"> <?php echo get_lang('Ok'); ?></button> |
218 | 218 | </form> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | SessionManager::protectSession($id_session); |
17 | 17 | |
18 | 18 | // setting breadcrumbs |
19 | -$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); |
|
19 | +$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList')); |
|
20 | 20 | $interbreadcrumb[] = array( |
21 | 21 | 'url' => 'resume_session.php?id_session='.$id_session, |
22 | 22 | 'name' => get_lang('SessionOverview'), |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' |
44 | 44 | WHERE id='.$id_session; |
45 | 45 | $rs = Database::query($sql); |
46 | - if (Database::result($rs,0,0)!=$_user['user_id']) { |
|
46 | + if (Database::result($rs, 0, 0) != $_user['user_id']) { |
|
47 | 47 | api_not_allowed(true); |
48 | 48 | } |
49 | 49 | } |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | foreach ($CourseList as $enreg_course) { |
90 | 90 | $exists = false; |
91 | - foreach($existingCourses as $existingCourse) { |
|
91 | + foreach ($existingCourses as $existingCourse) { |
|
92 | 92 | if ($enreg_course == $existingCourse['id']) { |
93 | - $exists=true; |
|
93 | + $exists = true; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | foreach ($existingCourses as $existingCourse) { |
113 | - if (!in_array($existingCourse['id'], $CourseList)){ |
|
113 | + if (!in_array($existingCourse['id'], $CourseList)) { |
|
114 | 114 | $existingCourse = Database::escape_string($existingCourse['id']); |
115 | 115 | $sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user (session_id,c_id,user_id) |
116 | 116 | VALUES ('$id_session','$existingCourse','$id_user')"; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | WHERE srcru.user_id = $id_user AND session_id = $id_session"; |
147 | 147 | |
148 | 148 | //all |
149 | -$sql_all="SELECT course.id, code, title, visual_code, src.session_id |
|
149 | +$sql_all = "SELECT course.id, code, title, visual_code, src.session_id |
|
150 | 150 | FROM $tbl_course course |
151 | 151 | INNER JOIN $tbl_session_rel_course as src |
152 | 152 | ON course.id = src.c_id AND session_id = $id_session"; |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | foreach ($CoursesAll as $course) { |
165 | 165 | if (in_array($course['id'], $course_temp)) { |
166 | - $nosessionCourses[$course['id']] = $course ; |
|
166 | + $nosessionCourses[$course['id']] = $course; |
|
167 | 167 | } else { |
168 | - $sessionCourses[$course['id']] = $course ; |
|
168 | + $sessionCourses[$course['id']] = $course; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | unset($Courses); |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | <td width="45%" align="center"> |
185 | 185 | <div id="ajax_list_courses_multiple"> |
186 | 186 | <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:320px;"> <?php |
187 | - foreach($nosessionCourses as $enreg) { |
|
187 | + foreach ($nosessionCourses as $enreg) { |
|
188 | 188 | ?> |
189 | - <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
189 | + <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES).'"'; if (in_array($enreg['code'], $CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
190 | 190 | <?php |
191 | 191 | } |
192 | 192 | ?> </select></div> <?php |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | <td width="45%" align="center"> |
212 | 212 | <select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" style="width:320px;"> |
213 | 213 | <?php |
214 | - foreach($sessionCourses as $enreg) { |
|
214 | + foreach ($sessionCourses as $enreg) { |
|
215 | 215 | ?> |
216 | - <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>"><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
216 | + <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES); ?>"><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
217 | 217 | <?php |
218 | 218 | } |
219 | 219 | unset($sessionCourses); |
@@ -186,7 +186,10 @@ |
||
186 | 186 | <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:320px;"> <?php |
187 | 187 | foreach($nosessionCourses as $enreg) { |
188 | 188 | ?> |
189 | - <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
189 | + <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) { |
|
190 | + echo 'selected="selected"'; |
|
191 | +} |
|
192 | +?>><?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?></option> |
|
190 | 193 | <?php |
191 | 194 | } |
192 | 195 | ?> </select></div> <?php |