Fixing bug when uploading assignments due the new DB changes

skala
Julio Montoya 14 years ago
parent 25c5780787
commit f4c715d1cf
  1. 6
      main/work/work.lib.php
  2. 22
      main/work/work.php

@ -488,11 +488,11 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
WHERE ";
if (!empty($_SESSION['toolgroup'])) {
$sql_select_directory .= " prop.c_id = $course_id AND work.c_id = $course_id AND work.post_group_id = '".$_SESSION['toolgroup']."' "; // set to select only messages posted by the user's group
$sql_select_directory .= " work.post_group_id = '".$_SESSION['toolgroup']."' "; // set to select only messages posted by the user's group
} else {
$sql_select_directory .= " prop.c_id = $course_id AND work.c_id = $course_id AND work.post_group_id = '0' ";
$sql_select_directory .= " work.post_group_id = '0' ";
}
$sql_select_directory .= " AND work.url LIKE BINARY '".$mydir_temp."' AND work.filetype = 'folder' AND prop.tool='work' $condition_session";
$sql_select_directory .= " AND prop.c_id = $course_id AND work.c_id = $course_id AND work.url LIKE BINARY '".$mydir_temp."' AND work.filetype = 'folder' AND prop.tool='work' $condition_session";
$result = Database::query($sql_select_directory);
$row = Database::fetch_array($result);

@ -332,8 +332,6 @@ if (!empty ($_POST['changeProperties'])) {
$result = Database::query($query);
$number_of_setting = Database::num_rows($result);
if ($number_of_setting == 1) {
$query = "UPDATE " . $table_course_setting . " SET value='" . Database::escape_string($_POST['student_delete_own_publication']) . "' WHERE variable='student_delete_own_publication' and c_id = $course_id";
Database::query($query);
@ -863,29 +861,29 @@ if (isset($_POST['sec_token']) && $ctok == $_POST['sec_token']) { //check the to
$result = Database::query("SHOW FIELDS FROM " . $work_table . " LIKE 'sent_date'");
if (!Database::num_rows($result)) {
Database::query("ALTER TABLE " . $work_table . " ADD sent_date DATETIME NOT NULL");
Database::query("ALTER TABLE " . $work_table . " ADD sent_date DATETIME NOT NULL WHERE c_id = $course_id ");
}
$active = '1';
$sql_add_publication = "INSERT INTO " . $work_table . " SET
c_id = $course_id ,
url = '" . $url . "',
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
author = '" . Database::escape_string($authors) . "',
c_id = $course_id ,
url = '" . $url . "',
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
author = '" . Database::escape_string($authors) . "',
active = '" . $active . "',
accepted = '1',
post_group_id = '".$post_group_id."',
sent_date = '".api_get_utc_datetime()."',
parent_id = '".$work_id."' ,
session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
session_id = '".intval($id_session)."' ,
user_id = '".$user_id."'";
Database::query($sql_add_publication);
$Id = Database::insert_id();
api_item_property_update($_course, 'work', $Id, 'DocumentAdded', $user_id);
$id = Database::insert_id();
api_item_property_update($_course, 'work', $id, 'DocumentAdded', $user_id);
$succeed = true;
// update all the parents in the table item propery

Loading…
Cancel
Save