|
|
|
@ -103,8 +103,11 @@ class Dropbox_Work |
|
|
|
|
// Check if object exists already. If it does, the old object is used |
|
|
|
|
// with updated information (authors, description, upload_date) |
|
|
|
|
$this->isOldWork = false; |
|
|
|
|
$sql = "SELECT id, upload_date FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
|
|
|
WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
|
|
|
|
$sql = "SELECT id, upload_date |
|
|
|
|
FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
filename = '".Database::escape_string($this->filename)."'"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$res = Database::fetch_array($result); |
|
|
|
|
if ($res) { |
|
|
|
@ -158,7 +161,6 @@ class Dropbox_Work |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$row = Database::fetch_array($result); |
|
|
|
|
if ($row['count'] == 0) { |
|
|
|
|
|
|
|
|
|
// Insert entries into person table |
|
|
|
|
$sql = "INSERT INTO ".Database::get_course_table(TABLE_DROPBOX_PERSON)." (c_id, file_id, user_id) |
|
|
|
|
VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
|
|
|
@ -174,7 +176,6 @@ class Dropbox_Work |
|
|
|
|
public function _createExistingWork($id) |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
|
|
|
|
|
$action = isset($_GET['action']) ? $_GET['action'] : null; |
|
|
|
|
|
|
|
|
|
// Do some sanity checks |
|
|
|
@ -209,7 +210,7 @@ class Dropbox_Work |
|
|
|
|
$this->category = $res['cat_id']; |
|
|
|
|
|
|
|
|
|
// Getting the feedback on the work. |
|
|
|
|
if ($action == 'viewfeedback' AND $this->id == $_GET['id']) { |
|
|
|
|
if ($action == 'viewfeedback' && $this->id == $_GET['id']) { |
|
|
|
|
$feedback2 = array(); |
|
|
|
|
$sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." |
|
|
|
|
WHERE c_id = $course_id AND file_id='".$id."' |
|
|
|
@ -507,6 +508,7 @@ class Dropbox_Person |
|
|
|
|
/** |
|
|
|
|
* Deletes all the received categories and work of this person |
|
|
|
|
* @param integer $id |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public function deleteReceivedWorkFolder($id) |
|
|
|
|
{ |
|
|
|
@ -565,7 +567,10 @@ class Dropbox_Person |
|
|
|
|
//delete entries in person table concerning sent works |
|
|
|
|
foreach ($this->sentWork as $w) { |
|
|
|
|
$sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
|
|
|
WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
user_id='".$this->userId."' AND |
|
|
|
|
file_id='".$w->id."'"; |
|
|
|
|
Database::query($sql); |
|
|
|
|
removeMoreIfMailing($w->id); |
|
|
|
|
} |
|
|
|
@ -610,6 +615,7 @@ class Dropbox_Person |
|
|
|
|
* |
|
|
|
|
* @param string $id |
|
|
|
|
* @param string $text |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public function updateFeedback($id, $text) |
|
|
|
|
{ |
|
|
|
@ -669,7 +675,6 @@ class Dropbox_Person |
|
|
|
|
null, |
|
|
|
|
$ownerid |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|