Skip to content
Permalink
Browse files

Add config "block_student_publication_edition" see BT#14985

Teachers can't edit student publications
  • Loading branch information...
jmontoyaa committed Oct 22, 2018
1 parent 7775f9b commit 53f18dca32d41308bf907bdd51f7c7abcca4c3c6
Showing with 57 additions and 9 deletions.
  1. +18 −0 main/install/configuration.dist.php
  2. +6 −0 main/work/edit.php
  3. +6 −0 main/work/edit_work.php
  4. +27 −9 main/work/work.lib.php
@@ -975,6 +975,24 @@
// Hide complete name in who is online page
// $_configuration['hide_complete_name_in_whoisonline'] = false;
// Block student publication edition BT#14985
// $_configuration['block_student_publication_edition'] = false;
// Enable system to manage e-mail templates in users registration forms
/*CREATE TABLE mail_template(
id int not null primary key auto_increment,
name varchar(255) not null, -- a friendly name for the template, to remember what it is like
template text, -- the template content (in Twig format)
type varchar(255) not null, -- the type of the mail (we can use current template names to fill that)
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
author_id INT NOT NULL,
url_id INT NOT NULL,
default_template TINYINT not null,
system int not null default 0 -- whether it can be deleted or not (system = 1 means it's initially from Chamilo, any other template can be created/deleted/edited, but the ones with system=1 cannot)
);*/
// $_configuration['mail_template_system'] = false;
// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email
@@ -6,6 +6,12 @@
api_protect_course_script(true);
$blockEdition = api_get_configuration_value('block_student_publication_edition');
if ($blockEdition && !api_is_platform_admin()) {
api_not_allowed(true);
}
// Including files
require_once 'work.lib.php';
@@ -14,6 +14,12 @@
api_not_allowed(true);
}
$blockEdition = api_get_configuration_value('block_student_publication_edition');
if ($blockEdition && !api_is_platform_admin()) {
api_not_allowed(true);
}
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$groupId = api_get_group_id();
@@ -1404,6 +1404,7 @@ function getWorkListTeacher(
}
$url = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq();
$blockEdition = api_get_configuration_value('block_student_publication_edition');
while ($work = Database::fetch_array($result, 'ASSOC')) {
$workId = $work['id'];
$work['type'] = Display::return_icon('work.png');
@@ -1456,10 +1457,14 @@ function getWorkListTeacher(
$work['title'] .= ' '.Display::label(get_count_work($work['id']), 'success');
$work['sent_date'] = api_get_local_time($work['sent_date']);
$editLink = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'work/edit_work.php?id='.$workId.'&'.api_get_cidreq()
);
if ($blockEdition && !api_is_platform_admin()) {
$editLink = '';
} else {
$editLink = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'work/edit_work.php?id='.$workId.'&'.api_get_cidreq()
);
}
$correctionLink = ' '.Display::url(
Display::return_icon('upload_package.png', get_lang('UploadCorrections'), '', ICON_SIZE_SMALL),
@@ -1932,6 +1937,8 @@ function get_work_user_list(
ICON_SIZE_SMALL
);
$blockEdition = api_get_configuration_value('block_student_publication_edition');
while ($work = Database::fetch_array($result, 'ASSOC')) {
$item_id = $work['id'];
// Get the author ID for that document from the item_property table
@@ -2126,13 +2133,24 @@ class="work_correction_file_upload file_upload_small fileinput-button"
$action .= Display::return_icon('edit_na.png', get_lang('Comment'), [], ICON_SIZE_SMALL);
}
} else {
if ($qualification_exists) {
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Edit').'" >'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
if ($blockEdition && !api_is_platform_admin()) {
$editLink = '';
} else {
$action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
if ($qualification_exists) {
$editLink = '<a href="'.$url.'edit.php?'.api_get_cidreq(
).'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang(
'Edit'
).'" >'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
} else {
$editLink = '<a href="'.$url.'edit.php?'.api_get_cidreq(
).'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang(
'Modify'
).'">'.
Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
}
}
$action .= $editLink;
}
if ($work['contains_file']) {

0 comments on commit 53f18dc

Please sign in to comment.
You can’t perform that action at this time.