/** * was: deliverReturnedFiles($a_member_id, $a_only_new = false) */ function deliverReturnedFiles($a_eph_id, $a_ass_id, $a_user_id, $a_only_new = false) { global $ilUser, $ilDB; // get last download time $and_str = ""; if ($a_only_new) { $q = "SELECT download_time FROM rep_robj_xeph_tutor WHERE " . " ass_id = " . $ilDB->quote($a_ass_id, "integer") . " AND " . " user_id = " . $ilDB->quote($a_user_id, "integer") . " AND " . " tutor_id = " . $ilDB->quote($ilUser->getId(), "integer"); $lu_set = $ilDB->query($q); if ($lu_rec = $ilDB->fetchAssoc($lu_set)) { if ($lu_rec["download_time"] > 0) { $and_str = " AND date_created > " . $ilDB->quote($lu_rec["download_time"], "timestamp"); } } } ilEphAssignment::updateTutorDownloadTime($a_eph_id, $a_ass_id, $a_user_id); $query = sprintf("SELECT * FROM rep_robj_xeph_subm WHERE ass_id = %s AND user_id = %s" . $and_str, $ilDB->quote($a_ass_id, "integer"), $ilDB->quote($a_user_id, "integer")); $result = $ilDB->query($query); $count = $ilDB->numRows($result); if ($count == 1) { $row = $ilDB->fetchAssoc($result); ilEphAssignment::downloadSingleFile($a_eph_id, $a_ass_id, $a_user_id, $row["filename"], $row["filetitle"]); } else { if ($count > 0) { $array_files = array(); $filename = ""; while ($row = $ilDB->fetchAssoc($result)) { array_push($array_files, basename($row["filename"])); } $pathinfo = pathinfo($filename); $dir = $pathinfo["dirname"]; ilEphAssignment::downloadMultipleFiles($a_eph_id, $a_ass_id, $array_files, $a_user_id); } else { return false; } } return true; }