23 $this->assignment = $a_ass;
24 $this->user_id = $a_user_id;
25 $this->is_tutor = (bool)$a_is_tutor;
26 $this->public_submissions = (bool)$a_public_submissions;
32 include_once
"Modules/Exercise/classes/class.ilExAssignmentTeam.php";
37 $this->team = $a_team;
41 if($this->assignment->getPeerReview())
43 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
50 switch($this->assignment->getType())
89 if($this->peer_review)
109 return $this->team->getMembers();
113 return array($this->user_id);
120 return "t".$this->team->getId();
130 return (
bool)
sizeof($this->
getFiles(
null,
true));
138 return array_pop($files);
145 !$this->assignment->notStartedYet() &&
146 $this->assignment->beforeDeadline());
156 $this->public_submissions)
162 if($this->peer_review)
165 foreach($this->peer_review->getPeerReviewsByPeerId($this->getUserId()) as $giver)
167 if($giver[
"giver_id"] ==
$ilUser->getId())
184 if($this->assignment->hasTeam() &&
185 !$this->team->getId())
200 return in_array($a_user_id, $this->
getUserIds());
207 return (
$ilUser->getId() == $this->getUserId());
212 return ($this->peer_review &&
213 $this->peer_review->hasPeerReviewAccess($this->user_id));
240 return ($this->assignment->getDeadline() &&
241 $this->assignment->getDeadline() < time());
246 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
247 return new ilFSStorageExercise($this->assignment->getExerciseId(), $this->assignment->getId());
262 $deliver_result = $this->
initStorage()->uploadFile($a_http_post_files, $this->
getUserId(), $unzip);
266 $next_id =
$ilDB->nextId(
"exc_returned");
267 $query = sprintf(
"INSERT INTO exc_returned ".
268 "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late) ".
269 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
270 $ilDB->quote($next_id,
"integer"),
271 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
272 $ilDB->quote($this->getUserId(),
"integer"),
273 $ilDB->quote($deliver_result[
"fullname"],
"text"),
275 $ilDB->quote($deliver_result[
"mimetype"],
"text"),
277 $ilDB->quote($this->assignment->getId(),
"integer"),
278 $ilDB->quote($this->isLate(),
"integer")
285 $a_http_post_files[
"name"]);
304 include_once (
"Services/Utilities/classes/class.ilFileUtils.php");
314 $max_num = $this->assignment->getMaxFile();
317 $current_num =
sizeof($this->
getFiles());
318 $zip_num =
sizeof($filearray[
"file"]);
319 if($current_num + $zip_num > $max_num)
328 foreach ($filearray[
"file"] as $key =>
$filename)
331 $a_http_post_files[
"type"] =
"other";
332 $a_http_post_files[
"tmp_name"] = $filearray[
"path"][$key].
"/".
$filename;
333 $a_http_post_files[
"error"] = 0;
334 $a_http_post_files[
"size"] = filesize($filearray[
"path"][$key].
"/".
$filename);
336 if(!$this->
uploadFile($a_http_post_files,
true))
358 $query =
"SELECT * FROM exc_returned".
359 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
360 " AND (filename IS NOT NULL OR atext IS NOT NULL)".
361 " AND ts IS NOT NULL";
370 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
372 $path = $storage->getAbsoluteSubmissionPath();
374 $query =
"SELECT * FROM exc_returned WHERE ass_id = ".
375 $ilDB->quote($a_ass_id,
"integer");
385 return $delivered ? $delivered : array();
388 function getFiles(array $a_file_ids =
null, $a_only_valid =
false, $a_min_timestamp =
null)
392 $sql =
"SELECT * FROM exc_returned".
393 " WHERE ass_id = ".$ilDB->quote($this->
getAssignment()->getId(),
"integer").
394 " AND ".$ilDB->in(
"user_id", $this->
getUserIds(),
"",
"integer");
398 $sql .=
" AND ".$ilDB->in(
"returned_id", $a_file_ids,
false,
"integer");
403 $sql .=
" AND ts > ".$ilDB->quote($a_min_timestamp,
"timestamp");
408 $delivered_files = array();
418 !(trim(
$row[
"atext"])))
425 $row[
"timestamp14"] = substr(
$row[
"ts"], 0, 4).
426 substr(
$row[
"ts"], 5, 2).substr(
$row[
"ts"], 8, 2).
427 substr(
$row[
"ts"], 11, 2).substr(
$row[
"ts"], 14, 2).
428 substr(
$row[
"ts"], 17, 2);
430 "/".$row[
"user_id"].
"/".basename(
$row[
"filename"]);
431 array_push($delivered_files,
$row);
435 return $delivered_files;
446 $q =
"SELECT exc_returned.returned_id AS id ".
447 "FROM exc_usr_tutor, exc_returned ".
448 "WHERE exc_returned.ass_id = exc_usr_tutor.ass_id ".
449 " AND exc_returned.user_id = exc_usr_tutor.usr_id ".
450 " AND exc_returned.ass_id = ".$ilDB->quote($this->
getAssignment()->getId(),
"integer").
451 " AND ".$ilDB->in(
"exc_returned.user_id", $this->
getUserIds(),
"",
"integer").
452 " AND exc_usr_tutor.tutor_id = ".$ilDB->quote($ilUser->getId(),
"integer").
453 " AND exc_usr_tutor.download_time < exc_returned.ts ";
455 $new_up_set =
$ilDB->query($q);
458 while ($new_up_rec =
$ilDB->fetchAssoc($new_up_set))
460 $new_up[] = $new_up_rec[
"id"];
476 $set =
$ilDB->query(
"SELECT obj_id".
477 " FROM exc_returned".
478 " WHERE returned_id = ".
$ilDB->quote($a_returned_id,
"integer"));
480 return (
int)
$row[
"obj_id"];
495 $set =
$ilDB->query(
"SELECT obj_id, ass_id".
496 " FROM exc_returned".
497 " WHERE user_id = ".
$ilDB->quote($a_user_id,
"integer").
498 " AND filetitle = ".$ilDB->quote($a_filetitle,
"text"));
512 $files[] = $item[
"returned_id"];
532 !
sizeof($file_id_array))
537 if (count($file_id_array))
540 " WHERE ".
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer").
541 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
545 $result_array = array();
549 array_push($result_array,
$row);
553 $ilDB->manipulate(
"DELETE FROM exc_returned".
554 " WHERE ".
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer").
555 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
559 foreach ($result_array as $key => $value)
561 if($value[
"filename"])
566 $value[
"filetitle"]);
569 $filename =
$path.
"/".$value[
"user_id"].
"/".basename($value[
"filename"]);
586 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
590 $submission =
new self($ass, $a_user_id);
591 $submission->deleteAllFiles();
594 $team = $submission->getTeam();
597 $team->removeTeamMember($a_user_id);
601 $member_status = $ass->getMemberStatus($a_user_id);
602 $member_status->setStatus(
"notgraded");
603 $member_status->update();
611 $q =
"SELECT download_time FROM exc_usr_tutor WHERE ".
612 " ass_id = ".$ilDB->quote($this->
getAssignment()->getId(),
"integer").
" AND ".
613 $ilDB->in(
"usr_id", $a_user_ids,
"",
"integer").
" AND ".
614 " tutor_id = ".$ilDB->quote(
$ilUser->getId(),
"integer");
615 $lu_set =
$ilDB->query($q);
616 $lu_rec =
$ilDB->fetchAssoc($lu_set);
617 return $lu_rec[
"download_time"];
620 function downloadFiles(array $a_file_ids =
null, $a_only_new =
false, $a_peer_review_mask_filename =
false)
625 $is_team = $this->assignment->hasTeam();
628 $download_time =
null;
639 if($a_peer_review_mask_filename)
643 foreach($this->peer_review->getPeerReviewsByGiver(
$ilUser->getId()) as $idx => $item)
645 if($item[
"peer_id"] == $this->
getUserId())
656 $files = $this->
getFiles($a_file_ids,
false, $download_time);
659 if (
sizeof($files) == 1)
661 $file = array_pop($files);
663 switch($this->assignment->getType())
669 $this->assignment->getTitle().
" - ".
670 $file[
"filetitle"][
"firstname"].
" ".
671 $file[
"filetitle"][
"lastname"].
" (".
672 $file[
"filetitle"][
"login"].
").zip";
679 if($a_peer_review_mask_filename)
681 $suffix = array_pop(explode(
".",
$file[
"filetitle"]));
682 $file[
"filetitle"] = $this->assignment->getTitle().
"_peer".$peer_id.
".".$suffix;
684 else if(
$file[
"late"])
686 $file[
"filetitle"] =
$lng->txt(
"exc_late_submission").
" - ".
694 $array_files = array();
695 foreach($files as $seq =>
$file)
697 $src = basename(
$file[
"filename"]);
698 if($a_peer_review_mask_filename)
700 $suffix = array_pop(explode(
".", $src));
701 $tgt = $this->assignment->getTitle().
"_peer".$peer_id.
702 "_".(++$seq).
".".$suffix;
704 $array_files[
$file[
"user_id"]][] = array(
711 $array_files[
$file[
"user_id"]][] = array(
713 "late" =>
$file[
"late"]
719 ($is_team ?
null : $this->
getUserId()), $is_team);
735 $exc_id = $this->assignment->getExerciseId();
736 $ass_id = $this->assignment->getId();
740 $ilDB->manipulateF(
"DELETE FROM exc_usr_tutor ".
741 "WHERE ass_id = %s AND usr_id = %s AND tutor_id = %s",
742 array(
"integer",
"integer",
"integer"),
745 $ilDB->manipulateF(
"INSERT INTO exc_usr_tutor (ass_id, obj_id, usr_id, tutor_id, download_time) VALUES ".
746 "(%s, %s, %s, %s, %s)",
747 array(
"integer",
"integer",
"integer",
"integer",
"timestamp"),
757 require_once
"./Services/Utilities/classes/class.ilUtil.php";
767 require_once
"./Services/Utilities/classes/class.ilUtil.php";
773 $tmpzipfile = $tmpfile .
".zip";
779 $deliverFilename = str_replace(
" ",
"_", $assTitle);
780 if ($a_user_id > 0 && !$a_multi_user)
783 $deliverFilename .=
"_".$userName[
"lastname"].
"_".$userName[
"firstname"];
787 $deliverFilename .=
"_files";
789 $orgDeliverFilename = trim($deliverFilename);
792 chdir($tmpdir.
"/".$deliverFilename);
795 $parsed_files = $duplicates = array();
796 foreach ($a_filenames as
$user_id => $files)
815 $pos = strpos($newFilename ,
"_");
818 $newFilename = substr($newFilename, $pos + 1);
821 $chkName = strtolower($newFilename);
822 if(array_key_exists($chkName, $duplicates))
824 $suffix = strrpos($newFilename,
".");
825 $newFilename = substr($newFilename, 0, $suffix).
826 " (".(++$duplicates[$chkName]).
")".
827 substr($newFilename, $suffix);
831 $duplicates[$chkName] = 1;
836 $newFilename =
$lng->txt(
"exc_late_submission").
" - ".
842 $newFilename = $tmpdir.DIRECTORY_SEPARATOR.$deliverFilename.DIRECTORY_SEPARATOR.$newFilename;
844 $oldFilename = $pathname.DIRECTORY_SEPARATOR.$filename;
845 if (!copy ($oldFilename, $newFilename))
847 echo
'Could not copy '.$oldFilename.
' to '.$newFilename;
849 touch($newFilename, filectime($oldFilename));
874 include_once
"./Services/Utilities/classes/class.ilUtil.php";
875 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
882 $savepath = $storage->getAbsoluteSubmissionPath();
890 if (!is_dir($savepath))
896 chdir($storage->getTempPath());
906 foreach (array_keys($members) as $id)
908 $directory = $savepath.DIRECTORY_SEPARATOR.$id;
911 if ($dirsize > disk_free_space($tmpdir))
924 $team_dirs = array();
927 foreach ($members as $id => $item)
929 $user = $item[
"name"];
930 $user_files = $item[
"files"];
932 $sourcedir = $savepath.DIRECTORY_SEPARATOR.$id;
933 if (!is_dir($sourcedir))
942 if(is_array($team_map) &&
943 array_key_exists($id, $team_map))
945 $team_id = $team_map[$id];
946 if(!array_key_exists($team_id, $team_dirs))
948 $team_dir =
$lng->txt(
"exc_team").
" ".$team_id;
950 $team_dirs[$team_id] = $team_dir;
952 $team_dir = $team_dirs[$team_id].DIRECTORY_SEPARATOR;
955 $targetdir = $team_dir.ilUtil::getASCIIFilename(
956 trim($userName[
"lastname"]).
"_".
957 trim($userName[
"firstname"]).
"_".
958 trim($userName[
"login"]).
"_".
963 $sourcefiles = scandir($sourcedir);
964 $duplicates = array();
965 foreach ($sourcefiles as $sourcefile) {
966 if ($sourcefile ==
"." || $sourcefile ==
"..")
971 $targetfile = trim(basename($sourcefile));
972 $pos = strpos($targetfile,
"_");
975 $targetfile= substr($targetfile, $pos + 1);
979 if(array_key_exists($targetfile, $duplicates))
981 $suffix = strrpos($targetfile,
".");
982 $targetfile = substr($targetfile, 0, $suffix).
983 " (".(++$duplicates[$targetfile]).
")".
984 substr($targetfile, $suffix);
988 $duplicates[$targetfile] = 1;
992 foreach($user_files as
$file)
994 if(basename(
$file[
"filename"]) == $sourcefile)
998 $targetfile =
$lng->txt(
"exc_late_submission").
" - ".
1006 $targetfile = $targetdir.DIRECTORY_SEPARATOR.$targetfile;
1007 $sourcefile = $sourcedir.DIRECTORY_SEPARATOR.$sourcefile;
1009 if (!copy ($sourcefile, $targetfile))
1012 $ilias->raiseError(
'Could not copy '.basename($sourcefile).
" to '".$targetfile.
"'.",
1013 $ilias->error_obj->MESSAGE);
1018 touch($targetfile, filectime($sourcefile));
1025 unlink($targetfile);
1033 $tmpzipfile = $tmpfile .
".zip";
1042 ? strtolower(
$lng->txt(
"exc_assignment"))
1043 : $assTitle).
".zip",
"",
false,
true);
1057 $q =
"SELECT obj_id,user_id,ts FROM exc_returned".
1058 " WHERE ass_id = ".$ilDB->quote($this->assignment->getId(),
"integer").
1059 " AND ".$ilDB->in(
"user_id", $this->
getUserIds(),
"",
"integer").
1060 " AND (filename IS NOT NULL OR atext IS NOT NULL)".
1061 " AND ts IS NOT NULL".
1062 " ORDER BY ts DESC";
1063 $usr_set =
$ilDB->query($q);
1064 $array =
$ilDB->fetchAssoc($usr_set);
1083 $next_id =
$ilDB->nextId(
"exc_returned");
1084 $query = sprintf(
"INSERT INTO exc_returned ".
1085 "(returned_id, obj_id, user_id, filetitle, ass_id, ts, atext, late) ".
1086 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
1087 $ilDB->quote($next_id,
"integer"),
1088 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
1089 $ilDB->quote($this->getUserId(),
"integer"),
1090 $ilDB->quote($a_wsp_id,
"text"),
1091 $ilDB->quote($this->assignment->getId(),
"integer"),
1093 $ilDB->quote($a_text,
"text"),
1094 $ilDB->quote($this->isLate(),
"integer")
1110 $ilDB->manipulate(
"DELETE FROM exc_returned".
1111 " WHERE obj_id = ".
$ilDB->quote($this->assignment->getExerciseId(),
"integer").
1112 " AND user_id = ".$ilDB->quote($this->getUserId(),
"integer").
1113 " AND ass_id = ".$ilDB->quote($this->assignment->getId(),
"integer").
1114 " AND returned_id = ".$ilDB->quote($a_returned_id,
"integer"));
1142 $files = array_shift($files);
1143 $id = $files[
"returned_id"];
1146 $ilDB->manipulate(
"UPDATE exc_returned".
1147 " SET atext = ".
$ilDB->quote($a_text,
"text").
1148 ", ts = ".$ilDB->quote(
ilUtil::now(),
"timestamp").
1149 ", late = ".$ilDB->quote($this->isLate(),
"integer").
1150 " WHERE returned_id = ".$ilDB->quote($id,
"integer"));
1168 $result[
"files"][
"count"] =
"---";
1187 $result[
"last_submission"][
"txt"] =
$lng->txt(
"exc_last_submission");
1188 $result[
"last_submission"][
"value"] = $last_sub;
1191 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id", $this->
getUserId());
1194 switch($this->assignment->getType())
1203 foreach($all_files as
$file)
1212 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned");
1215 $result[
"files"][
"txt"].=
' - <span class="warning">'.$lng->txt(
"exc_late_submission").
" (".$late_files.
")</span>";
1217 $sub_cnt = count($all_files);
1219 if (count($new) > 0)
1221 $sub_cnt.=
" ".sprintf(
$lng->txt(
"cnt_new"),count($new));
1224 $result[
"files"][
"count"] = $sub_cnt;
1229 $result[
"files"][
"download_url"] =
1230 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1232 if (count($new) <= 0)
1234 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_download_files");
1238 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_download_all");
1242 if (count($new) > 0)
1244 $result[
"files"][
"download_new_url"] =
1245 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadNewReturned");
1247 $result[
"files"][
"download_new_txt"] =
$lng->txt(
"exc_download_new");
1253 $result[
"files"][
"txt"] =
$lng->txt(
"exc_blog_returned");
1257 $blogs = array_pop($blogs);
1258 if($blogs && substr($blogs[
"filename"], -1) !=
"/")
1262 $result[
"files"][
"txt"].=
' - <span class="warning">'.$lng->txt(
"exc_late_submission").
"</span>";
1265 $result[
"files"][
"count"] = 1;
1267 $result[
"files"][
"download_url"] =
1268 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1270 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_download_files");
1276 $result[
"files"][
"txt"] =
$lng->txt(
"exc_portfolio_returned");
1280 $portfolios = array_pop($portfolios);
1281 if($portfolios && substr($portfolios[
"filename"], -1) !=
"/")
1283 if($portfolios[
"late"])
1285 $result[
"files"][
"txt"].=
' - <span class="warning">'.$lng->txt(
"exc_late_submission").
"</span>";
1288 $result[
"files"][
"count"] = 1;
1290 $result[
"files"][
"download_url"] =
1291 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1293 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_download_files");
1299 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned_text");
1303 $result[
"files"][
"count"] = 1;
1305 $files = array_shift($files);
1306 if(trim($files[
"atext"]))
1310 $result[
"files"][
"txt"].=
' - <span class="warning">'.$lng->txt(
"exc_late_submission").
"</span>";
1313 $result[
"files"][
"download_url"] =
1314 $ilCtrl->getLinkTargetByClass(
"ilexsubmissiontextgui",
"showAssignmentText");
1316 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_text_assignment_show");
1322 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id",
"");
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Exercise assignment team.
const TEAM_LOG_REMOVE_FILE
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
static getInstanceByUserId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
getExerciseId()
Get exercise id.
getId()
Get assignment id.
static getInstancesByExercise($a_exc_id)
static lookupTitle($a_id)
Lookup title.
lookupNewFiles()
Check how much files have been uploaded by the learner after the last download of the tutor.
static deleteUser($a_exc_id, $a_user_id)
Delete all delivered files of user.
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
downloadSingleFile($a_user_id, $filename, $filetitle)
processUploadedZipFile($fileTmp)
processes errorhandling etc for uploaded archive
addResourceObject($a_wsp_id, $a_text=null)
Add personal resource to assigment.
downloadMultipleFiles($a_filenames, $a_user_id, $a_multi_user=false)
isInTeam($a_user_id=null)
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
static hasAnySubmissions($a_ass_id)
static downloadAllAssignmentFiles(ilExAssignment $a_ass, array $members)
Download all submitted files of an assignment (all user)
deleteSelectedFiles(array $file_id_array)
Deletes already delivered files.
__construct(ilExAssignment $a_ass, $a_user_id, ilExAssignmentTeam $a_team=null, $a_is_tutor=false, $a_public_submissions=false)
downloadFiles(array $a_file_ids=null, $a_only_new=false, $a_peer_review_mask_filename=false)
updateTutorDownloadTime()
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
updateTextSubmission($a_text)
Handle text assignment submissions.
uploadFile($a_http_post_files, $unzip=false)
Save submitted file of user.
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
getDownloadedFilesInfoForTableGUIS($a_parent_obj, $a_parent_cmd=null)
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
getLastSubmission()
Get the date of the last submission of a user for the assignment.
getLastDownloadTime(array $a_user_ids)
Class to report exception.
static getValidFilename($a_filename)
Get valid filename.
utf8_encode($string)
utf8-encodes string if it is not a valid utf8-string.
processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static _lookupName($a_user_id)
lookup user name
static _lookupTitle($a_id)
lookup object title
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getMySQLTimestamp($a_ts)
Get MySQL timestamp in 4.1.x or higher format (yyyy-mm-dd hh:mm:ss) This function converts a timestam...
static escapeShellArg($a_arg)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static now()
Return current timestamp in Y-m-d H:i:s format.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static dirsize($directory)
get size of a directory or a file.