22 public static function handleUpdatedSourceObject($a_src_obj_type, $a_src_obj_id, $a_src_filesize, $a_owner_obj_ids = null, $a_is_prtf =
false)
28 if(is_array($a_owner_obj_ids) &&
sizeof($a_owner_obj_ids) && (
int)$a_src_filesize > 0)
34 $set = $ilDB->query(
"SELECT DISTINCT(od.owner)".
35 " FROM object_data od".
36 " JOIN object_reference_ws ref ON (ref.obj_id = od.obj_id)".
37 " JOIN tree_workspace t ON (t.child = ref.wsp_id)".
38 " WHERE ".$ilDB->in(
"od.obj_id", $a_owner_obj_ids,
"",
"integer").
39 " AND t.tree = od.owner");
43 $set = $ilDB->query(
"SELECT DISTINCT(od.owner)".
44 " FROM object_data od".
45 " JOIN usr_portfolio prtf ON (prtf.id = od.obj_id)".
46 " WHERE ".$ilDB->in(
"od.obj_id", $a_owner_obj_ids,
"",
"integer"));
48 while(
$row = $ilDB->fetchAssoc($set))
50 $done[] =
$row[
"owner"];
63 $existing = array_diff($existing, $done);
66 foreach($existing as $owner)
80 protected static function deleteEntry($a_owner_id, $a_src_obj_type, $a_src_obj_id)
84 $ilDB->manipulate(
"DELETE FROM il_disk_quota".
85 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer").
86 " AND src_type = ".$ilDB->quote($a_src_obj_type,
"text").
87 " AND src_obj_id = ".$ilDB->quote($a_src_obj_id,
"integer"));
99 $ilDB->manipulate(
"DELETE FROM il_disk_quota".
100 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer"));
116 $set = $ilDB->query(
"SELECT owner_id".
117 " FROM il_disk_quota".
118 " WHERE src_type = ".$ilDB->quote($a_src_obj_type,
"text").
119 " AND src_obj_id = ".$ilDB->quote($a_src_obj_id,
"integer"));
120 while(
$row = $ilDB->fetchAssoc($set))
140 $set = $ilDB->query(
"SELECT src_type, src_obj_id".
141 " FROM il_disk_quota".
142 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer"));
143 while(
$row = $ilDB->fetchAssoc($set))
145 $res[
$row[
"src_type"]][] = $row[
"src_obj_id"];
159 protected static function handleEntry($a_owner_id, $a_src_obj_type, $a_src_obj_id, $a_src_filesize)
167 isset($existing[$a_src_obj_type]) &&
168 in_array($a_src_obj_id, $existing[$a_src_obj_type]))
170 $ilDB->manipulate(
"UPDATE il_disk_quota".
171 " SET src_size = ".$ilDB->quote($a_src_filesize,
"integer").
172 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer").
173 " AND src_type = ".$ilDB->quote($a_src_obj_type,
"text").
174 " AND src_obj_id = ".$ilDB->quote($a_src_obj_id,
"integer"));
179 $ilDB->manipulate(
"INSERT INTO il_disk_quota".
180 " (owner_id, src_type, src_obj_id, src_size)".
181 " VALUES (".$ilDB->quote($a_owner_id,
"integer").
182 ", ".$ilDB->quote($a_src_obj_type,
"text").
183 ", ".$ilDB->quote($a_src_obj_id,
"integer").
184 ", ".$ilDB->quote($a_src_filesize,
"integer").
")");
198 $set = $ilDB->query(
"SELECT sum(src_size) fsize".
199 " FROM il_disk_quota".
200 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer"));
201 $row = $ilDB->fetchAssoc($set);
202 return (
int)
$row[
"fsize"];
217 $set = $ilDB->query(
"SELECT sum(src_size) filesize, src_type, COUNT(*) count".
218 " FROM il_disk_quota".
219 " WHERE owner_id = ".$ilDB->quote($a_owner_id,
"integer").
220 " GROUP BY src_type");
221 while(
$row = $ilDB->fetchAssoc($set))
233 include_once
"Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php";
239 include_once
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
241 if($a_additional_size)
243 $usage += $a_additional_size;
246 include_once
"Services/WebDAV/classes/class.ilDiskQuotaChecker.php";
248 $quota = $quota[
"disk_quota"];
251 if(is_infinite($quota))
256 return $usage < $quota;
263 include_once
"Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php";
269 include_once
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
272 include_once
"Services/WebDAV/classes/class.ilDiskQuotaChecker.php";
274 $quota = $quota[
"disk_quota"];
277 if(is_infinite($quota) || !(int)$quota)
282 $lng->loadLanguageModule(
"file");
283 return sprintf($lng->txt(
"personal_workspace_quota_status_legend"),
286 $quota ? round($usage/$quota*100) : 0);