From b72247fd68fbc5ad2ab5507dab8276a4d64ffd71 Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Fri, 12 Dec 2008 23:25:38 +0100 Subject: [PATCH] [svn r17257] minor - logic changes - edit all weights in my gradebook tool - (partial FS#3319) --- main/gradebook/gradebook_edit_all.php | 13 +++++++------ main/gradebook/lib/fe/gradebooktable.class.php | 10 ++++++++-- main/gradebook/lib/gradebook_functions.inc.php | 5 ++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/main/gradebook/gradebook_edit_all.php b/main/gradebook/gradebook_edit_all.php index abfd1f1360..3cdc7bbf0d 100755 --- a/main/gradebook/gradebook_edit_all.php +++ b/main/gradebook/gradebook_edit_all.php @@ -1,4 +1,4 @@ - $value){ @@ -124,11 +125,11 @@ $output=''; $sql='SELECT * FROM '.$table_link.' WHERE category_id = '.$category_id; $result = api_sql_query($sql,__FILE__,__LINE__); while($row = Database ::fetch_array($result)){ - //update only if value changed if(isset($_POST['link'][$row['id']]) && $_POST['link'][$row['id']] != $row['weight']) { api_sql_query('UPDATE '.$table_link.' SET weight = '."'".trim($_POST['link'][$row['id']])."'".' WHERE id = '.$row['id'],__FILE__,__LINE__); - api_sql_query('UPDATE '.$table_forum_thread.' SET thread_weight='.$_POST['link'][$row['id']].' WHERE thread_id='.$row['ref_id']); + $sql='UPDATE '.$table_forum_thread.' SET thread_weight='.$_POST['link'][$row['id']].' WHERE thread_id='.$row['ref_id']; + api_sql_query($sql); AbstractLink::add_link_log($row['id']); $row['weight'] = trim($_POST['link'][$row['id']]); } diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index 7871679403..f23316aba1 100644 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -180,7 +180,13 @@ class GradebookTable extends SortableTable //admins get an edit column if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false'))) { - $row[] = $this->build_edit_column ($item); + $cat=new Category(); + $show_message=$cat->show_message_resource_delete($item->get_course_code()); + + if ($show_message===false) { + $row[] = $this->build_edit_column ($item); + } + } else { //students get the results and certificates columns if (count($this->evals_links)>0) { @@ -261,7 +267,7 @@ private function build_id_column ($item) { . '' . $item->get_name() . ' ['.get_lang('Evaluation').']'; - } elseif (ScoreDisplay :: instance()->is_custom()) { + } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) { // students can go to the statistics page (if custom display enabled) return ' ' . '' diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index 32735dadb1..bace4a4a2f 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -185,7 +185,6 @@ function build_edit_icons_cat($cat, $selectcat) { if ($show_message===false) { $visibility_icon= ($cat->is_visible() == 0) ? 'invisible' : 'visible'; $visibility_command= ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible'; - $modify_icons= ''; $modify_icons .= ' '; @@ -315,7 +314,7 @@ function name_database_by_link($id_link) { $course_table = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $res=api_sql_query('SELECT db_name from '.$course_table.' c inner join '.$tbl_grade_links.' l - on c.code=l.course_code WHERE l.id='.$id_link); + on c.code=l.course_code WHERE l.id='.$id_link.' OR l.category_id='.$id_link); $my_db_name=Database::fetch_array($res,'ASSOC'); return $my_db_name['db_name']; -} \ No newline at end of file +}