Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

Yannick Warnier 10 years ago
parent
commit
1626bc82f4
84 changed files with 856 additions and 1015 deletions
  1. 4 4
      composer.json
  2. 1 1
      main/admin/class_import.php
  3. 1 1
      main/admin/class_user_import.php
  4. 2 2
      main/admin/configure_extensions.php
  5. 3 2
      main/admin/configure_inscription.php
  6. 1 1
      main/admin/user_add.php
  7. 1 1
      main/admin/user_edit.php
  8. 17 19
      main/course_info/infocours.php
  9. 1 1
      main/course_info/legal.php
  10. 3 0
      main/course_info/maintenance.php
  11. 1 2
      main/course_progress/thematic_plan.php
  12. 1 1
      main/coursecopy/copy_course.php
  13. 1 1
      main/coursecopy/create_backup.php
  14. 1 7
      main/coursecopy/import_backup.php
  15. 1 1
      main/coursecopy/recycle_course.php
  16. 7 3
      main/css/base.css
  17. 2 3
      main/document/create_audio.php
  18. 10 6
      main/document/document.php
  19. 1 1
      main/exercice/admin.php
  20. 14 8
      main/exercice/calculated_answer.class.php
  21. 12 4
      main/exercice/fill_blanks.class.php
  22. 2 1
      main/exercice/freeanswer.class.php
  23. 2 2
      main/exercice/global_multiple_answer.class.php
  24. 2 1
      main/exercice/hotspot.class.php
  25. 1 1
      main/exercice/matching.class.php
  26. 7 16
      main/exercice/multiple_answer.class.php
  27. 2 2
      main/exercice/multiple_answer_combination.class.php
  28. 2 2
      main/exercice/multiple_answer_true_false.class.php
  29. 15 8
      main/exercice/oral_expression.class.php
  30. 8 8
      main/exercice/question.class.php
  31. 0 1
      main/exercice/question_admin.inc.php
  32. 5 15
      main/exercice/unique_answer.class.php
  33. 4 4
      main/exercice/unique_answer_no_option.class.php
  34. 1 1
      main/glossary/glossary_form.class.php
  35. 1 1
      main/glossary/index.php
  36. 4 0
      main/gradebook/lib/GradebookUtils.php
  37. 13 4
      main/inc/ajax/message.ajax.php
  38. 10 5
      main/inc/lib/course.lib.php
  39. 1 1
      main/inc/lib/formvalidator/Element/DatePicker.php
  40. 0 87
      main/inc/lib/formvalidator/Element/DatePickerDate.php
  41. 1 1
      main/inc/lib/formvalidator/Element/DateRangePicker.php
  42. 1 1
      main/inc/lib/formvalidator/Element/DateTimePicker.php
  43. 2 2
      main/inc/lib/formvalidator/Element/HtmlEditor.php
  44. 1 1
      main/inc/lib/formvalidator/Element/Number.php
  45. 3 0
      main/inc/lib/formvalidator/Element/calendar_popup.php
  46. 0 220
      main/inc/lib/formvalidator/Element/style_button.php
  47. 0 84
      main/inc/lib/formvalidator/Element/style_reset_button.php
  48. 77 14
      main/inc/lib/formvalidator/Element/style_submit_button.php
  49. 60 29
      main/inc/lib/formvalidator/FormValidator.class.php
  50. 6 7
      main/inc/lib/message.lib.php
  51. 2 1
      main/inc/lib/pear/HTML/QuickForm.php
  52. 1 1
      main/inc/lib/pear/HTML/QuickForm/CAPTCHA.php
  53. 51 20
      main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php
  54. 7 9
      main/inc/lib/pear/HTML/QuickForm/advmultiselect.php
  55. 48 0
      main/inc/lib/pear/HTML/QuickForm/button.php
  56. 1 1
      main/inc/lib/pear/HTML/QuickForm/checkbox.php
  57. 47 4
      main/inc/lib/pear/HTML/QuickForm/element.php
  58. 1 1
      main/inc/lib/pear/HTML/QuickForm/email.php
  59. 1 1
      main/inc/lib/pear/HTML/QuickForm/file.php
  60. 1 1
      main/inc/lib/pear/HTML/QuickForm/group.php
  61. 1 1
      main/inc/lib/pear/HTML/QuickForm/hidden.php
  62. 1 1
      main/inc/lib/pear/HTML/QuickForm/hiddenselect.php
  63. 1 1
      main/inc/lib/pear/HTML/QuickForm/image.php
  64. 2 2
      main/inc/lib/pear/HTML/QuickForm/input.php
  65. 2 20
      main/inc/lib/pear/HTML/QuickForm/label.php
  66. 1 1
      main/inc/lib/pear/HTML/QuickForm/link.php
  67. 11 24
      main/inc/lib/pear/HTML/QuickForm/password.php
  68. 2 3
      main/inc/lib/pear/HTML/QuickForm/radio.php
  69. 1 1
      main/inc/lib/pear/HTML/QuickForm/reset.php
  70. 57 3
      main/inc/lib/pear/HTML/QuickForm/select.php
  71. 1 1
      main/inc/lib/pear/HTML/QuickForm/submit.php
  72. 76 29
      main/inc/lib/pear/HTML/QuickForm/text.php
  73. 2 2
      main/inc/lib/social.lib.php
  74. 49 39
      main/inc/lib/userportal.lib.php
  75. 1 113
      main/social/profile.php
  76. 10 116
      main/social/search.php
  77. 82 0
      main/survey/copy_survey.php
  78. 13 8
      main/survey/survey.lib.php
  79. 0 6
      main/template/default/layout/layout_2_col.tpl
  80. 7 8
      main/template/default/layout/layout_3_col.tpl
  81. 54 4
      main/template/default/social/form_modals.tpl
  82. 4 0
      main/template/default/social/search.tpl
  83. 2 4
      main/user/user.php
  84. 0 1
      user_portal.php

+ 4 - 4
composer.json

@@ -53,10 +53,6 @@
         "gedmo/doctrine-extensions": "~2.3",
         "sonata-project/user-bundle": "~2.2",
         "fxp/composer-asset-plugin": "~1.0",
-
-        "behat/behat": "2.4.*@stable",
-        "behat/mink-extension": "*@stable",
-
         "bower-asset/bootstrap": "3.3.*",
         "bower-asset/fontawesome": "4.3.*",
         "bower-asset/moment": "2.9",
@@ -69,6 +65,10 @@
         "bower-asset/modernizr": "2.8.*",
         "bower-asset/jqueryui-timepicker-addon": "1.5.*"
     },
+    "require-dev": {
+        "behat/behat": "2.4.*@stable",
+        "behat/mink-extension": "*@stable"
+    },
     "extra": {
         "branch-alias": {
             "dev-master": "1.10.x-dev"

+ 1 - 1
main/admin/class_import.php

@@ -78,7 +78,7 @@ set_time_limit(0);
 
 $form = new FormValidator('import_classes');
 $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
-$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
+$form->addButtonImport(get_lang('Import'));
 
 if ($form->validate()) {
     $classes = Import::csv_to_array($_FILES['import_file']['tmp_name']);

+ 1 - 1
main/admin/class_user_import.php

@@ -153,7 +153,7 @@ $form = new FormValidator('class_user_import');
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
-$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
+$form->addButtonImport(get_lang('Import'));
 
 if ($form->validate()) {
     $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);

+ 2 - 2
main/admin/configure_extensions.php

@@ -350,13 +350,13 @@ Display::display_header($nameTool);
 							{
 								$defaults[$row['subkey']] = $row['selected_value'];
 							}
-							$form -> addElement('style_submit_button', 'activeExtension', get_lang('ReconfigureExtension'),'class="save"');
+							$form->addButtonSave(get_lang('ReconfigureExtension'), 'activeExtension');
 						}
 						else {
 							$defaults['host'] = 'localhost';
 							$defaults['port'] = '2002';
 							$defaults['size'] = '720x540';
-							$form -> addElement('style_submit_button', 'activeExtension', get_lang('ActivateExtension'),'class="save"');
+							$form->addButtonSave(get_lang('ActivateExtension'), 'activeExtension');
 						}
 
 						$form -> setDefaults($defaults);

+ 3 - 2
main/admin/configure_inscription.php

@@ -304,7 +304,8 @@ if (get_setting('allow_terms_conditions') == 'true') {
     }
 }
 
-$form->addElement('style_submit_button', 'submit', get_lang('RegisterUser'), array('disabled' => 'disabled'));
+//$form->addElement('style_submit_button', 'submit', get_lang('RegisterUser'), array('disabled' => 'disabled'));
+$form->addButtonSave(get_lang('RegisterUser'));
 
 $defaults['status'] = STUDENT;
 
@@ -357,7 +358,7 @@ switch ($action){
         $form->addElement('hidden', 'formSent', '1');
         $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
         $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-        $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
+        $form->addButtonSave(get_lang('Save'));
         $form->setDefaults($default);
         $form->display();
         break;

+ 1 - 1
main/admin/user_add.php

@@ -275,7 +275,7 @@ $form->setDefaults($defaults);
 
 // Submit button
 $html_results_enabled[] = $form->createElement('button', 'submit', get_lang('Add'), 'plus', 'primary');
-$html_results_enabled[] = $form->createElement('button', 'submit_plus', get_lang('Add').'+');
+$html_results_enabled[] = $form->createElement('button', 'submit_plus', get_lang('Add').'+', 'plus', 'primary');
 
 $form->addGroup($html_results_enabled);
 

+ 1 - 1
main/admin/user_edit.php

@@ -265,7 +265,7 @@ $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' ', false);
 // Registration User and Date
 $creatorInfo = api_get_user_info($user_data['creator_id']);
 $date = sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id='.$user_data['creator_id'], $creatorInfo['username'], $user_data['registration_date']);
-$form->addElement('html', '<div class="control-group"><label class="control-label">'.get_lang('RegistrationDate').'</label><div class="controls">'.$date.'</div></div>');
+$form->addElement('label', get_lang('RegistrationDate'), $date);
 
 if (!$user_data['platform_admin']) {
 	// Expiration Date

+ 17 - 19
main/course_info/infocours.php

@@ -163,7 +163,6 @@ $form->addGroup($group, '', array(get_lang("Stylesheets")), '');
 
 $form->addElement('label', get_lang('DocumentQuota'), format_file_size(DocumentManager::get_course_quota()));
 $form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '. get_lang('SaveSettings'), 'class="btn btn-primary"');
 $form->addElement('html', '</div></div>');
 
 // COURSE ACCESS
@@ -199,8 +198,8 @@ $form->addText('course_registration_password', get_lang('CourseRegistrationPassw
 
 $form->addElement('checkbox', 'activate_legal', array(null, get_lang('ShowALegalNoticeWhenEnteringTheCourse')), get_lang('ActivateLegal'));
 $form->addElement('textarea', 'legal', get_lang('CourseLegalAgreement'), array('class'=>'span6', 'rows' => 8));
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null, '<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
+
 $form->addElement('html', '</div></div>');
 
 // Documents
@@ -213,7 +212,7 @@ if (api_get_setting('documents_default_visibility_defined_in_course') == 'true')
     );
     $form->addGroup($group, '', array(get_lang("DocumentsDefaultVisibility")), '');
     $form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-    //$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+
 
     $form->addElement('html', '</div></div>');
 }
@@ -246,8 +245,7 @@ $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', null, get_lang('QuizEmailAlertDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("QuizEmailAlert")), '');
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null, '<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 
 $form->addElement('html', '</div></div>');
 
@@ -273,8 +271,7 @@ $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', null, get_lang('AllowUserViewUserListDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowUserViewUserList")), '');
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null, '<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addElement('html', '</div></div>');
 
 // CHAT SETTINGS
@@ -284,8 +281,7 @@ $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', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowOpenchatWindow")), '');
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '. get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addElement('html', '</div></div>');
 
 // LEARNING PATH
