diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php index 8ee6de70e0..c598951a17 100644 --- a/main/gradebook/gradebook.php +++ b/main/gradebook/gradebook.php @@ -573,7 +573,7 @@ if (isset ($_GET['studentoverview'])) { } $gradebooktable= new GradebookTable($cats[0], $allcat, $alleval, $alllink, $addparams); -if ((empty ($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_platform_admin) && ($is_course_admin) && (!isset ($_GET['selectcat']))) { +if (((empty ($allcat)) && (empty ($alleval)) && (empty ($alllink)) && (!$is_platform_admin) && ($is_course_admin) && (!isset ($_GET['selectcat']))) && api_is_course_tutor()) { Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '

',false); } //here we are in a sub category diff --git a/main/gradebook/gradebook_add_link.php b/main/gradebook/gradebook_add_link.php index b45d6986d2..1d3936379c 100644 --- a/main/gradebook/gradebook_add_link.php +++ b/main/gradebook/gradebook_add_link.php @@ -97,7 +97,6 @@ if (isset($_GET['typeselected']) && $_GET['typeselected'] != '0') { //update view_properties $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); - if ( isset($_GET['typeselected']) && 5==$_GET['typeselected'] && (isset($addvalues['select_link']) && $addvalues['select_link']<>"")) { $sql1='SELECT thread_title from '.$tbl_forum_thread.' where thread_id='.$addvalues['select_link'].';'; $res1=api_sql_query($sql1); @@ -115,9 +114,8 @@ if (isset($_GET['typeselected']) && $_GET['typeselected'] != '0') { api_sql_query($sql_l); } - } else { - $link->add(); - } + } + $link->add(); $addvalue_result=!empty($addvalues['addresult'])?$addvalues['addresult']:array(); if ($addvalue_result == 1) { header('Location: gradebook_add_result.php?selecteval=' . $link->get_ref_id()); diff --git a/main/gradebook/gradebook_edit_all.php b/main/gradebook/gradebook_edit_all.php index 24cfbb3678..cc08df6f10 100755 --- a/main/gradebook/gradebook_edit_all.php +++ b/main/gradebook/gradebook_edit_all.php @@ -137,8 +137,7 @@ $result = api_sql_query($sql,__FILE__,__LINE__); $tempsql = api_sql_query('SELECT * FROM '.get_table_type_course($row['type'],$row['course_code']).' WHERE '.$table_evaluated[$row['type']][2].' = '.$row['ref_id']); $resource_name = Database ::fetch_array($tempsql); - - $output.= ' [ '.$table_evaluated[$row['type']][3].' ] '.$resource_name[$table_evaluated[$row['type']][1]].''; + $output.= ' [ '.$table_evaluated[$row['type']][3].' ] '.$resource_name[1].''; } $sql = api_sql_query('SELECT * FROM '.$table_evaluation.' WHERE category_id = '.$category_id,__FILE__,__LINE__); diff --git a/main/gradebook/index.php b/main/gradebook/index.php index 466e6c967d..18a572e44c 100755 --- a/main/gradebook/index.php +++ b/main/gradebook/index.php @@ -702,7 +702,7 @@ $gradebooktable= new GradebookTable($cats[0], $allcat, $alleval,$alllink, $addpa $no_qualification = false; if (( count($allcat) == 0) && ( count($alleval) == 0 ) && ( count($alllink) == 0 )) { $no_qualification = true; - if (($is_course_admin) && (!isset ($_GET['selectcat']))) { + if ((($is_course_admin) && (!isset ($_GET['selectcat']))) && api_is_course_tutor()) { Display :: display_normal_message(get_lang('GradebookWelcomeMessage') . '

',false); } } @@ -723,7 +723,7 @@ if ($category != '0') { //DisplayGradebook :: display_header_gradebook($cats[0], 0, 0, $is_course_admin, $is_platform_admin, $simple_search_form, false, false); } -if (api_is_platform_admin() || api_is_allowed_to_create_course()) { +if (api_is_platform_admin() || api_is_allowed_to_create_course() && api_is_course_tutor()) { if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0) ) { // diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index cb5aaeebc4..3be23810a3 100644 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -190,7 +190,7 @@ class DisplayGradebook $course_id=$objdat->get_course_by_category($selectcat); $message_resource=$objcat->show_message_resource_delete($course_id); - if (!$is_course_admin) { + if (!$is_course_admin || !api_is_course_tutor()) { $user_id = api_get_user_id(); $user= get_user_info_from_id($user_id); @@ -280,7 +280,7 @@ class DisplayGradebook // for course admin & platform admin add item buttons are added to the header $header .= '
'; - if (($is_course_admin) && (!isset ($_GET['search']))) { + if (api_is_course_tutor() && ($is_course_admin) && (!isset ($_GET['search']))) { if ($selectcat == '0') { if ($show_add_qualification === true) { // $header .= '' . get_lang('NewCategory') . ' ' . get_lang('NewCategory') . ''; diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index 0b01208fbd..3ae7e6cddc 100644 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -49,13 +49,13 @@ class GradebookTable extends SortableTable $this->set_additional_parameters($addparams); } $column= 0; - if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { + if (api_is_course_tutor() && api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $this->set_header($column++,'','','width="25px"'); } $this->set_header($column++, get_lang('Type'),'','width="35px"'); $this->set_header($column++, get_lang('Name')); $this->set_header($column++, get_lang('Description')); - if (api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { + if (api_is_course_tutor() && api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $this->set_header($column++, get_lang('Weight'),'','width="50px"'); } else { if (empty($_GET['selectcat'])) { @@ -68,7 +68,7 @@ class GradebookTable extends SortableTable } $this->set_header($column++, get_lang('Date'),true, 'width="100px"'); //admins get an edit column - if (api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { + if (api_is_course_tutor() && api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $this->set_header($column++, get_lang('Modify'), false, 'width="100"'); //actions on multiple selected documents $this->set_form_actions(array ( @@ -141,14 +141,14 @@ class GradebookTable extends SortableTable $invisibility_span_open = (api_is_allowed_to_create_course() && $item->is_visible() == '0') ? '' : ''; - if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { + if (api_is_course_tutor() && api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $row[] = $this->build_id_column ($item); } $row[] = $this->build_type_column ($item); $row[] = $invisibility_span_open . $this->build_name_link ($item) . $invisibility_span_close; $row[] = $invisibility_span_open . $data[2] . $invisibility_span_close; - if (api_is_allowed_to_create_course()) { + if (api_is_course_tutor() && api_is_allowed_to_create_course()) { $row[] = $invisibility_span_open . $data[3] . $invisibility_span_close; } else { @@ -181,7 +181,7 @@ class GradebookTable extends SortableTable $row[] = $invisibility_span_open . str_replace(' ',' ',$data[4]) . $invisibility_span_close; //admins get an edit column - if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false'))) { + if (api_is_course_tutor() && api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false'))) { $cat=new Category(); $show_message=$cat->show_message_resource_delete($item->get_course_code());