--- loncom/interface/longroup.pm 2006/06/26 22:20:57 1.5 +++ loncom/interface/longroup.pm 2006/06/28 23:38:10 1.6 @@ -92,11 +92,11 @@ Hash containing group information as key hash of hashes for (b) Keys (in two categories): -(a) groupname, creator, creation, modified, startdate,enddate. +(a) groupname, creator, creation, modified, startdate, enddate, quota. Corresponding values are name of the group, creator of the group (username:domain), UNIX time for date group was created, and -settings were last modified, and default start and end access -times for group members. +settings were last modified, file quota, and default start and end +access times for group members. (b) functions returned in hash of hashes. Outer hash key is functions. @@ -414,6 +414,43 @@ sub group_changes { } ############################################### + +sub sum_quotas { + my ($courseid) = @_; + my $totalquotas = 0; + my ($cdom,$cnum); + if (!defined($courseid)) { + if (defined($env{'request.course.id'})) { + $courseid = $env{'request.course.id'}; + $cdom = $env{'course.'.$courseid.'.domain'}; + $cnum = $env{'course.'.$courseid.'.num'}; + } else { + return ''; + } + } else { + ($cdom,$cnum) = split(/_/,$courseid); + } + if ($cdom && $cnum) { + my %curr_groups = &coursegroups($cdom,$cnum); + if (%curr_groups) { + foreach my $group (keys(%curr_groups)) { + my %settings=&get_group_settings($curr_groups{$group}); + my $quota = $settings{'quota'}; + if ($quota eq '') { + $quota = 0; + } + $totalquotas += $quota; + } + } else { + return 0; + } + } else { + return ''; + } + return $totalquotas; +} + +############################################### 1;