@@ -328,8 +324,7 @@ if (isset($_configuration['allow_lp_return_link']) && $_configuration['allow_lp_
 }
 
 if (is_settings_editable()) {
-    $form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-    //$form->addElement('style_submit_button', null, '<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+    $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 } else {
     // Is it allowed to edit the course settings?
     if (!is_settings_editable()) {
@@ -340,7 +335,13 @@ if (is_settings_editable()) {
 $form->addElement('html', '</div></div>');
 
 // THEMATIC ADVANCE SETTINGS
-$form->addElement('html', '<div><h3>'.Display::return_icon('course_progress.png', Security::remove_XSS(get_lang('ThematicAdvanceConfiguration')),'',ICON_SIZE_SMALL).' '.Security::remove_XSS(get_lang('ThematicAdvanceConfiguration')).'</h3><div>');
+$form->addElement(
+    'html',
+    '<div><h3>'.Display::return_icon(
+    'course_progress.png',
+    Security::remove_XSS(get_lang('ThematicAdvanceConfiguration')),'',ICON_SIZE_SMALL
+    ).' '.Security::remove_XSS(get_lang('ThematicAdvanceConfiguration')).'</h3><div>'
+);
 
 $group = array();
 $group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1);
@@ -348,8 +349,7 @@ $group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse',
 $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);
 $form->addGroup($group, '', array(get_lang("InfoAboutAdvanceInsideHomeCourse")), '');
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addElement('html', '</div></div>');
 
 // Document settings
@@ -361,8 +361,7 @@ $group = array(
 
 );
 $form->addGroup($group, '', array(get_lang("ShowSystemFolders")), '');
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-//$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn btn-primary"');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addElement('html', '</div></div>');
 
 // Certificate settings
@@ -372,8 +371,7 @@ if (api_get_setting('allow_public_certificates')=='true') {
     $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);
     $form->addGroup($group, '', array(get_lang("AllowPublicCertificates")), '');
-    $form->addButtonSave(get_lang('SaveSettings'),'submit_save');
-    //$form->addElement('style_submit_button', null,'<i class="fa fa-floppy-o"></i> '.get_lang('SaveSettings'), 'class="btn  btn-primary"');
+    $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
     $form->addElement('html', '</div></div>');
 }
 

+ 1 - 1
main/course_info/legal.php

@@ -74,7 +74,7 @@ if ($pluginLegal && !empty($plugin)) {
 $form->addElement('hidden', 'course_code', $course_code);
 $form->addElement('hidden', 'session_id', $session_id);
 $form->addElement('checkbox', 'accept_legal', null, get_lang('AcceptLegal'));
-$form->addElement('style_submit_button', null, get_lang('Accept'), 'class="save"');
+$form->addButtonSave(get_lang('Accept'));
 
 $variable = 'accept_legal_'.$user_id.'_'.$course_info['real_id'].'_'.$session_id;
 

+ 3 - 0
main/course_info/maintenance.php

@@ -38,6 +38,9 @@ echo Display::page_header($nameTools);
 <div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopyCourse'); ?></a></div>
 <div class="sectioncomment"><?php echo get_lang('DescriptionCopyCourse'); ?></div>
 
+<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopySurvey')); ?>&nbsp;&nbsp;<a href="../survey/copy_survey.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopySurvey'); ?></a></div>
+<div class="sectioncomment"><?php echo get_lang('DescriptionCopySurvey'); ?></div>
+
 <div class="sectiontitle"><?php Display::display_icon('tool_delete.gif', get_lang('recycle_course')); ?>&nbsp;&nbsp;<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('recycle_course'); ?></a></div>
 <div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div>
 

+ 1 - 2
main/course_progress/thematic_plan.php

@@ -99,8 +99,7 @@ if ($action == 'thematic_plan_list') {
 
 	$form->addText('title', get_lang('Title'), true, array('size'=>'50'));
 	$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarStartExpanded'=>'false', 'ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150'));
-	//$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
-	$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
+	$form->addButtonSave(get_lang('Save'));
 
 	if ($description_type < ADD_THEMATIC_PLAN) {
 		$default['title'] = $default_thematic_plan_title[$description_type];

+ 1 - 1
main/coursecopy/copy_course.php

@@ -120,7 +120,7 @@ if (Security::check_token('post') && (
         $group[] = $form->createElement('radio', 'same_file_name_option', null, get_lang('SameFilenameOverwrite'), FILE_OVERWRITE);
         $form->addGroup($group, '', get_lang('SameFilename'));
         $form->add_progress_bar();
-        $form->addElement('style_submit_button', 'submit', get_lang('CopyCourse'), 'class="save"');
+        $form->addButtonSave(get_lang('CopyCourse'));
         $form->setDefaults(array('copy_option' =>'select_items','same_file_name_option' => FILE_OVERWRITE));
 
         // Add Security token

+ 1 - 1
main/coursecopy/create_backup.php

@@ -104,7 +104,7 @@ if (Security::check_token('post') && (
         $form->addElement('header', get_lang('SelectOptionForBackup'));
         $form->addElement('radio', 'backup_option', '', get_lang('CreateFullBackup'), 'full_backup');
         $form->addElement('radio', 'backup_option', '', get_lang('LetMeSelectItems'), 'select_items');
-        $form->addElement('style_submit_button', null, get_lang('CreateBackup'), 'class="save"');
+        $form->addButtonSave(get_lang('CreateBackup'));
         $form->add_progress_bar();
         // When progress bar appears we have to hide the title "Please select a backup-option".
         $form->updateAttributes(

+ 1 - 7
main/coursecopy/import_backup.php

@@ -260,13 +260,7 @@ if (Security::check_token('post') && (
     );
 
     $form->addElement('html', '<br />');
-    $form->addElement(
-        'style_submit_button',
-        null,
-        get_lang('ImportBackup'),
-        'class="save"'
-    );
-
+    $form->addButtonImport(get_lang('ImportBackup'));
     $values['backup_type'] = 'local';
     $values['import_option'] = 'full_backup';
     $values['same_file_name_option'] = FILE_OVERWRITE;

+ 1 - 1
main/coursecopy/recycle_course.php

@@ -99,7 +99,7 @@ if (Security::check_token('post') && (
         $form->addElement('header', get_lang('SelectOptionForBackup'));
         $form->addElement('radio', 'recycle_option', null, get_lang('FullRecycle'), 'full_backup');
         $form->addElement('radio', 'recycle_option', null, get_lang('LetMeSelectItems'), 'select_items');
-        $form->addElement('style_submit_button', 'submit', get_lang('RecycleCourse'), 'class="save"');
+        $form->addButtonSave(get_lang('RecycleCourse'));
         $form->setDefaults(array('recycle_option' => 'select_items'));
         // Add Security token
         $token = Security::get_token();

+ 7 - 3
main/css/base.css

@@ -2409,10 +2409,10 @@ div.admin_section h4 {
     margin-bottom:5px;
     clear: both;
 }
-.question-list-description-block {
+/*.question-list-description-block {
     margin-bottom:10px !important;
     margin-top: -6px !important;
-}
+}*/
 
 .thematic_advance_content {
     padding:10px;
@@ -5484,4 +5484,8 @@ i.size-32.icon-new-work{
   background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
   background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
   text-decoration: none;
-}
+}
+
+.actions .form-inline {
+    display:inline-block;
+}

+ 2 - 3
main/document/create_audio.php

@@ -216,7 +216,7 @@ $(document).ready(function(){
 		$form->addElement('select', 'lang', get_lang('Language'), $options);
 		$form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google', 'class' =>'span6' ));
 		//echo Display :: return_icon('info3.gif', get_lang('HelpGoogleAudio'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
-		$form->addElement('style_submit_button', 'submit', get_lang('SaveMP3'), 'class="save"');
+		$form->addButtonSave(get_lang('SaveMP3'));
 		$defaults = array();
 		$defaults['lang'] = $selected_language;
 		$form->setDefaults($defaults);
@@ -248,8 +248,7 @@ $(document).ready(function(){
 		$form->addElement('select', 'speed', get_lang('Speed'), $speed_options, array());
 		$form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_pediaphon', 'class' =>'span6'));
 		//echo Display :: return_icon('info3.gif', get_lang('HelpPediaphon'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
-
-		$form->addElement('style_submit_button', 'submit', get_lang('SaveMP3'), 'class="save"');
+		$form->addButtonSave(get_lang('SaveMP3'));
 		$defaults = array();
 		$defaults['lang'] = $selected_language;
 		$form->setDefaults($defaults);

+ 10 - 6
main/document/document.php

@@ -1509,17 +1509,21 @@ if (!isset($folders) || $folders === false) {
 $actions = '<div class="actions">';
 if (!$is_certificate_mode) {
     /* BUILD SEARCH FORM */
-    $actions .= '<span style="display:inline-block;">';
-    $form = new FormValidator('search_document', 'get', api_get_self().'?'.api_get_cidreq());
-    $renderer = & $form->defaultRenderer();
-    $renderer->setElementTemplate('<span>{element}</span> ');
+
+    $form = new FormValidator(
+        'search_document',
+        'get',
+        api_get_self().'?'.api_get_cidreq(),
+        '',
+        array(),
+        FormValidator::LAYOUT_INLINE
+    );
     $form->addText('keyword', '', false, array('class' => 'col-md-2'));
     $form->addElement('hidden', 'cidReq', api_get_course_id());
     $form->addElement('hidden', 'id_session', api_get_session_id());
     $form->addElement('hidden', 'gidReq', $groupId);
     $form->addButtonSearch(get_lang('Search'));
-    $actions .= $form->return_form();
-    $actions .= '</span>';
+    $actions .= $form->returnForm();
 }
 
 /* GO TO PARENT DIRECTORY */

+ 1 - 1
main/exercice/admin.php

@@ -521,7 +521,7 @@ if (isset($_GET['message'])) {
 }
 
 if ($newQuestion || $editQuestion) {
-    // statement management
+    // Question management
     $type = isset($_REQUEST['answerType']) ? Security::remove_XSS($_REQUEST['answerType']) : null;
     echo '<input type="hidden" name="Type" value="'.$type.'" />';
 

+ 14 - 8
main/exercice/calculated_answer.class.php

@@ -89,7 +89,7 @@ class CalculatedAnswer extends Question
                     var answer = e.editor.getData();
                 }
                 var blanks = answer.match(/\[[^\]]*\]/g);
-                var fields = "<div class=\"control-group\"><label class=\"control-label\">'.get_lang('VariableRanges').'</label><div class=\"controls\"><table>";
+                var fields = "<div class=\"form-group\"><label class=\"col-sm-2\">'.get_lang('VariableRanges').'</label><div class=\"col-sm-8\"><table>";
                 if (blanks!=null) {
                     if (typeof updateBlanks.randomValues === "undefined") {
                         updateBlanks.randomValues = [];
@@ -120,7 +120,15 @@ class CalculatedAnswer extends Question
 
         // answer
         $form->addElement('label', null, '<br /><br />'.get_lang('TypeTextBelow').', '.get_lang('And').' '.get_lang('UseTagForBlank'));
-        $form->addElement('html_editor', 'answer', '<img src="../img/fill_field.png">','id="answer" cols="122" rows="6" onkeyup="javascript: updateBlanks(this);"', array('ToolbarSet' => 'Test_Question_Description', 'Width' => '100%', 'Height' => '350'));
+        $form->addElement(
+            'html_editor',
+            'answer',
+            '<img src="../img/fill_field.png">',
+            array(
+                'id' => 'answer',
+                'onkeyup' => 'javascript: updateBlanks(this);'
+            ),
+            array('ToolbarSet' => 'Test_Question_Description', 'Width' => '100%', 'Height' => '350'));
 
         $form->addRule('answer', get_lang('GiveText'),'required');
         $form->addRule('answer', get_lang('DefineBlanks'),'regex','/\[.*\]/');
@@ -137,11 +145,8 @@ class CalculatedAnswer extends Question
             )
         );
         $form->addElement(
-            'html',
-            '<div class="control-group">
-                <label class="control-label"></label>
-                <div class="controls">'.$notationListButton.'</div>
-            </div>');
+            'label', null,
+            $notationListButton);
 
         $form->addElement('label', null, get_lang('FormulaExample'));
 
@@ -157,7 +162,8 @@ class CalculatedAnswer extends Question
 
         global $text, $class;
         // setting the save button here and not in the question class.php
-        $form->addElement('style_submit_button', 'submitQuestion', $text, 'class="'.$class.'"');
+        //$form->addElement('style_submit_button', 'submitQuestion', $text, 'class="'.$class.'"');
+        $form->addButtonSave($text, 'submitQuestion');
 
         if (!empty($this->id)) {
             $form -> setDefaults($defaults);

+ 12 - 4
main/exercice/fill_blanks.class.php

@@ -90,14 +90,14 @@ class FillBlanks extends Question
                 }
 
                 var blanks = answer.match(/\[[^\]]*\]/g);
-                var fields = "<div class=\"control-group\"><label class=\"control-label\">'.get_lang('Weighting').'</label><div class=\"controls\"><table>";
+                var fields = "<div class=\"form-group\"><label class=\" col-sm-2 control-label\">'.get_lang('Weighting').'</label><div class=\"col-sm-8\"><table>";
                 if (blanks!=null) {
                     for (i=0 ; i<blanks.length ; i++){
                         if (document.getElementById("weighting["+i+"]"))
                             value = document.getElementById("weighting["+i+"]").value;
                         else
                             value = "10";
-                        fields += "<tr><td><label>"+blanks[i]+"</label></td><td><input style=\"margin-left: 0em;\" size=\"5\" value=\""+value+"\" type=\"text\" id=\"weighting["+i+"]\" name=\"weighting["+i+"]\" /></td></tr>";
+                        fields += "<tr><td><label>"+blanks[i]+"</label></td><td><input class=\"form-control\"style=\"margin-left: 0em;\" size=\"5\" value=\""+value+"\" type=\"text\" id=\"weighting["+i+"]\" name=\"weighting["+i+"]\" /></td></tr>";
                     }
                 }
                 document.getElementById("blanks_weighting").innerHTML = fields + "</table></div></div>";
@@ -112,7 +112,15 @@ class FillBlanks extends Question
 
 		// answer
 		$form->addElement('label', null, '<br /><br />'.get_lang('TypeTextBelow').', '.get_lang('And').' '.get_lang('UseTagForBlank'));
-		$form->addElement('html_editor', 'answer', '<img src="../img/fill_field.png">','id="answer" cols="122" rows="6" onkeyup="javascript: updateBlanks(this);"', array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350'));
+		$form->addElement(
+            'html_editor',
+            'answer',
+            '<img src="../img/fill_field.png">',
+            array(
+                'id' => 'answer',
+                'onkeyup' => '"javascript: updateBlanks(this);"'
+            ),
+            array('ToolbarSet' => 'TestQuestionDescription', 'Height' => '350'));
 
 		$form->addRule('answer', get_lang('GiveText'),'required');
 		$form->addRule('answer', get_lang('DefineBlanks'),'regex','/\[.*\]/');
@@ -124,7 +132,7 @@ class FillBlanks extends Question
 
 		global $text, $class;
 		// setting the save button here and not in the question class.php
-		$form->addElement('style_submit_button', 'submitQuestion', $text, 'class="'.$class.'"');
+        $form->addButtonSave($text, 'submitQuestion');
 
 		if (!empty($this->id)) {
 			$form -> setDefaults($defaults);

+ 2 - 1
main/exercice/freeanswer.class.php

@@ -32,7 +32,8 @@ class FreeAnswer extends Question
         $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
         global $text, $class;
         // setting the save button here and not in the question class.php
-        $form->addElement('style_submit_button', 'submitQuestion', $text, 'class="' . $class . '"');
+        //$form->addElement('style_submit_button', 'submitQuestion', $text, 'class="' . $class . '"');
+        $form->addButtonSave($text, 'submitQuestion');
         if (!empty($this->id)) {
             $form->setDefaults(array('weighting' => float_format($this->weighting, 1)));
         } else {

+ 2 - 2
main/exercice/global_multiple_answer.class.php

@@ -109,10 +109,10 @@ class GlobalMultipleAnswer extends Question
             $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
             $boxes_names[] = 'correct[' . $i . ']';
 
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
             $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
 
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 
             $form->addElement('html', '</tr>');
         }

+ 2 - 1
main/exercice/hotspot.class.php

@@ -36,12 +36,13 @@ class HotSpot extends Question
 			// setting the save button here and not in the question class.php
 			// Saving a question
 			$form->addElement('style_submit_button','submitQuestion',get_lang('GoToQuestion'), 'class="'.$class.'"');
+			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
 			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
 			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
 		} else {
 			// setting the save button here and not in the question class.php
 			// Editing a question
-			$form->addElement('style_submit_button','submitQuestion',get_lang('ModifyExercise'), 'class="'.$class.'"');
+			$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
 		}
 	}
 

+ 1 - 1
main/exercice/matching.class.php

@@ -113,7 +113,7 @@ class Matching extends Question
             $puce->freeze();
             $group[] = $puce;
 
-            $group[] = $form->createElement('text', 'answer['.$i.']',null, 'size="60" style="margin-left: 0em;"');
+            $group[] = $form->createElement('text', 'answer['.$i.']',null);
             $group[] = $form->createElement('select', 'matches['.$i.']',null,$a_matches);
             $group[] = $form->createElement('text', 'weighting['.$i.']',null, array('class' => 'span1', 'value' => 10));
             $form -> addGroup($group, null, null, '</td><td>');

+ 7 - 16
main/exercice/multiple_answer.class.php

@@ -109,10 +109,10 @@ class MultipleAnswer extends Question
 			$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
 			$boxes_names[] = 'correct['.$i.']';
 
-			$form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+			$form->addElement('html_editor', 'answer['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 			$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
 
-				$form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+				$form->addElement('html_editor', 'comment['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 
 			$form->addElement('text', 'weighting['.$i.']',null, array('class' => "span1", 'value' => '0'));
 			$form -> addElement ('html', '</tr>');
@@ -122,23 +122,14 @@ class MultipleAnswer extends Question
 
 		$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required');
 
-
-		$navigator_info = api_get_navigator();
-
 		global $text, $class;
 		if ($obj_ex->edit_exercise_in_lp == true) {
-			//ie6 fix
-			if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
-                $form->addElement('submit', 'lessAnswers', get_lang('LessAnswer'),'class="btn minus"');
-                $form->addElement('submit', 'moreAnswers', get_lang('PlusAnswer'),'class="btn plus"');
-                $form->addElement('submit','submitQuestion',$text, 'class="'.$class.'"');
-			} else {
-                // setting the save button here and not in the question class.php
-                $form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'class="btn minus"');
-                $form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'class="btn plus"');
-                $form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
-			}
+			// setting the save button here and not in the question class.php
+			$form->addElement('style_submit_button', 'lessAnswers', get_lang('LessAnswer'),'class="btn minus"');
+			$form->addElement('style_submit_button', 'moreAnswers', get_lang('PlusAnswer'),'class="btn plus"');
+			$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
 		}
+
 		$renderer->setElementTemplate('{element}&nbsp;','lessAnswers');
 		$renderer->setElementTemplate('{element}&nbsp;','submitQuestion');
 		$renderer->setElementTemplate('{element}&nbsp;','moreAnswers');

+ 2 - 2
main/exercice/multiple_answer_combination.class.php

@@ -99,10 +99,10 @@ class MultipleAnswerCombination extends Question
 			$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
 			$boxes_names[] = 'correct['.$i.']';
 
-			$form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+			$form->addElement('html_editor', 'answer['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 			$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
 
-            $form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+            $form->addElement('html_editor', 'comment['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 			//only 1 answer the all deal ...
 			//$form->addElement('text', 'weighting['.$i.']',null, 'style="vertical-align:middle;margin-left: 0em;" size="5" value="10"');
 

+ 2 - 2
main/exercice/multiple_answer_true_false.class.php

@@ -121,12 +121,12 @@ class MultipleAnswerTrueFalse extends Question
 			}
 
 			$boxes_names[] = 'correct['.$i.']';
-			$form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+			$form->addElement('html_editor', 'answer['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 			$form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
 
 			// show comment when feedback is enable
 			if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
-				$form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
+				$form->addElement('html_editor', 'comment['.$i.']',null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
 			}
 			$form->addElement ('html', '</tr>');
 		}

+ 15 - 8
main/exercice/oral_expression.class.php

@@ -15,7 +15,7 @@ class OralExpression extends Question
 	/**
 	 * Constructor
 	 */
-	function OralExpression()
+	public function __construct()
     {
 		parent::question();
 		$this -> type = ORAL_EXPRESSION;
@@ -23,15 +23,16 @@ class OralExpression extends Question
 	}
 
 	/**
-	 * function which redifines Question::createAnswersForm
-	 * @param $form FormValidator
+	 * function which redefine Question::createAnswersForm
+	 * @param FormValidator $form
 	 */
-	function createAnswersForm ($form)
+	function createAnswersForm($form)
     {
-		$form -> addElement('text','weighting',get_lang('Weighting'), array('class' => 'span1'));
+
+		$form -> addElement('text','weighting', get_lang('Weighting'), array('class' => 'span1'));
 		global $text, $class;
 		// setting the save button here and not in the question class.php
-		$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
+		$form->addButtonSave($text, 'submitQuestion');
 		if (!empty($this->id)) {
 			$form -> setDefaults(array('weighting' => float_format($this->weighting, 1)));
 		} else {
@@ -43,14 +44,20 @@ class OralExpression extends Question
 
 	/**
 	 * abstract function which creates the form to create / edit the answers of the question
-	 * @param the formvalidator instance
+	 * @param the FormValidator $form
 	 */
 	function processAnswersCreation($form)
     {
-		$this->weighting = $form -> getSubmitValue('weighting');
+		$this->weighting = $form ->getSubmitValue('weighting');
 		$this->save();
 	}
 
+	/**
+	 * @param null $feedback_type
+	 * @param null $counter
+	 * @param null $score
+	 * @return null|string
+	 */
 	function return_header($feedback_type = null, $counter = null, $score = null)
     {
 	    $header = parent::return_header($feedback_type, $counter, $score);

+ 8 - 8
main/exercice/question.class.php

@@ -1289,7 +1289,7 @@ abstract class Question
             //$course_medias = Question::prepare_course_media_select(api_get_course_int_id());
             //$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
 
-            $form->addElement('html','</div>');
+            $form->addElement('html', '</div>');
         }
 
         if (!isset($_GET['fromExercise'])) {
@@ -1318,10 +1318,10 @@ abstract class Question
 
         // default values
         $defaults = array();
-        $defaults['questionName']           = $this -> question;
-        $defaults['questionDescription']    = $this -> description;
-        $defaults['questionLevel']          = $this -> level;
-        $defaults['questionCategory']       = $this->category;
+        $defaults['questionName'] = $this->question;
+        $defaults['questionDescription'] = $this->description;
+        $defaults['questionLevel'] = $this->level;
+        $defaults['questionCategory'] = $this->category;
 
         //$defaults['questionCategory']       = $this->category_list;
         //$defaults['parent_id']              = $this->parent_id;
@@ -1345,7 +1345,7 @@ abstract class Question
      * @param FormValidator $form
      * @param Exercise $objExercise
      */
-    public function processCreation ($form, $objExercise = null)
+    public function processCreation($form, $objExercise = null)
     {
         //$this->updateParentId($form->getSubmitValue('parent_id'));
         $this->updateTitle($form->getSubmitValue('questionName'));
@@ -1365,13 +1365,13 @@ abstract class Question
 
     /**
      * abstract function which creates the form to create / edit the answers of the question
-     * @param the formvalidator instance
+     * @param the FormValidator instance
      */
     abstract function createAnswersForm ($form);
 
     /**
      * abstract function which process the creation of answers
-     * @param the formvalidator instance
+     * @param the FormValidator instance
      */
     abstract function processAnswersCreation ($form);
 

+ 0 - 1
main/exercice/question_admin.inc.php

@@ -10,7 +10,6 @@
  * 	@version $Id: question_admin.inc.php 22126 2009-07-15 22:38:39Z juliomontoya $
  */
 
-// INIT QUESTION
 if (isset($_GET['editQuestion'])) {
 	$objQuestion = Question::read ($_GET['editQuestion']);
 	$action = api_get_self()."?".api_get_cidreq()."&myid=1&modifyQuestion=".$modifyQuestion."&editQuestion=".$objQuestion->id;

+ 5 - 15
main/exercice/unique_answer.class.php

@@ -85,8 +85,7 @@ class UniqueAnswer extends Question
                     </th>
                 </tr>';
 
-        $form->addElement(
-            'label',
+        $form->addLabel(
             get_lang('Answers') . '<br /> <img src="../img/fill_field.png">',
             $html
         );
@@ -114,9 +113,9 @@ class UniqueAnswer extends Question
                 }
                 $question = Question::read($questionid);
                 $select_question[$questionid] = 'Q' . $key . ' :' . cut(
-                        $question->selectTitle(),
-                        20
-                    );
+                    $question->selectTitle(),
+                    20
+                );
             }
         }
         $select_question[-1] = get_lang('ExitTest');
@@ -215,8 +214,6 @@ class UniqueAnswer extends Question
                 ' value = "' . $i . '"'
             );
             $answer_number->freeze();
-            $form->addHtml('<div class="row">');
-            $form->addHtml('<div class="col-md-1">');
             $form->addElement(
                 'radio',
                 'correct',
@@ -225,10 +222,8 @@ class UniqueAnswer extends Question
                 $i,
                 'class="checkbox"'
             );
-            $form->addHtml('</div>');
-            $form->addHtml('<div class="col-md-5">');
+
             $form->addHtmlEditor('answer[' . $i . ']',null,null,true, $editor_config);
-            $form->addHtml('</div>');
 
             $form->addRule(
                 'answer[' . $i . ']',
@@ -237,9 +232,7 @@ class UniqueAnswer extends Question
             );
 
             if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
-                $form->addHtml('<div class="col-md-5">');
                 $form->addHtmlEditor('comment[' . $i . ']',null,null,false,$editor_config);
-                $form->addHtml('</div>');
                 // Direct feedback
 
                 //Adding extra feedback fields
@@ -279,11 +272,8 @@ class UniqueAnswer extends Question
                 );
 
             } else {
-                $form->addHtml('<div class="col-md-5">');
                 $form->addHtmlEditor('comment[' . $i . ']',null,null,false,$editor_config);
-                $form->addHtml('</div>');
             }
-            $form->addHtml('</div>');
             $form->addText('weighting[' . $i . ']', null,null, array('class' => "col-md-1", 'value' => '0'));
             $form->addElement('html', '</tr>');
         }

+ 4 - 4
main/exercice/unique_answer_no_option.class.php

@@ -184,9 +184,9 @@ class UniqueAnswerNoOption extends Question
 
 
 			$form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
-			$form->addElement('html_editor', 'answer['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
+			$form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
 
-            $form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
 			$form->addElement('text', 'weighting['.$i.']', null, array('class' => "span1", 'value' => '0'));
 			$form->addElement('html', '</tr>');
             $i++;
@@ -218,12 +218,12 @@ class UniqueAnswerNoOption extends Question
         $form->addElement('hidden', 'position['.$i.']', '666');
 
         $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
-        $form->addElement('html_editor', 'answer['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
+        $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
 
         $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
 
 
-        $form->addElement('html_editor', 'comment['.$i.']', null, 'style="vertical-align:middle"', $editor_config);
+        $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
 
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
 

+ 1 - 1
main/glossary/glossary_form.class.php

@@ -77,7 +77,7 @@ class GlossaryForm extends \FormValidator
         $this->addHeader($form_name);
 
         $this->addText('name', get_lang('TermName'), $required = true, array('class' => 'span3'));
-        $this->addHtmlEditor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300'));
+        $this->addHtmlEditor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Height' => '300'));
         $this->addButton('save', get_lang('Save'));
 
         $this->setDefaults($defaults);

+ 1 - 1
main/glossary/index.php

@@ -134,7 +134,7 @@ if (api_is_allowed_to_edit(null, true)) {
                 $form->addElement('hidden', 'glossary_id');
                 $form->addElement('text', 'glossary_title', get_lang('TermName'),array('size'=>'80'));
                 //$form->applyFilter('glossary_title', 'html_filter');
-                $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'), null, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300'));
+                $form->addElement('html_editor', 'glossary_comment', get_lang('TermDefinition'), null, array('ToolbarSet' => 'Glossary', 'Height' => '300'));
                 $element = $form->addElement('text', 'insert_date', get_lang('CreationDate'),array('size'=>'100'));
                 $element->freeze();
                 $element = $form->addElement('text', 'update_date', get_lang('UpdateDate'),array('size'=>'100'));

+ 4 - 0
main/gradebook/lib/GradebookUtils.php

@@ -1010,6 +1010,10 @@ class GradebookUtils
         $coursecodes = array();
         $users = array();
 
+        // By default add all user in course
+        $coursecodes[api_get_course_id()] = '1';
+        $users = GradebookUtils::get_users_in_course(api_get_course_id());
+
         foreach ($evals as $eval) {
             $coursecode = $eval->get_course_code();
             // evaluation in course

+ 13 - 4
main/inc/ajax/message.ajax.php

@@ -12,8 +12,15 @@ $action = $_GET['a'];
 
 switch ($action) {
     case 'send_message':
-        $subject = isset($_REQUEST['subject']) ? $_REQUEST['subject'] : null;
-        $result = MessageManager::send_message($_REQUEST['user_id'], $subject, $_REQUEST['content']);
+        $subject = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : null;
+        $messageContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null;
+
+        if (empty($subject) || empty($messageContent)) {
+            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
+            exit;
+        }
+
+        $result = MessageManager::send_message($_REQUEST['user_id'], $subject, $messageContent);
         if ($result) {
             echo Display::display_confirmation_message(get_lang('MessageHasBeenSent'));
         } else {
@@ -21,8 +28,10 @@ switch ($action) {
         }
         break;
     case 'send_invitation':
-        $subject = isset($_REQUEST['subject']) ? $_REQUEST['subject'] : null;
-        SocialManager::send_invitation_friend_user($_REQUEST['user_id'], $subject, $_REQUEST['content']);
+        $subject = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : null;
+        $invitationContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null;
+
+        SocialManager::send_invitation_friend_user($_REQUEST['user_id'], $subject, $invitationContent);
         break;
     case 'find_users':
         if (api_is_anonymous()) {

+ 10 - 5
main/inc/lib/course.lib.php

@@ -3299,7 +3299,7 @@ class CourseManager
         $notifications = isset($params['notifications']) ? $params['notifications'] : null;
         $html.= $params['title']. $notifications;
         $html.='</li>';
-        
+
         return $html;
     }
 
@@ -5321,8 +5321,13 @@ class CourseManager
             $result[$content['value']] = $content['content'];
         }
 
-        $group = $form->addElement('advmultiselect', 'users', get_lang('Users'), $result,
-            array('select_all_checkbox' => true));
+        $form->addElement(
+            'advmultiselect',
+            'users',
+            get_lang('Users'),
+            $result,
+            array('select_all_checkbox' => true)
+        );
     }
 
     /**
@@ -5344,7 +5349,7 @@ class CourseManager
             $result[$content['value']] = $content['content'];
         }
 
-        $group = $form->addElement('advmultiselect', 'users', get_lang('Users'), $result);
+        $form->addElement('advmultiselect', 'users', get_lang('Users'), $result);
     }
 
     /**
@@ -5375,7 +5380,7 @@ class CourseManager
                     ) { // $to_already_selected is the array containing the groups (and users) that are already selected
                         $user_label = ($this_group['userNb'] > 0) ? get_lang('Users') : get_lang('LowerCaseUser');
                         $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled";
-                        $result [] = array(
+                        $result[] = array(
                             'disabled' => $user_disabled,
                             'value' => "GROUP:" . $this_group['id'],
                             'content' => "G: " . $this_group['name'] . " - " . $this_group['userNb'] . " " . $user_label

+ 1 - 1
main/inc/lib/formvalidator/Element/DatePicker.php

@@ -20,7 +20,7 @@ class DatePicker extends HTML_QuickForm_text
         }
         $attributes['class'] = 'form-control';
 
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_appendName = true;
         $this->_type = 'date_picker';
     }

+ 0 - 87
main/inc/lib/formvalidator/Element/DatePickerDate.php

@@ -1,87 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-
-/**
- * Form element to select a date and hour (with popup datepicker)
- * @deprecated use DatePicker
- */
-class DatePickerDate extends HTML_QuickForm_date
-{
-	/**
-	 * Constructor
-     * @deprecated use class DatePicker
-	 */
-	public function DatePickerDate($elementName = null, $elementLabel = null, $attributes = null)
-    {
-		global $myMinYear, $myMaxYear;
-		$js_form_name = $attributes['form_name'];
-		unset($attributes['form_name']);
-		HTML_QuickForm_element :: HTML_QuickForm_element($elementName, $elementLabel, $attributes);
-		$this->_persistantFreeze = true;
-		$this->_appendName = true;
-		$this->_type = 'datepicker';
-		$popup_link = '<a href="javascript:openCalendar(\''.$js_form_name.'\',\''.$elementName.'\')"><img src="'.api_get_path(WEB_IMG_PATH).'calendar_select.gif" style="vertical-align:middle;" alt="Select Date" /></a>';
-		$special_chars = array ('D', 'l', 'd', 'M', 'F', 'm', 'y', 'H', 'a', 'A', 's', 'i', 'h', 'g', ' ');
-		foreach ($special_chars as $char) {
-			$popup_link = str_replace($char, "\\".$char, $popup_link);
-		}
-		$lang_code = api_get_language_isocode();
-		// If translation not available in PEAR::HTML_QuickForm_date, add the Chamilo-translation
-		if (! array_key_exists($lang_code,$this->_locale)) {
-			$this->_locale[$lang_code]['months_long'] = api_get_months_long();
-		}
-		$this->_options['format'] = 'dFY '.$popup_link;
-		$this->_options['minYear'] = date('Y')-5;
-		$this->_options['maxYear'] = date('Y')+10;
-		$this->_options['language'] = $lang_code;
-	}
-
-	/**
-	 * HTML code to display this datepicker
-	 */
-	function toHtml()
-	{
-		$js = $this->getElementJS();
-		return $js.parent :: toHtml();
-	}
-	/**
-	 * Get the necessary javascript for this datepicker
-	 */
-	function getElementJS()
-	{
-		$js = '';
-		if(!defined('DATEPICKER_JAVASCRIPT_INCLUDED')) {
-			define('DATEPICKER_JAVASCRIPT_INCLUDED', 1);
-			$js = "\n";
-			$js .= '<script src="';
-			$js .= api_get_path(WEB_CODE_PATH).'inc/lib/formvalidator/Element/';
-			$js .= 'tbl_change.js.php" type="text/javascript"></script>';
-			$js .= "\n";
-		}
-		return $js;
-	}
-
-	/**
-	 * Export the date value in MySQL format
-	 * @return string YYYY-MM-DD HH:II:SS
-	 */
-	function exportValue(&$submitValues, $assoc = false)
-	{
-		$values = parent::getValue();
-		$y = $values['Y'][0];
-		$m = $values['F'][0];
-		$d = $values['d'][0];
-		$m = $m < 10 ? '0'.$m : $m;
-		$d = $d < 10 ? '0'.$d : $d;
-		$datetime = $y.'-'.$m.'-'.$d;
-		$result[$this->getName()]= $datetime;
-		return $result;
-	}
-	/**
-	 * Sets an option to a value
-	 */
-	function setLocalOption($name,$value)
-	{
-		$this->_options[$name] = $value;
-	}
-}

+ 1 - 1
main/inc/lib/formvalidator/Element/DateRangePicker.php

@@ -15,7 +15,7 @@ class DateRangePicker extends HTML_QuickForm_text
             $attributes['id'] = $elementName;
         }
         $attributes['class'] = 'form-control';
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_appendName = true;
         $this->_type = 'date_range_picker';
     }

+ 1 - 1
main/inc/lib/formvalidator/Element/DateTimePicker.php

@@ -15,7 +15,7 @@ class DateTimePicker extends HTML_QuickForm_text
             $attributes['id'] = $elementName;
         }
         $attributes['class'] = 'form-control';
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_appendName = true;
         $this->_type = 'date_time_picker';
     }

+ 2 - 2
main/inc/lib/formvalidator/Element/HtmlEditor.php

@@ -24,7 +24,7 @@ class HtmlEditor extends HTML_QuickForm_textarea
      * @param array $config Optional configuration settings for the online editor.
      * @return bool
      */
-    public function HtmlEditor(
+    public function __construct(
         $name = null,
         $elementLabel = null,
         $attributes = null,
@@ -34,7 +34,7 @@ class HtmlEditor extends HTML_QuickForm_textarea
             return false;
         }
 
-        HTML_QuickForm_element :: HTML_QuickForm_element($name, $elementLabel, $attributes);
+        parent::__construct($name, $elementLabel, $attributes);
         $this->_persistantFreeze = true;
         $this->_type = 'html_editor';
 

+ 1 - 1
main/inc/lib/formvalidator/Element/Number.php

@@ -22,7 +22,7 @@ class Number extends HTML_QuickForm_text
         $attributes['type'] = 'number';
         $attributes['class'] = 'form-control';
 
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_appendName = true;
         $this->_type = 'number';
     }

+ 3 - 0
main/inc/lib/formvalidator/Element/calendar_popup.php

@@ -1,5 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
+/**
+ * @deprecated code use DatePicker or DateTimePicker
+ */
 require_once dirname(__FILE__).'/../../../global.inc.php';
 
 //session

+ 0 - 220
main/inc/lib/formvalidator/Element/style_button.php

@@ -1,220 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for <input /> form elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Adam Daniel <adaniel1@eesus.jnj.com>
- * @author      Bertrand Mansion <bmansion@mamasam.com>
- * @copyright   2001-2007 The PHP Group
- * @license     http://www.php.net/license/3_01.txt PHP License 3.01
- * @version     CVS: $Id: input.php 17344 2008-12-17 08:55:29Z Scara84 $
- * @link        http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <button></button> form elements
- *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Hans De Bisschop <hans.de.bisschop@ehb.be>
- * @abstract
- */
-class HTML_QuickForm_style_button extends HTML_QuickForm_element
-{
-    // {{{ constructor
-    /**
-     * Class constructor
-     *
-     * @param    string     Input field name attribute
-     * @param    mixed      Label(s) for the input field
-     * @param    mixed      Either a typical HTML attribute string or an associative array
-     * @since     1.0
-     * @access    public
-     * @return    void
-     */
-    function HTML_QuickForm_style_button($elementName=null, $elementLabel=null, $attributes=null)
-    {
-        $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
-
-    } //end constructor
-
-    // }}}
-    // {{{ setType()
-
-    /**
-     * Sets the element type
-     *
-     * @param     string    $type   Element type
-     * @since     1.0
-     * @access    public
-     * @return    void
-     */
-
-
-    /* Returns an HTML formatted attribute string
-     * @param    array   $attributes
-     * @return   string
-     * @access   private
-     */
-    function _getAttrString($attributes) {
-        $strAttr = '';
-        if (is_array($attributes)) {
-            foreach ($attributes as $key => $value) {
-            	if ($key != 'value') $strAttr .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
-            }
-        }
-        return $strAttr;
-    } // end func _getAttrString
-
-
-    function setType($type)
-    {
-        $this->_type = $type;
-        $this->updateAttributes(array('type'=>$type));
-    } // end func setType
-
-    // }}}
-    // {{{ setName()
-
-    /**
-     * Sets the input field name
-     *
-     * @param     string    $name   Input field name attribute
-     * @since     1.0
-     * @access    public
-     * @return    void
-     */
-    function setName($name)
-    {
-        $this->updateAttributes(array('name'=>$name));
-    } //end func setName
-
-    // }}}
-    // {{{ getName()
-
-    /**
-     * Returns the element name
-     *
-     * @since     1.0
-     * @access    public
-     * @return    string
-     */
-    function getName()
-    {
-        return $this->getAttribute('name');
-    } //end func getName
-
-    // }}}
-    // {{{ setValue()
-
-    /**
-     * Sets the value of the form element
-     *
-     * @param     string    $value      Default value of the form element
-     * @since     1.0
-     * @access    public
-     * @return    void
-     */
-    function setValue($value)
-    {
-        $this->updateAttributes(array('value'=>$value));
-    } // end func setValue
-
-    // }}}
-    // {{{ getValue()
-
-    /**
-     * Returns the value of the form element
-     *
-     * @since     1.0
-     * @access    public
-     * @return    string
-     */
-    function getValue()
-    {
-        //return $this->getAttribute('value');
-	    return $this->_attributes['value'];
-    } // end func getValue
-
-    // }}}
-    // {{{ toHtml()
-
-    /**
-     * Returns the input field in HTML
-     *
-     * @since     1.0
-     * @access    public
-     * @return    string
-     */
-    function toHtml() {
-        if ($this->_flagFrozen) {
-            return $this->getFrozenHtml();
-        } else {
-            //Adding the btn class
-            if (isset($this->_attributes['class'])) {
-                $this->_attributes['class'] = 'btn '.$this->_attributes['class'];
-            }
-            return $this->_getTabs().'<button ' . $this->_getAttrString($this->_attributes) . ' >'.$this->getValue() .'</button>';
-        }
-    } //end func toHtml
-
-    // }}}
-    // {{{ onQuickFormEvent()
-
-    /**
-     * Called by HTML_QuickForm whenever form event is made on this element
-     *
-     * @param     string    $event  Name of event
-     * @param     mixed     $arg    event arguments
-     * @param     object    &$caller calling object
-     * @since     1.0
-     * @access    public
-     * @return    void
-     * @throws
-     */
-    function onQuickFormEvent($event, $arg, &$caller)
-    {
-        // do not use submit values for button-type elements
-        $type = $this->getType();
-        if (('updateValue' != $event) ||
-            ('submit' != $type && 'reset' != $type && 'button' != $type)) {
-            parent::onQuickFormEvent($event, $arg, $caller);
-        } else {
-            $value = $this->_findValue($caller->_constantValues);
-            if (null === $value) {
-                $value = $this->_findValue($caller->_defaultValues);
-            }
-            if (null !== $value) {
-                $this->setValue($value);
-            }
-        }
-        return true;
-    } // end func onQuickFormEvent
-
-    // }}}
-    // {{{ exportValue()
-
-   /**
-    * We don't need values from button-type elements (except submit) and files
-    */
-    function exportValue(&$submitValues, $assoc = false)
-    {
-        $type = $this->getType();
-        if ('reset' == $type || 'button' == $type) {
-            return null;
-        } else {
-            return parent::exportValue($submitValues, $assoc);
-        }
-    }
-} // end class HTML_QuickForm_element

+ 0 - 84
main/inc/lib/formvalidator/Element/style_reset_button.php

@@ -1,84 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a submit type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Adam Daniel <adaniel1@eesus.jnj.com>
- * @author      Bertrand Mansion <bmansion@mamasam.com>
- * @copyright   2001-2007 The PHP Group
- * @license     http://www.php.net/license/3_01.txt PHP License 3.01
- * @version     CVS: $Id: submit.php 17344 2008-12-17 08:55:29Z Scara84 $
- * @link        http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for a submit type element
- *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Adam Daniel <adaniel1@eesus.jnj.com>
- * @author      Bertrand Mansion <bmansion@mamasam.com>
- * @version     Release: 3.2.10
- * @since       1.0
- */
-class HTML_QuickForm_styleresetbutton extends HTML_QuickForm_style_button
-{
-    // {{{ constructor
-
-    /**
-     * Class constructor
-     *
-     * @param     string    Input field name attribute
-     * @param     string    Input field value
-     * @param     mixed     Either a typical HTML attribute string or an associative array
-     * @since     1.0
-     * @access    public
-     * @return    void
-     */
-    function HTML_QuickForm_styleresetbutton($elementName=null, $value=null, $attributes=null)
-    {
-        HTML_QuickForm_style_button::HTML_QuickForm_style_button($elementName, null, $attributes, $value);
-        $this->setValue($value);
-        $this->setType('reset');
-    } //end constructor
-
-    // }}}
-    // {{{ freeze()
-
-    /**
-     * Freeze the element so that only its value is returned
-     *
-     * @access    public
-     * @return    void
-     */
-    function freeze()
-    {
-        return false;
-    } //end func freeze
-
-    // }}}
-    // {{{ exportValue()
-
-   /**
-    * Only return the value if it is found within $submitValues (i.e. if
-    * this particular submit button was clicked)
-    */
-    function exportValue(&$submitValues, $assoc = false)
-    {
-        return $this->_prepareValue($this->_findValue($submitValues), $assoc);
-    }
-
-    // }}}
-} //end class HTML_QuickForm_submit
-?>

+ 77 - 14
main/inc/lib/formvalidator/Element/style_submit_button.php

@@ -32,10 +32,8 @@
  * @version     Release: 3.2.10
  * @since       1.0
  */
-class HTML_QuickForm_style_submit_button extends HTML_QuickForm_style_button
+class HTML_QuickForm_style_submit_button extends HTML_QuickForm_input
 {
-    // {{{ constructor
-
     /**
      * Class constructor
      *
@@ -46,7 +44,8 @@ class HTML_QuickForm_style_submit_button extends HTML_QuickForm_style_button
      * @access    public
      * @return    void
      */
-    function HTML_QuickForm_style_submit_button($elementName = null, $value = null, $attributes = null, $img = null) {
+    public function __construct($elementName = null, $value = null, $attributes = null, $img = null)
+    {
         if (empty($attributes)) {
             $attributes = array();
         }
@@ -56,10 +55,10 @@ class HTML_QuickForm_style_submit_button extends HTML_QuickForm_style_button
                 $attributes['class'] = 'btn';
             }
         }
-        HTML_QuickForm_style_button::HTML_QuickForm_style_button($elementName, null, $attributes, $value, $img);
+        parent::__construct($elementName, null, $attributes, $value, $img);
         $this->setValue($value);
         $this->setType('submit');
-    } //end constructor
+    }
 
     /**
      * Freeze the element so that only its value is returned
@@ -67,19 +66,83 @@ class HTML_QuickForm_style_submit_button extends HTML_QuickForm_style_button
      * @access    public
      * @return    void
      */
-    function freeze() {
+    public function freeze()
+    {
         return false;
-    } //end func freeze
-
-    // }}}
-    // {{{ exportValue()
+    }
 
    /**
     * Only return the value if it is found within $submitValues (i.e. if
     * this particular submit button was clicked)
     */
-    function exportValue(&$submitValues, $assoc = false) {
+    public function exportValue(&$submitValues, $assoc = false)
+    {
         return $this->_prepareValue($this->_findValue($submitValues), $assoc);
     }
-    // }}}
-} //end class HTML_QuickForm_submit
+
+    /**
+     * @return string
+     */
+    public function toHtml()
+    {
+        if ($this->_flagFrozen) {
+            return $this->getFrozenHtml();
+        } else {
+            //Adding the btn class
+            if (isset($this->_attributes['class'])) {
+                $this->_attributes['class'] = 'btn '.$this->_attributes['class'];
+            }
+            return '<button ' . $this->_getAttrString($this->_attributes) . ' >'.$this->getValue() .'</button>';
+        }
+    }
+
+    /**
+     * Called by HTML_QuickForm whenever form event is made on this element
+     *
+     * @param     string    $event  Name of event
+     * @param     mixed     $arg    event arguments
+     * @param     object    &$caller calling object
+     * @since     1.0
+     * @access    public
+     * @return    void
+     * @throws
+     */
+    public function onQuickFormEvent($event, $arg, &$caller)
+    {
+        // do not use submit values for button-type elements
+        $type = $this->getType();
+        if (('updateValue' != $event) ||
+            ('submit' != $type && 'reset' != $type && 'button' != $type)) {
+            parent::onQuickFormEvent($event, $arg, $caller);
+        } else {
+            $value = $this->_findValue($caller->_constantValues);
+            if (null === $value) {
+                $value = $this->_findValue($caller->_defaultValues);
+            }
+            if (null !== $value) {
+                $this->setValue($value);
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns an HTML formatted attribute string
+    * @param    array   $attributes
+    * @return   string
+    * @access   private
+    */
+    public function _getAttrString($attributes)
+    {
+        $strAttr = '';
+        if (is_array($attributes)) {
+            foreach ($attributes as $key => $value) {
+                if ($key != 'value') $strAttr .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
+            }
+        }
+
+        return $strAttr;
+    }
+
+}

+ 60 - 29
main/inc/lib/formvalidator/FormValidator.class.php

@@ -9,7 +9,11 @@ class FormValidator extends HTML_QuickForm
 {
     const LAYOUT_HORIZONTAL = 'horizontal';
     const LAYOUT_INLINE = 'inline';
+    const LAYOUT_BOX = 'box';
+    const LAYOUT_BOX_NO_LABEL = 'box-no-label';
+
     public $with_progress_bar = false;
+    private $layout;
 
     /**
      * Constructor
@@ -27,7 +31,7 @@ class FormValidator extends HTML_QuickForm
         $method = 'post',
         $action = '',
         $target = '',
-        $attributes = null,
+        $attributes = array(),
         $layout = self::LAYOUT_HORIZONTAL,
         $trackSubmit = true
     ) {
@@ -40,11 +44,14 @@ class FormValidator extends HTML_QuickForm
             $layout = 'inline';
         }
 
+        $this->setLayout($layout);
+
         switch ($layout) {
             case self::LAYOUT_HORIZONTAL:
                 $attributes['class'] = 'form-horizontal';
                 break;
             case self::LAYOUT_INLINE:
+            case self::LAYOUT_BOX:
                 $attributes['class'] = 'form-inline';
                 break;
         }
@@ -82,7 +89,7 @@ class FormValidator extends HTML_QuickForm
             $elementTemplate = ' {label}  {element} ';
             $renderer->setElementTemplate($elementTemplate);
         } else {
-            $renderer->setElementTemplate($this->getElementTemplate());
+            $renderer->setElementTemplate($this->getDefaultElementTemplate());
 
             // Display a gray div in the buttons
             $templateSimple = '<div class="form-actions">{label} {element}</div>';
@@ -135,7 +142,7 @@ EOT;
     /**
      * @return string
      */
-    public function getElementTemplate()
+    public function getDefaultElementTemplate()
     {
         return '
             <div class="form-group {error_class}">
@@ -144,6 +151,7 @@ EOT;
                     {label}
                 </label>
                 <div class="col-sm-8">
+                    {icon}
                     {element}
 
                     <!-- BEGIN label_2 -->
@@ -162,6 +170,23 @@ EOT;
             </div>';
     }
 
+    /**
+     * @return string
+     */
+    public function getLayout()
+    {
+        return $this->layout;
+    }
+
+    /**
+     * @param string $layout
+     */
+    public function setLayout($layout)
+    {
+        $this->layout = $layout;
+    }
+
+
     /**
      * Adds a text field to the form.
      * A trim-filter is attached to the field.
@@ -606,11 +631,13 @@ EOT;
      * @param string $label				 The label for the form-element
      * @param bool   $required	(optional) Is the form-element required (default=true)
      * @param bool   $fullPage (optional) When it is true, the editor loads completed html code for a full page.
-     * @param array  $config (optional)	Configuration settings for the online editor.
+     * @param array  $config (optional) Configuration settings for the online editor.
      */
     public function addHtmlEditor($name, $label, $required = true, $fullPage = false, $config = array())
     {
-        $this->addElement('html_editor', $name, $label, 'rows="15" cols="80"', $config);
+        $config['rows'] = isset($config['rows']) ? $config['rows'] : 15;
+        $config['cols'] = isset($config['cols']) ? $config['cols'] : 80;
+        $this->addElement('html_editor', $name, $label, $config);
         $this->applyFilter($name, 'trim');
         if ($required) {
             $this->addRule($name, get_lang('ThisFieldIsRequired'), 'required');
@@ -731,30 +758,16 @@ EOT;
      */
     public function display()
     {
-        echo $this->return_form();
+        echo $this->returnForm();
     }
 
     /**
      * Returns the HTML code of the form.
-     * If an element in the form didn't validate, an error message is showed
-     * asking the user to complete the form.
-     *
      * @return string $return_value HTML code of the form
-     *
-     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, august 2006
-     * @author Julio Montoya
      */
-    public function return_form()
+    public function returnForm()
     {
         $error = false;
-        $addDateLibraries = false;
-        $dateElementTypes = array(
-            'date_range_picker',
-            'date_time_picker',
-            'date_picker',
-            'datepicker',
-            'datetimepicker'
-        );
         /** @var HTML_QuickForm_element $element */
         foreach ($this->_elements as $element) {
             if (!is_null(parent::getElementError($element->getName()))) {
@@ -762,22 +775,40 @@ EOT;
                 break;
             }
         }
-        $return_value = '';
+        $returnValue = '';
         $js = null;
 
         if ($error) {
-            $return_value = Display::return_message(get_lang('FormHasErrorsPleaseComplete'),
-                'warning');
+            $returnValue = Display::return_message(
+                get_lang('FormHasErrorsPleaseComplete'),
+                'warning'
+            );
         }
 
-        $return_value .= $js;
-        $return_value .= parent::toHtml();
+        $returnValue .= $js;
+        $returnValue .= parent::toHtml();
         // Add div-element which is to hold the progress bar
         if (isset($this->with_progress_bar) && $this->with_progress_bar) {
-            $return_value .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
+            $returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>';
         }
 
-        return $return_value;
+        return $returnValue;
+    }
+
+    /**
+     * Returns the HTML code of the form.
+     * If an element in the form didn't validate, an error message is showed
+     * asking the user to complete the form.
+     *
+     * @return string $return_value HTML code of the form
+     *
+     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, august 2006
+     * @author Julio Montoya
+     * @deprecated use returnForm()
+     */
+    public function return_form()
+    {
+        return $this->returnForm();
     }
 
     /**
@@ -866,7 +897,7 @@ EOT;
     }
 
     /**
-     * @return null
+     * @return HTML_QuickForm_Renderer_Default
      */
     public static function getDefaultRenderer()
     {

+ 6 - 7
main/inc/lib/message.lib.php

@@ -1386,20 +1386,19 @@ class MessageManager
      */
     public static function generate_message_form($id, $params = array())
     {
-        $form = new FormValidator('send_message', null, 'post', null, array('id' => $id.'_form', 'class' => 'form-vertical'));
-        $form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id', 'class' => 'span5'));
-        $form->addElement('textarea', 'content', get_lang('Message'), array('id' => 'content_id', 'rows' => '5', 'class' => 'span5'));
+        $form = new FormValidator('send_message');
+        $form->addText('subject', get_lang('Subject'), false, ['id' => 'subject_id']);
+        $form->addTextarea('content', get_lang('Message'), ['id' => 'content_id', 'rows' => '5']);
 
         return $form->return_form();
     }
 
     public static function generate_invitation_form($id, $params = array())
     {
-        $form = new FormValidator('send_invitation', null, 'post', null, array('id' => $id.'_form', 'class' => 'form-vertical'));
+        $form = new FormValidator('send_invitation');
         //$form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id'));
-        $form->addElement('textarea', 'content', get_lang('AddPersonalMessage'), array('id' => 'content_invitation_id', 'rows' => '5', 'class' => 'span5'));
-        $div = Display::div($form->return_form(), array('id' => $id.'_div', 'style' => 'display:none'));
-        return $div;
+        $form->addTextarea('content', get_lang('AddPersonalMessage'), ['id' => 'content_invitation_id', 'rows' => 5]);
+        return $form->return_form();
     }
 
     //@todo this functions should be in the message class

+ 2 - 1
main/inc/lib/pear/HTML/QuickForm.php

@@ -1761,7 +1761,8 @@ class HTML_QuickForm extends HTML_Common
      * @since     1.0
      * @access   public
      */
-    function toHtml ($in_data = null) {
+    public function toHtml($in_data = null)
+    {
         if (!is_null($in_data)) {
             $this->addElement('html', $in_data);
         }

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/CAPTCHA.php

@@ -115,7 +115,7 @@ class HTML_QuickForm_CAPTCHA extends HTML_QuickForm_input
     function HTML_QuickForm_CAPTCHA($elementName = null, $elementLabel = null,
                                     $options = null, $attributes = null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->setType('CAPTCHA_'.$this->_CAPTCHA_driver);
 
         if (is_array($options)) {

+ 51 - 20
main/inc/lib/pear/HTML/QuickForm/Renderer/Default.php

@@ -36,6 +36,8 @@
  */
 class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
 {
+    private $form;
+
    /**
     * The HTML of the form
     * @var      string
@@ -174,10 +176,30 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
     */
     function startForm(&$form)
     {
+        $this->setForm($form);
+
         $this->_html = '';
         $this->_hiddenHtml = '';
+    }
+
+    /**
+     * @return FormValidator
+     */
+    public function getForm()
+    {
+        return $this->form;
+    }
+
+    /**
+     * @param mixed $form
+     */
+    public function setForm($form)
+    {
+        $this->form = $form;
     } // end func startForm
 
+
+
    /**
     * Called when visiting a form, after processing all form elements
     * Adds required note, form attributes, validation javascript and form content.
@@ -228,51 +250,61 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
    /**
     * Helper method for renderElement
     *
-    * @param    string      Element name
-    * @param    mixed       Element label (if using an array of labels, you should set the appropriate template)
+    * @param    HTML_QuickForm_element $element
     * @param    bool        Whether an element is required
-    * @param    string      Error message associated with the element
-    * @param    string      Label for ID
+    * @param    string      $required Error message associated with the element
+    * @param    string      $error Label for ID
     * @access   private
     * @see      renderElement()
     * @return   string      Html for element
     */
-    function _prepareTemplate($name, $label, $required, $error, $labelForId = '')
+    private function _prepareTemplate(HTML_QuickForm_element $element, $required, $error)
     {
+        $name = $element->getName();
+        $label = $element->getLabel();
+        $labelForId = $element->getLabelFor();
+        $icon = $element->getIconToHtml();
+
         if (is_array($label)) {
             $nameLabel = array_shift($label);
         } else {
             $nameLabel = $label;
         }
-        if (!empty($labelForId)) {
-            $labelFor = 'for="' . $labelForId . '"';
-        } else {
-            $labelFor = '';
-        }
+
+        $labelFor = !empty($labelForId) ? 'for="' . $labelForId . '"' : '';
+
         if (isset($this->_templates[$name])) {
+            // Custom template
             $html = str_replace('{label}', $nameLabel, $this->_templates[$name]);
-            $html = str_replace('{label-for}', $labelFor, $html);
         } else {
-            $html = str_replace('{label}', $nameLabel, $this->_elementTemplate);
-            $html = str_replace('{label-for}', $labelFor, $html);
+            if (method_exists($element, 'getTemplate')) {
+                $template = $element->getTemplate($this->getForm()->getLayout());
+            } else {
+                $template = $this->getForm()->getDefaultElementTemplate();
+            }
+            $html = str_replace('{label}', $nameLabel, $template);
         }
+        $html = str_replace('{label-for}', $labelFor, $html);
+        $html = str_replace('{icon}', $icon, $html);
+
         if ($required) {
             $html = str_replace('<!-- BEGIN required -->', '', $html);
             $html = str_replace('<!-- END required -->', '', $html);
         } else {
             $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html);
         }
+
         if (isset($error)) {
             $html = str_replace('{error}', $error, $html);
             $html = str_replace('{error_class}', 'error has-error', $html);
             $html = str_replace('<!-- BEGIN error -->', '', $html);
             $html = str_replace('<!-- END error -->', '', $html);
         } else {
-        	$html = str_replace('{error_class}', '', $html);
+            $html = str_replace('{error_class}', '', $html);
             $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN error -->.*<!-- END error -->([ \t\n\r]*)?/isU", '', $html);
         }
         if (is_array($label)) {
-            foreach($label as $key => $text) {
+            foreach ($label as $key => $text) {
                 $key  = is_int($key)? $key + 2: $key;
                 $html = str_replace("{label_{$key}}", $text, $html);
                 $html = str_replace("<!-- BEGIN label_{$key} -->", '', $html);
@@ -282,6 +314,7 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
         if (strpos($html, '{label_')) {
             $html = preg_replace('/\s*<!-- BEGIN label_(\S+) -->.*<!-- END label_\1 -->\s*/is', '', $html);
         }
+
         return $html;
     } // end func _prepareTemplate
 
@@ -299,11 +332,9 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
     {
         if (!$this->_inGroup) {
             $html = $this->_prepareTemplate(
-                $element->getName(),
-                $element->getLabel(),
+                $element,
                 $required,
-                $error,
-                $element->getLabelFor()
+                $error
             );
 
             $this->_html .= str_replace('{element}', $element->toHtml(), $html);
@@ -360,7 +391,7 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
     function startGroup(&$group, $required, $error)
     {
         $name = $group->getName();
-        $this->_groupTemplate        = $this->_prepareTemplate($name, $group->getLabel(), $required, $error);
+        $this->_groupTemplate        = $this->_prepareTemplate($group, $required, $error);
         $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name];
         $this->_groupWrap            = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name];
         $this->_groupElements        = array();

+ 7 - 9
main/inc/lib/pear/HTML/QuickForm/advmultiselect.php

@@ -533,21 +533,17 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
         } else {
             $this->_elementTemplate = '
 {javascript}
-<table{class}>
-<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
-<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
-<tr>
-  <td valign="top">{unselected}</td>
-  <td align="center">{add}{remove}</td>
-  <td valign="top">{selected}</td>
-</tr>
-</table>
+  <div class="col-sm-3"><!-- BEGIN label_2 -->{label_2}<!-- END label_2 --> {unselected}</div>
+  <div class="col-sm-2"><div class="text-center">{add}{remove}</div></div>
+  <div class="col-sm-3"><!-- BEGIN label_3 -->{label_3}<!-- END label_3 -->{selected}</div>
+
 ';
         }
         if ($js == false) {
             $this->_elementTemplate = str_replace('{javascript}', '',
                 $this->_elementTemplate);
         }
+
         return $oldTemplate;
     }
 
@@ -1010,9 +1006,11 @@ class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
 
         if ($this->selectAllCheckBox) {
             $strHtml .= '
+                    <div class="col-sm-8">
                     <label class="checkbox" >'.get_lang('SelectAll').'
                     <input type="checkbox" class="advmultiselect_checkbox" id="'.$selectId.'_select_all'.'">
                     </label>
+                    </div>
             ';
         }
 

+ 48 - 0
main/inc/lib/pear/HTML/QuickForm/button.php

@@ -196,4 +196,52 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
     {
         return false;
     }
+
+    /**
+     * @param string $layout
+     *
+     * @return string
+     */
+    public function getTemplate($layout)
+    {
+        switch ($layout) {
+            case FormValidator::LAYOUT_INLINE:
+                return '
+                    {element}
+                ';
+                break;
+            case FormValidator::LAYOUT_HORIZONTAL:
+                return '
+                <div class="form-group {error_class}">
+                    <label {label-for} class="col-sm-2 control-label" >
+                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
+                        {label}
+                    </label>
+                    <div class="col-sm-8">
+                        {icon}
+                        {element}
+
+                        <!-- BEGIN label_2 -->
+                            <p class="help-block">{label_2}</p>
+                        <!-- END label_2 -->
+
+                        <!-- BEGIN error -->
+                            <span class="help-inline">{error}</span>
+                        <!-- END error -->
+                    </div>
+                    <div class="col-sm-2">
+                        <!-- BEGIN label_3 -->
+                            {label_3}
+                        <!-- END label_3 -->
+                    </div>
+                </div>';
+                break;
+            case FormValidator::LAYOUT_BOX:
+            case FormValidator::LAYOUT_BOX_NO_LABEL:
+                return '
+                        {element}
+                ';
+                break;
+        }
+    }
 }

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/checkbox.php

@@ -68,7 +68,7 @@ class HTML_QuickForm_checkbox extends HTML_QuickForm_input
         $text = '',
         $attributes = null
     ) {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_persistantFreeze = true;
         $this->_text = $text;
         $this->setType('checkbox');

+ 47 - 4
main/inc/lib/pear/HTML/QuickForm/element.php

@@ -37,6 +37,9 @@
  */
 class HTML_QuickForm_element extends HTML_Common
 {
+    private $layout;
+    private $icon;
+
     // {{{ properties
 
     /**
@@ -88,7 +91,7 @@ class HTML_QuickForm_element extends HTML_Common
      * @access    public
      * @return    void
      */
-    function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
+    public function __construct($elementName = null, $elementLabel = null, $attributes = null)
     {
         parent::__construct($attributes);
         if (isset($elementName)) {
@@ -109,6 +112,46 @@ class HTML_QuickForm_element extends HTML_Common
         }
     }
 
+    /**
+     * @return string
+     */
+    public function getLayout()
+    {
+        return $this->layout;
+    }
+
+    /**
+     * @param string $layout
+     */
+    public function setLayout($layout)
+    {
+        $this->layout = $layout;
+    }
+
+    /**
+     * @return string
+     */
+    public function getIcon()
+    {
+        return $this->icon;
+    }
+
+    /**
+     * @return string
+     */
+    public function getIconToHtml()
+    {
+        return $this->icon;
+    }
+
+    /**
+     * @param mixed $icon
+     */
+    public function setIcon($icon)
+    {
+        $this->icon = $icon;
+    }
+
     /**
      * Returns the current API version
      *
@@ -238,7 +281,7 @@ class HTML_QuickForm_element extends HTML_Common
      * @access    public
      * @return    string
      */
-    function getFrozenHtml()
+    public function getFrozenHtml()
     {
         $value = $this->getValue();
         // Modified by Ivan Tcholakov, 16-MAR-2010.
@@ -284,7 +327,7 @@ class HTML_QuickForm_element extends HTML_Common
      * @access    public
      * @return    bool
      */
-    function isFrozen()
+    public function isFrozen()
     {
         return $this->_flagFrozen;
     } // end func isFrozen
@@ -318,7 +361,7 @@ class HTML_QuickForm_element extends HTML_Common
      * @access    public
      * @return    void
      */
-    function setLabel($label, $labelFor = null)
+    public function setLabel($label, $labelFor = null)
     {
         $this->_label = $label;
         if (!empty($labelFor)) {

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/email.php

@@ -28,7 +28,7 @@ class HTML_QuickForm_email extends HTML_QuickForm_input
      */
     function HTML_QuickForm_email($elementName=null, $elementLabel=null, $attributes=null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->setType('email');
     } //end constructor
 

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/file.php

@@ -67,7 +67,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input
      */
     function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->setType('file');
     } //end constructor
 

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/group.php

@@ -91,7 +91,7 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
      * @access    public
      * @return    void
      */
-    function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
+    public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
     {
         parent::__construct($elementName, $elementLabel);
         $this->_type = 'group';

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/hidden.php

@@ -49,7 +49,7 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input
      */
     public function HTML_QuickForm_hidden($elementName = null, $value = '', $attributes = null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+        parent::__construct($elementName, null, $attributes);
         $this->setType('hidden');
         $this->setValue($value);
     } //end constructor

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/hiddenselect.php

@@ -53,7 +53,7 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
      */
     function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
     {
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_persistantFreeze = true;
         $this->_type = 'hiddenselect';
         if (isset($options)) {

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/image.php

@@ -49,7 +49,7 @@ class HTML_QuickForm_image extends HTML_QuickForm_input
      */
     function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+        parent::__construct($elementName, null, $attributes);
         $this->setType('image');
         $this->setSource($src);
     } // end class constructor

+ 2 - 2
main/inc/lib/pear/HTML/QuickForm/input.php

@@ -47,9 +47,9 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
      * @access    public
      * @return    void
      */
-    function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
+    public function __construct($elementName=null, $elementLabel=null, $attributes=null)
     {
-        $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
     } //end constructor
 
     // }}}

+ 2 - 20
main/inc/lib/pear/HTML/QuickForm/label.php

@@ -28,7 +28,7 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
      * @access public
      * @return void
      */
-    function HTML_QuickForm_label(
+    public function __construct(
         $label = null,
         $text = null,
         $attributes = null
@@ -37,29 +37,11 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
         $this->_type = 'html';
     }
 
-    /**
-     * Accepts a renderer
-     *
-     * @param HTML_QuickForm_Renderer    renderer object (only works with Default renderer!)
-     * @access public
-     * @return void
-     */
-    public function accept(&$renderer, $required = false, $error = null)
-    {
-        $renderer->renderHtml($this);
-    }
-
     /**
      * @return string
      */
     public function toHtml()
     {
-        $for = $this->getLabelFor();
-        return
-            '<label class="control-label"' . empty($for) ? '' : ' for="' . $for . '"' . '>' .
-            $this->getLabel() .
-            '</label>
-            ' .
-            parent::toHtml();
+        return parent::toHtml();
     }
 }

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/link.php

@@ -62,7 +62,7 @@ class HTML_QuickForm_link extends HTML_QuickForm_static
      */
     function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
     {
-        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->_persistantFreeze = false;
         $this->_type = 'link';
         $this->setHref($href);

+ 11 - 24
main/inc/lib/pear/HTML/QuickForm/password.php

@@ -32,7 +32,7 @@
  * @version     Release: 3.2.11
  * @since       1.0
  */
-class HTML_QuickForm_password extends HTML_QuickForm_input
+class HTML_QuickForm_password extends HTML_QuickForm_text
 {
     // {{{ constructor
 
@@ -48,15 +48,12 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
      * @return    void
      * @throws
      */
-    function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
+    public function __construct($elementName=null, $elementLabel=null, $attributes=null)
     {
         $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'form-control';
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         $this->setType('password');
-    } //end constructor
-
-    // }}}
-    // {{{ setSize()
+    }
 
     /**
      * Sets size of password element
@@ -66,13 +63,10 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
      * @access    public
      * @return    void
      */
-    function setSize($size)
+    public function setSize($size)
     {
         $this->updateAttributes(array('size'=>$size));
-    } //end func setSize
-
-    // }}}
-    // {{{ setMaxlength()
+    }
 
     /**
      * Sets maxlength of password element
@@ -82,13 +76,10 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
      * @access    public
      * @return    void
      */
-    function setMaxlength($maxlength)
+    public function setMaxlength($maxlength)
     {
         $this->updateAttributes(array('maxlength'=>$maxlength));
-    } //end func setMaxlength
-
-    // }}}
-    // {{{ getFrozenHtml()
+    }
 
     /**
      * Returns the value of field without HTML tags (in this case, value is changed to a mask)
@@ -98,14 +89,10 @@ class HTML_QuickForm_password extends HTML_QuickForm_input
      * @return    string
      * @throws
      */
-    function getFrozenHtml()
+    public function getFrozenHtml()
     {
         $value = $this->getValue();
         return ('' != $value? '**********': '&nbsp;') .
                $this->_getPersistantData();
-    } //end func getFrozenHtml
-
-    // }}}
-
-} //end class HTML_QuickForm_password
-?>
+    }
+}

+ 2 - 3
main/inc/lib/pear/HTML/QuickForm/radio.php

@@ -34,7 +34,6 @@
  */
 class HTML_QuickForm_radio extends HTML_QuickForm_input
 {
-
     /**
      * Radio display text
      * @var       string
@@ -55,14 +54,14 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input
      * @access    public
      * @return    void
      */
-    public function HTML_QuickForm_radio(
+    public function __construct(
         $elementName = null,
         $elementLabel = null,
         $text = null,
         $value = null,
         $attributes = null
     ) {
-        $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        parent::__construct($elementName, $elementLabel, $attributes);
         if (isset($value)) {
             $this->setValue($value);
         }

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/reset.php

@@ -49,7 +49,7 @@ class HTML_QuickForm_reset extends HTML_QuickForm_input
      */
     function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+        parent::__construct($elementName, null, $attributes);
         $this->setValue($value);
         $this->setType('reset');
     } //end constructor

+ 57 - 3
main/inc/lib/pear/HTML/QuickForm/select.php

@@ -645,6 +645,60 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
         }
     }
 
-    // }}}
-} //end class HTML_QuickForm_select
-?>
+    /**
+     * @param string $layout
+     *
+     * @return string
+     */
+    public function getTemplate($layout)
+    {
+        /*$size = $this->getInputSize();
+        $size = empty($size) ? '8' : $size;*/
+
+        switch ($layout) {
+            case FormValidator::LAYOUT_INLINE:
+                return '
+                <div class="form-group {error_class}">
+                    <label {label-for} >
+                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
+                        {label}
+                    </label>
+                    {element}
+                </div>';
+                break;
+            case FormValidator::LAYOUT_HORIZONTAL:
+                return '
+                <div class="form-group {error_class}">
+                    <label {label-for} class="col-sm-2 control-label" >
+                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
+                        {label}
+                    </label>
+                    <div class="col-sm-8">
+                        {icon}
+                        {element}
+
+                        <!-- BEGIN label_2 -->
+                            <p class="help-block">{label_2}</p>
+                        <!-- END label_2 -->
+
+                        <!-- BEGIN error -->
+                            <span class="help-inline">{error}</span>
+                        <!-- END error -->
+                    </div>
+                    <div class="col-sm-2">
+                        <!-- BEGIN label_3 -->
+                            {label_3}
+                        <!-- END label_3 -->
+                    </div>
+                </div>';
+                break;
+            case FormValidator::LAYOUT_BOX_NO_LABEL:
+                return '
+                        <div class="input-group">
+                            {icon}
+                            {element}
+                        </div>';
+                break;
+        }
+    }
+}

+ 1 - 1
main/inc/lib/pear/HTML/QuickForm/submit.php

@@ -48,7 +48,7 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input
      */
     public function __construct($elementName=null, $value=null, $attributes=null)
     {
-        HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+        parent::__construct($elementName, null, $attributes);
         $this->setValue($value);
         $this->setType('submit');
     } //end constructor

+ 76 - 29
main/inc/lib/pear/HTML/QuickForm/text.php

@@ -1,5 +1,4 @@
 <?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
 /**
  * HTML class for a text field
@@ -39,9 +38,9 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
     /**
      * Class constructor
      *
-     * @param     string    $elementName    (optional)Input field name attribute
-     * @param     string    $elementLabel   (optional)Input field label
-     * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
+     * @param string $elementName    (optional)Input field name attribute
+     * @param string $elementLabel   (optional)Input field label
+     * @param mixed  $attributes     (optional)Either a typical HTML attribute string
      *                                      or an associative array
      * @since     1.0
      * @access    public
@@ -57,53 +56,101 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
         }
         $inputSize = isset($attributes['input-size']) ? $attributes['input-size'] : null;
         $this->setInputSize($inputSize);
+        $icon = isset($attributes['icon']) ? $attributes['icon'] : null;
+        $this->setIcon($icon);
+
         if (!empty($inputSize)) {
             unset($attributes['input-size']);
         }
 
+        if (!empty($icon)) {
+            unset($attributes['icon']);
+        }
+
         parent::__construct($elementName, $elementLabel, $attributes);
         $this->_persistantFreeze = true;
 
         $this->setType('text');
 
         $renderer = FormValidator::getDefaultRenderer();
-        $renderer->setElementTemplate($this->getTemplate(), $elementName);
+        //$renderer->setElementTemplate($this->getTemplate(), $elementName);
+    }
+
+    /**
+     * Show an icon at the left side of an input
+     * @return string
+     */
+    public function getIconToHtml()
+    {
+        $icon = $this->getIcon();
+
+        if (empty($icon)) {
+            return '';
+        }
+
+        return '
+                <div class="input-group-addon">
+                <i class="fa fa-'.$icon.'"></i>
+                </div>';
     }
 
     /**
+     * @param string $layout
+     *
      * @return string
      */
-    public function getTemplate()
+    public function getTemplate($layout)
     {
         $size = $this->getInputSize();
         $size = empty($size) ? '8' : $size;
 
-        return '
-            <div class="form-group {error_class}">
-                <label {label-for} class="col-sm-2 control-label" >
-                    <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
-                    {label}
-                </label>
-                <div class="col-sm-'.$size.'">
+        switch ($layout) {
+            case FormValidator::LAYOUT_INLINE:
+                return '
+                <div class="form-group {error_class}">
+                    <label {label-for} >
+                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
+                        {label}
+                    </label>
                     {element}
-
-                    <!-- BEGIN label_2 -->
-                        <p class="help-block">{label_2}</p>
-                    <!-- END label_2 -->
-
-                    <!-- BEGIN error -->
-                        <span class="help-inline">{error}</span>
-                    <!-- END error -->
-                </div>
-                <div class="col-sm-2">
-                    <!-- BEGIN label_3 -->
-                        {label_3}
-                    <!-- END label_3 -->
-                </div>
-            </div>';
+                </div>';
+                break;
+            case FormValidator::LAYOUT_HORIZONTAL:
+                return '
+                <div class="form-group {error_class}">
+                    <label {label-for} class="col-sm-2 control-label" >
+                        <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
+                        {label}
+                    </label>
+                    <div class="col-sm-'.$size.'">
+                        {icon}
+                        {element}
+
+                        <!-- BEGIN label_2 -->
+                            <p class="help-block">{label_2}</p>
+                        <!-- END label_2 -->
+
+                        <!-- BEGIN error -->
+                            <span class="help-inline">{error}</span>
+                        <!-- END error -->
+                    </div>
+                    <div class="col-sm-2">
+                        <!-- BEGIN label_3 -->
+                            {label_3}
+                        <!-- END label_3 -->
+                    </div>
+                </div>';
+                break;
+            case FormValidator::LAYOUT_BOX_NO_LABEL:
+                return '
+                        <div class="input-group">
+                            {icon}
+                            {element}
+                        </div>';
+                break;
+        }
     }
 
-
     /**
      * @return null
      */

+ 2 - 2
main/inc/lib/social.lib.php

@@ -760,7 +760,7 @@ class SocialManager extends UserManager
 
             // My friend profile.
             if ($user_id != api_get_user_id()) {
-                $html .= '<li><a href="#" id="btn-to-send-message" title="'.get_lang('SendMessage').'">';
+                $html .= '<li><a href="#" class="btn-to-send-message" data-send-to="' . $user_id . '" title="'.get_lang('SendMessage').'">';
                 $html .= Display::return_icon('compose_message.png', get_lang('SendMessage')).'&nbsp;&nbsp;'.get_lang('SendMessage').'</a></li>';
             }
 
@@ -771,7 +771,7 @@ class SocialManager extends UserManager
                 $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
             } else {
                 if (!$show_full_profile) {
-                    $html .= '<li><a  href="javascript:void(0);" onclick="javascript:send_invitation_to_user(\''.$user_id.'\');" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
+                    $html .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
                 }
             }
 

+ 49 - 39
main/inc/lib/userportal.lib.php

@@ -694,33 +694,40 @@ class IndexManager
      * Adds a form to let users login
      * @version 1.1
      */
-    function display_login_form()
+    public function display_login_form()
     {
+        $form = new FormValidator(
+            'formLogin',
+            'POST',
+            null,
+            null,
+            null,
+            FormValidator::LAYOUT_BOX_NO_LABEL
+        );
+
+        $form->addText(
+            'login',
+            get_lang('UserName'),
+            true,
+            array('id' => 'login', 'autofocus' => 'autofocus', 'icon' => 'user')
+        );
+
+        $form->addElement(
+            'password',
+            'password',
+            get_lang('Pass'),
+            array('id' => 'password', 'icon' => 'lock')
+        );
 
-        $form = new FormValidator('formLogin', 'POST', null,  null, null, FormValidator::LAYOUT_INLINE);
-        $form->addElement('label',get_lang('UserName'));
-        $form->addHtml('<div class="input-group">');
-        $form->addHtml('<div class="input-group-addon"><i class="fa fa-user"></i></div>');
-        $form->addElement('input', 'login','', array('id' => 'login', 'class' => 'form-control autocapitalize_off', 'autofocus' => 'autofocus'));
-        $form->addHtml('</div>');
-        $form->addElement('label',get_lang('Pass'));
-        $form->addHtml('<div class="input-group">');
-        $form->addHtml('<div class="input-group-addon"><i class="fa fa-lock"></i></div>');
-        $form->addElement('password', 'password','', array('id' => 'password', 'class' => 'form-control'));
-        $form->addHtml('</div>');
         global $_configuration;
 
         // Captcha
         $allowCaptcha = isset($_configuration['allow_captcha']) ? $_configuration['allow_captcha'] : false;
 
         if ($allowCaptcha) {
-
             $useCaptcha = isset($_SESSION['loginFailed']) ? $_SESSION['loginFailed'] : null;
-
             if ($useCaptcha) {
-
                 $ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha';
-
                 $options = array(
                     'width'        => 250,
                     'height'       => 90,
@@ -737,20 +744,18 @@ class IndexManager
                 // Minimum options using all defaults (including defaults for Image_Text):
                 //$options = array('callback' => 'qfcaptcha_image.php');
 
-                $captcha_question =  $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
+                $captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
                 $form->addElement('static', null, null, get_lang('ClickOnTheImageForANewOne'));
 
                 $form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'));
                 $form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client');
-
                 $form->addRule('captcha', get_lang('TheTextYouEnteredDoesNotMatchThePicture'), 'CAPTCHA', $captcha_question);
             }
         }
-        $form->addHtml('<div class="form-button-login">');
-        $form->addElement('style_submit_button','submitAuth', get_lang('LoginEnter'), array('class' => 'btn-primary btn-block'));
-        $form->addHtml('</div>');
 
-        $html = $form->return_form();
+        $form->addButton('submitAuth', get_lang('LoginEnter'), null, 'primary', null, 'btn-block');
+
+        $html = $form->returnForm();
         // The validation is located in the local.inc
         /*if ($form->validate()) {
             // Prevent re-use of the same CAPTCHA phrase
@@ -761,10 +766,16 @@ class IndexManager
             include_once 'main/auth/openid/login.php';
             $html .= '<div>'.openid_form().'</div>';
         }
+
         return $html;
     }
 
-    function return_search_block() {
+    /**
+     * @todo use FormValidator
+     * @return string
+     */
+    public function return_search_block()
+    {
         $html = '';
         if (api_get_setting('search_enabled') == 'true') {
             $search_btn = get_lang('Search');
@@ -775,10 +786,14 @@ class IndexManager
                 </div></form>';
             $html .= self::show_right_block(get_lang('Search'), $search_content, 'search_block');
         }
+
         return $html;
     }
 
-    function return_classes_block()
+    /**
+     * @return string
+     */
+    public function return_classes_block()
     {
         $html = '';
         if (api_get_setting('show_groups_to_users') == 'true') {
@@ -793,7 +808,10 @@ class IndexManager
                 }
             }
             if (api_is_platform_admin()) {
-                $classes .= Display::tag('li',  Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add'));
+                $classes .= Display::tag(
+                    'li',
+                    Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
+                );
             }
             if (!empty($classes)) {
                 $classes = Display::tag('ul', $classes, array('class'=>'nav nav-pills nav-stacked'));
@@ -803,18 +821,6 @@ class IndexManager
         return $html;
     }
 
-    function return_reservation_block() {
-        $html = '';
-        $booking_content = null;
-        if (api_get_setting('allow_reservation') == 'true' && api_is_allowed_to_create_course()) {
-            $booking_content .='<ul class="nav nav-pills nav-stacked">';
-            $booking_content .='<a href="main/reservation/reservation.php">'.get_lang('ManageReservations').'</a><br />';
-            $booking_content .='</ul>';
-            $html .= self::show_right_block(get_lang('Booking'), $booking_content, 'reservation_block');
-        }
-        return $html;
-    }
-
     /**
      * @return null|string
      */
@@ -849,7 +855,10 @@ class IndexManager
         return $html;
     }
 
-    function return_profile_block()
+    /**
+     * @return null|string|void
+     */
+    public function return_profile_block()
     {
         global $_configuration;
         $user_id = api_get_user_id();
@@ -899,7 +908,8 @@ class IndexManager
         return $html;
     }
 
-    function return_navigation_links() {
+    public function return_navigation_links()
+    {
         $html = '';
 
         // Deleting the myprofile link.

+ 1 - 113
main/social/profile.php

@@ -134,105 +134,7 @@ if (file_exists($timeAgoLocaleDir)) {
 
 $htmlHeadXtra[] = '<script>
 
-function checkLength( o, n, min, max ) {
-    if ( o.val().length > max || o.val().length < min ) {
-        o.addClass( "ui-state-error" );
-        //updateTips( "Length of " + n + " must be between " + min + " and " + max + "." );
-        return false;
-    } else {
-        return true;
-    }
-}
-
-function send_invitation_to_user(user_id) {
-    var content = $( "#content_invitation_id" );
-    $("#send_invitation_form").show();
-    $("#send_invitation_div").dialog({
-        modal:true,
-        buttons: {
-            "'.  addslashes(get_lang('SendInvitation')).'": function() {
-                var bValid = true;
-                bValid = bValid && checkLength( content, "content", 1, 255 );
-                if (bValid) {
-                    var url = "'.$ajax_url.'?a=send_invitation&user_id="+user_id;
-                    var params = $("#send_invitation_form").serialize();
-                    $.ajax({
-                        url: url+"&"+params,
-                        success:function(data) {
-                            $("#message_ajax_reponse").attr("class", "");
-                            $("#message_ajax_reponse").html(data);
-                            $("#message_ajax_reponse").show();
-
-                            $("#send_invitation_div").dialog({ buttons:{}});
-
-                            $("#send_invitation_form").hide();
-                            $("#send_invitation_div").dialog("close");
-                            $("#content_invitation_id").val("");
-                        }
-                    });
-                }
-            },
-        },
-        close: function() {
-        }
-    });
-    $("#send_invitation_div").dialog("open");
-    //prevent the browser to follow the link
-}
-
-function toogle_course (element_html, course_code){
-    elem_id=$(element_html).attr("id");
-    id_elem=elem_id.split("_");
-    ident="div#div_group_"+id_elem[1];
-
-    id_button="#btn_"+id_elem[1];
-    elem_src=$(id_button).attr("src");
-    image_show=elem_src.split("/");
-    my_image=image_show[2];
-    var content = \'social_content\' + id_elem[1];
-    if (my_image=="nolines_plus.gif") {
-        $(id_button).attr("src","../img/nolines_minus.gif"); var action = "load_course";
-        $("div#"+content).show("fast");
-    } else {
-        $("div#"+content).hide("fast");
-        $(id_button).attr("src","../img/nolines_plus.gif"); var action = "unload";
-        return false;
-    }
-
-     $.ajax({
-        contentType: "application/x-www-form-urlencoded",
-        beforeSend: function(objeto) {
-        $("div#"+content).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
-        type: "POST",
-        url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=toogle_course",
-        data: "load_ajax="+id_elem+"&action="+action+"&course_code="+course_code,
-        success: function(datos) {
-         $("div#"+content).html(datos);
-        }
-    });
-}
-
 $(document).ready(function (){
-    $("input#id_btn_send_invitation").bind("click", function(){
-        if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
-            $("#form_register_friend").submit();
-        }
-    });
-
-    $("#send_message_div").dialog({
-        autoOpen: false,
-        modal    : false,
-        width    : 550,
-        height    : 300
-       });
-
-    $("#send_invitation_div").dialog({
-        autoOpen: false,
-        modal    : false,
-        width    : 550,
-        height    : 300
-       });
-
     var container = $("#wallMessages");
     container.jscroll({
         loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>",
@@ -248,19 +150,6 @@ function timeAgo() {
     $(".timeago").timeago();
 }
 
-function display_hide () {
-    setTimeout("hide_display_message()",3000);
-}
-
-function hide_display_message () {
-    $("div#display_response_id").html("");
-    try {
-        $("#txt_subject_id").val("");
-        $("#txt_area_invite").val("");
-    }catch(e) {
-        $("#txt_area_invite").val("");
-    }
-}
 function register_friend(element_input) {
     if(confirm("'.get_lang('AddToFriends').'")) {
         name_button=$(element_input).attr("id");
@@ -838,7 +727,6 @@ if ($show_full_profile) {
     }
 }
 
-$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
 
 
 $tpl = new Template(get_lang('Social'));
@@ -856,8 +744,8 @@ $tpl->assign('socialRightInformation', $socialRightInformation);
 $tpl->assign('socialAutoExtendLink', $socialAutoExtendLink);
 
 $formModalTpl =  new Template();
-$formModalTpl->assign('friendId', $friendId);
 $formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
+$formModalTpl->assign('invitationForm', MessageManager::generate_invitation_form('send_invitation'));
 $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
 
 $tpl->assign('formModals', $formModals);

+ 10 - 116
main/social/search.php

@@ -14,118 +14,6 @@ require_once api_get_path(LIBRARY_PATH).'magpierss/rss_fetch.inc';
 $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
 api_block_anonymous_users();
 
-$htmlHeadXtra[] = '<script>
-
-function checkLength( o, n, min, max ) {
-    if ( o.val().length > max || o.val().length < min ) {
-        o.addClass( "ui-state-error" );
-        //updateTips( "Length of " + n + " must be between " + min + " and " + max + "." );
-        return false;
-    } else {
-        return true;
-    }
-}
-
-function send_message_to_user(user_id) {
-    var subject = $( "#subject_id" );
-    var content = $( "#content_id" );
-
-    $("#send_message_form").show();
-    $("#send_message_div").dialog({
-        modal:true,
-        height:350,
-        buttons: {
-            "'.addslashes(get_lang('Sent')).'": function() {
-                var bValid = true;
-                bValid = bValid && checkLength( subject, "subject", 1, 255 );
-                bValid = bValid && checkLength( content, "content", 1, 255 );
-
-                if (bValid) {
-                    var url = "'.$ajax_url.'?a=send_message&user_id="+user_id;
-                    var params = $("#send_message_form").serialize();
-                    $.ajax({
-                        url: url+"&"+params,
-                        success:function(data) {
-                            $("#message_ajax_reponse").attr("class", "");
-                            $("#message_ajax_reponse").html(data);
-                            $("#message_ajax_reponse").show();
-                            $("#send_message_div").dialog({ buttons:{}});
-                            $("#send_message_form").hide();
-                            $("#send_message_div").dialog("close");
-
-                            $("#subject_id").val("");
-                            $("#content_id").val("");
-                        }
-                    });
-                }
-            },
-        },
-        close: function() {
-        }
-    });
-    $("#send_message_div").dialog("open");
-    //prevent the browser to follow the link
-}
-
-function send_invitation_to_user(user_id) {
-    var content = $( "#content_invitation_id" );
-    $("#send_invitation_form").show();
-    $("#send_invitation_div").dialog({
-        modal:true,
-        buttons: {
-            "'.addslashes(get_lang('SendInvitation')).'": function() {
-                var bValid = true;
-                bValid = bValid && checkLength( content, "content", 1, 255 );
-                if (bValid) {
-                    var url = "'.$ajax_url.'?a=send_invitation&user_id="+user_id;
-                    var params = $("#send_invitation_form").serialize();
-                    $.ajax({
-                        url: url+"&"+params,
-                        success:function(data) {
-                            $("#message_ajax_reponse").attr("class", "");
-                            $("#message_ajax_reponse").html(data);
-                            $("#message_ajax_reponse").show();
-
-                            $("#send_invitation_div").dialog({ buttons:{}});
-
-                            $("#send_invitation_form").hide();
-                            $("#send_invitation_div").dialog("close");
-                            $("#content_invitation_id").val("");
-                        }
-                    });
-                }
-            },
-        },
-        close: function() {
-        }
-    });
-    $("#send_invitation_div").dialog("open");
-    //prevent the browser to follow the link
-}
-
-$(document).ready(function (){
-    $("input#id_btn_send_invitation").bind("click", function(){
-        if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
-            $("#form_register_friend").submit();
-        }
-    });
-
-    $("#send_message_div").dialog({
-        autoOpen: false,
-        modal    : false,
-        width    : 550,
-        height    : 300
-       });
-
-    $("#send_invitation_div").dialog({
-        autoOpen: false,
-        modal    : false,
-        width    : 550,
-        height    : 300
-       });
-});
-</script>';
-
 if (api_get_setting('allow_social_tool') != 'true') {
     api_not_allowed();
 }
@@ -194,10 +82,10 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
 
             // Show send invitation icon if they are not friends yet
             if ($relation_type != 3 && $relation_type != 4 && $user['user_id'] != api_get_user_id()) {
-                $send_inv = '<a href="javascript:void(0);" onclick="javascript:send_invitation_to_user(\''.$user['user_id'].'\');"/>
+                $send_inv = '<a href="#" class="btn-to-send-invitation" data-send-to="' . $user['user_id'] . '">
                              <button class="btn btn-mini"><i class="fa fa-user"></i> '.get_lang('SendInvitation').'</button></a><br /><br />';
             }
-            $send_msg = '<a href="javascript:void(0);" onclick="javascript:send_message_to_user(\''.$user['user_id'].'\');"/>
+            $send_msg = '<a href="#" class="btn-to-send-message" data-send-to="' . $user['user_id'] . '">
                         <button class="btn btn-mini"><i class="fa fa-envelope"></i> '.get_lang('SendMessage').'</button></a>';
             if (empty($user['picture_uri'])) {
                 $picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg';
@@ -324,13 +212,19 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
         $totalGroups
     );
 }
-$social_right_content .= MessageManager::generate_message_form('send_message');
-$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
+
 
 $tpl = new Template($tool_name);
 $tpl->assign('social_avatar_block', $social_avatar_block);
 $tpl->assign('social_menu_block', $social_menu_block);
 $tpl->assign('social_right_content', $social_right_content);
 
+$formModalTpl =  new Template();
+$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
+$formModalTpl->assign('invitationForm', MessageManager::generate_invitation_form('send_invitation'));
+$formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
+
+$tpl->assign('formModals', $formModals);
+
 $social_layout = $tpl->get_template('social/search.tpl');
 $tpl->display($social_layout);

+ 82 - 0
main/survey/copy_survey.php

@@ -0,0 +1,82 @@
+<?php
+/* For licensing terms, see /license.txt */
+/**
+ * @package chamilo.backup
+ */
+/**
+ * Code
+ */
+// Language files that need to be included
+$language_file = array('exercice', 'coursebackup', 'admin');
+
+// Setting the global file that gets the general configuration, the databases, the languages, ...
+require_once '../inc/global.inc.php';
+$current_course_tool  = TOOL_COURSE_MAINTENANCE;
+api_protect_course_script(true);
+
+// Notice for unauthorized people.
+if (!api_is_allowed_to_edit()) {
+    api_not_allowed(true);
+}
+
+// Breadcrumbs
+$interbreadcrumb[] = array('url' => '../course_info/maintenance.php', 'name' => get_lang('Maintenance'));
+
+// The section (for the tabs)
+$this_section = SECTION_COURSES;
+
+// Display the header
+Display::display_header(get_lang('CopySurvey'));
+echo Display::page_header(get_lang('CopySurvey'));
+
+/* MAIN CODE */
+
+// If a CourseSelectForm is posted or we should copy all resources, then copy them
+if (Security::check_token('post')) {
+    // Clear token
+    Security::clear_token();
+    $surveyId = intval($_POST['surveys']);
+    $courseId = Security::remove_XSS($_POST['destination_course']);
+    $surveyCopyId = survey_manager::copy_survey($surveyId, null, $courseId);
+    // Copy the survey to the target course
+    survey_manager::empty_survey($surveyCopyId, $courseId);
+    // Empty the copied survey
+    Display::display_confirmation_message(get_lang('SurveyCopied'));
+}
+
+$surveys = survey_manager::get_surveys(api_get_course_id(), api_get_session_id());
+$courses = CourseManager::get_courses_list();
+$form = new FormValidator('copy_survey', 'post', 'copy_survey.php?'.api_get_cidreq());
+if (!$surveys) {
+    Display::display_error_message(get_lang('NoSurveysAvailable'));
+}
+if (count($courses) <= 1) {
+    Display::display_error_message(get_lang('NoCoursesAvailable'));
+}
+if ($surveys && count($courses) > 1) {
+    // Surveys select
+    $options = array();
+    foreach ($surveys as $survey) {
+        $options[$survey['survey_id']] = $survey['title'];
+    }
+    $form->addElement('select', 'surveys', get_lang('SelectSurvey'), $options);
+    // All-courses-but-current select
+    $currentCourseId = api_get_course_int_id();
+    $options = array();
+    foreach ($courses as $course) {
+        if ($course['id'] != $currentCourseId) {
+            $options[$course['id']] = $course['title'];
+        }
+    }
+    $form->addElement('select', 'destination_course', get_lang('SelectDestinationCourse'), $options);
+    $form->addElement('style_submit_button', 'submit', get_lang('CopySurvey'), 'class="save"');
+}
+
+// Add Security token
+$token = Security::get_token();
+$form->addElement('hidden', 'sec_token');
+$form->setConstants(array('sec_token' => $token));
+
+$form->display();
+
+Display::display_footer();

+ 13 - 8
main/survey/survey.lib.php

@@ -534,12 +534,16 @@ class survey_manager
     /**
      * @param int $survey_id
      * @param int $new_survey_id
+     * @param int $targetCourseId
      *
      * @return bool
      */
-    public static function copy_survey($survey_id, $new_survey_id = null)
+    public static function copy_survey($survey_id, $new_survey_id = null, $targetCourseId = null)
     {
         $course_id = api_get_course_int_id();
+        if (!$targetCourseId) {
+            $targetCourseId = $course_id;
+        }
 
         // Database table definitions
         $table_survey 					= Database::get_course_table(TABLE_SURVEY);
@@ -557,7 +561,7 @@ class survey_manager
         if (empty($new_survey_id)) {
             $params = $survey_data;
             $params['code'] = self::generate_unique_code($params['code']);
-            $params['c_id'] = $course_id;
+            $params['c_id'] = $targetCourseId;
             unset($params['survey_id']);
             $params['session_id'] = api_get_session_id();
             $params['title'] = $params['title'] . ' ' . get_lang('Copy');
@@ -575,7 +579,7 @@ class survey_manager
         $res = Database::query($sql);
         while($row = Database::fetch_array($res, 'ASSOC')) {
             $params = array(
-                'c_id' =>  $course_id,
+                'c_id' =>  $targetCourseId,
                 'name' => $row['name'],
                 'description' => $row['description'],
                 'survey_id' => $new_survey_id
@@ -591,7 +595,7 @@ class survey_manager
         $res = Database::query($sql);
         while ($row = Database::fetch_array($res, 'ASSOC')) {
             $params = array(
-                'c_id' =>  $course_id,
+                'c_id' =>  $targetCourseId,
                 'survey_id' => $new_survey_id,
                 'survey_question' => $row['survey_question'],
                 'survey_question_comment' => $row['survey_question_comment'],
@@ -615,7 +619,7 @@ class survey_manager
         $res = Database::query($sql);
         while ($row = Database::fetch_array($res ,'ASSOC')) {
             $params = array(
-                'c_id' =>  $course_id,
+                'c_id' =>  $targetCourseId,
                 'question_id' => $question_id[$row['question_id']],
                 'survey_id' => $new_survey_id,
                 'option_text' => $row['option_text'],
@@ -625,26 +629,27 @@ class survey_manager
             Database::insert($table_survey_options, $params);
         }
 
-        return true;
+        return $new_survey_id;
     }
 
     /**
      * This function duplicates a survey (and also all the question in that survey
      *
      * @param int $survey_id id of the survey that has to be duplicated
+     * @param int $courseId id of the course which survey has to be duplicated
      * @return true
      *
      * @author Eric Marguin <e.marguin@elixir-interactive.com>, Elixir Interactive
      * @version October 2007
      */
-    public static function empty_survey($survey_id)
+    public static function empty_survey($survey_id, $courseId = null)
     {
         // Database table definitions
         $table_survey_invitation      = Database :: get_course_table(TABLE_SURVEY_INVITATION);
         $table_survey_answer          = Database :: get_course_table(TABLE_SURVEY_ANSWER);
         $table_survey                 = Database :: get_course_table(TABLE_SURVEY);
 
-        $course_id = api_get_course_int_id();
+        $course_id = $courseId ? $courseId : api_get_course_int_id();
 
         $datas = survey_manager::get_survey($survey_id);
         $session_where = '';

+ 0 - 6
main/template/default/layout/layout_2_col.tpl

@@ -51,18 +51,12 @@
 		{# Links that are not added in the tabs #}
 		{{ navigation_course_links }}
 
-
-		{# Reservation block  #}
-		{{ reservation_block }}
-
 		{# Search (xapian) #}
 		{{ search_block }}
 
 		{# Classes #}
 		{{ classes_block }}
 
-
-
 		{# Plugin courses sidebar #}
         {# Plugins for footer section #}
 

+ 7 - 8
main/template/default/layout/layout_3_col.tpl

@@ -1,7 +1,7 @@
 {#  This template is NOT used in chamilo 1.9 #}
 {% extends template ~ "/layout/main.tpl" %}
 
-{% block body %}	
+{% block body %}
 	<div id="maincontent" class="maincontent">
 		{{ plugin_courses_block}}
 		{{ home_page_block}}
@@ -9,17 +9,16 @@
 		{{ content}}
 		{{ announcements_block}}
 	</div>
-	
-	<div id="menu-wrapper">	
-		{{ login_block}}		
-		{{ profile_block}}			
-		{{ account_block}}	
+
+	<div id="menu-wrapper">
+		{{ login_block}}
+		{{ profile_block}}
+		{{ account_block}}
 		{{ teacher_block}}
 		{{ notice_block}}
 		{{ navigation_course_links}}
 		{{ plugin_courses_right_block}}
-		{{ reservation_block}}
 		{{ search_block}}
 		{{ classes_block}}
 	</div>
-{% endblock %}
+{% endblock %}

+ 54 - 4
main/template/default/social/form_modals.tpl

@@ -12,7 +12,31 @@
                 {{ messageForm }}
             </div>
             <div class="modal-footer">
-                <button type="button" id="btn-send-message" class="btn btn-primary">{{ 'Send' | get_lang }}</button>
+                <button type="button" id="btn-send-message" class="btn btn-primary">
+                    <i class="fa fa-send"></i> {{ 'Send' | get_lang }}
+                </button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div class="modal fade" id="send-invitation-modal" tabindex="-1" role="dialog" aria-labelledby="send-invitation-modal-title" aria-hidden="true">
+    <div class="modal-dialog">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close' | get_lang }}">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="send-invitation-modal-title">{{ 'SendInvitation' | get_lang }}</h4>
+            </div>
+            <div class="modal-body">
+                <div id="send-invitation-alert"></div>
+                {{ invitationForm }}
+            </div>
+            <div class="modal-footer">
+                <button type="button" id="btn-send-invitation" class="btn btn-primary">
+                    <i class="fa fa-send"></i> {{ 'Send' | get_lang }}
+                </button>
             </div>
         </div>
     </div>
@@ -20,11 +44,16 @@
 
 <script>
     $(document).on('ready', function() {
-        var $sendMessageModal = $('#send-message-modal');
+        var $sendMessageModal = $('#send-message-modal'),
+            $sendInvitationModal = $('#send-invitation-modal');
+
+        var sendToUser = 0;
 
-        $('#btn-to-send-message').on('click', function(e) {
+        $('.btn-to-send-message').on('click', function(e) {
             e.preventDefault();
 
+            sendToUser = $(this).data('send-to');
+
             $sendMessageModal.modal('show');
         });
 
@@ -32,7 +61,7 @@
             e.preventDefault();
 
             var $frmSendMessage = $sendMessageModal.find('.modal-body form'),
-                url = '{{ _p.web_ajax }}message.ajax.php?a=send_message&user_id={{ friendId }}';
+                url = '{{ _p.web_ajax }}message.ajax.php?a=send_message&user_id=' + sendToUser;
 
             $.get(url, $frmSendMessage.serialize(), function(response) {
                 $('#send-message-alert').html(response);
@@ -40,5 +69,26 @@
                 $frmSendMessage[0].reset();
             });
         });
+
+        $('.btn-to-send-invitation').on('click', function(e) {
+            e.preventDefault();
+
+            sendToUser = $(this).data('send-to');
+
+            $sendInvitationModal.modal('show');
+        });
+
+        $('#btn-send-invitation').on('click', function(e) {
+            e.preventDefault();
+
+            var $frmSendInvitation = $sendInvitationModal.find('.modal-body form'),
+                url = '{{ _p.web_ajax }}message.ajax.php?a=send_invitation&user_id=' + sendToUser;
+
+            $.get(url, $frmSendInvitation.serialize(), function(response) {
+                $('#send-invitation-alert').html(response);
+
+                $frmSendInvitation[0].reset();
+            });
+        });
     });
 </script>

+ 4 - 0
main/template/default/social/search.tpl

@@ -26,4 +26,8 @@
         </div>
     </div>
 </div>
+
+    {% if formModals is defined %}
+        {{ formModals }}
+    {% endif %}
 {% endblock %}

+ 2 - 4
main/user/user.php

@@ -496,13 +496,11 @@ if (api_is_allowed_to_edit(null, true)) {
     }
 
     // Build search-form
-    $form = new FormValidator('search_user', 'get', '', '', null, false);
-    $renderer = $form->defaultRenderer();
-    $renderer->setElementTemplate('<span>{element}</span> ');
+    $form = new FormValidator('search_user', 'get', '', '', null, FormValidator::LAYOUT_INLINE);
     $form->addText('keyword', '', false);
     $form->addButtonSearch(get_lang('SearchButton'));
-    $form->addElement('static', 'additionalactions', null, $actions);
     $form->display();
+    echo $actions;
     echo '</div>';
 }
 

+ 0 - 1
user_portal.php

@@ -198,7 +198,6 @@ $controller->tpl->assign('profile_block', $controller->return_profile_block());
 $controller->tpl->assign('user_image_block', $controller->return_user_image_block());
 $controller->tpl->assign('course_block', $controller->return_course_block());
 $controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
-$controller->tpl->assign('reservation_block', $controller->return_reservation_block());
 $controller->tpl->assign('search_block', $controller->return_search_block());
 $controller->tpl->assign('classes_block', $controller->return_classes_block());