Real blocking in evaluations (links not yet) see BT#4080

skala
Julio Montoya 14 years ago
parent b73d96bac4
commit 9cf75cd587
  1. 4
      main/gradebook/gradebook_edit_result.php
  2. 5
      main/gradebook/gradebook_view_result.php
  3. 6
      main/gradebook/lib/be/abstractlink.class.php
  4. 15
      main/gradebook/lib/be/evaluation.class.php
  5. 14
      main/gradebook/lib/fe/displaygradebook.php
  6. 2
      main/gradebook/lib/gradebook_functions.inc.php

@ -21,9 +21,11 @@ $select_eval=Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) {
api_not_allowed();
}
$resultedit = Result :: load (null,null,$select_eval);
$evaluation = Evaluation :: load ($select_eval);
$evaluation[0]->check_lock_permissions();
$edit_result_form = new EvalForm(EvalForm :: TYPE_ALL_RESULTS_EDIT, $evaluation[0], $resultedit, 'edit_result_form', null, api_get_self() . '?&selecteval='.$select_eval);
$table = $edit_result_form->toHtml();
if ($edit_result_form->validate()) {

@ -90,12 +90,15 @@ if (isset ($_GET['editres'])) {
}
}
if (isset ($_GET['import'])) {
if (isset ($_GET['import'])) {
$interbreadcrumb[]= array ('url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']), 'name' => get_lang('ViewResult'));
$import_result_form = new DataForm(DataForm :: TYPE_IMPORT, 'import_result_form', null, api_get_self() . '?import=&selecteval=' . Security::remove_XSS($_GET['selecteval']), '_blank', '');
if (!$import_result_form->validate()) {
Display :: display_header(get_lang('Import'));
}
$eval[0]->check_lock_permissions();
if ($_POST['formSent'] ) {
if (!empty ($_FILES['import_file']['name'])) {

@ -72,9 +72,9 @@ abstract class AbstractLink implements GradebookItem {
return $this->weight;
}
public function get_locked() {
return $this->locked;
}
public function is_locked() {
return isset($this->locked) && $this->locked == 1 ? true : false ;
}
public function is_visible() {
return $this->visible;

@ -78,6 +78,11 @@ class Evaluation implements GradebookItem
public function get_locked() {
return $this->locked;
}
public function is_locked() {
return isset($this->locked) && $this->locked == 1 ? true : false ;
}
public function set_id ($id) {
$this->id = $id;
}
@ -591,4 +596,14 @@ class Evaluation implements GradebookItem
$sql = "UPDATE $table_evaluation SET locked = '".intval($locked)."' WHERE id='".intval($this->id)."'";
Database::query($sql);
}
function check_lock_permissions() {
if (api_is_platform_admin()) {
return true;
} else {
if ($this->is_locked()) {
api_not_allowed();
}
}
}
}

@ -29,12 +29,18 @@ class DisplayGradebook
$header .= '<a href="gradebook_add_result.php?selectcat=' . $selectcat . '&selecteval=' . $evalobj->get_id() . '">
'.Display::return_icon('evaluation_rate.png',get_lang('AddResult'),'',ICON_SIZE_MEDIUM) . '</a>';
}
$header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&import=">
'.Display::return_icon('import_evaluation.png',get_lang('ImportResult'),'',ICON_SIZE_MEDIUM) . '</a>';
if (api_is_platform_admin() || $evalobj->is_locked() == false) {
$header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&import=">'.Display::return_icon('import_evaluation.png',get_lang('ImportResult'),'',ICON_SIZE_MEDIUM) . '</a>';
}
if ($evalobj->has_results()) {
$header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&export=">'.Display::return_icon('export_evaluation.png',get_lang('ExportResult'),'',ICON_SIZE_MEDIUM) . '</a>';
$header .= '<a href="gradebook_edit_result.php?selecteval=' . $evalobj->get_id() .'">'.Display::return_icon('edit.png',get_lang('EditResult'),'',ICON_SIZE_MEDIUM).'</a>';
$header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">'.Display::return_icon('delete.png',get_lang('DeleteResult'),'',ICON_SIZE_MEDIUM).'</a>';
if (api_is_platform_admin() || $evalobj->is_locked() == false) {
$header .= '<a href="gradebook_edit_result.php?selecteval=' . $evalobj->get_id() .'">'.Display::return_icon('edit.png',get_lang('EditResult'),'',ICON_SIZE_MEDIUM).'</a>';
$header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">'.Display::return_icon('delete.png',get_lang('DeleteResult'),'',ICON_SIZE_MEDIUM).'</a>';
}
}
$header .= '<a href="' . api_get_self() . '?print=&selecteval=' . $evalobj->get_id() . '" target="_blank">'.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';

@ -215,7 +215,7 @@ function build_edit_icons_cat($cat, $selectcat) {
if (api_is_platform_admin()) {
$modify_icons .= '&nbsp;<a onclick="javascrip:lock_confirmation()" href="' . api_get_self() . '?'. api_get_cidreq().'&category_id=' . $cat->get_id() . '&action=unlock">'.Display::return_icon('unlock.png', get_lang('Unlock'),'',ICON_SIZE_SMALL).'</a>';
} else {
$modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('unlock_na.png', get_lang('Unlock'),'',ICON_SIZE_SMALL).'</a>';
$modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('unlock_na.png', get_lang('ResourceLockedByGradebook'),'',ICON_SIZE_SMALL).'</a>';
}
} else {
$modify_icons .= '&nbsp;<a onclick="javascrip:lock_confirmation()" href="' . api_get_self() . '?'. api_get_cidreq().'&category_id=' . $cat->get_id() . '&action=lock">'.Display::return_icon('lock.png', get_lang('Lock'),'',ICON_SIZE_SMALL).'</a>';

Loading…
Cancel
Save