@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $sessionId = api_get_session_id(); |
62 | 62 | |
63 | 63 | if (api_is_in_group()) { |
64 | - $group_properties = GroupManager::get_group_properties($group_id); |
|
64 | + $group_properties = GroupManager::get_group_properties($group_id); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $dir = '/'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $_GET['id'], |
74 | 74 | api_get_course_id(), |
75 | 75 | true, |
76 | - 0 |
|
76 | + 0 |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | if (!empty($sessionId) && empty($document_data)) { |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - $document_id = $document_data['id']; |
|
89 | - $file = $document_data['path']; |
|
90 | - $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
91 | - $dir = dirname($document_data['path']); |
|
92 | - $dir_original = $dir; |
|
93 | - $doc = basename($file); |
|
94 | - $readonly = $document_data['readonly']; |
|
88 | + $document_id = $document_data['id']; |
|
89 | + $file = $document_data['path']; |
|
90 | + $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
91 | + $dir = dirname($document_data['path']); |
|
92 | + $dir_original = $dir; |
|
93 | + $doc = basename($file); |
|
94 | + $readonly = $document_data['readonly']; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if (empty($document_data)) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // Level correction for group documents. |
115 | 115 | if (!empty($group_properties['directory'])) { |
116 | - $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
116 | + $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
117 | 117 | } |
118 | 118 | $relative_url = ''; |
119 | 119 | for ($i = 0; $i < ($count_dir); $i++) { |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | ); |
136 | 136 | |
137 | 137 | if ($is_certificate_mode) { |
138 | - $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
139 | - $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
140 | - $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
138 | + $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
139 | + $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
140 | + $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $groupRights || |
144 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
144 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
145 | 145 | $noPHP_SELF = true; |
146 | 146 | |
147 | 147 | /* Other initialization code */ |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
155 | 155 | 'name' => get_lang('GroupSpace'), |
156 | 156 | ); |
157 | - $group_document = true; |
|
158 | - $noPHP_SELF = true; |
|
157 | + $group_document = true; |
|
158 | + $noPHP_SELF = true; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (!$is_certificate_mode) { |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | |
190 | 190 | //TODO:check the below code and his funcionality |
191 | 191 | if (!api_is_allowed_to_edit()) { |
192 | - if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
193 | - api_not_allowed(); |
|
194 | - } |
|
192 | + if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
193 | + api_not_allowed(); |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /* MAIN TOOL CODE */ |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | /* Code to change the comment */ |
200 | 200 | |
201 | 201 | if (isset($_POST['comment'])) { |
202 | - // Fixing the path if it is wrong |
|
203 | - $comment = trim($_POST['comment']); |
|
204 | - $title = trim($_POST['title']); |
|
202 | + // Fixing the path if it is wrong |
|
203 | + $comment = trim($_POST['comment']); |
|
204 | + $title = trim($_POST['title']); |
|
205 | 205 | |
206 | 206 | // Just in case see BT#3525 |
207 | 207 | if (empty($title)) { |
208 | - $title = $document_data['title']; |
|
209 | - } |
|
208 | + $title = $document_data['title']; |
|
209 | + } |
|
210 | 210 | |
211 | - if (empty($title)) { |
|
212 | - $title = get_document_title($_POST['filename']); |
|
213 | - } |
|
211 | + if (empty($title)) { |
|
212 | + $title = get_document_title($_POST['filename']); |
|
213 | + } |
|
214 | 214 | |
215 | 215 | if (!empty($document_id)) { |
216 | 216 | $params = [ |
@@ -222,43 +222,43 @@ discard block |
||
222 | 222 | $params, |
223 | 223 | ['c_id = ? AND id = ?' => [$course_id, $document_id]] |
224 | 224 | ); |
225 | - Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
225 | + Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | 229 | /* WYSIWYG HTML EDITOR - Program Logic */ |
230 | 230 | if ($is_allowed_to_edit) { |
231 | - if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
231 | + if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
232 | 232 | |
233 | - $filename = stripslashes($_POST['filename']); |
|
233 | + $filename = stripslashes($_POST['filename']); |
|
234 | 234 | $extension = $_POST['extension']; |
235 | - $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
236 | - $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
235 | + $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
236 | + $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
237 | 237 | |
238 | 238 | if ($dir == '/') { |
239 | 239 | $dir = ''; |
240 | 240 | } |
241 | 241 | |
242 | - $file = $dir.'/'.$filename.'.'.$extension; |
|
243 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
244 | - $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
242 | + $file = $dir.'/'.$filename.'.'.$extension; |
|
243 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
244 | + $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
245 | 245 | |
246 | - if (empty($filename)) { |
|
246 | + if (empty($filename)) { |
|
247 | 247 | Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning')); |
248 | - } else { |
|
248 | + } else { |
|
249 | 249 | |
250 | - $file_size = filesize($document_data['absolute_path']); |
|
250 | + $file_size = filesize($document_data['absolute_path']); |
|
251 | 251 | |
252 | - if ($read_only_flag == 0) { |
|
253 | - if (!empty($content)) { |
|
254 | - if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
255 | - // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
256 | - $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
257 | - fputs($fp, $content); |
|
258 | - fclose($fp); |
|
252 | + if ($read_only_flag == 0) { |
|
253 | + if (!empty($content)) { |
|
254 | + if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
255 | + // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
256 | + $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
257 | + fputs($fp, $content); |
|
258 | + fclose($fp); |
|
259 | 259 | |
260 | 260 | $filepath = $document_data['absolute_parent_path']; |
261 | - /* |
|
261 | + /* |
|
262 | 262 | if (!is_dir($filepath.'css')) { |
263 | 263 | mkdir($filepath.'css', api_get_permissions_for_new_directories()); |
264 | 264 | $doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css'); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | ); |
289 | 289 | }*/ |
290 | 290 | |
291 | - /*if (!is_file($filepath.'css/frames.css')) { |
|
291 | + /*if (!is_file($filepath.'css/frames.css')) { |
|
292 | 292 | $platform_theme = api_get_setting('stylesheets'); |
293 | 293 | if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) { |
294 | 294 | copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css'); |
@@ -326,54 +326,54 @@ discard block |
||
326 | 326 | } |
327 | 327 | }*/ |
328 | 328 | |
329 | - // "WHAT'S NEW" notification: update table item_property |
|
330 | - $document_id = DocumentManager::get_document_id($_course, $file); |
|
331 | - |
|
332 | - if ($document_id) { |
|
333 | - update_existing_document( |
|
334 | - $_course, |
|
335 | - $document_id, |
|
336 | - $file_size, |
|
337 | - $read_only_flag |
|
338 | - ); |
|
339 | - api_item_property_update( |
|
340 | - $_course, |
|
341 | - TOOL_DOCUMENT, |
|
342 | - $document_id, |
|
343 | - 'DocumentUpdated', |
|
344 | - api_get_user_id(), |
|
345 | - null, |
|
346 | - null, |
|
347 | - null, |
|
348 | - null, |
|
349 | - $sessionId |
|
350 | - ); |
|
351 | - // Update parent folders |
|
352 | - item_property_update_on_folder( |
|
353 | - $_course, |
|
354 | - $dir, |
|
355 | - api_get_user_id() |
|
356 | - ); |
|
357 | - header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
358 | - exit; |
|
359 | - } else { |
|
329 | + // "WHAT'S NEW" notification: update table item_property |
|
330 | + $document_id = DocumentManager::get_document_id($_course, $file); |
|
331 | + |
|
332 | + if ($document_id) { |
|
333 | + update_existing_document( |
|
334 | + $_course, |
|
335 | + $document_id, |
|
336 | + $file_size, |
|
337 | + $read_only_flag |
|
338 | + ); |
|
339 | + api_item_property_update( |
|
340 | + $_course, |
|
341 | + TOOL_DOCUMENT, |
|
342 | + $document_id, |
|
343 | + 'DocumentUpdated', |
|
344 | + api_get_user_id(), |
|
345 | + null, |
|
346 | + null, |
|
347 | + null, |
|
348 | + null, |
|
349 | + $sessionId |
|
350 | + ); |
|
351 | + // Update parent folders |
|
352 | + item_property_update_on_folder( |
|
353 | + $_course, |
|
354 | + $dir, |
|
355 | + api_get_user_id() |
|
356 | + ); |
|
357 | + header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
358 | + exit; |
|
359 | + } else { |
|
360 | 360 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
361 | - } |
|
362 | - } else { |
|
361 | + } |
|
362 | + } else { |
|
363 | 363 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
364 | - } |
|
365 | - } else { |
|
366 | - if ($document_id) { |
|
364 | + } |
|
365 | + } else { |
|
366 | + if ($document_id) { |
|
367 | 367 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
368 | - } |
|
369 | - } |
|
370 | - } else { |
|
368 | + } |
|
369 | + } |
|
370 | + } else { |
|
371 | 371 | if ($document_id) { |
372 | 372 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
373 | 373 | } |
374 | - } |
|
375 | - } |
|
376 | - } |
|
374 | + } |
|
375 | + } |
|
376 | + } |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/') |
@@ -428,35 +428,35 @@ discard block |
||
428 | 428 | $groupInfo['iid'] |
429 | 429 | ) |
430 | 430 | ) { |
431 | - $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
431 | + $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
432 | 432 | if ($is_certificate_mode) { |
433 | 433 | $action .= '&curdirpath=/certificates&selectcat=1'; |
434 | 434 | } |
435 | - $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
436 | - |
|
437 | - // Form title |
|
438 | - $form->addElement('header', $nameTools); |
|
439 | - $form->addElement('hidden', 'filename'); |
|
440 | - $form->addElement('hidden', 'extension'); |
|
441 | - $form->addElement('hidden', 'file_path'); |
|
442 | - $form->addElement('hidden', 'commentPath'); |
|
443 | - $form->addElement('hidden', 'showedit'); |
|
444 | - $form->addElement('hidden', 'origin'); |
|
445 | - $form->addElement('hidden', 'origin_opt'); |
|
435 | + $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
436 | + |
|
437 | + // Form title |
|
438 | + $form->addElement('header', $nameTools); |
|
439 | + $form->addElement('hidden', 'filename'); |
|
440 | + $form->addElement('hidden', 'extension'); |
|
441 | + $form->addElement('hidden', 'file_path'); |
|
442 | + $form->addElement('hidden', 'commentPath'); |
|
443 | + $form->addElement('hidden', 'showedit'); |
|
444 | + $form->addElement('hidden', 'origin'); |
|
445 | + $form->addElement('hidden', 'origin_opt'); |
|
446 | 446 | $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus')); |
447 | 447 | |
448 | - $defaults['title'] = $document_data['title']; |
|
448 | + $defaults['title'] = $document_data['title']; |
|
449 | 449 | |
450 | - $form->addElement('hidden', 'formSent'); |
|
451 | - $defaults['formSent'] = 1; |
|
450 | + $form->addElement('hidden', 'formSent'); |
|
451 | + $defaults['formSent'] = 1; |
|
452 | 452 | |
453 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
453 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
454 | 454 | |
455 | - // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
456 | - // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
457 | - $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
455 | + // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
456 | + // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
457 | + $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
458 | 458 | |
459 | - // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
459 | + // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
460 | 460 | |
461 | 461 | $showSystemFolders = api_get_course_setting('show_system_folders'); |
462 | 462 | $condition = stripos($dir, '/HotPotatoes_files') === false; |
@@ -464,44 +464,44 @@ discard block |
||
464 | 464 | $condition = true; |
465 | 465 | } |
466 | 466 | |
467 | - if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
468 | - if (empty($readonly) && $readonly == 0) { |
|
467 | + if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
468 | + if (empty($readonly) && $readonly == 0) { |
|
469 | 469 | $form->addHtmlEditor('content', '', true, true, $editorConfig); |
470 | - } |
|
471 | - } |
|
470 | + } |
|
471 | + } |
|
472 | 472 | |
473 | - if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
474 | - // Updated on field |
|
473 | + if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
474 | + // Updated on field |
|
475 | 475 | $display_date = date_to_str_ago($last_edit_date). |
476 | - ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
477 | - $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
478 | - } |
|
476 | + ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
477 | + $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
478 | + } |
|
479 | 479 | |
480 | - $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
480 | + $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
481 | 481 | |
482 | - if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
483 | - $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
484 | - if ($readonly == 1) { |
|
485 | - $checked->setChecked(true); |
|
486 | - } |
|
487 | - } |
|
482 | + if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
483 | + $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
484 | + if ($readonly == 1) { |
|
485 | + $checked->setChecked(true); |
|
486 | + } |
|
487 | + } |
|
488 | 488 | |
489 | - if ($is_certificate_mode) { |
|
490 | - $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
489 | + if ($is_certificate_mode) { |
|
490 | + $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
491 | 491 | } else { |
492 | - $form->addButtonUpdate(get_lang('SaveDocument')); |
|
492 | + $form->addButtonUpdate(get_lang('SaveDocument')); |
|
493 | 493 | } |
494 | 494 | |
495 | - $defaults['filename'] = $filename; |
|
496 | - $defaults['extension'] = $extension; |
|
497 | - $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
498 | - $defaults['commentPath'] = $file; |
|
499 | - $defaults['renameTo'] = $file_name; |
|
500 | - $defaults['comment'] = $document_data['comment']; |
|
501 | - $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
502 | - $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
495 | + $defaults['filename'] = $filename; |
|
496 | + $defaults['extension'] = $extension; |
|
497 | + $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
498 | + $defaults['commentPath'] = $file; |
|
499 | + $defaults['renameTo'] = $file_name; |
|
500 | + $defaults['comment'] = $document_data['comment']; |
|
501 | + $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
502 | + $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
503 | 503 | |
504 | - $form->setDefaults($defaults); |
|
504 | + $form->setDefaults($defaults); |
|
505 | 505 | |
506 | 506 | show_return( |
507 | 507 | $parent_id, |
@@ -511,25 +511,25 @@ discard block |
||
511 | 511 | $is_certificate_mode |
512 | 512 | ); |
513 | 513 | |
514 | - if ($is_certificate_mode) { |
|
515 | - $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
516 | - api_get_user_id(), |
|
517 | - api_get_course_id() |
|
518 | - ); |
|
519 | - $str_info = ''; |
|
520 | - foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
521 | - $str_info .= $info_value.'<br/>'; |
|
522 | - } |
|
523 | - $create_certificate=get_lang('CreateCertificateWithTags'); |
|
524 | - Display::display_normal_message( |
|
525 | - $create_certificate.': <br /><br />'.$str_info, |
|
526 | - false |
|
527 | - ); |
|
528 | - } |
|
529 | - |
|
530 | - if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
531 | - Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
532 | - } |
|
514 | + if ($is_certificate_mode) { |
|
515 | + $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
516 | + api_get_user_id(), |
|
517 | + api_get_course_id() |
|
518 | + ); |
|
519 | + $str_info = ''; |
|
520 | + foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
521 | + $str_info .= $info_value.'<br/>'; |
|
522 | + } |
|
523 | + $create_certificate=get_lang('CreateCertificateWithTags'); |
|
524 | + Display::display_normal_message( |
|
525 | + $create_certificate.': <br /><br />'.$str_info, |
|
526 | + false |
|
527 | + ); |
|
528 | + } |
|
529 | + |
|
530 | + if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
531 | + Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
532 | + } |
|
533 | 533 | // HTML-editor |
534 | 534 | echo '<div class="page-create"> |
535 | 535 | <div class="row" style="overflow:hidden"> |
@@ -556,26 +556,26 @@ discard block |
||
556 | 556 | */ |
557 | 557 | function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc) |
558 | 558 | { |
559 | - $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
559 | + $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
560 | 560 | $rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file |
561 | - $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
562 | - |
|
563 | - if ($rename_to) { |
|
564 | - if (isset($dir) && $dir != '') { |
|
565 | - $source_file = $dir.$source_file; |
|
566 | - $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
567 | - } else { |
|
568 | - $source_file = '/'.$source_file; |
|
569 | - $new_full_file_name = '/'.$rename_to; |
|
570 | - } |
|
571 | - |
|
572 | - update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
561 | + $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
562 | + |
|
563 | + if ($rename_to) { |
|
564 | + if (isset($dir) && $dir != '') { |
|
565 | + $source_file = $dir.$source_file; |
|
566 | + $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
567 | + } else { |
|
568 | + $source_file = '/'.$source_file; |
|
569 | + $new_full_file_name = '/'.$rename_to; |
|
570 | + } |
|
571 | + |
|
572 | + update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
573 | 573 | Display::addFlash(Display::return_message(get_lang('fileModified'))); |
574 | 574 | |
575 | - return true; |
|
576 | - } else { |
|
575 | + return true; |
|
576 | + } else { |
|
577 | 577 | Display::addFlash(Display::return_message(get_lang('FileExists'))); |
578 | - } |
|
578 | + } |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | //return button back to |
@@ -586,32 +586,32 @@ discard block |
||
586 | 586 | global $parent_id; |
587 | 587 | $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id; |
588 | 588 | |
589 | - if ($is_certificate_mode) { |
|
590 | - $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
591 | - $actionsLeft .= '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
589 | + if ($is_certificate_mode) { |
|
590 | + $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
591 | + $actionsLeft .= '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
592 | 592 | Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
593 | 593 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
594 | - } elseif($call_from_tool=='slideshow') { |
|
595 | - $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
594 | + } elseif($call_from_tool=='slideshow') { |
|
595 | + $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
596 | 596 | Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('ViewSlideshow'),'',ICON_SIZE_MEDIUM).'</a>'; |
597 | - } elseif($call_from_tool=='editdraw') { |
|
598 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
597 | + } elseif($call_from_tool=='editdraw') { |
|
598 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
599 | 599 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
600 | - $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
601 | - } elseif($call_from_tool=='editodf') { |
|
600 | + $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
601 | + } elseif($call_from_tool=='editodf') { |
|
602 | 602 | $actionsLeft .= '<a href="'.$url.'">'. |
603 | 603 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
604 | 604 | $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Write'), array(), 32).'</a>'; |
605 | 605 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
606 | 606 | } elseif($call_from_tool=='editpaint'){ |
607 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
607 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
608 | 608 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), array(), ICON_SIZE_MEDIUM).'</a>'; |
609 | - $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
610 | - } else { |
|
611 | - $actionsLeft .= '<a href="'.$url.'">'. |
|
609 | + $actionsLeft .= '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
610 | + } else { |
|
611 | + $actionsLeft .= '<a href="'.$url.'">'. |
|
612 | 612 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
613 | 613 | $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>'; |
614 | - } |
|
614 | + } |
|
615 | 615 | |
616 | 616 | echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft)); |
617 | 617 | } |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | */ |
28 | 28 | // Resetting the images of the slideshow = destroying the slideshow |
29 | 29 | if (isset($_GET['action']) && $_GET['action'] == 'exit_slideshow') { |
30 | - $_SESSION['image_files_only'] = null; |
|
31 | - unset($image_files_only); |
|
30 | + $_SESSION['image_files_only'] = null; |
|
31 | + unset($image_files_only); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // We check if there are images in this folder by searching the extensions for .jpg, .gif, .png |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $array_to_search = !empty($documentAndFolders) && is_array($documentAndFolders) ? $documentAndFolders : array(); |
38 | 38 | |
39 | 39 | if (count($array_to_search) > 0) { |
40 | - while (list($key) = each($array_to_search)) { |
|
41 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
42 | - //echo basename($array_to_search[$key]['path']).'<br />'; |
|
43 | - } |
|
40 | + while (list($key) = each($array_to_search)) { |
|
41 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
42 | + //echo basename($array_to_search[$key]['path']).'<br />'; |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Always show gallery. |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | $tablename_column = isset($_GET['tablename_column']) ? Security::remove_XSS($_GET['tablename_column']) : 0; |
62 | 62 | if ($tablename_column == 0) { |
63 | - $tablename_column = 1; |
|
63 | + $tablename_column = 1; |
|
64 | 64 | } else { |
65 | - $tablename_column = intval($tablename_column) - 1; |
|
65 | + $tablename_column = intval($tablename_column) - 1; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $image_files_only = sort_files($array_to_search); |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | $final_array[] = $file_array[1]; |
97 | 97 | } |
98 | 98 | |
99 | - return $final_array; |
|
99 | + return $final_array; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | function sort_table($a, $b) { |
103 | - global $tablename_column; |
|
104 | - return strnatcmp($a[$tablename_column], $b[$tablename_column]); |
|
103 | + global $tablename_column; |
|
104 | + return strnatcmp($a[$tablename_column], $b[$tablename_column]); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | function rsort_table($a, $b) { |
108 | - global $tablename_column; |
|
109 | - return strnatcmp($b[$tablename_column], $a[$tablename_column]); |
|
108 | + global $tablename_column; |
|
109 | + return strnatcmp($b[$tablename_column], $a[$tablename_column]); |
|
110 | 110 | } |
@@ -10,67 +10,67 @@ discard block |
||
10 | 10 | // protect a course script |
11 | 11 | api_protect_course_script(true); |
12 | 12 | if (empty($id)) { |
13 | - $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : ''; |
|
14 | - if (empty($id)) { |
|
15 | - // If the ID was not provided, find the first matching description item given the item type |
|
16 | - $course_description = new CourseDescription(); |
|
17 | - $description = $course_description->get_data_by_description_type($description_type); |
|
18 | - if (count($description) > 0) { |
|
19 | - $id = $description['id']; |
|
20 | - } |
|
21 | - // If no corresponding description is found, edit a new one |
|
22 | - unset($course_description); |
|
23 | - } |
|
13 | + $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : ''; |
|
14 | + if (empty($id)) { |
|
15 | + // If the ID was not provided, find the first matching description item given the item type |
|
16 | + $course_description = new CourseDescription(); |
|
17 | + $description = $course_description->get_data_by_description_type($description_type); |
|
18 | + if (count($description) > 0) { |
|
19 | + $id = $description['id']; |
|
20 | + } |
|
21 | + // If no corresponding description is found, edit a new one |
|
22 | + unset($course_description); |
|
23 | + } |
|
24 | 24 | } |
25 | 25 | $original_id = $id; |
26 | 26 | |
27 | 27 | if (empty($error)) { |
28 | - $token = Security::get_token(); |
|
28 | + $token = Security::get_token(); |
|
29 | 29 | } |
30 | 30 | // display categories |
31 | 31 | $categories = array(); |
32 | 32 | foreach ($default_description_titles as $id => $title) { |
33 | - $categories[$id] = $title; |
|
33 | + $categories[$id] = $title; |
|
34 | 34 | } |
35 | 35 | $categories[ADD_BLOCK] = get_lang('NewBloc'); |
36 | 36 | |
37 | 37 | $i=1; |
38 | 38 | echo '<div class="actions" style="margin-bottom:30px">'; |
39 | 39 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
40 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
41 | - '</a>'; |
|
40 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
41 | + '</a>'; |
|
42 | 42 | |
43 | 43 | ksort($categories); |
44 | 44 | foreach ($categories as $id => $title) { |
45 | - if ($i==ADD_BLOCK) { |
|
46 | - echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
47 | - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
48 | - break; |
|
49 | - } else { |
|
50 | - echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
51 | - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
52 | - $i++; |
|
53 | - } |
|
45 | + if ($i==ADD_BLOCK) { |
|
46 | + echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
47 | + Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
48 | + break; |
|
49 | + } else { |
|
50 | + echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
51 | + Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
52 | + $i++; |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | echo '</div>'; |
56 | 56 | |
57 | 57 | // error messages |
58 | 58 | if (isset($error) && intval($error) == 1) { |
59 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); |
|
59 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // default header title form |
63 | 63 | $description_type = intval($description_type); |
64 | 64 | $header = $default_description_titles[$description_type]; |
65 | 65 | if ($description_type >= ADD_BLOCK) { |
66 | - $header = $default_description_titles[ADD_BLOCK]; |
|
66 | + $header = $default_description_titles[ADD_BLOCK]; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // display form |
70 | 70 | $form = new FormValidator( |
71 | - 'course_description', |
|
72 | - 'POST', |
|
73 | - 'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq() |
|
71 | + 'course_description', |
|
72 | + 'POST', |
|
73 | + 'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq() |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $form->addElement('header', $header); |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | $form->addText('title', get_lang('Title'), true, array('size' => '50')); |
81 | 81 | $form->applyFilter('title', 'html_filter'); |
82 | 82 | $form->addHtmlEditor( |
83 | - 'contentDescription', |
|
84 | - get_lang('Content'), |
|
85 | - true, |
|
86 | - false, |
|
87 | - array( |
|
88 | - 'ToolbarSet' => 'TrainingDescription', |
|
89 | - 'Width' => '100%', |
|
90 | - 'Height' => '200', |
|
91 | - ) |
|
83 | + 'contentDescription', |
|
84 | + get_lang('Content'), |
|
85 | + true, |
|
86 | + false, |
|
87 | + array( |
|
88 | + 'ToolbarSet' => 'TrainingDescription', |
|
89 | + 'Width' => '100%', |
|
90 | + 'Height' => '200', |
|
91 | + ) |
|
92 | 92 | ); |
93 | 93 | $form->addButtonCreate(get_lang('Save')); |
94 | 94 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | $form->setDefaults($default); |
105 | 105 | |
106 | 106 | if (isset ($question[$description_type])) { |
107 | - $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
108 | - $message .= $question[$description_type]; |
|
109 | - Display::display_normal_message($message, false); |
|
107 | + $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
108 | + $message .= $question[$description_type]; |
|
109 | + Display::display_normal_message($message, false); |
|
110 | 110 | } |
111 | 111 | $form->display(); |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | } |
19 | 19 | $categories[ADD_BLOCK] = get_lang('NewBloc'); |
20 | 20 | |
21 | - $i=1; |
|
22 | - echo '<div class="actions" style="margin-bottom:30px">'; |
|
23 | - ksort($categories); |
|
24 | - foreach ($categories as $id => $title) { |
|
25 | - if ($i==ADD_BLOCK) { |
|
26 | - echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
21 | + $i=1; |
|
22 | + echo '<div class="actions" style="margin-bottom:30px">'; |
|
23 | + ksort($categories); |
|
24 | + foreach ($categories as $id => $title) { |
|
25 | + if ($i==ADD_BLOCK) { |
|
26 | + echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
27 | 27 | Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>'; |
28 | - break; |
|
29 | - } else { |
|
30 | - echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
28 | + break; |
|
29 | + } else { |
|
30 | + echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
31 | 31 | Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>'; |
32 | - $i++; |
|
33 | - } |
|
34 | - } |
|
35 | - echo '</div>'; |
|
32 | + $i++; |
|
33 | + } |
|
34 | + } |
|
35 | + echo '</div>'; |
|
36 | 36 | } |
37 | 37 | $history = isset($history) ? $history : null; |
38 | 38 | |
39 | 39 | // display course description list |
40 | 40 | if ($history) { |
41 | - echo '<div> |
|
41 | + echo '<div> |
|
42 | 42 | <table width="100%"> |
43 | 43 | <tr> |
44 | 44 | <td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $user_info = api_get_user_info(); |
50 | 50 | |
51 | 51 | if (isset($descriptions) && count($descriptions) > 0) { |
52 | - foreach ($descriptions as $id => $description) { |
|
52 | + foreach ($descriptions as $id => $description) { |
|
53 | 53 | if (!empty($description)) { |
54 | 54 | $actions = ''; |
55 | 55 | if (api_is_allowed_to_edit(null,true) && !$history) { |
@@ -49,29 +49,29 @@ discard block |
||
49 | 49 | $extra_field_list = UserManager::get_extra_fields(); |
50 | 50 | $new_field_list = array(); |
51 | 51 | if (is_array($extra_field_list)) { |
52 | - foreach ($extra_field_list as $extra_field) { |
|
53 | - //if is enabled to filter and is a "<select>" field type |
|
54 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
52 | + foreach ($extra_field_list as $extra_field) { |
|
53 | + //if is enabled to filter and is a "<select>" field type |
|
54 | + if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
55 | 55 | $new_field_list[] = array( |
56 | 56 | 'name' => $extra_field[3], |
57 | 57 | 'variable' => $extra_field[1], |
58 | 58 | 'data' => $extra_field[9], |
59 | 59 | ); |
60 | - } |
|
61 | - } |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | function search_users($needle, $type) |
65 | 65 | { |
66 | - global $id_session; |
|
66 | + global $id_session; |
|
67 | 67 | |
68 | 68 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
69 | 69 | $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
70 | 70 | |
71 | - $xajax_response = new xajaxResponse(); |
|
72 | - $return = ''; |
|
71 | + $xajax_response = new xajaxResponse(); |
|
72 | + $return = ''; |
|
73 | 73 | |
74 | - if (!empty($needle) && !empty($type)) { |
|
74 | + if (!empty($needle) && !empty($type)) { |
|
75 | 75 | |
76 | 76 | //normal behaviour |
77 | 77 | if ($type == 'any_session' && $needle == 'false') { |
@@ -79,32 +79,32 @@ discard block |
||
79 | 79 | $needle = ''; |
80 | 80 | } |
81 | 81 | |
82 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
83 | - $charset = api_get_system_encoding(); |
|
84 | - $needle = Database::escape_string($needle); |
|
85 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
82 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
83 | + $charset = api_get_system_encoding(); |
|
84 | + $needle = Database::escape_string($needle); |
|
85 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
86 | 86 | |
87 | - $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
88 | - $cond_user_id = ''; |
|
87 | + $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
88 | + $cond_user_id = ''; |
|
89 | 89 | |
90 | 90 | //Only for single & multiple |
91 | 91 | if (in_array($type, array('single','multiple'))) { |
92 | - if (!empty($id_session)) { |
|
93 | - $id_session = intval($id_session); |
|
94 | - // check id_user from session_rel_user table |
|
95 | - $sql = 'SELECT user_id FROM '.$tbl_session_rel_user.' |
|
92 | + if (!empty($id_session)) { |
|
93 | + $id_session = intval($id_session); |
|
94 | + // check id_user from session_rel_user table |
|
95 | + $sql = 'SELECT user_id FROM '.$tbl_session_rel_user.' |
|
96 | 96 | WHERE session_id ="'.$id_session.'" AND relation_type<>'.SESSION_RELATION_TYPE_RRHH.' '; |
97 | - $res = Database::query($sql); |
|
98 | - $user_ids = array(); |
|
99 | - if (Database::num_rows($res) > 0) { |
|
100 | - while ($row = Database::fetch_row($res)) { |
|
101 | - $user_ids[] = (int)$row[0]; |
|
102 | - } |
|
103 | - } |
|
104 | - if (count($user_ids) > 0) { |
|
105 | - $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')'; |
|
106 | - } |
|
107 | - } |
|
97 | + $res = Database::query($sql); |
|
98 | + $user_ids = array(); |
|
99 | + if (Database::num_rows($res) > 0) { |
|
100 | + while ($row = Database::fetch_row($res)) { |
|
101 | + $user_ids[] = (int)$row[0]; |
|
102 | + } |
|
103 | + } |
|
104 | + if (count($user_ids) > 0) { |
|
105 | + $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')'; |
|
106 | + } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | switch ($type) { |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | user.status <> 6 '.$cond_user_id. |
137 | 137 | $order_clause; |
138 | 138 | break; |
139 | - } |
|
140 | - if (api_is_multiple_url_enabled()) { |
|
141 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
142 | - $access_url_id = api_get_current_access_url_id(); |
|
143 | - if ($access_url_id != -1) { |
|
139 | + } |
|
140 | + if (api_is_multiple_url_enabled()) { |
|
141 | + $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
142 | + $access_url_id = api_get_current_access_url_id(); |
|
143 | + if ($access_url_id != -1) { |
|
144 | 144 | switch ($type) { |
145 | 145 | case 'single': |
146 | 146 | $sql = 'SELECT user.user_id, username, lastname, firstname |
@@ -178,36 +178,36 @@ discard block |
||
178 | 178 | user.status<>6 '.$cond_user_id. |
179 | 179 | $order_clause; |
180 | 180 | break; |
181 | - } |
|
182 | - } |
|
183 | - } |
|
181 | + } |
|
182 | + } |
|
183 | + } |
|
184 | 184 | |
185 | - $rs = Database::query($sql); |
|
185 | + $rs = Database::query($sql); |
|
186 | 186 | $i=0; |
187 | - if ($type == 'single') { |
|
188 | - while ($user = Database::fetch_array($rs)) { |
|
189 | - $i++; |
|
190 | - if ($i<=10) { |
|
191 | - $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
192 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
|
193 | - } else { |
|
194 | - $return .= '...<br />'; |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
199 | - } else { |
|
200 | - $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
|
201 | - while ($user = Database :: fetch_array($rs)) { |
|
202 | - $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
203 | - $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
|
204 | - } |
|
205 | - $return .= '</select>'; |
|
206 | - $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
207 | - } |
|
208 | - } |
|
187 | + if ($type == 'single') { |
|
188 | + while ($user = Database::fetch_array($rs)) { |
|
189 | + $i++; |
|
190 | + if ($i<=10) { |
|
191 | + $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
192 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
|
193 | + } else { |
|
194 | + $return .= '...<br />'; |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
199 | + } else { |
|
200 | + $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
|
201 | + while ($user = Database :: fetch_array($rs)) { |
|
202 | + $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
203 | + $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
|
204 | + } |
|
205 | + $return .= '</select>'; |
|
206 | + $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | - return $xajax_response; |
|
210 | + return $xajax_response; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $xajax -> processRequests(); |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($use_extra_fields) { |
349 | 349 | $final_result = array(); |
350 | - if (count($extra_field_result)>1) { |
|
351 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
350 | + if (count($extra_field_result)>1) { |
|
351 | + for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
352 | 352 | if (is_array($extra_field_result[$i+1])) { |
353 | 353 | $final_result = array_intersect( |
354 | 354 | $extra_field_result[$i], |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | 'un' => $user['username'] |
427 | 427 | ); |
428 | 428 | unset($users[$uid]); |
429 | - } |
|
429 | + } |
|
430 | 430 | } |
431 | 431 | unset($users); //clean to free memory |
432 | 432 | |
@@ -471,13 +471,13 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | if ($add_type === 'multiple') { |
474 | - $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
475 | - $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
|
474 | + $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
475 | + $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
|
476 | 476 | } else { |
477 | - $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
|
478 | - $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
477 | + $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
|
478 | + $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
479 | 479 | } |
480 | - $link_add_group = '<a href="usergroups.php">'. |
|
480 | + $link_add_group = '<a href="usergroups.php">'. |
|
481 | 481 | Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>'; |
482 | 482 | ?> |
483 | 483 | <div class="actions"> |
@@ -487,30 +487,30 @@ discard block |
||
487 | 487 | <?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?> |
488 | 488 | <?php |
489 | 489 | if ($add_type === 'multiple') { |
490 | - if (is_array($extra_field_list)) { |
|
491 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
492 | - echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
493 | - foreach ($new_field_list as $new_field) { |
|
494 | - echo $new_field['name']; |
|
495 | - $varname = 'field_'.$new_field['variable']; |
|
496 | - echo ' <select name="'.$varname.'">'; |
|
497 | - echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
498 | - foreach ($new_field['data'] as $option) { |
|
499 | - $checked=''; |
|
500 | - if (isset($_POST[$varname])) { |
|
501 | - if ($_POST[$varname] == $option[1]) { |
|
502 | - $checked = 'selected="true"'; |
|
503 | - } |
|
504 | - } |
|
505 | - echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
506 | - } |
|
507 | - echo '</select>'; |
|
508 | - echo ' '; |
|
509 | - } |
|
510 | - echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
511 | - echo '<br /><br />'; |
|
512 | - } |
|
513 | - } |
|
490 | + if (is_array($extra_field_list)) { |
|
491 | + if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
492 | + echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
493 | + foreach ($new_field_list as $new_field) { |
|
494 | + echo $new_field['name']; |
|
495 | + $varname = 'field_'.$new_field['variable']; |
|
496 | + echo ' <select name="'.$varname.'">'; |
|
497 | + echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
498 | + foreach ($new_field['data'] as $option) { |
|
499 | + $checked=''; |
|
500 | + if (isset($_POST[$varname])) { |
|
501 | + if ($_POST[$varname] == $option[1]) { |
|
502 | + $checked = 'selected="true"'; |
|
503 | + } |
|
504 | + } |
|
505 | + echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
506 | + } |
|
507 | + echo '</select>'; |
|
508 | + echo ' '; |
|
509 | + } |
|
510 | + echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
511 | + echo '<br /><br />'; |
|
512 | + } |
|
513 | + } |
|
514 | 514 | } |
515 | 515 | ?> |
516 | 516 | <input type="hidden" name="form_sent" value="1" /> |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <div id="content_source"> |
534 | 534 | <?php |
535 | 535 | if (!($add_type == 'multiple')) { |
536 | - ?> |
|
536 | + ?> |
|
537 | 537 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
538 | 538 | <div id="ajax_list_users_single"></div> |
539 | 539 | <?php |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | <div id="ajax_list_users_multiple"> |
543 | 543 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="span5"> |
544 | 544 | <?php |
545 | - foreach ($nosessionUsersList as $uid => $enreg) { |
|
546 | - ?> |
|
545 | + foreach ($nosessionUsersList as $uid => $enreg) { |
|
546 | + ?> |
|
547 | 547 | <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
548 | 548 | <?php |
549 | - } |
|
550 | - ?> |
|
549 | + } |
|
550 | + ?> |
|
551 | 551 | </select> |
552 | 552 | </div> |
553 | 553 | <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id"> |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | <?php |
556 | 556 | } |
557 | 557 | unset($nosessionUsersList); |
558 | - ?> |
|
558 | + ?> |
|
559 | 559 | </div> |
560 | 560 | </div> |
561 | 561 | |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | <br /> |
583 | 583 | <br /> |
584 | 584 | <?php |
585 | - if (isset($_GET['add'])) { |
|
586 | - echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
585 | + if (isset($_GET['add'])) { |
|
586 | + echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
587 | 587 | } else { |
588 | 588 | //@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed) |
589 | - echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
|
589 | + echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
|
590 | 590 | } |
591 | - ?> |
|
591 | + ?> |
|
592 | 592 | </div> |
593 | 593 | <div class="span5"> |
594 | 594 | <div class="multiple_select_header"> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $filename = 'reporting.xlsx'; |
13 | 13 | |
14 | 14 | if (!api_is_allowed_to_create_course()) { |
15 | - api_not_allowed(true); |
|
15 | + api_not_allowed(true); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $user_id = api_get_user_id(); |
@@ -23,226 +23,226 @@ discard block |
||
23 | 23 | $session_id = 0; |
24 | 24 | |
25 | 25 | if (!empty($my_courses)) { |
26 | - foreach ($my_courses as $course) { |
|
27 | - $course_code = $course['code']; |
|
28 | - $course_id = $course['real_id']; |
|
29 | - $course_info = api_get_course_info($course_code); |
|
30 | - |
|
31 | - //Only show open courses |
|
32 | - if ($course_info['visibility'] == 0) { |
|
33 | - continue; |
|
34 | - } |
|
35 | - |
|
36 | - $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | - $teacher_list = array(); |
|
38 | - |
|
39 | - if (!empty($teachers)) { |
|
40 | - foreach($teachers as $teacher) { |
|
41 | - $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | - |
|
47 | - //Cleaning students only REAL students |
|
48 | - $students = array(); |
|
49 | - foreach ($tmp_students as $student) { |
|
50 | - $user_info = api_get_user_info($student['user_id']); |
|
51 | - if ($user_info['status'] != STUDENT) { |
|
52 | - continue; |
|
53 | - } |
|
54 | - $students[] = $student['user_id']; |
|
55 | - } |
|
56 | - |
|
57 | - $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | - $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
26 | + foreach ($my_courses as $course) { |
|
27 | + $course_code = $course['code']; |
|
28 | + $course_id = $course['real_id']; |
|
29 | + $course_info = api_get_course_info($course_code); |
|
30 | + |
|
31 | + //Only show open courses |
|
32 | + if ($course_info['visibility'] == 0) { |
|
33 | + continue; |
|
34 | + } |
|
35 | + |
|
36 | + $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | + $teacher_list = array(); |
|
38 | + |
|
39 | + if (!empty($teachers)) { |
|
40 | + foreach($teachers as $teacher) { |
|
41 | + $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | + |
|
47 | + //Cleaning students only REAL students |
|
48 | + $students = array(); |
|
49 | + foreach ($tmp_students as $student) { |
|
50 | + $user_info = api_get_user_info($student['user_id']); |
|
51 | + if ($user_info['status'] != STUDENT) { |
|
52 | + continue; |
|
53 | + } |
|
54 | + $students[] = $student['user_id']; |
|
55 | + } |
|
56 | + |
|
57 | + $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | + $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
59 | 59 | WHERE c_id = $course_id AND lp.session_id = 0"; |
60 | - $rs_lp = Database::query($sql_lp); |
|
61 | - $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | - $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | - |
|
64 | - $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | - $course_id, |
|
66 | - $session_id |
|
67 | - ); |
|
68 | - |
|
69 | - $total_tools = 0; |
|
70 | - foreach($total_tools_list as $tool) { |
|
71 | - $total_tools += $tool['count_access_tool']; |
|
72 | - } |
|
73 | - |
|
74 | - if (Database :: num_rows($rs_lp) > 0) { |
|
75 | - while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | - $lp_id = $learnpath['id']; |
|
77 | - |
|
78 | - $lp_items = |
|
79 | - $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | - |
|
81 | - $array[$i]['teachers'] = ''; |
|
82 | - if (!empty($teacher_list)) { |
|
83 | - $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | - } |
|
85 | - |
|
86 | - $array[$i]['course_name'] = $course['title']; |
|
87 | - $count_students_accessing = 0; |
|
88 | - $count_students_complete_all_activities = 0; |
|
89 | - $count_students_complete_all_activities_at_50 = 0; |
|
90 | - $total_time_spent = 0; |
|
91 | - $total_average_progress = 0; |
|
92 | - |
|
93 | - if (!empty($students)) { |
|
94 | - foreach ($students as $student_id) { |
|
95 | - $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | - $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | - $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | - |
|
99 | - if (intval($avg_progress_in_course) == 100) { |
|
100 | - $count_students_complete_all_activities++; |
|
101 | - } |
|
102 | - if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | - $count_students_complete_all_activities_at_50 ++; |
|
104 | - } |
|
105 | - $total_average_progress +=$avg_progress_in_course; |
|
106 | - |
|
107 | - $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | - $total_time_spent += $time_spent; |
|
109 | - if (!empty($time_spent)) { |
|
110 | - $count_students_accessing++; |
|
111 | - } |
|
112 | - } |
|
113 | - //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | - } |
|
115 | - |
|
116 | - $student_count = count($students); |
|
117 | - |
|
118 | - $array[$i]['count_students'] = $student_count; |
|
119 | - $array[$i]['count_students_accessing'] = 0; |
|
120 | - $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | - $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | - $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | - $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | - $array[$i]['total_time_spent'] = 0; |
|
125 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | - $array[$i]['total_time_spent'] = 0; |
|
127 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | - //$array[$i]['tools_used'] = 0; |
|
129 | - $array[$i]['learnpath_docs'] = 0; |
|
130 | - $array[$i]['learnpath_exercises'] = 0; |
|
131 | - $array[$i]['learnpath_links'] = 0; |
|
132 | - $array[$i]['learnpath_forums'] = 0; |
|
133 | - $array[$i]['learnpath_assignments'] = 0; |
|
134 | - |
|
135 | - //registering the number of each category of |
|
136 | - //items in learning path |
|
137 | - $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
60 | + $rs_lp = Database::query($sql_lp); |
|
61 | + $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | + $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | + |
|
64 | + $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | + $course_id, |
|
66 | + $session_id |
|
67 | + ); |
|
68 | + |
|
69 | + $total_tools = 0; |
|
70 | + foreach($total_tools_list as $tool) { |
|
71 | + $total_tools += $tool['count_access_tool']; |
|
72 | + } |
|
73 | + |
|
74 | + if (Database :: num_rows($rs_lp) > 0) { |
|
75 | + while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | + $lp_id = $learnpath['id']; |
|
77 | + |
|
78 | + $lp_items = |
|
79 | + $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | + |
|
81 | + $array[$i]['teachers'] = ''; |
|
82 | + if (!empty($teacher_list)) { |
|
83 | + $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | + } |
|
85 | + |
|
86 | + $array[$i]['course_name'] = $course['title']; |
|
87 | + $count_students_accessing = 0; |
|
88 | + $count_students_complete_all_activities = 0; |
|
89 | + $count_students_complete_all_activities_at_50 = 0; |
|
90 | + $total_time_spent = 0; |
|
91 | + $total_average_progress = 0; |
|
92 | + |
|
93 | + if (!empty($students)) { |
|
94 | + foreach ($students as $student_id) { |
|
95 | + $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | + $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | + $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | + |
|
99 | + if (intval($avg_progress_in_course) == 100) { |
|
100 | + $count_students_complete_all_activities++; |
|
101 | + } |
|
102 | + if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | + $count_students_complete_all_activities_at_50 ++; |
|
104 | + } |
|
105 | + $total_average_progress +=$avg_progress_in_course; |
|
106 | + |
|
107 | + $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | + $total_time_spent += $time_spent; |
|
109 | + if (!empty($time_spent)) { |
|
110 | + $count_students_accessing++; |
|
111 | + } |
|
112 | + } |
|
113 | + //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | + } |
|
115 | + |
|
116 | + $student_count = count($students); |
|
117 | + |
|
118 | + $array[$i]['count_students'] = $student_count; |
|
119 | + $array[$i]['count_students_accessing'] = 0; |
|
120 | + $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | + $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | + $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | + $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | + $array[$i]['total_time_spent'] = 0; |
|
125 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | + $array[$i]['total_time_spent'] = 0; |
|
127 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | + //$array[$i]['tools_used'] = 0; |
|
129 | + $array[$i]['learnpath_docs'] = 0; |
|
130 | + $array[$i]['learnpath_exercises'] = 0; |
|
131 | + $array[$i]['learnpath_links'] = 0; |
|
132 | + $array[$i]['learnpath_forums'] = 0; |
|
133 | + $array[$i]['learnpath_assignments'] = 0; |
|
134 | + |
|
135 | + //registering the number of each category of |
|
136 | + //items in learning path |
|
137 | + $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
138 | 138 | WHERE c_id = $course_id AND lpi.lp_id = $lp_id |
139 | 139 | ORDER BY item_type"; |
140 | - $res_lpi = Database::query($sql_lpi); |
|
141 | - while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | - switch($row_lpi['item_type']) { |
|
143 | - case 'document': |
|
144 | - $array[$i]['learnpath_docs']++; |
|
145 | - break; |
|
146 | - case 'quiz': |
|
147 | - $array[$i]['learnpath_exercises']++; |
|
148 | - break; |
|
149 | - case 'link': |
|
150 | - $array[$i]['learnpath_links']++; |
|
151 | - break; |
|
152 | - case 'forum': |
|
153 | - case 'thread': |
|
154 | - $array[$i]['learnpath_forums']++; |
|
155 | - break; |
|
156 | - case 'student_publication': |
|
157 | - $array[$i]['learnpath_assignments']++; |
|
158 | - break; |
|
159 | - } |
|
160 | - } |
|
161 | - // Count announcements |
|
162 | - $array[$i]['total_announcements'] = 0; |
|
163 | - $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | - $res_news = Database::query($sql_news); |
|
165 | - while ($row_news = Database::fetch_array($res_news)) { |
|
166 | - $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | - } |
|
168 | - |
|
169 | - //@todo don't know what means this value |
|
170 | - $count_students_complete_all_activities_at_50 = 0; |
|
171 | - |
|
172 | - if (!empty($student_count)) { |
|
173 | - $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | - $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | - $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | - $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | - $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | - $array[$i]['total_time_spent'] = 0; |
|
179 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | - |
|
181 | - if (!empty($total_time_spent)) { |
|
182 | - $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | - $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | - } |
|
185 | - //$array[$i]['tools_used'] = $total_tools; |
|
186 | - } |
|
187 | - $i++; |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
140 | + $res_lpi = Database::query($sql_lpi); |
|
141 | + while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | + switch($row_lpi['item_type']) { |
|
143 | + case 'document': |
|
144 | + $array[$i]['learnpath_docs']++; |
|
145 | + break; |
|
146 | + case 'quiz': |
|
147 | + $array[$i]['learnpath_exercises']++; |
|
148 | + break; |
|
149 | + case 'link': |
|
150 | + $array[$i]['learnpath_links']++; |
|
151 | + break; |
|
152 | + case 'forum': |
|
153 | + case 'thread': |
|
154 | + $array[$i]['learnpath_forums']++; |
|
155 | + break; |
|
156 | + case 'student_publication': |
|
157 | + $array[$i]['learnpath_assignments']++; |
|
158 | + break; |
|
159 | + } |
|
160 | + } |
|
161 | + // Count announcements |
|
162 | + $array[$i]['total_announcements'] = 0; |
|
163 | + $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | + $res_news = Database::query($sql_news); |
|
165 | + while ($row_news = Database::fetch_array($res_news)) { |
|
166 | + $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | + } |
|
168 | + |
|
169 | + //@todo don't know what means this value |
|
170 | + $count_students_complete_all_activities_at_50 = 0; |
|
171 | + |
|
172 | + if (!empty($student_count)) { |
|
173 | + $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | + $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | + $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | + $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | + $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | + $array[$i]['total_time_spent'] = 0; |
|
179 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | + |
|
181 | + if (!empty($total_time_spent)) { |
|
182 | + $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | + $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | + } |
|
185 | + //$array[$i]['tools_used'] = $total_tools; |
|
186 | + } |
|
187 | + $i++; |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $headers = array( |
194 | - get_lang('LearningPath'), |
|
195 | - get_lang('Teachers'), |
|
196 | - get_lang('Courses'), |
|
197 | - get_lang('NumberOfStudents'), |
|
198 | - get_lang('NumberStudentsAccessingCourse'), |
|
199 | - get_lang('PercentageStudentsAccessingCourse'), |
|
200 | - get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | - get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | - get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | - get_lang('TotalTimeSpentInTheCourse'), |
|
204 | - get_lang('AverageTimePerStudentInCourse'), |
|
205 | - get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | - get_lang('NumberOfExercisesInLearnpath'), |
|
207 | - get_lang('NumberOfLinksInLearnpath'), |
|
208 | - get_lang('NumberOfForumsInLearnpath'), |
|
209 | - get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | - get_lang('NumberOfAnnouncementsInCourse'), |
|
194 | + get_lang('LearningPath'), |
|
195 | + get_lang('Teachers'), |
|
196 | + get_lang('Courses'), |
|
197 | + get_lang('NumberOfStudents'), |
|
198 | + get_lang('NumberStudentsAccessingCourse'), |
|
199 | + get_lang('PercentageStudentsAccessingCourse'), |
|
200 | + get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | + get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | + get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | + get_lang('TotalTimeSpentInTheCourse'), |
|
204 | + get_lang('AverageTimePerStudentInCourse'), |
|
205 | + get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | + get_lang('NumberOfExercisesInLearnpath'), |
|
207 | + get_lang('NumberOfLinksInLearnpath'), |
|
208 | + get_lang('NumberOfForumsInLearnpath'), |
|
209 | + get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | + get_lang('NumberOfAnnouncementsInCourse'), |
|
211 | 211 | ); |
212 | 212 | |
213 | 213 | if (isset($_GET['export'])) { |
214 | - global $charset; |
|
214 | + global $charset; |
|
215 | 215 | $spreadsheet = new PHPExcel(); |
216 | 216 | $spreadsheet->setActiveSheetIndex(0); |
217 | 217 | $worksheet = $spreadsheet->getActiveSheet(); |
218 | 218 | |
219 | - $line = 0; |
|
220 | - $column = 0; //skip the first column (row titles) |
|
221 | - |
|
222 | - foreach ($headers as $header) { |
|
223 | - $worksheet->setCellValueByColumnAndRow($column, $line, $header); |
|
224 | - $column++; |
|
225 | - } |
|
226 | - $line++; |
|
227 | - foreach ($array as $row) { |
|
228 | - $column = 0; |
|
229 | - foreach ($row as $item) { |
|
219 | + $line = 0; |
|
220 | + $column = 0; //skip the first column (row titles) |
|
221 | + |
|
222 | + foreach ($headers as $header) { |
|
223 | + $worksheet->setCellValueByColumnAndRow($column, $line, $header); |
|
224 | + $column++; |
|
225 | + } |
|
226 | + $line++; |
|
227 | + foreach ($array as $row) { |
|
228 | + $column = 0; |
|
229 | + foreach ($row as $item) { |
|
230 | 230 | $worksheet->setCellValueByColumnAndRow( |
231 | 231 | $column, |
232 | 232 | $line, |
233 | 233 | html_entity_decode(strip_tags($item)) |
234 | 234 | ); |
235 | - $column++; |
|
236 | - } |
|
237 | - $line++; |
|
238 | - } |
|
239 | - $line++; |
|
235 | + $column++; |
|
236 | + } |
|
237 | + $line++; |
|
238 | + } |
|
239 | + $line++; |
|
240 | 240 | |
241 | 241 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
242 | 242 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
243 | 243 | $writer->save($file); |
244 | 244 | DocumentManager::file_send_for_download($file, true, $filename); |
245 | - exit; |
|
245 | + exit; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace')); |
@@ -253,20 +253,20 @@ discard block |
||
253 | 253 | $row = 0; |
254 | 254 | $column = 0; |
255 | 255 | foreach ($headers as $header) { |
256 | - $table->setHeaderContents($row, $column, $header); |
|
257 | - $column++; |
|
256 | + $table->setHeaderContents($row, $column, $header); |
|
257 | + $column++; |
|
258 | 258 | } |
259 | 259 | $row++; |
260 | 260 | |
261 | 261 | foreach ($array as $row_table) { |
262 | - $column = 0; |
|
263 | - foreach ($row_table as $cell) { |
|
264 | - $table->setCellContents($row, $column, $cell); |
|
265 | - //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
266 | - $column++; |
|
267 | - } |
|
268 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
269 | - $row++; |
|
262 | + $column = 0; |
|
263 | + foreach ($row_table as $cell) { |
|
264 | + $table->setCellContents($row, $column, $cell); |
|
265 | + //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
266 | + $column++; |
|
267 | + } |
|
268 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
269 | + $row++; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | echo '<div class="actions">'; |
@@ -109,23 +109,23 @@ discard block |
||
109 | 109 | $form->addGroup($html_results_enabled); |
110 | 110 | // Validate form |
111 | 111 | if ($form->validate()) { |
112 | - $check = Security::check_token('post'); |
|
113 | - if ($check) { |
|
114 | - $user = $form->exportValues(); |
|
115 | - $email = $userInfo['email']; |
|
112 | + $check = Security::check_token('post'); |
|
113 | + if ($check) { |
|
114 | + $user = $form->exportValues(); |
|
115 | + $email = $userInfo['email']; |
|
116 | 116 | $username = $userInfo['username']; |
117 | - $send_mail = intval($user['mail']['send_mail']); |
|
117 | + $send_mail = intval($user['mail']['send_mail']); |
|
118 | 118 | $auth_source = PLATFORM_AUTH_SOURCE; |
119 | 119 | |
120 | 120 | $resetPassword = $user['password']['password_auto'] == '1' ? 0 : 2; |
121 | 121 | |
122 | - if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') { |
|
123 | - //$auth_source = $user['password']['auth_source']; |
|
124 | - //$password = 'PLACEHOLDER'; |
|
125 | - } else { |
|
126 | - //$auth_source = PLATFORM_AUTH_SOURCE; |
|
127 | - //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
128 | - } |
|
122 | + if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') { |
|
123 | + //$auth_source = $user['password']['auth_source']; |
|
124 | + //$password = 'PLACEHOLDER'; |
|
125 | + } else { |
|
126 | + //$auth_source = PLATFORM_AUTH_SOURCE; |
|
127 | + //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
128 | + } |
|
129 | 129 | |
130 | 130 | $auth_source = $userInfo['auth_source']; |
131 | 131 | $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | $resetPassword |
154 | 154 | ); |
155 | 155 | |
156 | - if (!empty($email) && $send_mail) { |
|
157 | - $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); |
|
158 | - $portal_url = api_get_path(WEB_PATH); |
|
159 | - if (api_is_multiple_url_enabled()) { |
|
160 | - $access_url_id = api_get_current_access_url_id(); |
|
161 | - if ($access_url_id != -1) { |
|
162 | - $url = api_get_access_url($access_url_id); |
|
163 | - $portal_url = $url['url']; |
|
164 | - } |
|
165 | - } |
|
166 | - |
|
167 | - $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n". |
|
156 | + if (!empty($email) && $send_mail) { |
|
157 | + $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); |
|
158 | + $portal_url = api_get_path(WEB_PATH); |
|
159 | + if (api_is_multiple_url_enabled()) { |
|
160 | + $access_url_id = api_get_current_access_url_id(); |
|
161 | + if ($access_url_id != -1) { |
|
162 | + $url = api_get_access_url($access_url_id); |
|
163 | + $portal_url = $url['url']; |
|
164 | + } |
|
165 | + } |
|
166 | + |
|
167 | + $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n". |
|
168 | 168 | get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n". |
169 | 169 | get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" . |
170 | 170 | get_lang('Address') ." ". api_get_setting('siteName') ." ". |
@@ -178,26 +178,26 @@ discard block |
||
178 | 178 | get_lang('Email') ." : ".api_get_setting('emailAdministrator'); |
179 | 179 | $emailbody = nl2br($emailbody); |
180 | 180 | |
181 | - api_mail_html( |
|
181 | + api_mail_html( |
|
182 | 182 | api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), |
183 | 183 | $email, |
184 | 184 | $emailsubject, |
185 | 185 | $emailbody |
186 | 186 | ); |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - Security::clear_token(); |
|
189 | + Security::clear_token(); |
|
190 | 190 | $tok = Security::get_token(); |
191 | 191 | header('Location: '.$url.'&message=1'); |
192 | 192 | exit(); |
193 | - } |
|
193 | + } |
|
194 | 194 | } else { |
195 | - if (isset($_POST['submit'])) { |
|
196 | - Security::clear_token(); |
|
197 | - } |
|
198 | - $token = Security::get_token(); |
|
199 | - $form->addElement('hidden', 'sec_token'); |
|
200 | - $form->setConstants(array('sec_token' => $token)); |
|
195 | + if (isset($_POST['submit'])) { |
|
196 | + Security::clear_token(); |
|
197 | + } |
|
198 | + $token = Security::get_token(); |
|
199 | + $form->addElement('hidden', 'sec_token'); |
|
200 | + $form->setConstants(array('sec_token' => $token)); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $interbreadcrumb[] = array( |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | Display::display_header($tool_name); |
210 | 210 | |
211 | 211 | if (isset($_REQUEST['message'])) { |
212 | - Display::display_normal_message(get_lang('Updated')); |
|
212 | + Display::display_normal_message(get_lang('Updated')); |
|
213 | 213 | } |
214 | 214 | $form->display(); |
215 | 215 |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | if ($is_drh) { |
105 | - $view = 'drh'; |
|
105 | + $view = 'drh'; |
|
106 | 106 | $menu_items[] = Display::url( |
107 | 107 | Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), |
108 | 108 | '#' |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | echo "</div><br />"; |
162 | 162 | } |
163 | 163 | } else { |
164 | - echo Display::url( |
|
164 | + echo Display::url( |
|
165 | 165 | Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM), |
166 | 166 | api_get_path(WEB_CODE_PATH)."auth/my_progress.php" |
167 | 167 | ); |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | |
432 | 432 | // Send the csv file if asked |
433 | 433 | if ($export_csv) { |
434 | - ob_end_clean(); |
|
435 | - Export :: arrayToCsv($csv_content, 'reporting_index'); |
|
436 | - exit; |
|
434 | + ob_end_clean(); |
|
435 | + Export :: arrayToCsv($csv_content, 'reporting_index'); |
|
436 | + exit; |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | if (!$export_csv) { |
440 | - Display::display_footer(); |
|
440 | + Display::display_footer(); |
|
441 | 441 | } |
@@ -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'); |