More fixes in the work tool

skala
Julio Montoya 13 years ago
parent f1d279413c
commit 15872b0b56
  1. 75
      main/work/work.lib.php
  2. 149
      main/work/work.php

@ -354,6 +354,16 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
// Getting the work data
$my_folder_data = get_work_data_by_id($id);
$qualification_exists = false;
if (!empty($my_folder_data['qualification']) && intval($my_folder_data['qualification']) > 0) {
$qualification_exists = true;
}
$work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
if (!empty($my_folder_data)) {
$work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work'.$my_folder_data['url'];
}
if (empty($my_folder_data)) {
$work_in_gradebook_link_id = is_resource_in_course_gradebook(api_get_course_id(), 3 , $id, api_get_session_id());
if ($work_in_gradebook_link_id) {
@ -362,15 +372,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
Display::display_warning_message(get_lang('MaxWeightNeedToBeProvided'));
}
}
$qualification_exists = false;
if (!empty($my_folder_data['qualification']) && intval($my_folder_data['qualification']) > 0) {
$qualification_exists = true;
}
$work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
if (!empty($my_folder_data)) {
$work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work'.$my_folder_data['url'];
}
$contains_file_query = '';
@ -406,14 +408,21 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
}
} else {
$parent_id = isset($my_folder_data['id']) ? $my_folder_data['id'] : 0;
if (!empty($_SESSION['toolgroup'])) {
$group_query = " WHERE c_id = $course_id AND post_group_id = '".intval($_SESSION['toolgroup'])."' "; // set to select only messages posted by the user's group
$subdirs_query = "AND parent_id = $parent_id ";
} else {
$group_query = " WHERE c_id = $course_id AND post_group_id = '0' ";
$subdirs_query = "AND parent_id = $parent_id";
}
$subdirs_query .= " AND user_id = ".api_get_user_id()." ";
$subdirs_query = "AND parent_id = $parent_id ";
if ($is_allowed_to_edit) {
//$subdirs_query .= " AND user_id = ".api_get_user_id()." ";
} else {
$subdirs_query .= " AND user_id = ".api_get_user_id()." ";
}
$active_condition = ' AND active IN (1)';
$sql_get_publications_list = "SELECT * FROM $work_table $group_query $subdirs_query $add_in_where_query $active_condition $condition_session ORDER BY title";
@ -447,7 +456,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$table_data = array();
// List of all folders
// List of all folders if no id was provided
if (is_array($work_parents)) {
@ -820,6 +829,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
}
}
//If an id was loaded we loop through the documents
$my_assignment = get_work_assignment_by_id($id);
if (Database::num_rows($sql_result) > 0) {
@ -829,9 +839,11 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$is_author = false;
$item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $work->id, api_get_session_id());
if (!$is_allowed_to_edit && $item_property_data['insert_user_id'] == api_get_user_id()) {
$is_author = true;
}
$user_info = api_get_user_info($item_property_data['insert_user_id']);
//display info depending on the permissions
@ -899,7 +911,11 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$table_has_actions_column = true;
}
$action = '';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;action=mark_work&item_id='.$work->id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>';
if (api_is_allowed_to_session_edit(false, true)) {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;action=mark_work&item_id='.$work->id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>';
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), 22);
}
if (api_get_course_setting('student_delete_own_publication') == 1) {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&origin='.$origin.'&gradebook='.$gradebook.'&delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'" >'.Display::return_icon('delete.png',get_lang('WorkDelete'),'',22).'</a>';
}
@ -1239,6 +1255,9 @@ function update_work_url($id, $new_path, $parent_id) {
if (empty($id)) return -1;
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$course_id = api_get_course_int_id();
$id = intval($id);
$parent_id = intval($parent_id);
$sql = "SELECT * FROM $table WHERE c_id = $course_id AND id = $id";
$res = Database::query($sql);
if (Database::num_rows($res) != 1) {
@ -1247,7 +1266,7 @@ function update_work_url($id, $new_path, $parent_id) {
$row = Database::fetch_array($res);
$filename = basename($row['url']);
$new_url = $new_path .$filename;
$sql2 = "UPDATE $table SET url = '$new_url', parent_id = '$parent_id' WHERE c_id = $course_id AND id = $id";
$sql2 = "UPDATE $table SET url = '$new_url', parent_id = '$parent_id' WHERE c_id = $course_id AND id = $id";
$res2 = Database::query($sql2);
return $res2;
}
@ -1324,22 +1343,18 @@ function update_dir_name($work_data, $new_name, $title) {
* @version April 2008
*/
function get_parent_directories($my_cur_dir_path) {
$list_id = array();
if (!empty($my_cur_dir_path)) {
$list_parents = explode('/', $my_cur_dir_path);
$dir_acum = '';
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
for ($i = 0; $i < count($list_parents) - 1; $i++) {
$item = Database::escape_string($list_parents[$i]);
$where_sentence = "url LIKE BINARY '" . $dir_acum . "/" . $item."'";
$dir_acum .= '/' . $list_parents[$i];
$sql = "SELECT id FROM ". $work_table . " WHERE c_id = '.$course_id.' ". $where_sentence;
$result = Database::query($sql);
$row = Database::fetch_array($result);
$list_id[] = $row['id'];
}
}
function get_parent_directories($id) {
$course_id = api_get_course_int_id();
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$id = intval($id);
$sql = "SELECT id FROM $work_table WHERE c_id = $course_id AND parent_id = $id";
$result = Database::query($sql);
$list_id = array();
if (Database::num_rows($result)) {
while ($row = Database::fetch_array($result)) {
$list_id[] = $row['id'];
}
}
return $list_id;
}

@ -63,10 +63,9 @@ require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
$course_id = api_get_course_int_id();
$course_info = api_get_course_info();
$user_id = api_get_user_id();
$course_id = api_get_course_int_id();
$course_info = api_get_course_info();
$user_id = api_get_user_id();
// Section (for the tabs)
$this_section = SECTION_COURSES;
@ -125,16 +124,16 @@ $currentUserFirstName = $_user['firstName'];
$currentUserLastName = $_user['lastName'];
$currentUserEmail = $_user['mail'];
$delete = isset($_REQUEST['delete']) ? Database::escape_string($_REQUEST['delete']) : '';
$description = isset($_REQUEST['description']) ? Database::escape_string($_REQUEST['description']) : '';
$delete = isset($_REQUEST['delete']) ? Database::escape_string($_REQUEST['delete']) : '';
$description = isset($_REQUEST['description']) ? Database::escape_string($_REQUEST['description']) : '';
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$parent_id = isset($_REQUEST['parent_id']) ? Database::escape_string($_REQUEST['parent_id']) : '';
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$parent_id = isset($_REQUEST['parent_id']) ? Database::escape_string($_REQUEST['parent_id']) : '';
$origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
$submitGroupWorkUrl = isset($_REQUEST['submitGroupWorkUrl']) ? Security::remove_XSS($_REQUEST['submitGroupWorkUrl']) : '';
$title = isset($_REQUEST['title']) ? Database::escape_string($_REQUEST['title']) : '';
$uploadvisibledisabled = isset($_REQUEST['uploadvisibledisabled']) ? Database::escape_string($_REQUEST['uploadvisibledisabled']) : '';
$submitGroupWorkUrl = isset($_REQUEST['submitGroupWorkUrl']) ? Security::remove_XSS($_REQUEST['submitGroupWorkUrl']) : '';
$title = isset($_REQUEST['title']) ? Database::escape_string($_REQUEST['title']) : '';
$uploadvisibledisabled = isset($_REQUEST['uploadvisibledisabled']) ? Database::escape_string($_REQUEST['uploadvisibledisabled']) : '';
// get data for publication assignment
@ -192,9 +191,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && !sizeof($_POST)) {
}
}
//toolgroup comes from group. the but of tis variable is to limit post to the group of the student
//if (!api_is_course_admin()) {
if (isset($_GET['toolgroup'])) {
$toolgroup = Database::escape_string($_GET['toolgroup']);
api_session_register('toolgroup');
@ -202,8 +198,6 @@ if (isset($_GET['toolgroup'])) {
$toolgroup = isset($_SESSION['toolgroup']) ? $_SESSION['toolgroup'] : api_get_group_id();
//}
$display_upload_form = false;
if ($action == 'upload_form') {
$display_upload_form = true;
@ -233,11 +227,9 @@ if (!empty($_SESSION['toolgroup'])) {
$url_dir ='';
$interbreadcrumb[] = array ('url' =>'work.php?gidReq='.$_SESSION['toolgroup'],'name' => get_lang('StudentPublications'));
$url_dir = 'work.php?&id=' . $work_id;
$interbreadcrumb[] = array ('url' => $url_dir,'name' => $my_folder_data['title']);
if ($display_upload_form) {
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('UploadADocument'));
}
@ -288,6 +280,8 @@ event_access_tool(TOOL_STUDENTPUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit(); //has to come after display_tool_view_option();
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
Display :: display_introduction_section(TOOL_STUDENTPUBLICATION);
// introduction section
@ -349,21 +343,17 @@ if ($is_special) {
switch ($action) {
case 'mark_work':
case 'upload_form':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if (empty($item_id)) {
$parent_data = get_work_data_by_id($work_id);
$parent_data['qualification'] = intval($parent_data['qualification']);
if (!empty($parent_data) && !empty($parent_data['qualification'])) {
$count = get_work_count_by_student($user_id, $work_id);
if ($count >= 1 ) {
if ($count >= 1 ) {
if (api_get_course_setting('student_delete_own_publication') == '1') {
Display::display_warning_message(get_lang('CantUploadDeleteYourPaperFirst'));
} else {
Display::display_warning_message(get_lang('CantUpload'));
Display::display_warning_message(get_lang('YouAlreadySentAPaperYouCantUpload'));
}
Display::display_footer();
exit;
@ -389,7 +379,6 @@ switch ($action) {
$is_author = true;
}
}
$form = new FormValidator('form', 'POST', api_get_self() . "?action=upload&id=".$work_id."&curdirpath=" . rtrim(Security :: remove_XSS($curdirpath),'/') . "&gradebook=".Security::remove_XSS($_GET['gradebook'])."&origin=$origin", '', 'enctype="multipart/form-data"');
// form title
@ -439,12 +428,11 @@ switch ($action) {
$sql = "SELECT qualification FROM $work_table WHERE c_id = $course_id AND id ='$parent_id' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$form->addElement('text', 'qualification', get_lang('Qualification'), 'size="10"');
$form->addElement('html', '<div class="row"><div class="formw">'.get_lang('QualificationNumeric').'&nbsp;:&nbsp;'.$row['qualification'].'</div></div>');
$form->addElement('text', 'qualification', array(get_lang('Qualification'), null, " / ".$row['qualification']) , 'size="10"');
//$form->addElement('html', '<div class="row"><div class="formw">'.get_lang('QualificationNumeric').'&nbsp;:&nbsp;'.$row['qualification'].'</div></div>');
$form->addElement('hidden', 'qualification_over', $row['qualification']);
}
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'accepted', 1);
$form->addElement('hidden', 'item_to_edit', $item_id);
@ -480,26 +468,26 @@ switch ($action) {
}
$form->setDefaults($defaults);
//fixes bug when showing modification form
if (empty($item_id) || (!empty($item_id) && ($is_allowed_to_edit or $is_author))) {
if ($student_can_edit_in_session && (empty($item_id) || (!empty($item_id) && ($is_allowed_to_edit or $is_author)))) {
$form->display();
} else {
Display::display_error_message(get_lang('ActionNotAllowed'));
}
break;
//download of an completed folder
case 'downloadfolder':
//require 'downloadfolder.inc.php';
break;
case 'send_mail':
if ($_GET['sec_token'] == $_SESSION['token']) {
send_reminder_users_without_publication($my_folder_data);
unset($_SESSION['token']);
}
break;
case 'settings':
//if posts
if (!empty($_POST['changeProperties'])) {
if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) {
// changing the tool setting: default visibility of an uploaded document
$query = "UPDATE " . $main_course_table . " SET show_score='" . $uploadvisibledisabled . "' WHERE code='" . api_get_course_id() . "'";
Database::query($query);
@ -523,14 +511,7 @@ switch ($action) {
Database::query($query);
}
Display::display_confirmation_message(get_lang('Saved'));
//$_course['show_score'] = $uploadvisibledisabled;
} else {
$query = "SELECT * FROM " . $main_course_table . " WHERE code=\"" . $_course['sysCode'] . "\"";
$result = Database::query($query);
$row = Database::fetch_array($result);
//$uploadvisibledisabled = $row["show_score"];
}
/* Display of tool options */
display_tool_options($uploadvisibledisabled, $origin);
break;
@ -576,7 +557,8 @@ switch ($action) {
$addtext .= '<table cellspacing="0" cellpading="0" border="0"><tr>';
$addtext .= '<td colspan="2">&nbsp;&nbsp;'.get_lang('QualificationNumeric').'&nbsp;';
$addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">';
$addtext .= '<input type="checkbox" value="1" name="make_calification" onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>'.get_lang('MakeQualifiable').'</td></tr><tr>';
$addtext .= '<input type="checkbox" value="1" id="make_calification_id" name="make_calification" onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>
<label for="make_calification_id">'.get_lang('MakeQualifiable').'</label></td></tr><tr>';
$addtext .= '<td colspan="2"><div id="option1" style="display:none">';
$addtext .= '<div id="msg_error_weight" style="display:none;color:red"></div>';
$addtext .= '&nbsp;&nbsp;'.get_lang('WeightInTheGradebook').'&nbsp;';
@ -584,12 +566,14 @@ switch ($action) {
$addtext .= '</tr></table>';
$addtext .= '<br />';
$addtext .= '<b>'.get_lang('DatesAvailables').'</b><br />';
$addtext .= '<input type="checkbox" value="1" name="type1" onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/>'.get_lang('EnableExpiryDate').'';
$addtext .= '<input type="checkbox" value="1" id="type1_id" name="type1" onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/>
<label for="type1_id">'.get_lang('EnableExpiryDate').'</label>';
$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error2" style="display:none;color:red"></span>';
$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';
$addtext .= '<div id="option2" style="padding:4px;display:none">&nbsp;&nbsp;';
$addtext .= draw_date_picker('expires').'</div>';
$addtext .= '<br /><input type="checkbox" value="1" name="type2" onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>'.get_lang('EnableEndDate').'';
$addtext .= '<br /><input type="checkbox" value="1" id="type2_id" name="type2" onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>
<label for="type2_id">'.get_lang('EnableEndDate').'</label>';
$addtext .= '<div id="option3" style="padding:4px;display:none">';
$addtext .= '&nbsp;&nbsp;&nbsp;<div id="msg_error4" style="display:none;color:red"></div>';
$addtext .= draw_date_picker('ends').'<br />';
@ -619,9 +603,6 @@ switch ($action) {
}
break;
case 'add':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
$fexpire = get_date_from_select('expires');
$fend = get_date_from_select('ends');
@ -635,7 +616,7 @@ switch ($action) {
// we insert here the directory in the table $work_table
$dir_name_sql = '';
if ($ctok == $_POST['sec_token']) {
if ($is_allowed_to_edit && $ctok == $_POST['sec_token']) {
if (!empty($created_dir)) {
if ($curdirpath == '/') {
@ -749,7 +730,7 @@ switch ($action) {
}
}
case 'upload':
if (isset($_POST['sec_token']) && $ctok == $_POST['sec_token']) {
if ($student_can_edit_in_session && isset($_POST['sec_token']) && $ctok == $_POST['sec_token']) {
//check the token inserted into the form
if (isset($_POST['submitWork']) && !empty($is_course_member)) {
@ -821,11 +802,13 @@ switch ($action) {
$succeed = true;
}
// update all the parents in the table item propery
$list_id = get_parent_directories($my_cur_dir_path);
// update all the parents in the table item property
//no need to add this
/*
$list_id = get_parent_directories($id);
for ($i = 0; $i < count($list_id); $i++) {
api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
}
}*/
} elseif ($newWorkUrl) {
if (isset ($_SESSION['toolgroup'])) {
@ -1005,12 +988,9 @@ switch ($action) {
case 'move_to':
case 'list':
if ($action == 'mark_work') {
}
/* Move file command */
if ($action == 'move_to') {
if ($is_allowed_to_edit && $action == 'move_to') {
$move_to_path = get_work_path($_REQUEST['move_to_id']);
if ($move_to_path==-1) {
@ -1021,14 +1001,19 @@ switch ($action) {
//security fix: make sure they can't move files that are not in the document table
if ($path = get_work_path($item_id)) {
if (move($course_dir . '/' . $path, $base_work_dir . $move_to_path)) {
if (move($course_dir.'/'.$path, $base_work_dir . $move_to_path)) {
//update db
update_work_url($item_id, 'work' . $move_to_path, $move_to);
update_work_url($item_id, 'work' . $move_to_path, $_REQUEST['move_to_id']);
api_item_property_update($_course, 'work', $_REQUEST['move_to_id'], 'FolderUpdated', $user_id);
/*
// update all the parents in the table item propery
$list_id = get_parent_directories($move_to_path);
for ($i = 0; $i < count($list_id); $i++) {
api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
}
}*/
Display :: display_confirmation_message(get_lang('DirMv'));
} else {
Display :: display_error_message(get_lang('Impossible'));
@ -1038,30 +1023,24 @@ switch ($action) {
}
}
/* Move file form request */
if ($action == 'move') {
if ($is_allowed_to_edit && $action == 'move') {
if (!empty($item_id)) {
$folders = array();
$session_id = api_get_session_id();
$session_id == 0 ? $withsession = " AND session_id = 0 " : $withsession = " AND session_id='".$session_id."'";
$sql = "SELECT id, url FROM $work_table WHERE url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:intval($_SESSION['toolgroup']))."'".$withsession;
$sql = "SELECT id, url, title FROM $work_table WHERE active IN (0, 1) AND url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:intval($_SESSION['toolgroup']))."'".$withsession;
$res = Database::query($sql);
while($folder = Database::fetch_array($res)) {
$folders[$folder['id']] = substr($folder['url'], 1, strlen($folder['url']) - 1);
$folders[$folder['id']] = $folder['title'];
}
echo build_work_move_to_selector($folders, $curdirpath, $item_id);
}
}
/* MAKE VISIBLE WORK COMMAND */
if ($action == 'make_visible') {
if ($is_allowed_to_edit && $action == 'make_visible') {
if (!empty($item_id)) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if (isset($item_id) && $item_id == 'all') {
//never happens
/*
@ -1079,13 +1058,10 @@ switch ($action) {
}
}
if ($action == 'make_invisible') {
if ($is_allowed_to_edit && $action == 'make_invisible') {
/* MAKE INVISIBLE WORK COMMAND */
if (!empty($item_id)) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if (isset($item_id) && $item_id == 'all') {
/*
$sql = "ALTER TABLE " . $work_table . "
@ -1104,22 +1080,13 @@ switch ($action) {
}
}
/* Delete dir command */
if (!empty($_REQUEST['delete_dir'])) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if ($is_allowed_to_edit && !empty($_REQUEST['delete_dir'])) {
del_dir($_REQUEST['delete_dir']);
Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$delete_directory);
}
if (!empty($_REQUEST['delete2'])) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
$delete_2 = intval($_REQUEST['delete2']);
$delete_2 = intval($_REQUEST['delete_dir']);
// gets calendar_id from student_publication_assigment
$sql = "SELECT add_to_calendar FROM $TSTDPUBASG WHERE c_id = $course_id AND publication_id ='$delete_2'";
$res = Database::query($sql);
@ -1137,16 +1104,14 @@ switch ($action) {
if ($link_id !== false) {
remove_resource_from_course_gradebook($link_id);
}
Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$delete_directory);
}
/* DELETE WORK COMMAND */
if ($delete) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if ($delete == 'all' && api_is_allowed_to_edit(null, true)) {
if ($is_allowed_to_edit && $delete) {
if ($delete == 'all') {
//we can't delete all documents
@ -1272,8 +1237,8 @@ switch ($action) {
if (!$is_allowed_to_edit && $is_special && $uploadvisibledisabled == 1) {
$add_query = ' AND author IN('.$admin_course.'\''.api_get_person_name($_user['firstName'], $_user['lastName']).'\')';
}
if ($is_allowed_to_edit && $is_special) {
if ($is_allowed_to_edit && $is_special) {
if (!empty($_REQUEST['filter'])) {
switch($_REQUEST['filter']) {
case 1:

Loading…
Cancel
Save