replace for the condition api_is_allowed_to_edit part 1 CT#874

skala
Carlos Vargas 15 years ago
parent 8d7943de86
commit 2602ce24da
  1. 2
      main/gradebook/index.php
  2. 10
      main/gradebook/lib/fe/displaygradebook.php
  3. 14
      main/gradebook/lib/fe/gradebooktable.class.php
  4. 2
      main/gradebook/lib/fe/resulttable.class.php
  5. 2
      main/gradebook/lib/gradebook_data_generator.class.php
  6. 2
      main/gradebook/lib/gradebook_functions.inc.php

@ -862,7 +862,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() || $status==1) {
if (api_is_allowed_to_edit(null, true)) {
/*
-----------------------------------------------------------
Introduction section (teacher edit)

@ -11,7 +11,7 @@ class DisplayGradebook
*/
function display_header_result($evalobj, $selectcat, $shownavbar) {
$status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
if ($shownavbar == '1' && $status==1) {
if (api_is_allowed_to_edit(null, true)) {
$header = '<div class="actions">';
$header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat=' . $selectcat . '">'. Display::return_icon(('back.png'),get_lang('FolderView')) . get_lang('FolderView') . '</a>';
if ($evalobj->get_course_code() == null) {
@ -268,7 +268,7 @@ class DisplayGradebook
$user_id=api_get_user_id();
$course_code=$my_category['course_code'];
$status_user=api_get_status_of_user_in_course ($user_id,$course_code);
if (($status_user==1 && $is_course_admin && !isset ($_GET['search'])) || api_is_platform_admin() || api_is_course_coach()) {
if (api_is_allowed_to_edit(null, true)) {
if ($selectcat == '0') {
if ($show_add_qualification === true) {
// $header .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat=0"><img src="../img/folder_new.gif" alt="' . get_lang('NewCategory') . '" /> ' . get_lang('NewCategory') . '</a></td>';
@ -306,7 +306,7 @@ class DisplayGradebook
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() .'">'.Display::return_icon('acces_tool.gif', get_lang('ScoreEdit')).' ' . get_lang('ScoreEdit') . '</a>';
}
if (api_is_course_admin() || api_is_platform_admin() || api_is_course_coach()) {
if (api_is_allowed_to_edit(null, true)) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('stats_access.gif', get_lang('FlatView')).' ' . get_lang('FlatView') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('acces_tool.gif', get_lang('AttachCertificate')).' ' . get_lang('AttachCertificate') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int)$_GET['selectcat'].'">'.Display::return_icon('acces_tool.gif', get_lang('Certificate')).' ' . get_lang('GradebookSeeListOfStudentsCertificates') . '</a>';
@ -324,7 +324,7 @@ class DisplayGradebook
function display_reduce_header_gradebook($catobj,$is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true) {
//student
if (!$is_course_admin) {
/*$user= get_user_info_from_id(api_get_user_id());
$user= get_user_info_from_id(api_get_user_id());
$catcourse= Category :: load($catobj->get_id());
$scoredisplay = ScoreDisplay :: instance();
$scorecourse = $catcourse[0]->calc_score(api_get_user_id());
@ -337,7 +337,7 @@ class DisplayGradebook
$scoreinfo.= '<br />'.get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
$scoreinfo.= '<br />'.get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
Display :: display_normal_message($scoreinfo,false);
*/
}
// show navigation tree and buttons?
$header = '<div class="actions">';

@ -31,14 +31,14 @@ class GradebookTable extends SortableTable
$this->set_additional_parameters($addparams);
}
$column= 0;
if ((($status==1 || is_null($status)) && api_is_allowed_to_create_course()) && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
if (api_is_allowed_to_edit(null, true)) {
$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 (($status==1 || is_null($status)) && api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
if (api_is_allowed_to_edit(null, true)) {
$this->set_header($column++, get_lang('Weight'),'','width="50px"');
} else {
if (empty($_GET['selectcat']) ) {
@ -49,13 +49,13 @@ class GradebookTable extends SortableTable
}
}
if (($status==1 || is_null($status)) && api_is_allowed_to_create_course()) {
if (api_is_allowed_to_edit(null, true)) {
$this->set_header($column++, get_lang('Date'),true, 'width="100px"');
} elseif (($status<>1) && !api_is_allowed_to_create_course() && (!isset($_GET['selectcat']) || $_GET['selectcat']==0)) {
$this->set_header($column++, get_lang('Date'),true, 'width="100px"');
}
//admins get an edit column
if (($status==1 || is_null($status)) && api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
if (api_is_allowed_to_edit(null, true)) {
$this->set_header($column++, get_lang('Modify'), false, 'width="100"');
//actions on multiple selected documents
$this->set_form_actions(array (
@ -133,14 +133,14 @@ class GradebookTable extends SortableTable
$invisibility_span_open = (api_is_allowed_to_create_course() && $item->is_visible() == '0') ? '<span class="invisible">' : '';
$invisibility_span_close = (api_is_allowed_to_create_course() && $item->is_visible() == '0') ? '</span>' : '';
if (/*($status_user==1 ||is_null($status_user)) && */api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
if (api_is_allowed_to_edit(null, true)) {
$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 (($status_user==1 || is_null($status_user)) && api_is_allowed_to_create_course()) {
if (api_is_allowed_to_edit(null, true)) {
$row[] = $invisibility_span_open . $data[3] . $invisibility_span_close;
$weight_total_links += intval($data[3]);
} else {
@ -175,7 +175,7 @@ class GradebookTable extends SortableTable
$row[] = $invisibility_span_open . str_replace(' ','&nbsp;',$data[4]) . $invisibility_span_close;
//admins get an edit column
if (($status_user==1 || is_null($status_user)) && api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false'))) {
if (api_is_allowed_to_edit(null, true)) {
$cat=new Category();
$show_message=$cat->show_message_resource_delete($item->get_course_code());
if ($show_message===false) {

@ -138,7 +138,7 @@ class ResultTable extends SortableTable
private function build_edit_column ($item) {
$status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
if ($status==1) {//api_is_course_admin()
if (api_is_allowed_to_edit(null, true)) {//api_is_course_admin()
$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '"><img src="../img/edit.gif" border="0" title="' . get_lang('Modify') . '" alt="" /></a>';
}
if ($this->evaluation->get_course_code() == null) {

@ -91,7 +91,7 @@ class GradebookDataGenerator
$row[] = $item->get_name();
$row[] = $item->get_description();
$row[] = $item->get_weight();
if (($status==1 || is_null($status)) && api_is_allowed_to_create_course()) {
if (api_is_allowed_to_edit(null, true)) {
$row[] = $this->build_date_column ($item);
}
if(count($this->evals_links)>0)

@ -196,7 +196,7 @@ function build_edit_icons_eval($eval, $selectcat) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &amp;cidReq='.$eval->get_course_code().'" onclick="return confirmation();"><img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
//$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?moveeval=' . $eval->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . ' "><img src="../img/' . $visibility_icon . '.gif" border="0" title="' . get_lang('Visible') . '" alt="" /></a>';
if ($status==1 || is_null($status)){
if (api_is_allowed_to_edit(null, true)){
$modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&amp;selectcat=' . $selectcat . ' &amp;cidReq='.$eval->get_course_code().'"><img src="../img/file_txt_small.gif" border="0" title="' . get_lang('GradebookQualifyLog') . '" alt="" /></a>';
}
return $modify_icons;

Loading…
Cancel
Save