Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent 613a560bb3
commit a9a8ec5a55
  1. 120
      main/course_info/infocours.php
  2. 8
      main/dashboard/dashboard.php
  3. 14
      main/document/record_audio.php
  4. 48
      main/exercise/fill_blanks.class.php
  5. 42
      main/exercise/global_multiple_answer.class.php
  6. 36
      main/exercise/multiple_answer_combination.class.php
  7. 18
      main/gradebook/gradebook_display_certificate.php
  8. 72
      main/gradebook/lib/flatview_data_generator.class.php
  9. 14
      main/inc/ajax/course.ajax.php
  10. 86
      main/inc/ajax/course_home.ajax.php
  11. 12
      main/inc/ajax/user_manager.ajax.php
  12. 48
      main/inc/lib/notebook.lib.php
  13. 50
      main/inc/lib/urlmanager.lib.php
  14. 68
      main/session/add_users_to_session.php
  15. 32
      main/social/invitations.php
  16. 26
      main/ticket/new_ticket.php
  17. 6
      main/work/upload_corrections.php
  18. 20
      plugin/vchamilo/lib/Virtual.php
  19. 10
      plugin/vchamilo/views/manage.controller.php
  20. 2
      src/Chamilo/CoreBundle/Component/Editor/Editor.php

@ -15,7 +15,7 @@
*/ */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_SETTING; $current_course_tool = TOOL_COURSE_SETTING;
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$nameTools = get_lang('ModifInfo'); $nameTools = get_lang('ModifInfo');
@ -106,7 +106,7 @@ $form->addHtml('
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-course-settings" aria-expanded="true" aria-controls="collapse-course-settings"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-course-settings" aria-expanded="true" aria-controls="collapse-course-settings">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('settings.png', get_lang('CourseSettings')) . ' ' . get_lang('CourseSettings') Display::return_icon('settings.png', get_lang('CourseSettings')).' '.get_lang('CourseSettings')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -120,11 +120,11 @@ $form->addHtml('
$image = ''; $image = '';
// Display course picture // Display course picture
$course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository; // course path $course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository; // course path
if (file_exists($course_path.'/course-pic85x85.png')) { if (file_exists($course_path.'/course-pic85x85.png')) {
$course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository; // course web path $course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository; // course web path
$course_medium_image = $course_web_path.'/course-pic85x85.png?'.rand(1, 1000); // redimensioned image 85x85 $course_medium_image = $course_web_path.'/course-pic85x85.png?'.rand(1, 1000); // redimensioned image 85x85
$image = '<div class="row"><label class="col-md-2 control-label">'.get_lang('Image').'</label> $image = '<div class="row"><label class="col-md-2 control-label">'.get_lang('Image').'</label>
<div class="col-md-8"><img src="'.$course_medium_image.'" /></div></div>'; <div class="col-md-8"><img src="'.$course_medium_image.'" /></div></div>';
} }
$form->addHtml($image); $form->addHtml($image);
@ -176,11 +176,11 @@ $form->addRule(
$form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture')); $form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture'));
if (api_get_setting('pdf_export_watermark_by_course') == 'true') { if (api_get_setting('pdf_export_watermark_by_course') == 'true') {
$url = PDF::get_watermark($course_code); $url = PDF::get_watermark($course_code);
$form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, array('size' => '60')); $form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, array('size' => '60'));
$form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
if ($url != false) { if ($url != false) {
$delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png',get_lang('DelImage')).'</a>'; $delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png', get_lang('DelImage')).'</a>';
$form->addElement('html', '<div class="row"><div class="formw"><a href="'.$url.'">'.$url.' '.$delete_url.'</a></div></div>'); $form->addElement('html', '<div class="row"><div class="formw"><a href="'.$url.'">'.$url.' '.$delete_url.'</a></div></div>');
} }
$form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); $form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
@ -198,7 +198,7 @@ if (api_get_setting('allow_course_theme') == 'true') {
} }
$form->addElement('label', get_lang('DocumentQuota'), format_file_size(DocumentManager::get_course_quota())); $form->addElement('label', get_lang('DocumentQuota'), format_file_size(DocumentManager::get_course_quota()));
$form->addButtonSave(get_lang('SaveSettings'),'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
$form->addHtml(' $form->addHtml('
</div> </div>
</div> </div>
@ -214,7 +214,7 @@ $form->addHtml('
'); ');
$form->addElement( $form->addElement(
'html', 'html',
Display::return_icon('course.png', get_lang('CourseAccess')) . ' ' . get_lang('CourseAccess') Display::return_icon('course.png', get_lang('CourseAccess')).' '.get_lang('CourseAccess')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -228,13 +228,13 @@ $form->addHtml('
'); ');
$group = array(); $group = array();
$group[]= $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); $group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); $group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); $group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
// The "hidden" visibility is only available to portal admins // The "hidden" visibility is only available to portal admins
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
} }
$form->addGroup($group, '', array(get_lang("CourseAccess"), get_lang("CourseAccessConfigTip"))); $form->addGroup($group, '', array(get_lang("CourseAccess"), get_lang("CourseAccessConfigTip")));
@ -243,13 +243,13 @@ $url = Display::url($url, $url);
$form->addElement('label', get_lang('DirectLink'), sprintf(get_lang('CourseSettingsRegisterDirectLink'), $url)); $form->addElement('label', get_lang('DirectLink'), sprintf(get_lang('CourseSettingsRegisterDirectLink'), $url));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); $group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$group[]=$form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); $group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
$form->addGroup($group, '', array(get_lang("Subscription"))); $form->addGroup($group, '', array(get_lang("Subscription")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1); $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
$group[]=$form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
$form->addGroup($group, '', array(get_lang("Unsubscription"))); $form->addGroup($group, '', array(get_lang("Unsubscription")));
$form->addText('course_registration_password', get_lang('CourseRegistrationPassword'), false, array('size' => '60')); $form->addText('course_registration_password', get_lang('CourseRegistrationPassword'), false, array('size' => '60'));
@ -272,7 +272,7 @@ $form->addHtml('
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-documents" aria-expanded="false" aria-controls="collapse-documents"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-documents" aria-expanded="false" aria-controls="collapse-documents">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('folder.png', get_lang('Documents')) . ' ' . get_lang('Documents') Display::return_icon('folder.png', get_lang('Documents')).' '.get_lang('Documents')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -313,7 +313,7 @@ $form->addHtml('
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-email-notifications" aria-expanded="false" aria-controls="collapse-email-notifications"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-email-notifications" aria-expanded="false" aria-controls="collapse-email-notifications">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('mail.png', get_lang('EmailNotifications')) . ' ' . get_lang('EmailNotifications') Display::return_icon('mail.png', get_lang('EmailNotifications')).' '.get_lang('EmailNotifications')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -325,31 +325,31 @@ $form->addHtml('
<div class="panel-body"> <div class="panel-body">
'); ');
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1); $group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertToTeacharAndTutor'), 2); $group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertToTeacharAndTutor'), 2);
$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0); $group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
$form->addGroup($group, '', array(get_lang("NewUserEmailAlert"))); $form->addGroup($group, '', array(get_lang("NewUserEmailAlert")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'email_alert_students_on_new_homework', get_lang('NewHomeworkEmailAlert'), get_lang('NewHomeworkEmailAlertEnable'), 1); $group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', get_lang('NewHomeworkEmailAlert'), get_lang('NewHomeworkEmailAlertEnable'), 1);
$group[]=$form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertDisable'), 0); $group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertDisable'), 0);
$form->addGroup($group, '', array(get_lang("NewHomeworkEmailAlert"))); $form->addGroup($group, '', array(get_lang("NewHomeworkEmailAlert")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForTeachers'), 3); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForTeachers'), 3);
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForStudents'), 2); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForStudents'), 2);
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("WorkEmailAlert"))); $form->addGroup($group, '', array(get_lang("WorkEmailAlert")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1); $group[] = $form->createElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
$group[]=$form->createElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0); $group[] = $form->createElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("DropboxEmailAlert"))); $form->addGroup($group, '', array(get_lang("DropboxEmailAlert")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
$group[]=$form->createElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0); $group[] = $form->createElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("QuizEmailAlert"))); $form->addGroup($group, '', array(get_lang("QuizEmailAlert")));
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
@ -367,7 +367,7 @@ $form->addHtml('
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-user-right" aria-expanded="false" aria-controls="collapse-user-right"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-user-right" aria-expanded="false" aria-controls="collapse-user-right">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('user.png', get_lang('UserRights')) . ' ' . get_lang('UserRights') Display::return_icon('user.png', get_lang('UserRights')).' '.get_lang('UserRights')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -380,23 +380,23 @@ $form->addHtml('
'); ');
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1); $group[] = $form->createElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
$group[]=$form->createElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0); $group[] = $form->createElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("AllowUserEditAgenda"))); $form->addGroup($group, '', array(get_lang("AllowUserEditAgenda")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1); $group[] = $form->createElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
$group[]=$form->createElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0); $group[] = $form->createElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("AllowUserEditAnnouncement"))); $form->addGroup($group, '', array(get_lang("AllowUserEditAnnouncement")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1); $group[] = $form->createElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
$group[]=$form->createElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0); $group[] = $form->createElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("AllowUserImageForum"))); $form->addGroup($group, '', array(get_lang("AllowUserImageForum")));
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_user_view_user_list', get_lang('AllowUserViewUserList'), get_lang('AllowUserViewUserListActivate'), 1); $group[] = $form->createElement('radio', 'allow_user_view_user_list', get_lang('AllowUserViewUserList'), get_lang('AllowUserViewUserListActivate'), 1);
$group[]=$form->createElement('radio', 'allow_user_view_user_list', null, get_lang('AllowUserViewUserListDeactivate'), 0); $group[] = $form->createElement('radio', 'allow_user_view_user_list', null, get_lang('AllowUserViewUserListDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("AllowUserViewUserList"))); $form->addGroup($group, '', array(get_lang("AllowUserViewUserList")));
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
$form->addHtml(' $form->addHtml('
@ -413,7 +413,7 @@ $form->addHtml('
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-chat-settings" aria-expanded="false" aria-controls="collapse-chat-settings"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-chat-settings" aria-expanded="false" aria-controls="collapse-chat-settings">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('chat.png', get_lang('ConfigChat'),'',ICON_SIZE_SMALL).' '.get_lang('ConfigChat') Display::return_icon('chat.png', get_lang('ConfigChat'), '', ICON_SIZE_SMALL).' '.get_lang('ConfigChat')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -426,8 +426,8 @@ $form->addHtml('
'); ');
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1); $group[] = $form->createElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
$group[]=$form->createElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0); $group[] = $form->createElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
$form->addGroup($group, '', array(get_lang("AllowOpenchatWindow"))); $form->addGroup($group, '', array(get_lang("AllowOpenchatWindow")));
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
@ -459,16 +459,16 @@ $form->addHtml('
// Auto launch LP // Auto launch LP
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToALearningPath'), 1); $group[] = $form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToALearningPath'), 1);
$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToTheLearningPathList'), 2); $group[] = $form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToTheLearningPathList'), 2);
$group[]=$form->createElement('radio', 'enable_lp_auto_launch', null, get_lang('Deactivate'), 0); $group[] = $form->createElement('radio', 'enable_lp_auto_launch', null, get_lang('Deactivate'), 0);
$form->addGroup($group, '', array(get_lang("LPAutoLaunch"))); $form->addGroup($group, '', array(get_lang("LPAutoLaunch")));
if (api_get_setting('allow_course_theme') == 'true') { if (api_get_setting('allow_course_theme') == 'true') {
// Allow theme into Learning path // Allow theme into Learning path
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1); $group[] = $form->createElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
$group[]=$form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0); $group[] = $form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
$form->addGroup($group, '', array(get_lang("AllowLearningPathTheme"))); $form->addGroup($group, '', array(get_lang("AllowLearningPathTheme")));
} }
@ -544,7 +544,7 @@ $form->addHtml(
Display::return_icon( Display::return_icon(
'course_progress.png', 'course_progress.png',
get_lang('ThematicAdvanceConfiguration') get_lang('ThematicAdvanceConfiguration')
) . ' ' . get_lang('ThematicAdvanceConfiguration') ).' '.get_lang('ThematicAdvanceConfiguration')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -557,10 +557,10 @@ $form->addHtml('
'); ');
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1); $group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1);
$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2); $group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2);
$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDoneAndLastDoneAdvance'), 3); $group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDoneAndLastDoneAdvance'), 3);
$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0); $group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0);
$form->addGroup($group, '', array(get_lang("InfoAboutAdvanceInsideHomeCourse"))); $form->addGroup($group, '', array(get_lang("InfoAboutAdvanceInsideHomeCourse")));
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
$form->addHtml(' $form->addHtml('
@ -570,7 +570,7 @@ $form->addHtml('
$form->addHtml('</div>'); $form->addHtml('</div>');
// Certificate settings // Certificate settings
if (api_get_setting('allow_public_certificates')=='true') { if (api_get_setting('allow_public_certificates') == 'true') {
$form->addHtml('<div class="panel panel-default">'); $form->addHtml('<div class="panel panel-default">');
$form->addHtml(' $form->addHtml('
<div class="panel-heading" role="tab" id="heading-certificate-settings"> <div class="panel-heading" role="tab" id="heading-certificate-settings">
@ -578,7 +578,7 @@ if (api_get_setting('allow_public_certificates')=='true') {
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-certificate-settings" aria-expanded="false" aria-controls="collapse-certificate-settings"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-certificate-settings" aria-expanded="false" aria-controls="collapse-certificate-settings">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('certificate.png', get_lang('Certificates')) . ' ' . get_lang('Certificates') Display::return_icon('certificate.png', get_lang('Certificates')).' '.get_lang('Certificates')
); );
$form->addHtml(' $form->addHtml('
</a> </a>
@ -591,8 +591,8 @@ if (api_get_setting('allow_public_certificates')=='true') {
'); ');
$group = array(); $group = array();
$group[]=$form->createElement('radio', 'allow_public_certificates', get_lang('AllowPublicCertificates'), get_lang('Yes'), 1); $group[] = $form->createElement('radio', 'allow_public_certificates', get_lang('AllowPublicCertificates'), get_lang('Yes'), 1);
$group[]=$form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0); $group[] = $form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0);
$form->addGroup($group, '', array(get_lang('AllowPublicCertificates'))); $form->addGroup($group, '', array(get_lang('AllowPublicCertificates')));
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
$form->addHtml(' $form->addHtml('
@ -610,7 +610,7 @@ $form->addHtml('
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-forum-settings" aria-expanded="false" aria-controls="collapse-forum-settings"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-forum-settings" aria-expanded="false" aria-controls="collapse-forum-settings">
'); ');
$form->addHtml( $form->addHtml(
Display::return_icon('forum.png', get_lang('Forum')) . ' ' . get_lang('Forum') Display::return_icon('forum.png', get_lang('Forum')).' '.get_lang('Forum')
); );
$form->addHtml(' $form->addHtml('
</a> </a>

@ -13,7 +13,7 @@ api_block_anonymous_users();
// menu actions for dashboard views // menu actions for dashboard views
$views = array('blocks', 'list'); $views = array('blocks', 'list');
if(isset($_GET['view']) && in_array($_GET['view'], $views)){ if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
$dashboard_view = $_GET['view']; $dashboard_view = $_GET['view'];
} }
@ -21,16 +21,16 @@ $link_blocks_view = $link_list_view = null;
if (isset($dashboard_view) && $dashboard_view == 'list') { if (isset($dashboard_view) && $dashboard_view == 'list') {
$link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'.
Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('blocks.png', get_lang('DashboardBlocks'), '', ICON_SIZE_MEDIUM).'</a>';
} else { } else {
$link_list_view = '<a href="'.api_get_self().'?view=list">'. $link_list_view = '<a href="'.api_get_self().'?view=list">'.
Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('edit.png', get_lang('EditBlocks'), '', ICON_SIZE_MEDIUM).'</a>';
} }
$configuration_link = null; $configuration_link = null;
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'
.Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; .Display::return_icon('settings.png', get_lang('ConfigureDashboardPlugin'), '', ICON_SIZE_MEDIUM).'</a>';
} }
echo '<div class="actions">'; echo '<div class="actions">';

@ -80,7 +80,7 @@ if (!is_dir($filepath)) {
//groups //TODO: clean //groups //TODO: clean
if (!empty($groupId)) { if (!empty($groupId)) {
$interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace')); $interbreadcrumb[] = array("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
$noPHP_SELF = true; $noPHP_SELF = true;
$group = GroupManager :: get_group_properties($groupId); $group = GroupManager :: get_group_properties($groupId);
$path = explode('/', $dir); $path = explode('/', $dir);
@ -138,14 +138,14 @@ if (isset($document_data['parents'])) {
//make some vars //make some vars
$wamiuserid = api_get_user_id(); $wamiuserid = api_get_user_id();
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>'; $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
$actions = Display::toolbarButton( $actions = Display::toolbarButton(
get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), get_lang('BackTo').' '.get_lang('DocumentsOverview'),
'document.php?' . api_get_cidreq() . "&id=$document_id", 'document.php?'.api_get_cidreq()."&id=$document_id",
'arrow-left', 'arrow-left',
'default', 'default',
[], [],

@ -372,7 +372,7 @@ class FillBlanks extends Question
// remove spaces at the beginning and the end of text in square brackets // remove spaces at the beginning and the end of text in square brackets
$answer = preg_replace_callback( $answer = preg_replace_callback(
"/".$blankStartSeparatorRegexp."[^]]+".$blankEndSeparatorRegexp."/", "/".$blankStartSeparatorRegexp."[^]]+".$blankEndSeparatorRegexp."/",
function ($matches) use ($blankStartSeparator, $blankEndSeparator) { function($matches) use ($blankStartSeparator, $blankEndSeparator) {
$matchingResult = $matches[0]; $matchingResult = $matches[0];
$matchingResult = trim($matchingResult, $blankStartSeparator); $matchingResult = trim($matchingResult, $blankStartSeparator);
$matchingResult = trim($matchingResult, $blankEndSeparator); $matchingResult = trim($matchingResult, $blankEndSeparator);
@ -417,7 +417,7 @@ class FillBlanks extends Question
if ($nb > 0) { if ($nb > 0) {
$answer .= '::'; $answer .= '::';
// weighting // weighting
for ($i=0; $i < $nb; ++$i) { for ($i = 0; $i < $nb; ++$i) {
// enter the weighting of word $i // enter the weighting of word $i
$answer .= $form->getSubmitValue('weighting['.$i.']'); $answer .= $form->getSubmitValue('weighting['.$i.']');
// not the last word, add "," // not the last word, add ","
@ -455,7 +455,7 @@ class FillBlanks extends Question
// Allow answers order switches // Allow answers order switches
$is_multiple = $form -> getSubmitValue('multiple_answer'); $is_multiple = $form -> getSubmitValue('multiple_answer');
$answer.= '@'.$is_multiple; $answer .= '@'.$is_multiple;
$this->save(); $this->save();
$objAnswer = new Answer($this->id); $objAnswer = new Answer($this->id);
@ -472,7 +472,7 @@ class FillBlanks extends Question
public function return_header($feedback_type = null, $counter = null, $score = null) public function return_header($feedback_type = null, $counter = null, $score = null)
{ {
$header = parent::return_header($feedback_type, $counter, $score); $header = parent::return_header($feedback_type, $counter, $score);
$header .= '<table class="'.$this->question_table_class .'"> $header .= '<table class="'.$this->question_table_class.'">
<tr> <tr>
<th>'.get_lang("Answer").'</th> <th>'.get_lang("Answer").'</th>
</tr>'; </tr>';
@ -513,13 +513,13 @@ class FillBlanks extends Question
// if display for student, shuffle the correct answer menu // if display for student, shuffle the correct answer menu
$listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent); $listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent);
$result .= '<select id="choice_id_'.$currentQuestion.'_'.$inBlankNumber.'" name="choice['.$questionId.'][]">'; $result .= '<select id="choice_id_'.$currentQuestion.'_'.$inBlankNumber.'" name="choice['.$questionId.'][]">';
for ($k=0; $k < count($listMenu); $k++) { for ($k = 0; $k < count($listMenu); $k++) {
$selected = ''; $selected = '';
if ($correctItem == $listMenu[$k]) { if ($correctItem == $listMenu[$k]) {
$selected = " selected=selected "; $selected = " selected=selected ";
} }
// if in teacher view, display the first item by default, which is the right answer // if in teacher view, display the first item by default, which is the right answer
if ($k==0 && !$displayForStudent) { if ($k == 0 && !$displayForStudent) {
$selected = " selected=selected "; $selected = " selected=selected ";
} }
$optionMenu .= '<option '.$selected.' value="'.$listMenu[$k].'">'.$listMenu[$k].'</option>'; $optionMenu .= '<option '.$selected.' value="'.$listMenu[$k].'">'.$listMenu[$k].'</option>';
@ -696,10 +696,10 @@ class FillBlanks extends Question
if (count($listDetails) < 3) { if (count($listDetails) < 3) {
$listWeightings = explode(',', $listDetails[0]); $listWeightings = explode(',', $listDetails[0]);
$listSizeOfInput = array(); $listSizeOfInput = array();
for ($i=0; $i < count($listWeightings); $i++) { for ($i = 0; $i < count($listWeightings); $i++) {
$listSizeOfInput[] = 200; $listSizeOfInput[] = 200;
} }
$blankSeparatorNumber = 0; // 0 is [...] $blankSeparatorNumber = 0; // 0 is [...]
} else { } else {
$listWeightings = explode(',', $listDetails[0]); $listWeightings = explode(',', $listDetails[0]);
$listSizeOfInput = explode(',', $listDetails[1]); $listSizeOfInput = explode(',', $listDetails[1]);
@ -731,9 +731,9 @@ class FillBlanks extends Question
// remove [ and ] in string // remove [ and ] in string
array_walk( array_walk(
$listWords[0], $listWords[0],
function (&$value, $key, $tabBlankChar) { function(&$value, $key, $tabBlankChar) {
$trimChars = ''; $trimChars = '';
for ($i=0; $i < count($tabBlankChar); $i++) { for ($i = 0; $i < count($tabBlankChar); $i++) {
$trimChars .= $tabBlankChar[$i]; $trimChars .= $tabBlankChar[$i];
} }
$value = trim($value, $trimChars); $value = trim($value, $trimChars);
@ -753,18 +753,18 @@ class FillBlanks extends Question
// if student answer, the second [] is the student answer, // if student answer, the second [] is the student answer,
// the third is if student scored or not // the third is if student scored or not
$listBrackets = array(); $listBrackets = array();
$listWords = array(); $listWords = array();
if ($isStudentAnswer) { if ($isStudentAnswer) {
for ($i=0; $i < count($listAnswerResults['tabwords']); $i++) { for ($i = 0; $i < count($listAnswerResults['tabwords']); $i++) {
$listBrackets[] = $listAnswerResults['tabwordsbracket'][$i]; $listBrackets[] = $listAnswerResults['tabwordsbracket'][$i];
$listWords[] = $listAnswerResults['tabwords'][$i]; $listWords[] = $listAnswerResults['tabwords'][$i];
if ($i+1 < count($listAnswerResults['tabwords'])) { if ($i + 1 < count($listAnswerResults['tabwords'])) {
// should always be // should always be
$i++; $i++;
} }
$listAnswerResults['studentanswer'][] = $listAnswerResults['tabwords'][$i]; $listAnswerResults['studentanswer'][] = $listAnswerResults['tabwords'][$i];
if ($i+1 < count($listAnswerResults['tabwords'])) { if ($i + 1 < count($listAnswerResults['tabwords'])) {
// should always be // should always be
$i++; $i++;
} }
@ -866,9 +866,9 @@ class FillBlanks extends Question
$tabAnswer['tabwords'][$bracketNumber] $tabAnswer['tabwords'][$bracketNumber]
) )
) { ) {
$tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer
} else { } else {
$tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer
} }
} }
} else { } else {
@ -876,11 +876,11 @@ class FillBlanks extends Question
if ($useLastAnsweredAttempt) { if ($useLastAnsweredAttempt) {
// if we take into account the last answered attempt // if we take into account the last answered attempt
if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) {
$tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
} }
} else { } else {
// we take the last attempt, even if the student answer the question before // we take the last attempt, even if the student answer the question before
$tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
} }
} }
} }
@ -924,7 +924,7 @@ class FillBlanks extends Question
$separatorEnd = $listWithStudentAnswer['blankseparatorend']; $separatorEnd = $listWithStudentAnswer['blankseparatorend'];
// lets rebuild the sentence with [correct answer][student answer][answer is correct] // lets rebuild the sentence with [correct answer][student answer][answer is correct]
$result = ''; $result = '';
for ($i=0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) { for ($i = 0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) {
$result .= $listWithStudentAnswer['commonwords'][$i]; $result .= $listWithStudentAnswer['commonwords'][$i];
$result .= $listWithStudentAnswer['tabwordsbracket'][$i]; $result .= $listWithStudentAnswer['tabwordsbracket'][$i];
$result .= $separatorStart.$listWithStudentAnswer['studentanswer'][$i].$separatorEnd; $result .= $separatorStart.$listWithStudentAnswer['studentanswer'][$i].$separatorEnd;
@ -1006,7 +1006,7 @@ class FillBlanks extends Question
")", ")",
]; ];
$result = $text; $result = $text;
for ($i=0; $i < count($listRegexpCharacters); $i++) { for ($i = 0; $i < count($listRegexpCharacters); $i++) {
$result = str_replace($listRegexpCharacters[$i], "\\".$listRegexpCharacters[$i], $result); $result = str_replace($listRegexpCharacters[$i], "\\".$listRegexpCharacters[$i], $result);
} }
@ -1067,7 +1067,7 @@ class FillBlanks extends Question
{ {
$listResults = array(); $listResults = array();
$fillBlanksAllowedSeparator = self::getAllowedSeparator(); $fillBlanksAllowedSeparator = self::getAllowedSeparator();
for ($i=0; $i < count($fillBlanksAllowedSeparator); $i++) { for ($i = 0; $i < count($fillBlanksAllowedSeparator); $i++) {
$listResults[] = $fillBlanksAllowedSeparator[$i][0]."...".$fillBlanksAllowedSeparator[$i][1]; $listResults[] = $fillBlanksAllowedSeparator[$i][0]."...".$fillBlanksAllowedSeparator[$i][1];
} }
@ -1085,7 +1085,7 @@ class FillBlanks extends Question
{ {
$listSeparators = self::getAllowedSeparator(); $listSeparators = self::getAllowedSeparator();
$result = 0; $result = 0;
for ($i=0; $i < count($listSeparators); $i++) { for ($i = 0; $i < count($listSeparators); $i++) {
if ($listSeparators[$i][0] == $startSeparator && if ($listSeparators[$i][0] == $startSeparator &&
$listSeparators[$i][1] == $endSeparator $listSeparators[$i][1] == $endSeparator
) { ) {
@ -1123,7 +1123,7 @@ class FillBlanks extends Question
// rebuild the answer with good HTML style // rebuild the answer with good HTML style
// this is the student answer, right or wrong // this is the student answer, right or wrong
for ($i=0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) { for ($i = 0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) {
if ($listStudentAnswerInfo['studentscore'][$i] == 1) { if ($listStudentAnswerInfo['studentscore'][$i] == 1) {
$listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer( $listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer(
$listStudentAnswerInfo['studentanswer'][$i], $listStudentAnswerInfo['studentanswer'][$i],
@ -1144,7 +1144,7 @@ class FillBlanks extends Question
} }
// rebuild the sentence with student answer inserted // rebuild the sentence with student answer inserted
for ($i=0; $i < count($listStudentAnswerInfo['commonwords']); $i++) { for ($i = 0; $i < count($listStudentAnswerInfo['commonwords']); $i++) {
$result .= isset($listStudentAnswerInfo['commonwords'][$i]) ? $listStudentAnswerInfo['commonwords'][$i] : ''; $result .= isset($listStudentAnswerInfo['commonwords'][$i]) ? $listStudentAnswerInfo['commonwords'][$i] : '';
$result .= isset($listStudentAnswerInfo['studentanswer'][$i]) ? $listStudentAnswerInfo['studentanswer'][$i] : ''; $result .= isset($listStudentAnswerInfo['studentanswer'][$i]) ? $listStudentAnswerInfo['studentanswer'][$i] : '';
} }

@ -35,20 +35,20 @@ class GlobalMultipleAnswer extends Question
$html = '<table class="data_table"> $html = '<table class="data_table">
<tr> <tr>
<th width="10px"> <th width="10px">
' . get_lang('Number') . ' ' . get_lang('Number').'
</th> </th>
<th width="10px"> <th width="10px">
' . get_lang('True') . ' ' . get_lang('True').'
</th> </th>
<th width="50%"> <th width="50%">
' . get_lang('Answer') . ' ' . get_lang('Answer').'
</th>'; </th>';
$html .='<th>' . get_lang('Comment') . '</th>'; $html .= '<th>'.get_lang('Comment').'</th>';
$html .='</tr>'; $html .= '</tr>';
$form->addElement( $form->addElement(
'label', 'label',
get_lang('Answers') . get_lang('Answers').
'<br /> '.Display::return_icon('fill_field.png'), '<br /> '.Display::return_icon('fill_field.png'),
$html $html
); );
@ -83,9 +83,9 @@ class GlobalMultipleAnswer extends Question
for ($i = 1; $i <= $nb_answers; ++$i) { for ($i = 1; $i <= $nb_answers; ++$i) {
/* si la reponse est de type objet */ /* si la reponse est de type objet */
if (is_object($answer)) { if (is_object($answer)) {
$defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['answer['.$i.']'] = $answer->answer[$i];
$defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['comment['.$i.']'] = $answer->comment[$i];
$defaults['correct[' . $i . ']'] = $answer->correct[$i]; $defaults['correct['.$i.']'] = $answer->correct[$i];
// start // start
$scoreA = $answer->weighting[$i]; $scoreA = $answer->weighting[$i];
@ -126,8 +126,8 @@ class GlobalMultipleAnswer extends Question
); );
$answer_number->freeze(); $answer_number->freeze();
$form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"');
$boxes_names[] = 'correct[' . $i . ']'; $boxes_names[] = 'correct['.$i.']';
$form->addElement( $form->addElement(
'html_editor', 'html_editor',
@ -140,7 +140,7 @@ class GlobalMultipleAnswer extends Question
'Height' => '100', 'Height' => '100',
) )
); );
$form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement( $form->addElement(
'html_editor', 'html_editor',
'comment['.$i.']', 'comment['.$i.']',
@ -217,7 +217,7 @@ class GlobalMultipleAnswer extends Question
// Reponses correctes // Reponses correctes
$nbr_corrects = 0; $nbr_corrects = 0;
for ($i = 1; $i <= $nb_answers; $i++) { for ($i = 1; $i <= $nb_answers; $i++) {
$goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
if ($goodAnswer) { if ($goodAnswer) {
$nbr_corrects++; $nbr_corrects++;
} }
@ -236,9 +236,9 @@ class GlobalMultipleAnswer extends Question
$test = $form->getSubmitValue('pts'); $test = $form->getSubmitValue('pts');
for ($i = 1; $i <= $nb_answers; $i++) { for ($i = 1; $i <= $nb_answers; $i++) {
$answer = trim($form->getSubmitValue('answer[' . $i . ']')); $answer = trim($form->getSubmitValue('answer['.$i.']'));
$comment = trim($form->getSubmitValue('comment[' . $i . ']')); $comment = trim($form->getSubmitValue('comment['.$i.']'));
$goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']')); $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
if ($goodAnswer) { if ($goodAnswer) {
$weighting = abs($answer_score); $weighting = abs($answer_score);
@ -266,12 +266,12 @@ class GlobalMultipleAnswer extends Question
$score = null $score = null
) { ) {
$header = parent::return_header($feedback_type, $counter, $score); $header = parent::return_header($feedback_type, $counter, $score);
$header .= '<table class="'.$this->question_table_class .'"> $header .= '<table class="'.$this->question_table_class.'">
<tr> <tr>
<th>' . get_lang("Choice") . '</th> <th>' . get_lang("Choice").'</th>
<th>' . get_lang("ExpectedChoice") . '</th> <th>' . get_lang("ExpectedChoice").'</th>
<th>' . get_lang("Answer") . '</th>'; <th>' . get_lang("Answer").'</th>';
$header .= '<th>' . get_lang("Comment") . '</th>'; $header .= '<th>'.get_lang("Comment").'</th>';
$header .= '</tr>'; $header .= '</tr>';
return $header; return $header;

@ -40,10 +40,10 @@ class MultipleAnswerCombination extends Question
$html = '<table class="table table-striped table-hover">'; $html = '<table class="table table-striped table-hover">';
$html .= '<thead>'; $html .= '<thead>';
$html .= '<tr>'; $html .= '<tr>';
$html .= '<th width="10">' . get_lang('Number') . '</th>'; $html .= '<th width="10">'.get_lang('Number').'</th>';
$html .= '<th width="10">' . get_lang('True') . '</th>'; $html .= '<th width="10">'.get_lang('True').'</th>';
$html .= '<th width="50%">' . get_lang('Answer') . '</th>'; $html .= '<th width="50%">'.get_lang('Answer').'</th>';
$html .= '<th width="50%">' . get_lang('Comment') . '</th>'; $html .= '<th width="50%">'.get_lang('Comment').'</th>';
$html .= '</tr>'; $html .= '</tr>';
$html .= '</thead>'; $html .= '</thead>';
$html .= '<tbody>'; $html .= '<tbody>';
@ -75,10 +75,10 @@ class MultipleAnswerCombination extends Question
$form->addHtml('<tr>'); $form->addHtml('<tr>');
if (is_object($answer)) { if (is_object($answer)) {
$defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['answer['.$i.']'] = $answer->answer[$i];
$defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['comment['.$i.']'] = $answer->comment[$i];
$defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1);
$defaults['correct[' . $i . ']'] = $answer->correct[$i]; $defaults['correct['.$i.']'] = $answer->correct[$i];
} else { } else {
$defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2');
$defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); $defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
@ -94,22 +94,22 @@ class MultipleAnswerCombination extends Question
$renderer->setElementTemplate( $renderer->setElementTemplate(
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
'correct[' . $i . ']' 'correct['.$i.']'
); );
$renderer->setElementTemplate( $renderer->setElementTemplate(
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
'counter[' . $i . ']' 'counter['.$i.']'
); );
$renderer->setElementTemplate( $renderer->setElementTemplate(
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
'answer[' . $i . ']' 'answer['.$i.']'
); );
$renderer->setElementTemplate( $renderer->setElementTemplate(
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
'comment[' . $i . ']' 'comment['.$i.']'
); );
$answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
$answer_number->freeze(); $answer_number->freeze();
$form->addElement( $form->addElement(
@ -119,20 +119,20 @@ class MultipleAnswerCombination extends Question
null, null,
'class="checkbox" style="margin-left: 0em;"' 'class="checkbox" style="margin-left: 0em;"'
); );
$boxes_names[] = 'correct[' . $i . ']'; $boxes_names[] = 'correct['.$i.']';
$form->addElement( $form->addElement(
'html_editor', 'html_editor',
'answer[' . $i . ']', 'answer['.$i.']',
null, null,
array(), array(),
array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')
); );
$form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement( $form->addElement(
'html_editor', 'html_editor',
'comment[' . $i . ']', 'comment['.$i.']',
null, null,
array(), array(),
array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100') array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')
@ -225,7 +225,7 @@ class MultipleAnswerCombination extends Question
function return_header($feedback_type = null, $counter = null, $score = null) function return_header($feedback_type = null, $counter = null, $score = null)
{ {
$header = parent::return_header($feedback_type, $counter, $score); $header = parent::return_header($feedback_type, $counter, $score);
$header .= '<table class="'.$this->question_table_class .'"> $header .= '<table class="'.$this->question_table_class.'">
<tr> <tr>
<th>'.get_lang("Choice").'</th> <th>'.get_lang("Choice").'</th>
<th>'. get_lang("ExpectedChoice").'</th> <th>'. get_lang("ExpectedChoice").'</th>

@ -6,7 +6,7 @@
* @package chamilo.gradebook * @package chamilo.gradebook
*/ */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK; $current_course_tool = TOOL_GRADEBOOK;
if (!api_is_student_boss()) { if (!api_is_student_boss()) {
api_protect_course_script(true); api_protect_course_script(true);
@ -16,9 +16,9 @@ set_time_limit(0);
ini_set('max_execution_time', 0); ini_set('max_execution_time', 0);
//extra javascript functions for in html head: //extra javascript functions for in html head:
$htmlHeadXtra[] ="<script> $htmlHeadXtra[] = "<script>
function confirmation() { function confirmation() {
if (confirm(\" " . trim(get_lang('AreYouSureToDelete')) . " ?\")) { if (confirm(\" " . trim(get_lang('AreYouSureToDelete'))." ?\")) {
return true; return true;
} else { } else {
return false; return false;
@ -31,7 +31,7 @@ if (!api_is_allowed_to_edit() && !api_is_student_boss()) {
api_not_allowed(true); api_not_allowed(true);
} }
$cat_id = isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null; $cat_id = isset($_GET['cat_id']) ? (int) $_GET['cat_id'] : null;
$action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null; $action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null;
$filterOfficialCode = isset($_POST['filter']) ? Security::remove_XSS($_POST['filter']) : null; $filterOfficialCode = isset($_POST['filter']) ? Security::remove_XSS($_POST['filter']) : null;
$filterOfficialCodeGet = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; $filterOfficialCodeGet = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
@ -76,7 +76,7 @@ $interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?',
'name' => get_lang('Gradebook'), 'name' => get_lang('Gradebook'),
); );
$interbreadcrumb[] = array('url' => '#','name' => get_lang('GradebookListOfStudentsCertificates')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsCertificates'));
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
Display::display_header(''); Display::display_header('');
@ -104,9 +104,9 @@ $cats = Category:: load($cat_id, null, null, null, null, null, false);
if (!empty($cats)) { if (!empty($cats)) {
//with this fix the teacher only can view 1 gradebook //with this fix the teacher only can view 1 gradebook
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id()); $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
} else { } else {
$stud_id= api_get_user_id(); $stud_id = api_get_user_id();
} }
$total_weight = $cats[0]->get_weight(); $total_weight = $cats[0]->get_weight();
@ -153,7 +153,7 @@ $certificate_list = array();
if ($filter === 'true') { if ($filter === 'true') {
echo '<br />'; echo '<br />';
$options = UserManager::getOfficialCodeGrouped(); $options = UserManager::getOfficialCodeGrouped();
$options =array_merge(array('all' => get_lang('All')), $options); $options = array_merge(array('all' => get_lang('All')), $options);
$form = new FormValidator( $form = new FormValidator(
'official_code_filter', 'official_code_filter',
'POST', 'POST',
@ -220,7 +220,7 @@ if (count($certificate_list) == 0) {
$certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn btn-default')); $certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn btn-default'));
echo $certificates; echo $certificates;
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&'.api_get_cidreq().'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'"> echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&'.api_get_cidreq().'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'">
'.Display::return_icon('delete.png',get_lang('Delete')).' '.Display::return_icon('delete.png', get_lang('Delete')).'
</a>'; </a>';
echo '</td></tr>'; echo '</td></tr>';
} }

@ -115,10 +115,10 @@ class FlatViewDataGenerator
isset($this->params['only_subcat']) && isset($this->params['only_subcat']) &&
$this->params['only_subcat'] == $this->category->get_id() $this->params['only_subcat'] == $this->category->get_id()
) { ) {
$main_weight = $this->category->get_weight(); $main_weight = $this->category->get_weight();
$grade_model_id = $this->category->get_grade_model_id(); $grade_model_id = $this->category->get_grade_model_id();
} else { } else {
$main_cat = Category::load($parent_id, null, null); $main_cat = Category::load($parent_id, null, null);
$main_weight = $main_cat[0]->get_weight(); $main_weight = $main_cat[0]->get_weight();
$grade_model_id = $main_cat[0]->get_grade_model_id(); $grade_model_id = $main_cat[0]->get_grade_model_id();
} }
@ -198,7 +198,7 @@ class FlatViewDataGenerator
$list = []; $list = [];
$list['items'] = $finalList; $list['items'] = $finalList;
$list['header'] = '<center>'.$mainHeader.'</center>'; $list['header'] = '<center>'.$mainHeader.'</center>';
$headers[]= $list; $headers[] = $list;
} else { } else {
$headers[] = '<center>'.$mainHeader.'</center>'; $headers[] = '<center>'.$mainHeader.'</center>';
} }
@ -226,7 +226,7 @@ class FlatViewDataGenerator
!in_array($item->get_id(), $evaluationsAdded) !in_array($item->get_id(), $evaluationsAdded)
) { ) {
$weight = round(100 * $item->get_weight() / $main_weight, 1); $weight = round(100 * $item->get_weight() / $main_weight, 1);
$headers[] = $item->get_name() . ' ' . $weight . ' % '; $headers[] = $item->get_name().' '.$weight.' % ';
} }
} }
} }
@ -265,7 +265,7 @@ class FlatViewDataGenerator
if (!isset($items_count)) { if (!isset($items_count)) {
$items_count = count($this->evals_links) - $items_start; $items_count = count($this->evals_links) - $items_start;
} }
for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
$item = $this->evals_links [$count + $items_start]; $item = $this->evals_links [$count + $items_start];
$headers[] = $item->get_name(); $headers[] = $item->get_name();
} }
@ -294,13 +294,13 @@ class FlatViewDataGenerator
) { ) {
// Do some checks on users/items counts, redefine if invalid values // Do some checks on users/items counts, redefine if invalid values
if (!isset($users_count)) { if (!isset($users_count)) {
$users_count = count ($this->users) - $users_start; $users_count = count($this->users) - $users_start;
} }
if ($users_count < 0) { if ($users_count < 0) {
$users_count = 0; $users_count = 0;
} }
if (!isset($items_count)) { if (!isset($items_count)) {
$items_count = count ($this->evals) + count ($this->links) - $items_start; $items_count = count($this->evals) + count($this->links) - $items_start;
} }
if ($items_count < 0) { if ($items_count < 0) {
$items_count = 0; $items_count = 0;
@ -313,10 +313,10 @@ class FlatViewDataGenerator
// sort users array // sort users array
if ($users_sorting & self::FVDG_SORT_LASTNAME) { if ($users_sorting & self::FVDG_SORT_LASTNAME) {
usort($userTable, array('FlatViewDataGenerator','sort_by_last_name')); usort($userTable, array('FlatViewDataGenerator', 'sort_by_last_name'));
} elseif ($users_sorting & self::FVDG_SORT_FIRSTNAME) { } elseif ($users_sorting & self::FVDG_SORT_FIRSTNAME) {
usort($userTable, array('FlatViewDataGenerator','sort_by_first_name')); usort($userTable, array('FlatViewDataGenerator', 'sort_by_first_name'));
} }
if ($users_sorting & self::FVDG_SORT_DESC) { if ($users_sorting & self::FVDG_SORT_DESC) {
@ -360,10 +360,10 @@ class FlatViewDataGenerator
$parent_id == 0 || $parent_id == 0 ||
(isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id()) (isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id())
) { ) {
$main_weight = $this->category->get_weight(); $main_weight = $this->category->get_weight();
$grade_model_id = $this->category->get_grade_model_id(); $grade_model_id = $this->category->get_grade_model_id();
} else { } else {
$main_cat = Category::load($parent_id, null, null); $main_cat = Category::load($parent_id, null, null);
$main_weight = $main_cat[0]->get_weight(); $main_weight = $main_cat[0]->get_weight();
$grade_model_id = $main_cat[0]->get_grade_model_id(); $grade_model_id = $main_cat[0]->get_grade_model_id();
} }
@ -477,11 +477,11 @@ class FlatViewDataGenerator
$divide = $score[1] == 0 ? 1 : $score[1]; $divide = $score[1] == 0 ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()]; $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0]/$divide*$main_weight; $item_value = $score[0] / $divide * $main_weight;
// Fixing total when using one or multiple gradebooks // Fixing total when using one or multiple gradebooks
$percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight(); $percentage = $sub_cat->get_weight() / ($sub_cat_percentage) * $sub_cat_percentage / $this->category->get_weight();
$item_value = $percentage*$item_value; $item_value = $percentage * $item_value;
$item_total += $sub_cat->get_weight(); $item_total += $sub_cat->get_weight();
/* /*
if ($convert_using_the_global_weight) { if ($convert_using_the_global_weight) {
@ -635,7 +635,7 @@ class FlatViewDataGenerator
// Sub cat weight // Sub cat weight
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()]; //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
$item_value = isset($score[0]) ? $score[0]/$divide : 0; $item_value = isset($score[0]) ? $score[0] / $divide : 0;
// Fixing total when using one or multiple gradebooks. // Fixing total when using one or multiple gradebooks.
if (empty($parentCategoryIdFilter)) { if (empty($parentCategoryIdFilter)) {
@ -724,11 +724,11 @@ class FlatViewDataGenerator
$data = array(); $data = array();
foreach ($selected_users as $user) { foreach ($selected_users as $user) {
$row = array (); $row = array();
for ($count = 0; $count < count($this->evals_links); $count++) { for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links [$count]; $item = $this->evals_links [$count];
$score = $item->calc_score($user[0]); $score = $item->calc_score($user[0]);
$porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0]*100)/$score[1] :0; $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0] * 100) / $score[1] : 0;
$row[$item->get_name()] = $porcent_score; $row[$item->get_name()] = $porcent_score;
} }
$data[$user[0]] = $row; $data[$user[0]] = $row;
@ -751,7 +751,7 @@ class FlatViewDataGenerator
*/ */
$result = array(); $result = array();
foreach ($data_by_item as $k => $v) { foreach ($data_by_item as $k => $v) {
$average = round(array_sum($v)/count($v)); $average = round(array_sum($v) / count($v));
arsort($v); arsort($v);
$maximum = array_shift($v); $maximum = array_shift($v);
$minimum = array_pop($v); $minimum = array_pop($v);
@ -760,7 +760,7 @@ class FlatViewDataGenerator
$minimum = 0; $minimum = 0;
} }
$summary= array( $summary = array(
'max' => $maximum, 'max' => $maximum,
'min' => $minimum, 'min' => $minimum,
'avg' => $average 'avg' => $average
@ -777,19 +777,19 @@ class FlatViewDataGenerator
public function get_data_to_graph() public function get_data_to_graph()
{ {
// do some checks on users/items counts, redefine if invalid values // do some checks on users/items counts, redefine if invalid values
$usertable = array (); $usertable = array();
foreach ($this->users as $user) { foreach ($this->users as $user) {
$usertable[] = $user; $usertable[] = $user;
} }
// sort users array // sort users array
usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name')); usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
$data = array (); $data = array();
$selected_users = $usertable; $selected_users = $usertable;
foreach ($selected_users as $user) { foreach ($selected_users as $user) {
$row = array (); $row = array();
$row[] = $user[0]; // user id $row[] = $user[0]; // user id
$item_value = 0; $item_value = 0;
$item_total = 0; $item_total = 0;
@ -797,12 +797,12 @@ class FlatViewDataGenerator
$item = $this->evals_links[$count]; $item = $this->evals_links[$count];
$score = $item->calc_score($user[0]); $score = $item->calc_score($user[0]);
$divide =( ($score[1])==0 ) ? 1 : $score[1]; $divide = (($score[1]) == 0) ? 1 : $score[1];
$item_value += $score[0]/$divide*$item->get_weight(); $item_value += $score[0] / $divide * $item->get_weight();
$item_total += $item->get_weight(); $item_total += $item->get_weight();
$score_denom = ($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1] == 0) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100; $score_final = ($score[0] / $score_denom) * 100;
$row[] = $score_final; $row[] = $score_final;
} }
@ -829,15 +829,15 @@ class FlatViewDataGenerator
$usertable[] = $user; $usertable[] = $user;
} }
// sort users array // sort users array
usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name')); usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
// generate actual data array // generate actual data array
$scoredisplay = ScoreDisplay::instance(); $scoredisplay = ScoreDisplay::instance();
$data = array(); $data = array();
$selected_users = $usertable; $selected_users = $usertable;
foreach ($selected_users as $user) { foreach ($selected_users as $user) {
$row = array (); $row = array();
$row[] = $user[0]; // user id $row[] = $user[0]; // user id
$item_value = 0; $item_value = 0;
$item_total = 0; $item_total = 0;
$final_score = 0; $final_score = 0;
@ -857,8 +857,8 @@ class FlatViewDataGenerator
$divide = $score[1] == 0 ? 1 : $score[1]; $divide = $score[1] == 0 ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()]; //$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0]/$divide*$main_weight; $item_value = $score[0] / $divide * $main_weight;
$item_total += $sub_cat->get_weight(); $item_total += $sub_cat->get_weight();
$row[] = array( $row[] = array(
$item_value, $item_value,
@ -880,13 +880,13 @@ class FlatViewDataGenerator
$score = $item->calc_score($user[0]); $score = $item->calc_score($user[0]);
$divide = ($score[1]) == 0 ? 1 : $score[1]; $divide = ($score[1]) == 0 ? 1 : $score[1];
$item_value += $score[0] / $divide * $item->get_weight(); $item_value += $score[0] / $divide * $item->get_weight();
$item_total+=$item->get_weight(); $item_total += $item->get_weight();
$score_denom=($score[1]==0) ? 1 : $score[1]; $score_denom = ($score[1] == 0) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100; $score_final = ($score[0] / $score_denom) * 100;
$row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true))); $row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true)));
} }
$total_score=array($item_value,$item_total); $total_score = array($item_value, $item_total);
$score_final = ($item_value / $item_total) * 100; $score_final = ($item_value / $item_total) * 100;
if ($displayWarning) { if ($displayWarning) {
Display::display_warning_message($total_score[1]); Display::display_warning_message($total_score[1]);

@ -90,7 +90,7 @@ switch ($action) {
0, //howMany 0, //howMany
1, //$orderby = 1 1, //$orderby = 1
'ASC', 'ASC',
-1, //visibility -1, //visibility
$_GET['q'], $_GET['q'],
null, //$urlId null, //$urlId
true //AlsoSearchCode true //AlsoSearchCode
@ -112,7 +112,7 @@ switch ($action) {
if (!empty($course['category_code'])) { if (!empty($course['category_code'])) {
$parents = CourseCategory::getParentsToString($course['category_code']); $parents = CourseCategory::getParentsToString($course['category_code']);
$title = $parents . $course['title']; $title = $parents.$course['title'];
} }
$results['items'][] = array( $results['items'][] = array(
@ -192,7 +192,7 @@ switch ($action) {
ON u.user_id = r.user_id ON u.user_id = r.user_id
WHERE session_id = %d AND c_id = '%s' WHERE session_id = %d AND c_id = '%s'
AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')"; AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')";
$needle = '%' . $_GET['q'] . '%'; $needle = '%'.$_GET['q'].'%';
$sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle); $sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle);
$result = Database::query($sql_query); $result = Database::query($sql_query);
@ -211,7 +211,7 @@ switch ($action) {
case 'search_exercise_by_course': case 'search_exercise_by_course':
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$course = api_get_course_info_by_id($_GET['course_id']); $course = api_get_course_info_by_id($_GET['course_id']);
$session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0 ; $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0;
$exercises = ExerciseLib::get_all_exercises( $exercises = ExerciseLib::get_all_exercises(
$course, $course,
$session_id, $session_id,
@ -222,7 +222,7 @@ switch ($action) {
); );
foreach ($exercises as $exercise) { foreach ($exercises as $exercise) {
$data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']) ); $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']));
} }
if (!empty($data)) { if (!empty($data)) {
$data[] = array('id' => 'T', 'text' => 'TODOS'); $data[] = array('id' => 'T', 'text' => 'TODOS');
@ -247,11 +247,11 @@ switch ($action) {
$sql, $sql,
intval($_GET['course_id']), intval($_GET['course_id']),
intval($_GET['session_id']), intval($_GET['session_id']),
'%' . Database::escape_string($_GET['q']).'%' '%'.Database::escape_string($_GET['q']).'%'
); );
$result = Database::query($sql_query); $result = Database::query($sql_query);
while ($survey = Database::fetch_assoc($result)) { while ($survey = Database::fetch_assoc($result)) {
$survey['title'] .= ($survey['anonymous'] == 1) ? ' (' . get_lang('Anonymous') . ')' : ''; $survey['title'] .= ($survey['anonymous'] == 1) ? ' ('.get_lang('Anonymous').')' : '';
$data[] = array( $data[] = array(
'id' => $survey['id'], 'id' => $survey['id'],
'text' => strip_tags(html_entity_decode($survey['title'])) 'text' => strip_tags(html_entity_decode($survey['title']))

@ -48,19 +48,19 @@ switch ($action) {
$na_image = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($tool_info['custom_icon']); $na_image = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($tool_info['custom_icon']);
} }
$requested_image = ($tool_visibility == 0 ) ? $tool_image : $na_image; $requested_image = ($tool_visibility == 0) ? $tool_image : $na_image;
$requested_class = ($tool_visibility == 0 ) ? '' : 'text-muted'; $requested_class = ($tool_visibility == 0) ? '' : 'text-muted';
$requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive'; $requested_message = ($tool_visibility == 0) ? 'is_active' : 'is_inactive';
$requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
$requested_visible = ($tool_visibility == 0 ) ? 1 : 0; $requested_visible = ($tool_visibility == 0) ? 1 : 0;
$requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png'; $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
$requested_visible = ($tool_visibility == 0 ) ? 1 : 0; $requested_visible = ($tool_visibility == 0) ? 1 : 0;
// HIDE AND REACTIVATE TOOL // HIDE AND REACTIVATE TOOL
if ($_GET["id"] == strval(intval($_GET["id"]))) { if ($_GET["id"] == strval(intval($_GET["id"]))) {
$sql = "UPDATE $tool_table SET $sql = "UPDATE $tool_table SET
visibility = $requested_visible visibility = $requested_visible
WHERE c_id = $course_id AND id='" . intval($_GET['id']) . "'"; WHERE c_id = $course_id AND id='".intval($_GET['id'])."'";
Database::query($sql); Database::query($sql);
} }
$response_data = array( $response_data = array(
@ -112,12 +112,12 @@ switch ($action) {
*/ */
require_once __DIR__.'/../global.inc.php'; require_once __DIR__.'/../global.inc.php';
$now = time(); $now = time();
$page = intval($_REQUEST['page']); //page $page = intval($_REQUEST['page']); //page
$limit = intval($_REQUEST['rows']); // quantity of rows $limit = intval($_REQUEST['rows']); // quantity of rows
//index to filter //index to filter
$sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
$sord = $_REQUEST['sord']; //asc or desc $sord = $_REQUEST['sord']; //asc or desc
if (!in_array($sord, array('asc','desc'))) { if (!in_array($sord, array('asc', 'desc'))) {
$sord = 'desc'; $sord = 'desc';
} }
$session_id = intval($_REQUEST['session_id']); $session_id = intval($_REQUEST['session_id']);
@ -137,7 +137,7 @@ switch ($action) {
} }
} }
$start = $limit*$page - $limit; $start = $limit * $page - $limit;
$course_list = SessionManager::get_course_list_by_session_id($session_id); $course_list = SessionManager::get_course_list_by_session_id($session_id);
$count = 0; $count = 0;
$temp = array(); $temp = array();
@ -149,14 +149,14 @@ switch ($action) {
$item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET)); $item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET));
foreach ($flat_list as $lp_id => $lp_item) { foreach ($flat_list as $lp_id => $lp_item) {
$temp[$count]['id']= $lp_id; $temp[$count]['id'] = $lp_id;
$lp = new learnpath($item['code'], $lp_id, api_get_user_id()); $lp = new learnpath($item['code'], $lp_id, api_get_user_id());
if ($lp->progress_db == 100) { if ($lp->progress_db == 100) {
continue; continue;
} }
$lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view'; $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
$last_date = Tracking::get_last_connection_date_on_the_course( $last_date = Tracking::get_last_connection_date_on_the_course(
api_get_user_id(), api_get_user_id(),
@ -212,25 +212,25 @@ switch ($action) {
} }
$temp = msort($temp, $sidx, $sord); $temp = msort($temp, $sidx, $sord);
$i =0; $i = 0;
$response = new stdClass(); $response = new stdClass();
foreach ($temp as $key => $row) { foreach ($temp as $key => $row) {
$row = $row['cell']; $row = $row['cell'];
if (!empty($row)) { if (!empty($row)) {
if ($key >= $start && $key < ($start + $limit)) { if ($key >= $start && $key < ($start + $limit)) {
$response->rows[$i]['id']= $key; $response->rows[$i]['id'] = $key;
$response->rows[$i]['cell']=array($row[0], $row[1], $row[2]); $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
$i++; $i++;
} }
} }
} }
$total_pages = 0; $total_pages = 0;
if ($count > 0 && $limit > 0) { if ($count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit); $total_pages = ceil($count / $limit);
} }
$response->total = $total_pages; $response->total = $total_pages;
if ($page > $total_pages) { if ($page > $total_pages) {
$response->page= $total_pages; $response->page = $total_pages;
} else { } else {
$response->page = $page; $response->page = $page;
} }
@ -240,12 +240,12 @@ switch ($action) {
case 'session_courses_lp_by_week': case 'session_courses_lp_by_week':
require_once __DIR__.'/../global.inc.php'; require_once __DIR__.'/../global.inc.php';
$now = time(); $now = time();
$page = intval($_REQUEST['page']); //page $page = intval($_REQUEST['page']); //page
$limit = intval($_REQUEST['rows']); // quantity of rows $limit = intval($_REQUEST['rows']); // quantity of rows
$sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course'; $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course';
$sidx = str_replace(array('week desc,', ' '), '', $sidx); $sidx = str_replace(array('week desc,', ' '), '', $sidx);
$sord = $_REQUEST['sord']; //asc or desc $sord = $_REQUEST['sord']; //asc or desc
if (!in_array($sord, array('asc','desc'))) { if (!in_array($sord, array('asc', 'desc'))) {
$sord = 'desc'; $sord = 'desc';
} }
@ -293,8 +293,8 @@ switch ($action) {
); );
foreach ($flat_list as $lp_id => $lp_item) { foreach ($flat_list as $lp_id => $lp_item) {
$temp[$count]['id']= $lp_id; $temp[$count]['id'] = $lp_id;
$lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view'; $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
$last_date = Tracking::get_last_connection_date_on_the_course( $last_date = Tracking::get_last_connection_date_on_the_course(
api_get_user_id(), api_get_user_id(),
@ -356,20 +356,20 @@ switch ($action) {
} }
$response = new stdClass(); $response = new stdClass();
$i =0; $i = 0;
foreach ($temp as $key => $row) { foreach ($temp as $key => $row) {
$row = $row['cell']; $row = $row['cell'];
if (!empty($row)) { if (!empty($row)) {
if ($key >= $start && $key < ($start + $limit)) { if ($key >= $start && $key < ($start + $limit)) {
$response->rows[$i]['id']= $key; $response->rows[$i]['id'] = $key;
$response->rows[$i]['cell']=array($row[0], $row[1], $row[2],$row[3]); $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2], $row[3]);
$i++; $i++;
} }
} }
} }
$total_pages = 0; $total_pages = 0;
if ($count > 0 && $limit > 0) { if ($count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit); $total_pages = ceil($count / $limit);
} }
$response->total = $total_pages; $response->total = $total_pages;
if ($page > $total_pages) { if ($page > $total_pages) {
@ -383,12 +383,12 @@ switch ($action) {
case 'session_courses_lp_by_course': case 'session_courses_lp_by_course':
require_once __DIR__.'/../global.inc.php'; require_once __DIR__.'/../global.inc.php';
$now = time(); $now = time();
$page = intval($_REQUEST['page']); //page $page = intval($_REQUEST['page']); //page
$limit = intval($_REQUEST['rows']); // quantity of rows $limit = intval($_REQUEST['rows']); // quantity of rows
$sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
$sidx = str_replace(array('course asc,', ' '), '', $sidx); $sidx = str_replace(array('course asc,', ' '), '', $sidx);
$sord = $_REQUEST['sord']; //asc or desc $sord = $_REQUEST['sord']; //asc or desc
if (!in_array($sord, array('asc', 'desc'))) { if (!in_array($sord, array('asc', 'desc'))) {
$sord = 'desc'; $sord = 'desc';
} }
@ -409,7 +409,7 @@ switch ($action) {
} }
} }
$start = $limit*$page - $limit; $start = $limit * $page - $limit;
$course_list = SessionManager::get_course_list_by_session_id($session_id); $course_list = SessionManager::get_course_list_by_session_id($session_id);
$count = 0; $count = 0;
@ -431,9 +431,9 @@ switch ($action) {
$item['title'], $item['title'],
api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id, array('target'=>SESSION_LINK_TARGET) api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id, array('target'=>SESSION_LINK_TARGET)
); );
foreach($flat_list as $lp_id => $lp_item) { foreach ($flat_list as $lp_id => $lp_item) {
$temp[$count]['id']= $lp_id; $temp[$count]['id'] = $lp_id;
$lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view'; $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
$last_date = Tracking::get_last_connection_date_on_the_course( $last_date = Tracking::get_last_connection_date_on_the_course(
api_get_user_id(), api_get_user_id(),
$item, $item,
@ -485,13 +485,13 @@ switch ($action) {
$temp = msort($temp, $sidx, $sord); $temp = msort($temp, $sidx, $sord);
$response = new stdClass(); $response = new stdClass();
$i =0; $i = 0;
foreach ($temp as $key => $row) { foreach ($temp as $key => $row) {
$row = $row['cell']; $row = $row['cell'];
if (!empty($row)) { if (!empty($row)) {
if ($key >= $start && $key < ($start + $limit)) { if ($key >= $start && $key < ($start + $limit)) {
$response->rows[$i]['id']= $key; $response->rows[$i]['id'] = $key;
$response->rows[$i]['cell']=array($row[0], $row[1], $row[2]); $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
$i++; $i++;
} }
} }

@ -71,7 +71,7 @@ switch ($action) {
<div class="row"> <div class="row">
<div class="col-sm-10 col-sm-offset-2"> <div class="col-sm-10 col-sm-offset-2">
<a class="btn btn-primary" id="send_message_link"> <a class="btn btn-primary" id="send_message_link">
<em class="fa fa-envelope"></em> ' . get_lang('Send') . ' <em class="fa fa-envelope"></em> ' . get_lang('Send').'
</a> </a>
</div> </div>
</div> </div>
@ -136,13 +136,13 @@ switch ($action) {
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$email_admin = api_get_setting('emailAdministrator'); $email_admin = api_get_setting('emailAdministrator');
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$emailbody=get_lang('Dear')." ".stripslashes($recipient_name).",\n\n"; $emailbody = get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
$emailbody.=sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n"; $emailbody .= sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
$emailbody.=sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n"; $emailbody .= sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
$emailbody.=get_lang('HaveFun')."\n\n"; $emailbody .= get_lang('HaveFun')."\n\n";
//$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula'); //$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
$emailbody.=api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); $emailbody .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator');
$additionalParameters = array( $additionalParameters = array(
'smsType' => SmsPlugin::ACCOUNT_APPROVED_CONNECT, 'smsType' => SmsPlugin::ACCOUNT_APPROVED_CONNECT,

@ -29,7 +29,7 @@ class NotebookManager
return "<script> return "<script>
function confirmation (name) function confirmation (name)
{ {
if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\")) if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
{return true;} {return true;}
else else
{return false;} {return false;}
@ -114,7 +114,7 @@ class NotebookManager
description AS note_comment, description AS note_comment,
session_id AS session_id session_id AS session_id
FROM $t_notebook FROM $t_notebook
WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' "; WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) != 1) { if (Database::num_rows($result) != 1) {
return array(); return array();
@ -193,8 +193,8 @@ class NotebookManager
$sql = "DELETE FROM $t_notebook $sql = "DELETE FROM $t_notebook
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
notebook_id='" . intval($notebook_id) . "' AND notebook_id='".intval($notebook_id)."' AND
user_id = '" . api_get_user_id() . "'"; user_id = '" . api_get_user_id()."'";
$result = Database::query($sql); $result = Database::query($sql);
$affected_rows = Database::affected_rows($result); $affected_rows = Database::affected_rows($result);
if ($affected_rows != 1) { if ($affected_rows != 1) {
@ -241,20 +241,20 @@ class NotebookManager
'32' '32'
).'</a>'; ).'</a>';
} elseif (api_is_allowed_to_session_edit(false, true)) { } elseif (api_is_allowed_to_session_edit(false, true)) {
echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' . echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>'; Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
} }
} else { } else {
echo '<a href="javascript:void(0)">' . echo '<a href="javascript:void(0)">'.
Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>'; Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
} }
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' . echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>'; Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' . echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>'; Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' . echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>'; Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
echo '</div>'; echo '</div>';
if (!isset($_SESSION['notebook_view']) || if (!isset($_SESSION['notebook_view']) ||
@ -266,9 +266,9 @@ class NotebookManager
// Database table definition // Database table definition
$t_notebook = Database::get_course_table(TABLE_NOTEBOOK); $t_notebook = Database::get_course_table(TABLE_NOTEBOOK);
if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') { if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
$order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction "; $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
} else { } else {
$order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction "; $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
} }
//condition for the session //condition for the session
@ -281,7 +281,7 @@ class NotebookManager
$sql = "SELECT * FROM $t_notebook $sql = "SELECT * FROM $t_notebook
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
user_id = '" . api_get_user_id() . "' user_id = '".api_get_user_id()."'
$condition_session $condition_session
$cond_extra $order_by $cond_extra $order_by
"; ";
@ -291,18 +291,18 @@ class NotebookManager
$session_img = api_get_session_image($row['session_id'], $_user['status']); $session_img = api_get_session_image($row['session_id'], $_user['status']);
$updateValue = ''; $updateValue = '';
if ($row['update_date'] <> $row['creation_date']) { if ($row['update_date'] <> $row['creation_date']) {
$updateValue = ', ' . get_lang('UpdateDate') . ': ' . Display::dateToStringAgoAndLongDate($row['update_date']); $updateValue = ', '.get_lang('UpdateDate').': '.Display::dateToStringAgoAndLongDate($row['update_date']);
} }
$actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' . $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>'; Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
$actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' . $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
echo Display::panel( echo Display::panel(
$row['description'], $row['description'],
$row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>', $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
get_lang('CreationDate') . ': ' . Display::dateToStringAgoAndLongDate($row['creation_date']). $updateValue get_lang('CreationDate').': '.Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue
); );
} }
} }

@ -23,7 +23,7 @@ class UrlManager
public static function add($url, $description, $active) public static function add($url, $description, $active)
{ {
$tms = time(); $tms = time();
$table= Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "INSERT INTO $table $sql = "INSERT INTO $table
SET url = '".Database::escape_string($url)."', SET url = '".Database::escape_string($url)."',
description = '".Database::escape_string($description)."', description = '".Database::escape_string($description)."',
@ -92,7 +92,7 @@ class UrlManager
$sql = "DELETE FROM $tableUser WHERE access_url_id = ".$id; $sql = "DELETE FROM $tableUser WHERE access_url_id = ".$id;
Database::query($sql); Database::query($sql);
$sql= "DELETE FROM $table WHERE id = ".$id; $sql = "DELETE FROM $table WHERE id = ".$id;
Database::query($sql); Database::query($sql);
return true; return true;
@ -105,7 +105,7 @@ class UrlManager
*/ */
public static function url_exist($url) public static function url_exist($url)
{ {
$table= Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table $sql = "SELECT id FROM $table
WHERE url = '".Database::escape_string($url)."' "; WHERE url = '".Database::escape_string($url)."' ";
$res = Database::query($sql); $res = Database::query($sql);
@ -139,10 +139,10 @@ class UrlManager
* */ * */
public static function url_count() public static function url_count()
{ {
$table_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT count(id) as count_result FROM $table_access_url"; $sql = "SELECT count(id) as count_result FROM $table_access_url";
$res = Database::query($sql); $res = Database::query($sql);
$url = Database::fetch_array($res,'ASSOC'); $url = Database::fetch_array($res, 'ASSOC');
$result = $url['count_result']; $result = $url['count_result'];
return $result; return $result;
@ -160,7 +160,7 @@ class UrlManager
FROM $table FROM $table
ORDER BY id"; ORDER BY id";
$res = Database::query($sql); $res = Database::query($sql);
$urls = array (); $urls = array();
while ($url = Database::fetch_array($res)) { while ($url = Database::fetch_array($res)) {
$urls[] = $url; $urls[] = $url;
} }
@ -277,7 +277,7 @@ class UrlManager
**/ **/
public static function get_url_rel_session_data($access_url_id = null) public static function get_url_rel_session_data($access_url_id = null)
{ {
$where =''; $where = '';
$table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@ -391,7 +391,7 @@ class UrlManager
public static function relation_url_user_exist($user_id, $url_id) public static function relation_url_user_exist($user_id, $url_id)
{ {
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql= "SELECT user_id FROM $table $sql = "SELECT user_id FROM $table
WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." ";
$result = Database::query($sql); $result = Database::query($sql);
$num = Database::num_rows($result); $num = Database::num_rows($result);
@ -409,7 +409,7 @@ class UrlManager
public static function relation_url_course_exist($courseId, $urlId) public static function relation_url_course_exist($courseId, $urlId)
{ {
$table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "SELECT c_id FROM $table_url_rel_course $sql = "SELECT c_id FROM $table_url_rel_course
WHERE WHERE
access_url_id = ".intval($urlId)." AND access_url_id = ".intval($urlId)." AND
c_id = '".intval($courseId)."'"; c_id = '".intval($courseId)."'";
@ -430,7 +430,7 @@ class UrlManager
public static function relationUrlUsergroupExist($userGroupId, $urlId) public static function relationUrlUsergroupExist($userGroupId, $urlId)
{ {
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
$sql= "SELECT usergroup_id FROM $table $sql = "SELECT usergroup_id FROM $table
WHERE WHERE
access_url_id = ".intval($urlId)." AND access_url_id = ".intval($urlId)." AND
usergroup_id = ".intval($userGroupId); usergroup_id = ".intval($userGroupId);
@ -449,7 +449,7 @@ class UrlManager
* */ * */
public static function relation_url_session_exist($session_id, $url_id) public static function relation_url_session_exist($session_id, $url_id)
{ {
$table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$session_id = intval($session_id); $session_id = intval($session_id);
$url_id = intval($url_id); $url_id = intval($url_id);
$sql = "SELECT session_id FROM $table_url_rel_session $sql = "SELECT session_id FROM $table_url_rel_session
@ -517,7 +517,7 @@ class UrlManager
$courseId = $courseInfo['real_id']; $courseId = $courseInfo['real_id'];
$count = self::relation_url_course_exist($courseId, $url_id); $count = self::relation_url_course_exist($courseId, $url_id);
if ($count==0) { if ($count == 0) {
$sql = "INSERT INTO $table_url_rel_course $sql = "INSERT INTO $table_url_rel_course
SET c_id = '".$courseId."', access_url_id = ".intval($url_id); SET c_id = '".$courseId."', access_url_id = ".intval($url_id);
$result = Database::query($sql); $result = Database::query($sql);
@ -603,7 +603,7 @@ class UrlManager
public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
{ {
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
$sql= "SELECT course_category_id FROM $table $sql = "SELECT course_category_id FROM $table
WHERE access_url_id = ".intval($urlId)." AND WHERE access_url_id = ".intval($urlId)." AND
course_category_id = ".intval($categoryCourseId); course_category_id = ".intval($categoryCourseId);
$result = Database::query($sql); $result = Database::query($sql);
@ -774,7 +774,7 @@ class UrlManager
$table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$result = true; $result = true;
if (!empty($user_id) && !empty($url_id)) { if (!empty($user_id) && !empty($url_id)) {
$sql= "DELETE FROM $table_url_rel_user $sql = "DELETE FROM $table_url_rel_user
WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id); WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id);
$result = Database::query($sql); $result = Database::query($sql);
} }
@ -794,7 +794,7 @@ class UrlManager
$table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$result = true; $result = true;
if (!empty($userId)) { if (!empty($userId)) {
$sql= "DELETE FROM $table_url_rel_user $sql = "DELETE FROM $table_url_rel_user
WHERE user_id = ".intval($userId); WHERE user_id = ".intval($userId);
Database::query($sql); Database::query($sql);
} }
@ -813,7 +813,7 @@ class UrlManager
public static function delete_url_rel_course($courseId, $urlId) public static function delete_url_rel_course($courseId, $urlId)
{ {
$table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql= "DELETE FROM $table_url_rel_course $sql = "DELETE FROM $table_url_rel_course
WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." "; WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." ";
$result = Database::query($sql); $result = Database::query($sql);
@ -831,7 +831,7 @@ class UrlManager
public static function delete_url_rel_usergroup($userGroupId, $urlId) public static function delete_url_rel_usergroup($userGroupId, $urlId)
{ {
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
$sql= "DELETE FROM $table $sql = "DELETE FROM $table
WHERE usergroup_id = '".intval($userGroupId)."' AND WHERE usergroup_id = '".intval($userGroupId)."' AND
access_url_id = ".intval($urlId); access_url_id = ".intval($urlId);
$result = Database::query($sql); $result = Database::query($sql);
@ -850,7 +850,7 @@ class UrlManager
public static function deleteUrlRelCourseCategory($userGroupId, $urlId) public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
{ {
$table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
$sql= "DELETE FROM $table $sql = "DELETE FROM $table
WHERE course_category_id = '".intval($userGroupId)."' AND WHERE course_category_id = '".intval($userGroupId)."' AND
access_url_id=".intval($urlId)." "; access_url_id=".intval($urlId)." ";
$result = Database::query($sql); $result = Database::query($sql);
@ -869,7 +869,7 @@ class UrlManager
public static function delete_url_rel_session($session_id, $url_id) public static function delete_url_rel_session($session_id, $url_id)
{ {
$table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$sql= "DELETE FROM $table_url_rel_session $sql = "DELETE FROM $table_url_rel_session
WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." "; WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." ";
$result = Database::query($sql, 'ASSOC'); $result = Database::query($sql, 'ASSOC');
@ -884,7 +884,7 @@ class UrlManager
* */ * */
public static function update_urls_rel_user($user_list, $access_url_id) public static function update_urls_rel_user($user_list, $access_url_id)
{ {
$table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql = "SELECT user_id $sql = "SELECT user_id
FROM $table_url_rel_user FROM $table_url_rel_user
WHERE access_url_id = ".intval($access_url_id); WHERE access_url_id = ".intval($access_url_id);
@ -1053,7 +1053,7 @@ class UrlManager
$result = Database::query($sql); $result = Database::query($sql);
$existing_sessions = array(); $existing_sessions = array();
while ($row = Database::fetch_array($result)){ while ($row = Database::fetch_array($result)) {
$existing_sessions[] = $row['session_id']; $existing_sessions[] = $row['session_id'];
} }
@ -1083,8 +1083,8 @@ class UrlManager
*/ */
public static function get_access_url_from_user($user_id) public static function get_access_url_from_user($user_id)
{ {
$table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT url, access_url_id $sql = "SELECT url, access_url_id
FROM $table_url_rel_user url_rel_user FROM $table_url_rel_user url_rel_user
INNER JOIN $table_url u INNER JOIN $table_url u
@ -1122,7 +1122,7 @@ class UrlManager
public static function get_access_url_from_session($session_id) public static function get_access_url_from_session($session_id)
{ {
$table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session
INNER JOIN $table_url u INNER JOIN $table_url u
ON (url_rel_session.access_url_id = u.id) ON (url_rel_session.access_url_id = u.id)
@ -1139,7 +1139,7 @@ class UrlManager
*/ */
public static function get_url_id($url) public static function get_url_id($url)
{ {
$table_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL); $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$sql = "SELECT id FROM $table_access_url $sql = "SELECT id FROM $table_access_url
WHERE url = '".Database::escape_string($url)."'"; WHERE url = '".Database::escape_string($url)."'";
$result = Database::query($sql); $result = Database::query($sql);

@ -102,13 +102,13 @@ function search_users($needle, $type)
if (api_is_session_admin() && if (api_is_session_admin() &&
api_get_setting('prevent_session_admins_to_manage_all_users') === 'true' api_get_setting('prevent_session_admins_to_manage_all_users') === 'true'
) { ) {
$order_clause = " AND user.creator_id = " . api_get_user_id() . $order_clause; $order_clause = " AND user.creator_id = ".api_get_user_id().$order_clause;
} }
$cond_user_id = ''; $cond_user_id = '';
// Only for single & multiple // Only for single & multiple
if (in_array($type, array('single','multiple'))) if (in_array($type, array('single', 'multiple')))
if (!empty($id_session)) { if (!empty($id_session)) {
$id_session = intval($id_session); $id_session = intval($id_session);
// check id_user from session_rel_user table // check id_user from session_rel_user table
@ -118,11 +118,11 @@ function search_users($needle, $type)
$user_ids = array(); $user_ids = array();
if (Database::num_rows($res) > 0) { if (Database::num_rows($res) > 0) {
while ($row = Database::fetch_row($res)) { while ($row = Database::fetch_row($res)) {
$user_ids[] = (int)$row[0]; $user_ids[] = (int) $row[0];
} }
} }
if (count($user_ids) > 0) { if (count($user_ids) > 0) {
$cond_user_id = ' AND user.id NOT IN('.implode(",",$user_ids).')'; $cond_user_id = ' AND user.id NOT IN('.implode(",", $user_ids).')';
} }
} }
@ -164,7 +164,7 @@ function search_users($needle, $type)
} }
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
switch ($type) { switch ($type) {
@ -215,10 +215,10 @@ function search_users($needle, $type)
$rs = Database::query($sql); $rs = Database::query($sql);
$i = 0; $i = 0;
if ($type=='single') { if ($type == 'single') {
while ($user = Database :: fetch_array($rs)) { while ($user = Database :: fetch_array($rs)) {
$i++; $i++;
if ($i<=10) { if ($i <= 10) {
$person_name = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].') '.$user['official_code']; $person_name = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].') '.$user['official_code'];
if ($showOfficialCode) { if ($showOfficialCode) {
$officialCode = !empty($user['official_code']) ? $user['official_code'].' - ' : '? - '; $officialCode = !empty($user['official_code']) ? $user['official_code'].' - ' : '? - ';
@ -231,7 +231,7 @@ function search_users($needle, $type)
} }
} }
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); $xajax_response -> addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return));
} else { } else {
global $nosessionUsersList; global $nosessionUsersList;
$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
@ -244,7 +244,7 @@ function search_users($needle, $type)
$return .= '<option value="'.$user['id'].'">'.$person_name.' </option>'; $return .= '<option value="'.$user['id'].'">'.$person_name.' </option>';
} }
$return .= '</select>'; $return .= '</select>';
$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); $xajax_response -> addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
} }
} }
return $xajax_response; return $xajax_response;
@ -360,10 +360,10 @@ if ($ajax_search) {
$order_clause"; $order_clause";
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql="SELECT u.id, lastname, firstname, username, session_id, official_code $sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
FROM $tbl_user u FROM $tbl_user u
INNER JOIN $tbl_session_rel_user INNER JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.id AND ON $tbl_session_rel_user.user_id = u.id AND
@ -377,7 +377,7 @@ if ($ajax_search) {
$result = Database::query($sql); $result = Database::query($sql);
$users = Database::store_result($result); $users = Database::store_result($result);
foreach ($users as $user) { foreach ($users as $user) {
$sessionUsersList[$user['id']] = $user ; $sessionUsersList[$user['id']] = $user;
} }
$sessionUserInfo = SessionManager::getTotalUserCoursesInSession($id_session); $sessionUserInfo = SessionManager::getTotalUserCoursesInSession($id_session);
@ -413,12 +413,12 @@ if ($ajax_search) {
if (isset($_POST[$varname]) && $_POST[$varname] != '0') { if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
$use_extra_fields = true; $use_extra_fields = true;
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
$extra_field_result[]= UserManager::get_extra_user_data_by_tags( $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
intval($_POST['field_id']), intval($_POST['field_id']),
$_POST[$varname] $_POST[$varname]
); );
} else { } else {
$extra_field_result[]= UserManager::get_extra_user_data_by_value( $extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'], $new_field['variable'],
$_POST[$varname] $_POST[$varname]
); );
@ -431,10 +431,10 @@ if ($ajax_search) {
if ($use_extra_fields) { if ($use_extra_fields) {
$final_result = array(); $final_result = array();
if (count($extra_field_result)>1) { if (count($extra_field_result) > 1) {
for($i=0;$i<count($extra_field_result)-1;$i++) { for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
if (is_array($extra_field_result[$i+1])) { if (is_array($extra_field_result[$i + 1])) {
$final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
} }
} }
} else { } else {
@ -442,14 +442,14 @@ if ($ajax_search) {
} }
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
if (is_array($final_result) && count($final_result)>0) { if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " AND u.id IN ('".implode("','",$final_result)."') "; $where_filter = " AND u.id IN ('".implode("','", $final_result)."') ";
} else { } else {
//no results //no results
$where_filter = " AND u.id = -1"; $where_filter = " AND u.id = -1";
} }
} else { } else {
if (is_array($final_result) && count($final_result)>0) { if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " WHERE u.id IN ('".implode("','", $final_result)."') "; $where_filter = " WHERE u.id IN ('".implode("','", $final_result)."') ";
} else { } else {
//no results //no results
@ -458,7 +458,7 @@ if ($ajax_search) {
} }
} }
if (api_is_session_admin() && api_get_setting('prevent_session_admins_to_manage_all_users') === 'true') { if (api_is_session_admin() && api_get_setting('prevent_session_admins_to_manage_all_users') === 'true') {
$order_clause = " AND u.creator_id = " . api_get_user_id() . $order_clause; $order_clause = " AND u.creator_id = ".api_get_user_id().$order_clause;
} }
if ($use_extra_fields) { if ($use_extra_fields) {
$sql = "SELECT u.id, lastname, firstname, username, session_id, official_code $sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
@ -480,7 +480,7 @@ if ($ajax_search) {
$order_clause"; $order_clause";
} }
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql = "SELECT u.id, lastname, firstname, username, session_id, official_code $sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
@ -506,7 +506,7 @@ if ($ajax_search) {
'ln' => $user['lastname'], 'ln' => $user['lastname'],
'un' => $user['username'], 'un' => $user['username'],
'official_code' => $user['official_code'] 'official_code' => $user['official_code']
) ; );
unset($users[$uid]); unset($users[$uid]);
} }
} }
@ -522,7 +522,7 @@ if ($ajax_search) {
WHERE u.status<>".DRH." AND u.status<>6 $order_clause"; WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql = "SELECT u.id, lastname, firstname, username, session_id, official_code $sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
@ -560,7 +560,7 @@ if ($add_type == 'multiple') {
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.$addProcess.'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.$addProcess.'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
} }
$link_add_group = Display::url( $link_add_group = Display::url(
Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'), Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'),
api_get_path(WEB_CODE_PATH).'admin/usergroups.php' api_get_path(WEB_CODE_PATH).'admin/usergroups.php'
); );
@ -581,12 +581,12 @@ $newLinks .= Display::url(
echo $newLinks; echo $newLinks;
?> ?>
</div> </div>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($addProcess)) echo '&add=true' ; ?>" <?php if ($ajax_search) { echo ' onsubmit="valide();"';}?>> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($addProcess)) echo '&add=true'; ?>" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; }?>>
<?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?> <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?>
<?php <?php
if ($add_type=='multiple') { if ($add_type == 'multiple') {
if (is_array($extra_field_list)) { if (is_array($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list)>0 ) { if (is_array($new_field_list) && count($new_field_list) > 0) {
echo '<h3>'.get_lang('FilterUsers').'</h3>'; echo '<h3>'.get_lang('FilterUsers').'</h3>';
foreach ($new_field_list as $new_field) { foreach ($new_field_list as $new_field) {
echo $new_field['name']; echo $new_field['name'];
@ -594,8 +594,8 @@ if ($add_type=='multiple') {
$fieldtype = $new_field['type']; $fieldtype = $new_field['type'];
echo '&nbsp;<select name="'.$varname.'">'; echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>'; echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) { foreach ($new_field['data'] as $option) {
$checked=''; $checked = '';
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
if (isset($_POST[$varname])) { if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option['tag']) { if ($_POST[$varname] == $option['tag']) {
@ -636,7 +636,7 @@ if (!empty($errorMsg)) {
<div class="form-group"> <div class="form-group">
<label><?php echo get_lang('UserListInPlatform') ?> </label> <label><?php echo get_lang('UserListInPlatform') ?> </label>
<?php <?php
if (!($add_type=='multiple')) { if (!($add_type == 'multiple')) {
?> ?>
<input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" /> <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" />
<div id="ajax_list_users_single" class="select-list-ajax"></div> <div id="ajax_list_users_single" class="select-list-ajax"></div>
@ -648,7 +648,7 @@ if (!empty($errorMsg)) {
<?php <?php
foreach ($nosessionUsersList as $uid => $enreg) { foreach ($nosessionUsersList as $uid => $enreg) {
?> ?>
<option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>> <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>>
<?php <?php
$personName = $enreg['ln'].' '.$enreg['fn'].' ('.$enreg['un'].') '.$enreg['official_code']; $personName = $enreg['ln'].' '.$enreg['fn'].' ('.$enreg['un'].') '.$enreg['official_code'];
if ($showOfficialCode) { if ($showOfficialCode) {
@ -673,7 +673,7 @@ if (!empty($errorMsg)) {
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<?php if ($add_type=='multiple') { ?> <?php if ($add_type == 'multiple') { ?>
<?php echo get_lang('FirstLetterUser'); ?> : <?php echo get_lang('FirstLetterUser'); ?> :
<select id="first_letter_user" name="firstLetterUser" onchange = "change_select(this.value);" > <select id="first_letter_user" name="firstLetterUser" onchange = "change_select(this.value);" >

@ -16,8 +16,8 @@ if (api_get_setting('allow_social_tool') !== 'true') {
$this_section = SECTION_SOCIAL; $this_section = SECTION_SOCIAL;
$interbreadcrumb[] = array ('url' =>'profile.php','name' => get_lang('SocialNetwork')); $interbreadcrumb[] = array('url' =>'profile.php', 'name' => get_lang('SocialNetwork'));
$interbreadcrumb[] = array ('url' =>'#','name' => get_lang('Invitations')); $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Invitations'));
$userGroupModel = new UserGroup(); $userGroupModel = new UserGroup();
@ -64,7 +64,7 @@ if (is_array($_GET) && count($_GET) > 0) {
Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'warning') Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'warning')
); );
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php'); header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
exit; exit;
break; break;
case 'deny': case 'deny':
@ -74,7 +74,7 @@ if (is_array($_GET) && count($_GET) > 0) {
Display::return_message(get_lang('GroupInvitationWasDeny')) Display::return_message(get_lang('GroupInvitationWasDeny'))
); );
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php'); header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
exit; exit;
} }
} }
@ -130,24 +130,24 @@ if ($number_loop != 0) {
$invitationHtml .= '<div class="btn-group btn-group-sm" role="group">'; $invitationHtml .= '<div class="btn-group btn-group-sm" role="group">';
$invitationHtml .= Display::toolbarButton( $invitationHtml .= Display::toolbarButton(
null, null,
api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([ api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
'a' => 'add_friend', 'a' => 'add_friend',
'friend_id' => $sender_user_id, 'friend_id' => $sender_user_id,
'is_my_friend' => 'friend' 'is_my_friend' => 'friend'
]), ]),
'check', 'check',
'default', 'default',
['id' => 'btn-accept-' . $sender_user_id] ['id' => 'btn-accept-'.$sender_user_id]
); );
$invitationHtml .= Display::toolbarButton( $invitationHtml .= Display::toolbarButton(
null, null,
api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([ api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
'a' => 'deny_friend', 'a' => 'deny_friend',
'denied_friend_id' => $sender_user_id, 'denied_friend_id' => $sender_user_id,
]), ]),
'times', 'times',
'default', 'default',
['id' => 'btn-deny-' . $sender_user_id] ['id' => 'btn-deny-'.$sender_user_id]
); );
$invitationHtml .= '</div>'; $invitationHtml .= '</div>';
$invitationHtml .= '</div>'; $invitationHtml .= '</div>';
@ -184,7 +184,7 @@ if (count($list_get_invitation_sent) > 0) {
$invitationSentHtml .= '<div class="col-md-9">'; $invitationSentHtml .= '<div class="col-md-9">';
$invitationSentHtml .= '<h4 class="title-profile"><a class="profile_link" href="profile.php?u='.$sender_user_id.'">'.$user_info['complete_name'].'</a></h4>'; $invitationSentHtml .= '<h4 class="title-profile"><a class="profile_link" href="profile.php?u='.$sender_user_id.'">'.$user_info['complete_name'].'</a></h4>';
$invitationSentHtml .= '<div class="content-invitation">'.$title.' : '.$content.'</div>'; $invitationSentHtml .= '<div class="content-invitation">'.$title.' : '.$content.'</div>';
$invitationSentHtml .= '<div class="date-invitation">'. get_lang('DateSend').' : '.$date.'</div>'; $invitationSentHtml .= '<div class="date-invitation">'.get_lang('DateSend').' : '.$date.'</div>';
$invitationSentHtml .= '</div>'; $invitationSentHtml .= '</div>';
$invitationSentHtml .= '</div></div>'; $invitationSentHtml .= '</div></div>';
} }
@ -203,9 +203,9 @@ if (count($pending_invitations) > 0) {
); );
$img = '<img class="img-responsive" src="'.$picture['file'].'" />'; $img = '<img class="img-responsive" src="'.$picture['file'].'" />';
$invitation['picture_uri'] = '<a href="group_view.php?id='.$invitation['id'].'">'.$img.'</a>'; $invitation['picture_uri'] = '<a href="group_view.php?id='.$invitation['id'].'">'.$img.'</a>';
$invitation['name'] = '<a href="group_view.php?id='.$invitation['id'].'">'.cut($invitation['name'],120,true).'</a>'; $invitation['name'] = '<a href="group_view.php?id='.$invitation['id'].'">'.cut($invitation['name'], 120, true).'</a>';
$invitation['description'] = cut($invitation['description'], 220, true); $invitation['description'] = cut($invitation['description'], 220, true);
$new_invitation[]=$invitation; $new_invitation[] = $invitation;
$waitingInvitation .= '<div class="panel-invitations"><div class="row">'; $waitingInvitation .= '<div class="panel-invitations"><div class="row">';
$waitingInvitation .= '<div class="col-md-3">'.$invitation['picture_uri'].'</div>'; $waitingInvitation .= '<div class="col-md-3">'.$invitation['picture_uri'].'</div>';
$waitingInvitation .= '<div class="col-md-9">'; $waitingInvitation .= '<div class="col-md-9">';
@ -214,19 +214,19 @@ if (count($pending_invitations) > 0) {
$waitingInvitation .= '<div class="btn-group" role="group">'; $waitingInvitation .= '<div class="btn-group" role="group">';
$waitingInvitation .= Display::toolbarButton( $waitingInvitation .= Display::toolbarButton(
get_lang('AcceptInvitation'), get_lang('AcceptInvitation'),
api_get_path(WEB_CODE_PATH) . 'social/invitations.php?' . http_build_query(['accept' => $invitation['id']]), api_get_path(WEB_CODE_PATH).'social/invitations.php?'.http_build_query(['accept' => $invitation['id']]),
'check', 'check',
'success', 'success',
['id' => 'accept-invitation-' . $invitation['id']] ['id' => 'accept-invitation-'.$invitation['id']]
); );
$waitingInvitation .= Display::toolbarButton( $waitingInvitation .= Display::toolbarButton(
get_lang('DenyInvitation'), get_lang('DenyInvitation'),
api_get_path(WEB_CODE_PATH) . 'social/invitations.php?' . http_build_query(['deny' => $invitation['id']]), api_get_path(WEB_CODE_PATH).'social/invitations.php?'.http_build_query(['deny' => $invitation['id']]),
'times', 'times',
'danger', 'danger',
['id' => 'deny-invitation-' . $invitation['id']] ['id' => 'deny-invitation-'.$invitation['id']]
); );
$waitingInvitation .='</div>'; $waitingInvitation .= '</div>';
$waitingInvitation .= '</div></div>'; $waitingInvitation .= '</div></div>';
} }
$socialInvitationsBlock .= Display::panel($waitingInvitation, get_lang('GroupsWaitingApproval')); $socialInvitationsBlock .= Display::panel($waitingInvitation, get_lang('GroupsWaitingApproval'));

@ -8,7 +8,7 @@
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true') { if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true') {
header('location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php'); header('location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit; exit;
} }
@ -91,7 +91,7 @@ function add_image_form() {
}); });
img_remove = $("<img/>", { img_remove = $("<img/>", {
src: "' . Display::returnIconPath('delete.png') . '" src: "' . Display::returnIconPath('delete.png').'"
}); });
new_filepath_id = $("#filepath_" + counter_image); new_filepath_id = $("#filepath_" + counter_image);
@ -110,10 +110,10 @@ $projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
$types = TicketManager::get_all_tickets_categories($projectId, 'category.name ASC'); $types = TicketManager::get_all_tickets_categories($projectId, 'category.name ASC');
$htmlHeadXtra[] = '<script language="javascript"> $htmlHeadXtra[] = '<script language="javascript">
var projects = ' . js_array($types, 'projects', 'project_id') . ' var projects = ' . js_array($types, 'projects', 'project_id').'
var course_required = ' . js_array($types, 'course_required', 'course_required') . ' var course_required = ' . js_array($types, 'course_required', 'course_required').'
var other_area = ' . js_array($types, 'other_area', 'other_area') . ' var other_area = ' . js_array($types, 'other_area', 'other_area').'
var email = ' . js_array($types, 'email', 'email') . var email = ' . js_array($types, 'email', 'email').
'</script>'; '</script>';
/** /**
@ -122,7 +122,7 @@ $htmlHeadXtra[] = '<script language="javascript">
*/ */
function js_str($s) function js_str($s)
{ {
return '"' . addcslashes($s, "\0..\37\"\\") . '"'; return '"'.addcslashes($s, "\0..\37\"\\").'"';
} }
/** /**
@ -135,7 +135,7 @@ function js_array($array, $name, $key)
{ {
$return = "new Array(); "; $return = "new Array(); ";
foreach ($array as $value) { foreach ($array as $value) {
$return .= $name . "['" . $value['category_id'] . "'] ='" . $value[$key] . "'; "; $return .= $name."['".$value['category_id']."'] ='".$value[$key]."'; ";
} }
return $return; return $return;
@ -148,7 +148,7 @@ function save_ticket()
{ {
$content = $_POST['content']; $content = $_POST['content'];
if ($_POST['phone'] != '') { if ($_POST['phone'] != '') {
$content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . $_POST['phone']. '</p>'; $content .= '<p style="color:red">&nbsp;'.get_lang('Phone').': '.$_POST['phone'].'</p>';
} }
$course_id = isset($_POST['course_id']) ? $_POST['course_id'] : ''; $course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
$sessionId = isset($_POST['session_id']) ? $_POST['session_id'] : ''; $sessionId = isset($_POST['session_id']) ? $_POST['session_id'] : '';
@ -179,7 +179,7 @@ function save_ticket()
$status, $status,
$user_id $user_id
)) { )) {
header('Location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php'); header('Location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit; exit;
} else { } else {
Display::addFlash(Display::return_message(get_lang('ThereWasAnErrorRegisteringTheTicket'))); Display::addFlash(Display::return_message(get_lang('ThereWasAnErrorRegisteringTheTicket')));
@ -363,7 +363,7 @@ $form->addElement(
$form->addElement( $form->addElement(
'text', 'text',
'phone', 'phone',
get_lang('Phone') . ' (' . get_lang('Optional') . ')', get_lang('Phone').' ('.get_lang('Optional').')',
array( array(
'id' => 'phone' 'id' => 'phone'
) )
@ -401,7 +401,7 @@ $form->addLabel('', '<span id="filepaths"><div id="filepath_1"></div></span>');
$form->addLabel( $form->addLabel(
'', '',
'<span id="link-more-attach"> '<span id="link-more-attach">
<span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span> <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile').'</span>
</span> </span>
('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).') ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
' '
@ -434,7 +434,7 @@ Display::display_header(get_lang('ComposeMessage'));
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM), Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php' api_get_path(WEB_CODE_PATH).'ticket/tickets.php'
); );
echo '</div>'; echo '</div>';

@ -5,7 +5,7 @@ use ChamiloSession as Session;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION; $current_course_tool = TOOL_STUDENTPUBLICATION;
api_protect_course_script(true); api_protect_course_script(true);
@ -81,7 +81,7 @@ if ($form->validate()) {
if ($upload) { if ($upload) {
$zip = new PclZip($_FILES['file']['tmp_name']); $zip = new PclZip($_FILES['file']['tmp_name']);
// Check the zip content (real size and file extension) // Check the zip content (real size and file extension)
$zipFileList = (array)$zip->listContent(); $zipFileList = (array) $zip->listContent();
$realSize = 0; $realSize = 0;
foreach ($zipFileList as & $this_content) { foreach ($zipFileList as & $this_content) {
@ -128,7 +128,7 @@ if ($form->validate()) {
foreach ($result as $item) { foreach ($result as $item) {
$title = $item['title_clean']; $title = $item['title_clean'];
$insert_date = str_replace(array(':', '-', ' '), '_', api_get_local_time($item['sent_date_from_db'])); $insert_date = str_replace(array(':', '-', ' '), '_', api_get_local_time($item['sent_date_from_db']));
$title = api_replace_dangerous_char($insert_date.'_'.$item['username'].'_'.$title); $title = api_replace_dangerous_char($insert_date.'_'.$item['username'].'_'.$title);
$finalResult[$title] = $item['id']; $finalResult[$title] = $item['id'];
} }

@ -28,7 +28,7 @@ class Virtual
self::getHostName($_configuration); self::getHostName($_configuration);
// We are on physical chamilo. Let original config play // We are on physical chamilo. Let original config play
$virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/') . '/'; $virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/').'/';
$virtualChamilo = []; $virtualChamilo = [];
if ($_configuration['root_web'] == $virtualChamiloWebRoot) { if ($_configuration['root_web'] == $virtualChamiloWebRoot) {
@ -234,7 +234,7 @@ class Virtual
if (preg_match('#https?://#', $url)) { if (preg_match('#https?://#', $url)) {
header('location: '.$url); header('location: '.$url);
} else { } else {
header('location: ' . api_get_path(WEB_PATH).$url); header('location: '.api_get_path(WEB_PATH).$url);
} }
exit; exit;
} }
@ -417,7 +417,7 @@ class Virtual
} }
// Making the command line (see 'vconfig.php' file for defining the right paths). // Making the command line (see 'vconfig.php' file for defining the right paths).
$sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' ' ); $sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' ');
$sqlcmd .= '-u'.$vchamilodata->db_user.' '.$databasePassword; $sqlcmd .= '-u'.$vchamilodata->db_user.' '.$databasePassword;
$sqlcmd .= '%DATABASE% < '; $sqlcmd .= '%DATABASE% < ';
@ -500,7 +500,7 @@ class Virtual
// $cmds[] = $cmd_main . ' > ' . $outputfilerad; // $cmds[] = $cmd_main . ' > ' . $outputfilerad;
//} else { //} else {
$cmd_main = "-h{$host} -P{$port} -u{$vchamilo->db_user} {$pass} {$vchamilo->main_database}"; $cmd_main = "-h{$host} -P{$port} -u{$vchamilo->db_user} {$pass} {$vchamilo->main_database}";
$cmds[] = $cmd_main . ' > ' . escapeshellarg($outputfilerad); $cmds[] = $cmd_main.' > '.escapeshellarg($outputfilerad);
//} //}
$mysqldumpcmd = self::getConfig('vchamilo', 'cmd_mysqldump', true); $mysqldumpcmd = self::getConfig('vchamilo', 'cmd_mysqldump', true);
@ -949,7 +949,7 @@ class Virtual
Display::return_message('You cannot use the same database as the chamilo master', 'error') Display::return_message('You cannot use the same database as the chamilo master', 'error')
); );
return ; return;
} }
$databaseName = $data->main_database; $databaseName = $data->main_database;
@ -963,7 +963,7 @@ class Virtual
'error' 'error'
) )
); );
return ; return;
} }
$data->root_web = api_add_trailing_slash($data->root_web); $data->root_web = api_add_trailing_slash($data->root_web);
@ -993,7 +993,7 @@ class Virtual
Display::addFlash( Display::addFlash(
Display::return_message('Cannot create slug from url: '.$data->root_web, 'error') Display::return_message('Cannot create slug from url: '.$data->root_web, 'error')
); );
return ; return;
} }
Database::insert($tablename, (array) $data); Database::insert($tablename, (array) $data);
} }
@ -1135,14 +1135,14 @@ class Virtual
$newDatabase->sitename = $siteName; $newDatabase->sitename = $siteName;
$newDatabase->institution = $institution; $newDatabase->institution = $institution;
$slug = $newDatabase->slug = $data->slug = self::getSlugFromUrl($data->root_web); $slug = $newDatabase->slug = $data->slug = self::getSlugFromUrl($data->root_web);
$id = Database::insert($table, (array)$newDatabase); $id = Database::insert($table, (array) $newDatabase);
} }
} }
if (!$id) { if (!$id) {
// Show data detail to help debug // Show data detail to help debug
//var_dump($data); //var_dump($data);
throw new Exception('New/Imported instance was not registered - edit ' . __FILE__ . ' on line ' . __LINE__ . 'to var_dump'); throw new Exception('New/Imported instance was not registered - edit '.__FILE__.' on line '.__LINE__.'to var_dump');
} }
if (empty($slug)) { if (empty($slug)) {
@ -1313,7 +1313,7 @@ class Virtual
$id = (int) $id; $id = (int) $id;
$sql = "SELECT * FROM vchamilo WHERE id = $id"; $sql = "SELECT * FROM vchamilo WHERE id = $id";
$result = Database::query($sql); $result = Database::query($sql);
$vhost = (object) Database::fetch_array($result, 'ASSOC'); $vhost = (object) Database::fetch_array($result, 'ASSOC');
} }
return $vhost; return $vhost;

@ -112,9 +112,9 @@ switch ($action) {
$vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : ''; $vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : '';
if ($vid) { if ($vid) {
$vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid))); $vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid)));
$vhost = (object)array_pop($vhosts); $vhost = (object) array_pop($vhosts);
} else { } else {
$vhost = (object)$_configuration; $vhost = (object) $_configuration;
$vhost->slug = Virtual::getSlugFromUrl($vhost->root_web); $vhost->slug = Virtual::getSlugFromUrl($vhost->root_web);
$vhost->id = 0; $vhost->id = 0;
} }
@ -305,10 +305,10 @@ switch ($action) {
$vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : 0; $vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : 0;
if ($vid) { if ($vid) {
$vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid))); $vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid)));
$vhost = (object)array_pop($vhosts); $vhost = (object) array_pop($vhosts);
$toclear[$vhost->id] = $vhost; $toclear[$vhost->id] = $vhost;
} else { } else {
$toclear[0] = (object)$_configuration; $toclear[0] = (object) $_configuration;
} }
} }
} else { } else {
@ -331,7 +331,7 @@ switch ($action) {
//$uploadPath = Virtual::getConfig('vchamilo', 'upload_real_root'); //$uploadPath = Virtual::getConfig('vchamilo', 'upload_real_root');
// Get instance archive // Get instance archive
$archivepath = api_get_path(SYS_ARCHIVE_PATH, (array)$instance); $archivepath = api_get_path(SYS_ARCHIVE_PATH, (array) $instance);
$templatepath = $archivePath.'/'.$instance['slug'].'/twig'; $templatepath = $archivePath.'/'.$instance['slug'].'/twig';
Display::addFlash(Display::return_message("Deleting cache $templatepath \n")); Display::addFlash(Display::return_message("Deleting cache $templatepath \n"));
removeDir($templatepath); removeDir($templatepath);

@ -131,7 +131,7 @@ class Editor
case 'integer': case 'integer':
//no break //no break
case 'double': case 'double':
return (string)$var; return (string) $var;
//no break //no break
case 'resource': case 'resource':
//no break //no break

Loading…
Cancel
Save