diff --git a/composer.lock b/composer.lock index 9d9b903236..7d7809bf75 100755 --- a/composer.lock +++ b/composer.lock @@ -1425,16 +1425,16 @@ }, { "name": "monolog/monolog", - "version": "1.13.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c41c218e239b50446fd883acb1ecfd4b770caeae" + "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c41c218e239b50446fd883acb1ecfd4b770caeae", - "reference": "c41c218e239b50446fd883acb1ecfd4b770caeae", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", + "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", "shasum": "" }, "require": { @@ -1494,7 +1494,7 @@ "logging", "psr-3" ], - "time": "2015-03-05 01:12:12" + "time": "2015-03-09 09:58:04" }, { "name": "mpdf/mpdf", diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index ecbcc50c25..4834dc19e7 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -92,13 +92,13 @@ function handle_regions() } echo ''; echo '
'; - echo ''; + echo ''; } function handle_extensions() { echo Display::page_subheader(get_lang('ConfigureExtensions')); - echo ''.get_lang('Ppt2lp').''; + echo ''.get_lang('Ppt2lp').''; } /** @@ -175,12 +175,12 @@ function handle_plugins() echo '
'; if (in_array($plugin, $installed_plugins)) { - echo Display::url(get_lang('Configure'), 'configure_plugin.php?name='.$plugin, array('class' => 'btn')); - echo Display::url(get_lang('Regions'), 'settings.php?category=Regions&name='.$plugin, array('class' => 'btn')); + echo Display::url(' '.get_lang('Configure'), 'configure_plugin.php?name='.$plugin, array('class' => 'btn btn-default')); + echo Display::url(' '.get_lang('Regions'), 'settings.php?category=Regions&name='.$plugin, array('class' => 'btn btn-default')); } if (file_exists(api_get_path(SYS_PLUGIN_PATH).$plugin.'/readme.txt')) { - echo Display::url("readme.txt", api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt", array('class' => 'btn ajax', '_target' => '_blank')); + echo Display::url(" readme.txt", api_get_path(WEB_PLUGIN_PATH).$plugin."/readme.txt", array('class' => 'btn btn-default', '_target' => '_blank')); } echo '
'; echo ''; @@ -189,7 +189,7 @@ function handle_plugins() echo ''; echo '
'; - echo ''; + echo ''; echo '
'; echo ''; } @@ -226,7 +226,7 @@ function handle_stylesheets() $form->addRule('new_stylesheet', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', 'filetype', $allowed_file_types); $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required'); - $form->addElement('style_submit_button', 'stylesheet_upload', get_lang('Upload'), array('class'=>'save')); + $form->addButtonUpload(get_lang('Upload'), 'stylesheet_upload'); $show_upload_form = false; @@ -346,10 +346,20 @@ function handle_stylesheets() } if ($is_style_changeable) { - //$group[] = $form_change->addButtonSave(get_lang('SaveSettings'),'submit'); - $group[] = $form_change->createElement('button', 'save', get_lang('SaveSettings')); - $group[] = $form_change->createElement('button', 'preview', get_lang('Preview')); - $group[] = $form_change->createElement('button', 'download', get_lang('Download')); + + /*$group = [ + $form_change->createElement('button', 'save', get_lang('SaveSettings')), + $form_change->createElement('button', 'preview', get_lang('Preview')), + $form_change->createElement('button', 'download', get_lang('Download')) + ];*/ + + //var_dump($group); + $group = [ + $form_change->addButtonSave(get_lang('SaveSettings'), 'save', true), + $form_change->addButtonPreview(get_lang('Preview'), 'preview', true), + $form_change->addButtonDownload(get_lang('Download'), 'download', true) + ]; + $form_change->addGroup($group); if ($show_upload_form) { @@ -634,12 +644,11 @@ function handle_search() $form->addElement('select', 'search_prefilter_prefix', array(get_lang('SearchPrefilterPrefix'), $url), $sf_values, ''); $default_values['search_prefilter_prefix'] = api_get_setting('search_prefilter_prefix'); } - } $default_values['search_enabled'] = $search_enabled; - $form->addElement('style_submit_button', 'submit', get_lang('Save')); + $form->addButtonSave(get_lang('Save')); $form->setDefaults($default_values); echo '
'; @@ -1341,7 +1350,8 @@ function generate_settings_form($settings, $settings_by_access_list) { if (!empty($settings)) { $form->setDefaults($default_values); } - $form->addElement('button', 'submit_fixed_in_bottom', get_lang('SaveSettings'), 'floppy-o','btn btn-success'); + $form->addButtonSave(get_lang('SaveSettings')); + //$form->addElement('button', 'submit_fixed_in_bottom', get_lang('SaveSettings'), 'class="save"'); return $form; } diff --git a/main/admin/settings.php b/main/admin/settings.php index f0e20c30bd..15539aaa7b 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -73,13 +73,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') { api_delete_setting_option($id); } -$form_search = new FormValidator('search_settings', 'get', api_get_self() , null, array('class'=>'well form-inline')); +$form_search = new FormValidator('search_settings', 'get', api_get_self() , null, array(), FormValidator::LAYOUT_INLINE); $form_search->addElement('text', 'search_field'); $form_search->addElement('hidden', 'category', 'search_setting'); -// Button rules: arg1 = type, arg2 = name, arg3 = text, arg4 = icon (fa-[...]), arg5 = class, arg6 = array('style' => 'display: block;', 'size' => 32, ...) -//$form_search->addElement('button', 'submit_button', get_lang('Search'), 'search', 'btn btn-primary'); -$form_search->addButtonSearch(get_lang('Search'),''); -$form_search->setDefaults(array('search_field' => (isset($_REQUEST['search_field'])?$_REQUEST['search_field']:null))); +$form_search->addButtonSearch(get_lang('Search'), 'submit_button'); +$form_search->setDefaults(array('search_field' => isset($_REQUEST['search_field'])?$_REQUEST['search_field']:null)); $form_search_html = $form_search->return_form(); diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 37b91bf479..ec3552c8a5 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -798,10 +798,8 @@ if (!empty($action)) { } // Create a search-box -$form = new FormValidator('search_simple', 'get', '', '', array()); -$renderer = & $form->defaultRenderer(); -$renderer->setElementTemplate('{element} '); -$form->addElement('text','keyword', get_lang('keyword')); +$form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE); +$form->addElement('text', 'keyword', get_lang('keyword')); $form->addButtonSearch(get_lang('Search')); $form->addElement( 'static', diff --git a/main/announcements/announcements.php b/main/announcements/announcements.php index cd56f97699..10888b49fb 100755 --- a/main/announcements/announcements.php +++ b/main/announcements/announcements.php @@ -55,6 +55,8 @@ $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); $course_id = api_get_course_int_id(); $_course = api_get_course_info(); +api_protect_course_group(GroupManager::GROUP_TOOL_ANNOUNCEMENT); + /* Tracking */ Event::event_access_tool(TOOL_ANNOUNCEMENT); diff --git a/main/attendance/attendance_sheet.php b/main/attendance/attendance_sheet.php index e92fcd12c2..ba0f355747 100755 --- a/main/attendance/attendance_sheet.php +++ b/main/attendance/attendance_sheet.php @@ -109,11 +109,11 @@ if (api_is_allowed_to_edit(null, true) || echo '
'; echo ''. Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).''; - //if (count($users_in_course) > 0) { - $form->display(); - //} echo ''. Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).''; + //if (count($users_in_course) > 0) { + $form->display(); + //} echo '
'; } @@ -398,7 +398,7 @@ if (api_is_allowed_to_edit(null, true) || - + @@ -417,8 +417,9 @@ if (api_is_allowed_to_edit(null, true) || -
-
+
+
+
@@ -442,14 +443,14 @@ if (api_is_allowed_to_edit(null, true) || ?> - + -
+
diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index b0b6008286..f8e0b62b7f 100755 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -48,6 +48,8 @@ if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) { } } +api_protect_course_group(GroupManager::GROUP_TOOL_CALENDAR); + $agenda = new Agenda(); $agenda->type = $type; diff --git a/main/chat/chat.php b/main/chat/chat.php index b99a9135b1..42b54b54ee 100755 --- a/main/chat/chat.php +++ b/main/chat/chat.php @@ -23,8 +23,9 @@ if ($origin != 'whoisonline') { $_SESSION['target']= $target; } -/* TRACKING */ +api_protect_course_group(GroupManager::GROUP_TOOL_CHAT, false); +/* TRACKING */ Event::event_access_tool(TOOL_CHAT); header('Content-Type: text/html; charset='.api_get_system_encoding()); diff --git a/main/course_progress/layout_no_header.php b/main/course_progress/layout_no_header.php index 2309c5d35b..65ae3e5477 100755 --- a/main/course_progress/layout_no_header.php +++ b/main/course_progress/layout_no_header.php @@ -6,6 +6,7 @@ api_protect_course_script(true); Display :: display_reduced_header(); +$tool = isset($tool) ? $tool : null; // Tracking Event::event_access_tool($tool); diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index e5792094ce..88806bcad5 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -180,7 +180,7 @@ if ($action == 'thematic_list') { $edit_link = ''; if (api_is_allowed_to_edit(null, true)) { - $edit_link = ''.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),ICON_SIZE_SMALL).''; + $edit_link = ''.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),ICON_SIZE_SMALL).''; $edit_link .= ''. Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).''; @@ -253,8 +253,8 @@ if ($action == 'thematic_list') { } $form->addText('title', get_lang('Title'), true, array('size'=>'50')); - $form->addHtmlEditor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '80%', 'Height' => '150')); - $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); + $form->addHtmlEditor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Height' => '150')); + $form->addButtonSave(get_lang('Save')); $show_form = true; diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php index 8161b1d05e..52afe306aa 100755 --- a/main/course_progress/thematic_advance.php +++ b/main/course_progress/thematic_advance.php @@ -18,15 +18,15 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { $header_form = get_lang('EditThematicAdvance'); } - if (!$start_date_error && !$duration_error) { + /*if (!$start_date_error && !$duration_error) { $token = md5(uniqid(rand(),TRUE)); $_SESSION['thematic_advance_token'] = $token; - } + }*/ // display form - $form = new FormValidator('thematic_advance','POST','index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq(),'','style="width: 100%;"'); + $form = new FormValidator('thematic_advance','POST','index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq()); $form->addElement('header', $header_form); - $form->addElement('hidden', 'thematic_advance_token',$token); + //$form->addElement('hidden', 'thematic_advance_token',$token); $form->addElement('hidden', 'action', $action); if (!empty($thematic_advance_id)) { @@ -41,7 +41,8 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { $radios[] = $form->createElement('radio', 'start_date_type', null, get_lang('StartDateCustom'),'2',array('onclick' => 'check_per_custom_date(this)', 'id'=>'custom_date')); $form->addGroup($radios, null, get_lang('StartDateOptions')); - if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) { + if (isset($thematic_advance_data['attendance_id']) && + $thematic_advance_data['attendance_id'] == 0) { $form->addElement('html', '
'); } else { $form->addElement('html', ''); - if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) { + if (isset($thematic_advance_data['attendance_id']) && + $thematic_advance_data['attendance_id'] == 0 + ) { $form->addElement('html', ''; $table = new SortableTable('thematic_advance_list', array('Thematic', 'get_number_of_thematic_advances'), array('Thematic', 'get_thematic_advance_data')); - $table->set_additional_parameters($parameters); + //$table->set_additional_parameters($parameters); $table->set_header(0, '', false, array('style'=>'width:20px;')); - $table->set_header(1, get_lang('StartDate'), false ); + $table->set_header(1, get_lang('StartDate'), false); $table->set_header(2, get_lang('DurationInHours'), false, array('style'=>'width:80px;')); $table->set_header(3, get_lang('Content'), false); diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 84c210b823..7938046db2 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -387,16 +387,15 @@ class ThematicController } $thematic_id = intval($_REQUEST['thematic_id']); - $thematic_advance_id = intval($_REQUEST['thematic_advance_id']); + $thematic_advance_id = isset($_REQUEST['thematic_advance_id']) ? intval($_REQUEST['thematic_advance_id']) : null; $thematic_advance_data = array(); switch ($action) { case 'thematic_advance_delete': if (!empty($thematic_advance_id)) { if (api_is_allowed_to_edit(null, true)) { - $affected_rows = $thematic->thematic_advance_destroy($thematic_advance_id); + $thematic->thematic_advance_destroy($thematic_advance_id); } - $action = 'thematic_list'; header('Location: index.php'); exit; } @@ -407,7 +406,7 @@ class ThematicController exit; } - if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || + if ((isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) { if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) { @@ -429,19 +428,17 @@ class ThematicController $data['thematic_advance_data'] = $thematic_advance_data; } } else { - if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && - api_is_allowed_to_edit(null, true) - ) { - $thematic_advance_id = $_REQUEST['thematic_advance_id']; + if (api_is_allowed_to_edit(null, true)) { + $thematic_advance_id = isset($_REQUEST['thematic_advance_id']) ? $_REQUEST['thematic_advance_id'] : null; $thematic_id = $_REQUEST['thematic_id']; - $content = $_REQUEST['content']; - $duration = $_REQUEST['duration_in_hours']; + $content = isset($_REQUEST['content']) ? $_REQUEST['content'] : null; + $duration = isset($_REQUEST['duration_in_hours']) ? $_REQUEST['duration_in_hours'] : null; if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) { - $start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']); + $start_date = $_REQUEST['custom_start_date']; $attendance_id = 0; } else { - $start_date = $_REQUEST['start_date_by_attendance']; - $attendance_id = $_REQUEST['attendance_select']; + $start_date = isset($_REQUEST['start_date_by_attendance']) ? $_REQUEST['start_date_by_attendance'] : null; + $attendance_id = isset($_REQUEST['attendance_select']) ? $_REQUEST['attendance_select'] : null; } $thematic->set_thematic_advance_attributes( $thematic_advance_id, diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index 675626236c..3445eab190 100755 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -156,7 +156,7 @@ $obj->fill_grade_model_select_in_form($form); $form->addElement('html','
'); // Submit button. -$form->addElement('button', 'submit', $course_validation_feature ? get_lang('CreateThisCourseRequest') : get_lang('CreateCourseArea'), 'plus-square', 'btn btn-primary'); +$form->addButtonCreate($course_validation_feature ? get_lang('CreateThisCourseRequest') : get_lang('CreateCourseArea')); // The progress bar of this form. $form->add_progress_bar(); diff --git a/main/css/base.css b/main/css/base.css index a1c835c30b..53e229162c 100755 --- a/main/css/base.css +++ b/main/css/base.css @@ -76,7 +76,8 @@ ul#navigation .report a { .button-load{ background: url("../img/icons/64/file_upload.png") no-repeat center 20px; padding-top: 70px; - } +} + /* START COURSE PROGRESS */ .thematic-postit{ padding-top: 5px; @@ -404,35 +405,18 @@ form .formw input { width: 110px; } -html, body { +html { margin: 0; padding: 0; -} - -html { position: relative; min-height: 100%; } body { + margin-bottom: 80px; /* hack ignored by non-IE to enable ie to support :hover on button */ behavior:url("/main/css/csshover3.htc"); - margin: 0; - padding: 0; background-color: #fff; - height: 100%; /* stick */ -} - -/* Sticky footer*/ -#wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -9em; /* Do not change this value */ -} - -#topbar { - z-index:9000; /* bug when using full area fckeditor */ } footer { @@ -3884,10 +3868,6 @@ a:active{ } -/*#homepage, #hot_courses, #announcements {*/ -#top_main_content section{ - /* margin-left: 5px; */ -} .welcome_course li { float:left; list-style-type: none; @@ -5472,4 +5452,4 @@ i.size-32.icon-new-work{ .menu-column .nav li a img{ vertical-align: bottom; margin-right: 5px; -} \ No newline at end of file +} diff --git a/main/document/document.php b/main/document/document.php index e48fbd5dc7..1c7e5210f4 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -40,6 +40,7 @@ $message = null; $lib_path = api_get_path(LIBRARY_PATH); api_protect_course_script(true); +api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS); DocumentManager::removeGeneratedAudioTempFile(); diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index cd17c6c7b4..b4011b42b7 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -79,7 +79,7 @@ if (!empty($groupId)) { (($current_forum_category && $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0 OR !$user_has_access_in_group) ) { - api_not_allowed(); + api_not_allowed(true); } } else { //Course diff --git a/main/glossary/index.php b/main/glossary/index.php index 07ef37ab15..5e088fb3b9 100755 --- a/main/glossary/index.php +++ b/main/glossary/index.php @@ -105,7 +105,7 @@ if (api_is_allowed_to_edit(null, true)) { $form->addElement('header', '', get_lang('TermAddNew')); $form->addElement('text', 'glossary_title', get_lang('TermName'), array('size'=>'80', 'id'=>'glossary_title')); //$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')); $form->addElement('style_submit_button', 'SubmitGlossary', get_lang('TermAddButton'), 'class="save"'); // setting the rules $form->addRule('glossary_title',get_lang('ThisFieldIsRequired'), 'required'); diff --git a/main/gradebook/lib/fe/evalform.class.php b/main/gradebook/lib/fe/evalform.class.php index ff36148c2a..1e95c762ea 100755 --- a/main/gradebook/lib/fe/evalform.class.php +++ b/main/gradebook/lib/fe/evalform.class.php @@ -109,7 +109,7 @@ class EvalForm extends FormValidator $select->addoption($user[1] . ' ' . $user[2] . ' (' . $user[3] . ')', $user[0]); } } - $this->addElement('submit', 'submit_button', get_lang('AddUserToEval')); + $this->addButtonCreate(get_lang('AddUserToEval'), 'submit_button'); } /** diff --git a/main/group/group.php b/main/group/group.php index f5e354023d..5d8ed94d1b 100755 --- a/main/group/group.php +++ b/main/group/group.php @@ -74,12 +74,16 @@ $my_get_id = isset($_GET['id']) ? Security::remove_XSS($_GET['id']) : null; if (isset($_GET['action']) && $is_allowed_in_course) { switch ($_GET['action']) { case 'set_visible': - GroupManager::setVisible($my_get_id); - Display :: display_confirmation_message(get_lang('ItemUpdated')); + if (api_is_allowed_to_edit()) { + GroupManager::setVisible($my_get_id); + Display:: display_confirmation_message(get_lang('ItemUpdated')); + } break; case 'set_invisible': - GroupManager::setInvisible($my_get_id); - Display :: display_confirmation_message(get_lang('ItemUpdated')); + if (api_is_allowed_to_edit()) { + GroupManager::setInvisible($my_get_id); + Display:: display_confirmation_message(get_lang('ItemUpdated')); + } break; case 'self_reg': if (GroupManager::is_self_registration_allowed($userId, $my_group_id)) { diff --git a/main/group/group_space.php b/main/group/group_space.php index 8be8cf5b46..637cfcca3b 100755 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -26,7 +26,7 @@ require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php'; $group_id = api_get_group_id(); $user_id = api_get_user_id(); -$current_group = GroupManager :: get_group_properties($group_id); +$current_group = GroupManager::get_group_properties($group_id); if (empty($current_group)) { api_not_allowed(true); @@ -40,7 +40,7 @@ $interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups')); $forums_of_groups = get_forums_of_group($current_group['id']); -$forum_state_public = 0; +/*$forum_state_public = 0; if (is_array($forums_of_groups)) { foreach ($forums_of_groups as $key => $value) { if ($value['forum_group_public_private'] == 'public') { @@ -57,18 +57,21 @@ if ($current_group['doc_state'] != 1 && $current_group['chat_state'] != 1 && $forum_state_public != 1 ) { - if (!api_is_allowed_to_edit(null, true) && - !GroupManager::is_user_in_group($user_id, $group_id)) { - api_not_allowed($print_headers); - } + +}*/ + +if (!api_is_allowed_to_edit(null, true) && + (!GroupManager::is_user_in_group($user_id, $group_id) || + $current_group['status'] == 0 + ) +) { + api_not_allowed(true); } /* Header */ - Display::display_header($nameTools.' '.Security::remove_XSS($current_group['name']), 'Group'); /* Introduction section (editable by course admin) */ - Display::display_introduction_section(TOOL_GROUP); /* Actions and Action links */ @@ -226,8 +229,11 @@ if (api_is_allowed_to_edit(false, true) OR // Link to the chat area of this group if (api_get_course_setting('allow_open_chat_window')) { $actions_array[] = array( - 'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"", - 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32) + 'url' => "javascript: void(0);", + 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32), + 'url_attributes' => array( + 'onclick' => " window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".api_get_course_id()."_".api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')" + ) ); } else { $actions_array[] = array( diff --git a/main/inc/ajax/thematic.ajax.php b/main/inc/ajax/thematic.ajax.php index 997a31b4b8..c2c7241641 100755 --- a/main/inc/ajax/thematic.ajax.php +++ b/main/inc/ajax/thematic.ajax.php @@ -30,56 +30,56 @@ switch ($action) { if (!api_is_allowed_to_edit(null, true)) { echo ''; exit; - } - /* - if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) { - if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) { - $start_date_error = true; - $data['start_date_error'] = $start_date_error; - } + } + /* + if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) { + if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) { + $start_date_error = true; + $data['start_date_error'] = $start_date_error; + } - if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) { - $duration_error = true; - $data['duration_error'] = $duration_error; - } + if (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) { + $duration_error = true; + $data['duration_error'] = $duration_error; + } - $data['action'] = $_REQUEST['action']; - $data['thematic_id'] = $_REQUEST['thematic_id']; - $data['attendance_select'] = $attendance_select; - if (isset($_REQUEST['thematic_advance_id'])) { - $data['thematic_advance_id'] = $_REQUEST['thematic_advance_id']; - $thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']); - $data['thematic_advance_data'] = $thematic_advance_data; - } - } else { - if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) { - $thematic_advance_id = $_REQUEST['thematic_advance_id']; - $thematic_id = $_REQUEST['thematic_id']; - $content = $_REQUEST['real_content']; - $duration = $_REQUEST['duration_in_hours']; - if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) { - $start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']); - $attendance_id = 0; - } else { - $start_date = $_REQUEST['start_date_by_attendance']; - $attendance_id = $_REQUEST['attendance_select']; - } - $thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration); - $affected_rows = $thematic->thematic_advance_save(); - if ($affected_rows) { - // get last done thematic advance before move thematic list - $last_done_thematic_advance = $thematic->get_last_done_thematic_advance(); - // update done advances with de current thematic list - if (!empty($last_done_thematic_advance)) { - $update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance); - } - } - } - } - $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true); - $return = $thematic->get_thematic_advance_div($thematic_advance_data); - echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/ - break; + $data['action'] = $_REQUEST['action']; + $data['thematic_id'] = $_REQUEST['thematic_id']; + $data['attendance_select'] = $attendance_select; + if (isset($_REQUEST['thematic_advance_id'])) { + $data['thematic_advance_id'] = $_REQUEST['thematic_advance_id']; + $thematic_advance_data = $thematic->get_thematic_advance_list($_REQUEST['thematic_advance_id']); + $data['thematic_advance_data'] = $thematic_advance_data; + } + } else { + if ($_REQUEST['thematic_advance_token'] == $_SESSION['thematic_advance_token'] && api_is_allowed_to_edit(null, true)) { + $thematic_advance_id = $_REQUEST['thematic_advance_id']; + $thematic_id = $_REQUEST['thematic_id']; + $content = $_REQUEST['real_content']; + $duration = $_REQUEST['duration_in_hours']; + if (isset($_REQUEST['start_date_type']) && $_REQUEST['start_date_type'] == 2) { + $start_date = $thematic->build_datetime_from_array($_REQUEST['custom_start_date']); + $attendance_id = 0; + } else { + $start_date = $_REQUEST['start_date_by_attendance']; + $attendance_id = $_REQUEST['attendance_select']; + } + $thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id, $attendance_id, $content, $start_date, $duration); + $affected_rows = $thematic->thematic_advance_save(); + if ($affected_rows) { + // get last done thematic advance before move thematic list + $last_done_thematic_advance = $thematic->get_last_done_thematic_advance(); + // update done advances with de current thematic list + if (!empty($last_done_thematic_advance)) { + $update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance); + } + } + } + } + $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true); + $return = $thematic->get_thematic_advance_div($thematic_advance_data); + echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/ + break; case 'get_datetime_by_attendance': $attendance_id = intval($_REQUEST['attendance_id']); $thematic_advance_id = intval($_REQUEST['thematic_advance_id']); @@ -89,13 +89,13 @@ switch ($action) { if (!empty($attendance_id)) { $attendance = new Attendance(); $thematic = new Thematic(); - $thematic_list = $thematic->get_thematic_list(); + $thematic_list = $thematic->get_thematic_list(); - $my_list = $thematic_list_temp = array(); - foreach ($thematic_list as $item) { - $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']); - $thematic_list_temp = array_merge($my_list, $thematic_list_temp); - } + $my_list = $thematic_list_temp = array(); + foreach ($thematic_list as $item) { + $my_list = $thematic->get_thematic_advance_by_thematic_id($item['id']); + $thematic_list_temp = array_merge($my_list, $thematic_list_temp); + } $new_thematic_list = array(); foreach($thematic_list_temp as $item) { @@ -108,19 +108,19 @@ switch ($action) { $label = get_lang('StartDate'); if (!empty($attendance_calendar)) { - $input_select .= ''; foreach ($attendance_calendar as $calendar) { - $selected = null; + $selected = null; $insert = true; //checking if was already taken foreach ($new_thematic_list as $key => $thematic_item) { //if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) { - if ($calendar['db_date_time'] == $thematic_item['start_date'] ) { + if ($calendar['db_date_time'] == $thematic_item['start_date'] ) { $insert = false; - if ($thematic_advance_id == $key) { - $insert = true; - $selected = 'selected'; - } + if ($thematic_advance_id == $key) { + $insert = true; + $selected = 'selected'; + } break; } } @@ -134,12 +134,12 @@ switch ($action) { } } ?> -
- -
+
+ +
ClearAddresses(); return 1; } + +/** + * @param string $tool Possible values: + * GroupManager::GROUP_TOOL_* + * + */ +function api_protect_course_group($tool, $showHeader = true) +{ + $userId = api_get_user_id(); + $groupId = api_get_group_id(); + + if (!empty($groupId)) { + $allow = GroupManager::user_has_access( + $userId, + $groupId, + $tool + ); + + if (!$allow) { + api_not_allowed($showHeader); + } + } +} diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 53100bf4b1..bfcbd42f5e 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -832,41 +832,46 @@ class Display /** * Creates a URL anchor + * @param string $name + * @param string $url + * @param array $attributes + * + * @return string */ - public static function url($name, $url, $extra_attributes = array()) + public static function url($name, $url, $attributes = array()) { if (!empty($url)) { $url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); - $extra_attributes['href'] = $url; + $attributes['href'] = $url; } - return self::tag('a', $name, $extra_attributes); + return self::tag('a', $name, $attributes); } /** * Creates a div tag * - * @param $content + * @param string $content * @param array $extra_attributes * @return string */ - public static function div($content, $extra_attributes = array()) + public static function div($content, $attributes = array()) { - return self::tag('div', $content, $extra_attributes); + return self::tag('div', $content, $attributes); } /** * Creates a span tag */ - public static function span($content, $extra_attributes = array()) + public static function span($content, $attributes = array()) { - return self::tag('span', $content, $extra_attributes); + return self::tag('span', $content, $attributes); } /** * Displays an HTML input tag * */ - public static function input($type, $name, $value, $extra_attributes = array()) + public static function input($type, $name, $value, $attributes = array()) { if (isset($type)) { $extra_attributes['type']= $type; @@ -877,7 +882,7 @@ class Display if (isset($value)) { $extra_attributes['value']= $value; } - return self::tag('input', '', $extra_attributes); + return self::tag('input', '', $attributes); } /** @@ -1828,7 +1833,8 @@ class Display $class = 'class ="active"'; } $html .= "
  • "; - $html .= self::url($value['content'], $value['url']); + $attributes = isset($value['url_attributes']) ? $value['url_attributes'] : array(); + $html .= self::url($value['content'], $value['url'], $attributes); $html .= '
  • '; } $html .= '
    '; diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 7db1518b7c..3acd271fd4 100755 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -146,6 +146,9 @@ class Event */ public static function event_access_tool($tool, $id_session = 0) { + if (empty($tool)) { + return false; + } $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); $TABLETRACK_LASTACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index cbdb24050f..53e8516431 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -110,8 +110,9 @@ class FormValidator extends HTML_QuickForm //Set required field template HTML_QuickForm::setRequiredNote('* ' . get_lang('ThisFieldIsRequired') . ''); $noteTemplate = << -
    {requiredNote}
    +
    +
    +
    {requiredNote}
    EOT; $renderer->setRequiredNoteTemplate($noteTemplate); @@ -138,11 +139,11 @@ EOT; { return '
    -