Don't allow send works to invtited users - refs BT#9070

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 3eb697ee42
commit 900d92f5a2
  1. 2
      main/work/upload.php
  2. 1
      main/work/work.lib.php
  3. 114
      main/work/work_list.php

@ -48,7 +48,7 @@ allowOnlySubscribedUser($user_id, $work_id, $course_id);
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $session_id);
$is_course_member = $is_course_member || api_is_platform_admin();
if ($is_course_member == false) {
if ($is_course_member == false || api_is_invited_user()) {
api_not_allowed(true);
}

@ -2260,6 +2260,7 @@ function get_work_user_list(
$sql = " $select
FROM $work_condition $user_condition
WHERE $extra_conditions $where_condition $condition_session
AND u.status != " . ROLE_INVITED . "
ORDER BY $column $direction";
if (!empty($start) && !empty($limit)) {

@ -73,7 +73,7 @@ Display :: display_header(null);
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_invited_user() ) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';
}
@ -112,48 +112,33 @@ $result = getWorkDateValidationStatus($work_data);
echo $result['message'];
$check_qualification = intval($my_folder_data['qualification']);
if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
$type = 'simple';
if (!api_is_invited_user()) {
if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
$type = 'simple';
$columns = array(
get_lang('Type'),
get_lang('Title'),
get_lang('Qualification'),
get_lang('Date'),
get_lang('Status'),
get_lang('Actions')
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'10', 'align'=>'left', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
);
} else {
$type = 'complex';
$columns = array(
get_lang('Type'),
get_lang('Title'),
get_lang('Date'),
get_lang('Actions')
);
$columns = array(
get_lang('Type'),
get_lang('Title'),
get_lang('Qualification'),
get_lang('Date'),
get_lang('Status'),
get_lang('Actions')
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'10', 'align'=>'left', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
);
} else {
$type = 'complex';
if (ALLOW_USER_COMMENTS) {
$columns = array(
get_lang('Type'),
get_lang('Title'),
get_lang('Feedback'),
get_lang('Date'),
get_lang('Actions')
);
@ -161,29 +146,46 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification))
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'10', 'align'=>'left', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
);
if (ALLOW_USER_COMMENTS) {
$columns = array(
get_lang('Type'),
get_lang('Title'),
get_lang('Feedback'),
get_lang('Date'),
get_lang('Actions')
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'10', 'align'=>'left', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
);
}
}
}
$extra_params = array(
'autowidth' => 'true',
'height' => 'auto',
'sortname' => 'firstname'
);
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list&work_id='.$workId.'&type='.$type;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
$extra_params = array(
'autowidth' => 'true',
'height' => 'auto',
'sortname' => 'firstname'
);
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list&work_id='.$workId.'&type='.$type;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');
}
Display :: display_footer();

Loading…
Cancel
Save