Annotation of loncom/interface/lonstatistics.pm, revision 1.41
1.1 albertel 1: # The LearningOnline Network with CAPA
2: # (Publication Handler
3: #
1.41 ! stredwic 4: # $Id: lonstatistics.pm,v 1.40 2002/08/06 17:39:15 minaeibi Exp $
1.1 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: # (Navigate problems for statistical reports
29: # YEAR=2001
1.15 minaeibi 30: # 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
1.14 minaeibi 31: # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
1.1 albertel 32: # YEAR=2002
1.18 minaeibi 33: # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
1.35 minaeibi 34: # 5/12,5/14,5/15,5/19,5/26,7/16,25/7,29/7 Behrouz Minaei
1.14 minaeibi 35: #
1.1 albertel 36: ###
37:
1.3 minaeibi 38: package Apache::lonstatistics;
1.1 albertel 39:
1.30 stredwic 40: use strict;
1.1 albertel 41: use Apache::Constants qw(:common :http);
42: use Apache::lonnet();
43: use Apache::lonhomework;
1.12 minaeibi 44: use Apache::loncommon;
1.29 stredwic 45: use Apache::loncoursedata;
46: use Apache::lonhtmlcommon;
1.30 stredwic 47: use Apache::lonproblemanalysis;
48: use Apache::lonproblemstatistics;
49: use Apache::lonstudentassessment;
1.1 albertel 50: use HTML::TokeParser;
51: use GDBM_File;
52:
1.27 stredwic 53:
54: sub CheckFormElement {
55: my ($cache, $ENVName, $cacheName, $default)=@_;
56:
57: if(defined($ENV{'form.'.$ENVName})) {
58: $cache->{$cacheName} = $ENV{'form.'.$ENVName};
59: } elsif(!defined($cache->{$cacheName})) {
60: $cache->{$cacheName} = $default;
61: }
62:
63: return;
64: }
65:
66: sub ProcessFormData{
1.29 stredwic 67: my ($cache)=@_;
1.27 stredwic 68:
1.29 stredwic 69: $cache->{'reportKey'} = 'false';
1.27 stredwic 70:
1.29 stredwic 71: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.34 stredwic 72: ['sort','download',
73: 'reportSelected',
1.41 ! stredwic 74: 'StudentAssessmentStudent',
! 75: 'ProblemStatisticsSort']);
1.29 stredwic 76: &CheckFormElement($cache, 'Status', 'Status', 'Active');
77: &CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list');
78: &CheckFormElement($cache, 'reportSelected', 'reportSelected',
79: 'Class list');
1.30 stredwic 80: $cache->{'reportSelected'} =
81: &Apache::lonnet::unescape($cache->{'reportSelected'});
1.29 stredwic 82: &CheckFormElement($cache, 'DownloadAll', 'DownloadAll', 'false');
83: &CheckFormElement($cache, 'sort', 'sort', 'fullname');
84: &CheckFormElement($cache, 'download', 'download', 'false');
85:
1.38 stredwic 86: # student assessment
1.29 stredwic 87: if(defined($ENV{'form.CreateStudentAssessment'}) ||
88: defined($ENV{'form.NextStudent'}) ||
89: defined($ENV{'form.PreviousStudent'})) {
90: $cache->{'reportSelected'} = 'Student Assessment';
91: }
92: if(defined($ENV{'form.NextStudent'})) {
93: $cache->{'StudentAssessmentMove'} = 'next';
94: } elsif(defined($ENV{'form.PreviousStudent'})) {
95: $cache->{'StudentAssessmentMove'} = 'previous';
96: } else {
97: $cache->{'StudentAssessmentMove'} = 'selected';
98: }
99: &CheckFormElement($cache, 'StudentAssessmentStudent',
1.30 stredwic 100: 'StudentAssessmentStudent', 'All Students');
101: $cache->{'StudentAssessmentStudent'} =
102: &Apache::lonnet::unescape($cache->{'StudentAssessmentStudent'});
1.34 stredwic 103: &CheckFormElement($cache, 'DefaultColumns', 'DefaultColumns', 'false');
1.29 stredwic 104:
1.33 stredwic 105: if(defined($ENV{'form.Section'})) {
106: my @sectionsSelected = (ref($ENV{'form.Section'}) ?
107: @{$ENV{'form.Section'}} :
108: ($ENV{'form.Section'}));
109: $cache->{'sectionsSelected'} = join(':', @sectionsSelected);
110: } elsif(!defined($cache->{'sectionsSelected'})) {
111: $cache->{'sectionsSelected'} = $cache->{'sectionList'};
112: }
113:
1.38 stredwic 114: # Problem analysis
115: &CheckFormElement($cache, 'Interval', 'Interval', '1');
116:
117: # ProblemStatistcs
118: &CheckFormElement($cache, 'DisplayCSVFormat',
119: 'DisplayFormat', 'Display Table Format');
120: &CheckFormElement($cache, 'ProblemStatisticsAscend',
121: 'ProblemStatisticsAscend', 'Ascending');
122: &CheckFormElement($cache, 'ProblemStatisticsMaps',
123: 'ProblemStatisticsMaps', 'All Maps');
1.41 ! stredwic 124: &CheckFormElement($cache, 'ProblemStatisticsSort',
! 125: 'ProblemStatisticsSort', 'Homework Sets Order');
1.38 stredwic 126:
127: # Search only form elements
1.34 stredwic 128: my @headingColumns=();
129: my @sequenceColumns=();
130: my $foundColumn = 0;
131: if(defined($ENV{'form.ReselectColumns'})) {
132: my @reselected = (ref($ENV{'form.ReselectColumns'}) ?
133: @{$ENV{'form.ReselectColumns'}}
134: : ($ENV{'form.ReselectColumns'}));
135: foreach (@reselected) {
136: if(/HeadingColumn/) {
137: push(@headingColumns, $_);
138: $foundColumn = 1;
139: } elsif(/SequenceColumn/) {
140: push(@sequenceColumns, $_);
141: $foundColumn = 1;
142: }
143: }
144: }
145:
1.37 stredwic 146: $cache->{'reportKey'} = 'false';
147: if($cache->{'reportSelected'} eq 'Analyze') {
148: $cache->{'reportKey'} = 'Analyze';
1.38 stredwic 149: } elsif($cache->{'reportSelected'} eq 'DoDiffGraph') {
150: $cache->{'reportKey'} = 'DoDiffGraph';
151: } elsif($cache->{'reportSelected'} eq 'PercentWrongGraph') {
152: $cache->{'reportKey'} = 'PercentWrongGraph';
153: }
154:
155: if(defined($ENV{'form.DoDiffGraph'})) {
156: $cache->{'reportSelected'} = 'DoDiffGraph';
157: $cache->{'reportKey'} = 'DoDiffGraph';
158: } elsif(defined($ENV{'form.PercentWrongGraph'})) {
159: $cache->{'reportSelected'} = 'PercentWrongGraph';
160: $cache->{'reportKey'} = 'PercentWrongGraph';
1.37 stredwic 161: }
162:
1.29 stredwic 163: foreach (keys(%ENV)) {
1.37 stredwic 164: if(/form\.Analyze/) {
165: $cache->{'reportSelected'} = 'Analyze';
166: $cache->{'reportKey'} = 'Analyze';
167: my $data;
168: (undef, $data)=split(':::', $_);
169: $cache->{'AnalyzeInfo'}=$data;
1.34 stredwic 170: } elsif(/form\.HeadingColumn/) {
171: my $value = $_;
172: $value =~ s/form\.//;
173: push(@headingColumns, $value);
174: $foundColumn=1;
175: } elsif(/form\.SequenceColumn/) {
176: my $value = $_;
177: $value =~ s/form\.//;
178: push(@sequenceColumns, $value);
179: $foundColumn=1;
1.27 stredwic 180: }
1.29 stredwic 181: }
1.27 stredwic 182:
1.34 stredwic 183: if($foundColumn) {
184: $cache->{'HeadingsFound'} = join(':', @headingColumns);
185: $cache->{'SequencesFound'} = join(':', @sequenceColumns);;
186: }
187: if(!defined($cache->{'HeadingsFound'}) ||
188: $cache->{'DefaultColumns'} ne 'false') {
189: $cache->{'HeadingsFound'}='HeadingColumnFull Name';
190: }
191: if(!defined($cache->{'SequencesFound'}) ||
192: $cache->{'DefaultColumns'} ne 'false') {
193: $cache->{'SequencesFound'}='All Sequences';
194: }
195: $cache->{'DefaultColumns'} = 'false';
196:
1.29 stredwic 197: return;
1.27 stredwic 198: }
199:
200: =pod
201:
202: =item &SortStudents()
203:
204: Determines which students to display and in which order. Which are
205: displayed are determined by their status(active/expired). The order
206: is determined by the sort button pressed (default to username). The
207: type of sorting is username, lastname, or section.
208:
209: =over 4
210:
211: Input: $students, $CacheData
212:
213: $students: A array pointer to a list of students (username:domain)
214:
215: $CacheData: A pointer to the hash tied to the cached data
216:
217: Output: \@order
218:
219: @order: An ordered list of students (username:domain)
220:
221: =back
222:
223: =cut
224:
225: sub SortStudents {
1.29 stredwic 226: my ($cache)=@_;
1.27 stredwic 227:
1.29 stredwic 228: my @students = split(':::',$cache->{'NamesOfStudents'});
1.27 stredwic 229: my @sorted1Students=();
1.29 stredwic 230: foreach (@students) {
231: if($cache->{'Status'} eq 'Any' ||
232: $cache->{$_.':Status'} eq $cache->{'Status'}) {
233: push(@sorted1Students, $_);
234: }
1.1 albertel 235: }
1.27 stredwic 236:
1.29 stredwic 237: my $sortBy = '';
238: if(defined($cache->{'sort'})) {
239: $sortBy = ':'.$cache->{'sort'};
1.27 stredwic 240: }
1.29 stredwic 241: my @order = sort { $cache->{$a.$sortBy} cmp $cache->{$b.$sortBy} ||
242: $cache->{$a.':fullname'} cmp $cache->{$b.':fullname'} }
243: @sorted1Students;
1.27 stredwic 244:
245: return \@order;
246: }
247:
1.32 stredwic 248: =pod
249:
250: =item &SpaceColumns()
251:
252: Determines the width of all the columns in the chart. It is based on
253: the max of the data for that column and its header.
254:
255: =over 4
256:
257: Input: $students, $studentInformation, $headings, $ChartDB
258:
259: $students: An array pointer to a list of students (username:domain)
260:
261: $studentInformatin: The type of data for the student information. It is
262: used as part of the key in $CacheData.
263:
264: $headings: The name of the student information columns.
265:
266: $ChartDB: The name of the cache database which is opened for read/write.
267:
268: Output: None - All data stored in cache.
269:
270: =back
271:
272: =cut
273:
274: sub SpaceColumns {
275: my ($students,$studentInformation,$headings,$cache)=@_;
276:
277: # Initialize Lengths
278: for(my $index=0; $index<(scalar @$headings); $index++) {
279: my @titleLength=split(//,$headings->[$index]);
280: $cache->{$studentInformation->[$index].':columnWidth'}=
281: scalar @titleLength;
282: }
283:
284: foreach my $name (@$students) {
285: foreach (@$studentInformation) {
286: my @dataLength=split(//,$cache->{$name.':'.$_});
287: my $length=(scalar @dataLength);
288: if($length > $cache->{$_.':columnWidth'}) {
289: $cache->{$_.':columnWidth'}=$length;
290: }
291: }
292: }
293:
294: return;
295: }
296:
1.27 stredwic 297: sub PrepareData {
1.38 stredwic 298: my ($c, $cacheDB, $studentInformation, $headings,$r)=@_;
1.27 stredwic 299:
300: # Test for access to the cache data
301: my $courseID=$ENV{'request.course.id'};
302: my $isRecalculate=0;
1.29 stredwic 303: if(defined($ENV{'form.Recalculate'})) {
1.27 stredwic 304: $isRecalculate=1;
305: }
306:
1.29 stredwic 307: my $isCached = &Apache::loncoursedata::TestCacheData($cacheDB,
308: $isRecalculate);
1.27 stredwic 309: if($isCached < 0) {
310: return "Unable to tie hash to db file.";
311: }
312:
313: # Download class list information if not using cached data
314: my %cache;
1.38 stredwic 315: unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) {
1.29 stredwic 316: return "Unable to tie hash to db file.";
317: }
318:
1.27 stredwic 319: if(!$isCached) {
320: my $processTopResourceMapReturn=
1.38 stredwic 321: &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c, $r);
1.27 stredwic 322: if($processTopResourceMapReturn ne 'OK') {
323: untie(%cache);
324: return $processTopResourceMapReturn;
325: }
1.29 stredwic 326: }
1.27 stredwic 327:
1.29 stredwic 328: if($c->aborted()) {
329: untie(%cache);
330: return 'aborted';
331: }
1.27 stredwic 332:
1.29 stredwic 333: my $classlist=&Apache::loncoursedata::DownloadClasslist($courseID,
334: $cache{'ClasslistTimestamp'},
335: $c);
336: foreach (keys(%$classlist)) {
337: if(/^(con_lost|error|no_such_host)/i) {
1.27 stredwic 338: untie(%cache);
339: return "Error getting student data.";
340: }
1.29 stredwic 341: }
1.27 stredwic 342:
1.29 stredwic 343: if($c->aborted()) {
344: untie(%cache);
345: return 'aborted';
346: }
347:
348: # Active is a temporary solution, remember to change
349: Apache::loncoursedata::ProcessClasslist(\%cache,$classlist,$courseID,$c);
350: if($c->aborted()) {
351: untie(%cache);
352: return 'aborted';
353: }
1.27 stredwic 354:
1.29 stredwic 355: &ProcessFormData(\%cache);
356: my $students = &SortStudents(\%cache);
1.32 stredwic 357: &SpaceColumns($students, $studentInformation, $headings, \%cache);
358: $cache{'updateTime:columnWidth'}=24;
1.27 stredwic 359:
1.29 stredwic 360: if($cache{'download'} ne 'false') {
1.41 ! stredwic 361: my @who = ($cache{'download'});
1.29 stredwic 362: $cache{'download'} = 'false';
1.41 ! stredwic 363: if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'false',
! 364: $cacheDB, 'true',
! 365: 'false', $courseID,
! 366: $r, $c) ne 'OK') {
! 367: untie(%cache);
! 368: return 'Stop at download individual';
! 369: }
1.29 stredwic 370: } elsif($cache{'DownloadAll'} ne 'false') {
1.39 stredwic 371: $cache{'DownloadAll'} = 'false';
1.29 stredwic 372: my @allStudents;
373: if($cache{'DownloadAll'} eq 'sorted') {
374: @allStudents = @$students;
375: } else {
376: @allStudents = split(':::', $cache{'NamesOfStudents'});
377: }
1.41 ! stredwic 378: if(&Apache::loncoursedata::DownloadStudentCourseData(\@allStudents,
! 379: 'false',
! 380: $cacheDB, 'true',
! 381: 'true', $courseID,
! 382: $r, $c) ne 'OK') {
! 383: untie(%cache);
! 384: return 'Stop at download all';
1.27 stredwic 385: }
1.29 stredwic 386: }
1.27 stredwic 387:
1.29 stredwic 388: if($c->aborted()) {
1.27 stredwic 389: untie(%cache);
1.29 stredwic 390: return 'aborted';
391: }
392:
393: untie(%cache);
394:
395: return ('OK', $students);
1.27 stredwic 396: }
397:
1.29 stredwic 398: sub BuildClasslist {
1.39 stredwic 399: my ($cacheDB,$students,$studentInformation,$headings,$r)=@_;
1.29 stredwic 400:
401: my %cache;
1.38 stredwic 402: unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
1.29 stredwic 403: return '<html><body>Unable to tie database.</body></html>';
1.1 albertel 404: }
405:
1.29 stredwic 406: my $Str='';
407: $Str .= '<table border="0"><tr><td bgcolor="#777777">'."\n";
408: $Str .= '<table border="0" cellpadding="3"><tr bgcolor="#e6ffff">'."\n";
409:
410: my $displayString = '<td align="left"><a href="/adm/statistics?';
411: $displayString .= 'sort=LINKDATA">DISPLAYDATA </a></td>'."\n";
1.39 stredwic 412: $Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache,
413: $studentInformation,
1.32 stredwic 414: $headings, $displayString);
1.29 stredwic 415: $Str .= '</tr>'."\n";
1.39 stredwic 416:
1.29 stredwic 417: my $alternate=0;
418: foreach (@$students) {
419: my ($username, $domain) = split(':', $_);
420: if($alternate) {
1.32 stredwic 421: $Str .= '<tr bgcolor="#ffffe6">';
1.29 stredwic 422: } else {
1.32 stredwic 423: $Str .= '<tr bgcolor="#ffffc6">';
1.29 stredwic 424: }
425: $alternate = ($alternate + 1) % 2;
426: foreach my $data (@$studentInformation) {
1.32 stredwic 427: $Str .= '<td>';
1.29 stredwic 428: if($data eq 'fullname') {
429: $Str .= '<a href="/adm/statistics?reportSelected=';
1.30 stredwic 430: $Str .= &Apache::lonnet::escape('Student Assessment');
431: $Str .= '&StudentAssessmentStudent=';
432: $Str .= &Apache::lonnet::escape($cache{$_.':'.$data}).'">';
1.32 stredwic 433: $Str .= $cache{$_.':'.$data}.' ';
1.29 stredwic 434: $Str .= '</a>';
1.32 stredwic 435: } elsif($data eq 'updateTime') {
436: $Str .= '<a href="/adm/statistics?reportSelected=';
437: $Str .= &Apache::lonnet::escape('Class list');
438: $Str .= '&download='.$_.'">';
439: $Str .= $cache{$_.':'.$data}.' ';
440: $Str .= ' </a>';
441: } else {
442: $Str .= $cache{$_.':'.$data}.' ';
1.29 stredwic 443: }
444:
1.32 stredwic 445: $Str .= '</td>'."\n";
1.29 stredwic 446: }
1.1 albertel 447: }
1.29 stredwic 448:
1.32 stredwic 449: $Str .= '</tr>'."\n";
1.29 stredwic 450: $Str .= '</table></td></tr></table>'."\n";
1.39 stredwic 451: $r->print($Str);
452: $r->rflush();
1.29 stredwic 453:
1.27 stredwic 454: untie(%cache);
1.1 albertel 455:
1.39 stredwic 456: return;
1.1 albertel 457: }
458:
1.33 stredwic 459: sub CreateMainMenu {
460: my ($status, $reports)=@_;
461:
462: my $Str = '';
463:
464: $Str .= '<table border="0"><tbody><tr>'."\n";
465: $Str .= '<td></td><td></td>'."\n";
466: $Str .= '<td align="center"><b>Analysis Reports:</b></td>'."\n";
467: $Str .= '<td align="center"><b>Student Status:</b></td></tr>'."\n";
468: $Str .= '<tr>'."\n";
469: $Str .= '<td align="center"><input type="submit" name="Refresh" ';
470: $Str .= 'value="Refresh" /></td>'."\n";
471: $Str .= '<td align="center"><input type="submit" name="DownloadAll" ';
472: $Str .= 'value="Update All Student Data" /></td>'."\n";
473: $Str .= '<td align="center">';
474: $Str .= '<select name="reportSelected" onchange="document.';
475: $Str .= 'Statistics.submit()">'."\n";
476:
477: foreach (sort(keys(%$reports))) {
478: next if($_ eq 'reportSelected');
479: $Str .= '<option name="'.$_.'"';
480: if($reports->{'reportSelected'} eq $reports->{$_}) {
481: $Str .= ' selected=""';
482: }
483: $Str .= '>'.$reports->{$_}.'</option>'."\n";
484: }
485: $Str .= '</select></td>'."\n";
486:
487: $Str .= '<td align="center">';
488: $Str .= &Apache::lonhtmlcommon::StatusOptions($status, 'Statistics');
489: $Str .= '</td>'."\n";
490:
491: $Str .= '</tr></tbody></table>'."\n";
492: $Str .= '<hr>'."\n";
493:
494: return $Str;
495: }
496:
1.29 stredwic 497: sub BuildStatistics {
498: my ($r)=@_;
499:
500: my $c = $r->connection;
1.32 stredwic 501: my @studentInformation=('fullname','section','id','domain','username',
502: 'updateTime');
503: my @headings=('Full Name', 'Section', 'PID', 'Domain', 'User Name',
504: 'Last Updated');
505: my $spacing = ' ';
1.29 stredwic 506: my %reports = ('classlist' => 'Class list',
507: 'problem_statistics' => 'Problem Statistics',
508: 'student_assessment' => 'Student Assessment',
1.40 minaeibi 509: # 'activitylog' => 'Activity Log',
1.29 stredwic 510: 'reportSelected' => 'Class list');
1.27 stredwic 511:
512: my %cache;
1.29 stredwic 513: my $courseID=$ENV{'request.course.id'};
514: my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
515: "_$ENV{'user.domain'}_$courseID\_statistics.db";
516:
1.41 ! stredwic 517: $r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));
! 518:
1.32 stredwic 519: my ($returnValue, $students) = &PrepareData($c, $cacheDB,
520: \@studentInformation,
1.38 stredwic 521: \@headings,$r);
1.29 stredwic 522: if($returnValue ne 'OK') {
1.41 ! stredwic 523: $r->print($returnValue."\n".'</body></html>');
1.29 stredwic 524: return OK;
525: }
1.41 ! stredwic 526: if(!$c->aborted()) {
! 527: &Apache::loncoursedata::CheckForResidualDownload($cacheDB,
! 528: 'true', 'true',
! 529: $courseID,
! 530: $r, $c);
! 531: }
1.29 stredwic 532:
533: my $GoToPage;
1.38 stredwic 534: if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
1.29 stredwic 535: $GoToPage = $cache{'reportSelected'};
536: $reports{'reportSelected'} = $cache{'reportSelected'};
1.37 stredwic 537: if(defined($cache{'reportKey'}) &&
538: !exists($reports{$cache{'reportKey'}}) &&
539: $cache{'reportKey'} ne 'false') {
540: $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
541: }
1.29 stredwic 542:
543: if(defined($cache{'OptionResponses'})) {
544: $reports{'problem_analysis'} = 'Problem Analysis';
545: }
546:
547: $r->print('<form name="Statistics" ');
548: $r->print('method="post" action="/adm/statistics">');
1.33 stredwic 549: $r->print(&CreateMainMenu($cache{'Status'}, \%reports));
1.39 stredwic 550: $r->rflush();
1.29 stredwic 551: untie(%cache);
552: } else {
1.27 stredwic 553: $r->print('<html><body>Unable to tie database.</body></html>');
1.29 stredwic 554: return OK;
555: }
556:
557: if($GoToPage eq 'Activity Log') {
1.30 stredwic 558: &Apache::lonproblemstatistics::Activity();
1.29 stredwic 559: } elsif($GoToPage eq 'Problem Statistics') {
1.30 stredwic 560: &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB,
561: $students,
562: $courseID,
1.36 minaeibi 563: $c,$r);
1.29 stredwic 564: } elsif($GoToPage eq 'Problem Analysis') {
1.39 stredwic 565: &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB, $r);
1.29 stredwic 566: } elsif($GoToPage eq 'Student Assessment') {
1.39 stredwic 567: &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
1.37 stredwic 568: $students,
569: $courseID,
570: 'Statistics',
571: \@headings,
572: $spacing,
573: \@studentInformation,
1.39 stredwic 574: $r, $c);
1.29 stredwic 575: } elsif($GoToPage eq 'Analyze') {
1.39 stredwic 576: &Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, $students,
577: $courseID, $r);
1.40 minaeibi 578: } elsif($GoToPage eq 'DoDiffGraph' || $GoToPage eq 'PercentWrongGraph') {
579: &Apache::lonproblemstatistics::BuildGraphicChart($GoToPage,$r,$cacheDB);
1.29 stredwic 580: } elsif($GoToPage eq 'Class list') {
1.39 stredwic 581: &BuildClasslist($cacheDB, $students, \@studentInformation,
582: \@headings, $r);
1.27 stredwic 583: }
584:
585: $r->print('</form>'."\n");
1.29 stredwic 586: $r->print("\n".'</body>'."\n".'</html>');
587: $r->rflush();
1.27 stredwic 588:
1.29 stredwic 589: return OK;
1.27 stredwic 590: }
1.1 albertel 591:
592: # ================================================================ Main Handler
593:
594: sub handler {
1.31 minaeibi 595: my $r=shift;
1.34 stredwic 596:
597: # $jr = $r;
1.1 albertel 598:
1.27 stredwic 599: unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
600: $ENV{'user.error.msg'}=
601: $r->uri.":vgr:0:0:Cannot view grades for complete course";
602: return HTTP_NOT_ACCEPTABLE;
603: }
604:
605: # Set document type for header only
606: if($r->header_only) {
607: if ($ENV{'browser.mathml'}) {
608: $r->content_type('text/xml');
609: } else {
610: $r->content_type('text/html');
611: }
612: &Apache::loncommon::no_cache($r);
613: $r->send_http_header;
614: return OK;
615: }
616:
617: unless($ENV{'request.course.fn'}) {
1.1 albertel 618: my $requrl=$r->uri;
1.27 stredwic 619: $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
620: return HTTP_NOT_ACCEPTABLE;
621: }
1.1 albertel 622:
1.27 stredwic 623: $r->content_type('text/html');
624: $r->send_http_header;
1.1 albertel 625:
1.29 stredwic 626: &BuildStatistics($r);
1.27 stredwic 627:
628: return OK;
1.1 albertel 629: }
630: 1;
631: __END__
1.31 minaeibi 632:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>