@ -1064,8 +1065,8 @@ function update_work_url($id, $new_path) {
} else {
$row = Database::fetch_array($res);
$filename = basename($row['url']);
$new_url = $new_path.$filename;
$sql2 = "UPDATE $table SET url = '$new_url' WHERE id=$id";
$new_url = $new_path.$filename;
$sql2 = "UPDATE $table SET url = '$new_url', parent_id = '$parent_id' WHERE id=$id";
$res2 = Database::query($sql2);
return $res2;
}
@ -1429,9 +1430,10 @@ function get_list_users_without_publication($task_id) {
$session_id = api_get_session_id();
if (!empty($session_id)){
$sql = "SELECT C.id_user as id FROM $work_table AS S, $session_course_rel_user AS C, $iprop_table AS I WHERE C.id_user=I.insert_user_id and S.id=I.ref and S.parent_id='$task_id' and course_code='".api_get_course_id()."' and S.session_id='".$session_id."'";
$sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id' and session_id='".$session_id."'";
} else {
$sql = "SELECT C.user_id as id FROM $work_table AS S, $table_course_user AS C, $iprop_table AS I WHERE C.user_id=I.insert_user_id and S.id=I.ref and C.status=5 and S.parent_id='$task_id' and course_code='".api_get_course_id()."'";
$sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id'";
}
$result = Database::query($sql);
$users_with_tasks = array();
@ -1444,6 +1446,7 @@ function get_list_users_without_publication($task_id) {
} else {
$sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u WHERE cu.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.user_id";
}
$result_users = Database::query($sql_users);
$users_without_tasks = array();
while ($row_users = Database::fetch_row($result_users)) {
@ -561,7 +561,7 @@ if (!empty($_REQUEST['new_dir'])) {
session_id = ".intval($id_session);
Database::query($sql_add_publication);
// add the directory
$id = Database::insert_id();
//Folder created
@ -674,10 +674,13 @@ if (!empty($_REQUEST['delete2'])) {
if (!empty ($_REQUEST['move'])) {
$folders = array();
$sql = "SELECT url FROM $work_table WHERE url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:intval($_SESSION['toolgroup']))."'";
$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;
// update all the parents in the table item propery
$list_id = get_parent_directories($cur_dir_path);
@ -875,6 +885,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form
$current_date = date('Y-m-d H:i:s');
$parent_id = '';
$active = '';
$user_id = api_get_user_id();
$sql = Database::query('SELECT id FROM '.Database::get_course_table(TABLE_STUDENT_PUBLICATION).' WHERE url = '."'/".Database::escape_string($_GET['curdirpath'])."' AND filetype='folder' LIMIT 1");
if (Database::num_rows($sql) > 0) {
$dir_row = Database::fetch_array($sql);
@ -890,7 +902,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form
post_group_id = '" . $post_group_id . "',
sent_date = '".$current_date ."',
parent_id = '".$parent_id ."' ,
session_id = ".intval($id_session);
session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
Database::query($sql_add_publication);
@ -935,7 +948,8 @@ if ($ctok == $_POST['sec_token']) { //check the token inserted into the form