Annotation of loncom/interface/lontrackstudent.pm, revision 1.1

1.1     ! matthew     1: # The LearningOnline Network with CAPA
        !             2: #
        !             3: # $Id$
        !             4: #
        !             5: # Copyright Michigan State University Board of Trustees
        !             6: #
        !             7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
        !             8: #
        !             9: # LON-CAPA is free software; you can redistribute it and/or modify
        !            10: # it under the terms of the GNU General Public License as published by
        !            11: # the Free Software Foundation; either version 2 of the License, or
        !            12: # (at your option) any later version.
        !            13: #
        !            14: # LON-CAPA is distributed in the hope that it will be useful,
        !            15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            17: # GNU General Public License for more details.
        !            18: #
        !            19: # You should have received a copy of the GNU General Public License
        !            20: # along with LON-CAPA; if not, write to the Free Software
        !            21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        !            22: #
        !            23: # /home/httpd/html/adm/gpl.txt
        !            24: #
        !            25: # http://www.lon-capa.org/
        !            26: #
        !            27: ###
        !            28: 
        !            29: =pod
        !            30: 
        !            31: =head1 NAME
        !            32: 
        !            33: lontrackstudent
        !            34: 
        !            35: =head1 SYNOPSIS
        !            36: 
        !            37: Track student progress through course materials
        !            38: 
        !            39: =over 4
        !            40: 
        !            41: =cut
        !            42: 
        !            43: package Apache::lontrackstudent;
        !            44: 
        !            45: use strict;
        !            46: use Apache::Constants qw(:common :http);
        !            47: use Apache::lonnet();
        !            48: use Apache::lonlocal;
        !            49: use Time::HiRes;
        !            50: 
        !            51: ###################################################################
        !            52: ###################################################################
        !            53: sub get_all_data {}
        !            54: sub get_student_data {}
        !            55: sub html_output_student_data {}
        !            56: sub html_output_class_data {}
        !            57: 
        !            58: sub request_data_update {
        !            59:     my $command = 'prepare activity log';
        !            60:     my $cid = $ENV{'request.course.id'};
        !            61:     my $domain = $ENV{'course.'.$cid.'.domain'};
        !            62:     my $home = $ENV{'course.'.$cid.'.home'};
        !            63:     my $course = $ENV{'course.'.$cid.'.num'};
        !            64:     &Apache::lonnet::logthis($command.' '.$course.' '.$domain.' '.$home);
        !            65:     my $result = &Apache::lonnet::metadata_query($command,$course,$domain,
        !            66:                                                  [$home]);
        !            67:     return $result;
        !            68: }
        !            69: 
        !            70: ###################################################################
        !            71: ###################################################################
        !            72: 
        !            73: 
        !            74: ###################################################################
        !            75: ###################################################################
        !            76: sub handler {
        !            77:     my $r=shift;
        !            78:     my $c = $r->connection();
        !            79:     #
        !            80:     # Check for overloading here and on the course home server
        !            81:     my $loaderror=&Apache::lonnet::overloaderror($r);
        !            82:     if ($loaderror) { return $loaderror; }
        !            83:     $loaderror=
        !            84:         &Apache::lonnet::overloaderror
        !            85:         ($r,
        !            86:          $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
        !            87:     if ($loaderror) { return $loaderror; }
        !            88:     #
        !            89:     # Check for access
        !            90:     if (! &Apache::lonnet::allowed('vsa',$ENV{'request.course.id'})) {
        !            91:         $ENV{'user.error.msg'}=
        !            92:             $r->uri.":vsa:0:0:Cannot student activity for complete course";
        !            93:         if (! 
        !            94:             &Apache::lonnet::allowed('vsa',
        !            95:                                      $ENV{'request.course.id'}.'/'.
        !            96:                                      $ENV{'request.course.sec'})) {
        !            97:             $ENV{'user.error.msg'}=
        !            98:                 $r->uri.":vsa:0:0:Cannot view student activity with given role";
        !            99:             return HTTP_NOT_ACCEPTABLE;
        !           100:         }
        !           101:     }
        !           102:     #
        !           103:     # Send the header
        !           104:     &Apache::loncommon::no_cache($r);
        !           105:     &Apache::loncommon::content_type($r,'text/html');
        !           106:     $r->send_http_header;
        !           107:     if ($r->header_only) { return OK; }
        !           108:     #
        !           109:     # Extract form elements from query string
        !           110:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
        !           111:                                             ['selected_student']);
        !           112:     #
        !           113:     # Give the LON-CAPA page header
        !           114:     $r->print('<html><head><title>'.
        !           115:               &mt('Student Activity').
        !           116:               "</title></head>\n".
        !           117:               &Apache::loncommon::bodytag('Student Activity'));
        !           118:     $r->rflush();
        !           119:     # 
        !           120:     # Either print out a menu for them or send them to a report
        !           121:     &Apache::lonhtmlcommon::clear_breadcrumbs();
        !           122:     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/studentactivity',
        !           123:                                             title=>'Student Activity',
        !           124:                                             text =>'Student Activity',
        !           125:                                             faq=>139,
        !           126:                                             bug=>'instructor interface'});
        !           127:     #
        !           128:     # Begin form output
        !           129:     $r->print('<form name="Statistics" ');
        !           130:     $r->print('method="post" action="/adm/statistics">');
        !           131:     $r->rflush();
        !           132:     $r->print('<h1>'.&mt('View student activity').'</h1>');
        !           133:     #
        !           134:     my $result = &request_data_update();
        !           135:     if (ref($result) eq 'HASH') {
        !           136:         $result = join(map { $_.'=>'.$result->{$_}; } keys(%$result));
        !           137:     }
        !           138:     $r->print('<h2>'.$result.'</h2>');
        !           139:     #
        !           140:     if (! exists($ENV{'form.selected_student'})) {
        !           141:         # Choose a student
        !           142:         $r->print('If you worked here you would be done by now');
        !           143:     } else {
        !           144:         # Show a students activity
        !           145:         $r->print('I would like to have something to show you but I do not.');
        !           146:     }
        !           147:     #
        !           148:     $r->print("</form>\n");
        !           149:     $r->print("</body>\n</html>\n");
        !           150:     $r->rflush();
        !           151:     #
        !           152:     return OK;
        !           153: }
        !           154: 
        !           155: 1;
        !           156: 
        !           157: #######################################################
        !           158: #######################################################
        !           159: 
        !           160: =pod
        !           161: 
        !           162: =back
        !           163: 
        !           164: =cut
        !           165: 
        !           166: #######################################################
        !           167: #######################################################
        !           168: 
        !           169: __END__
        !           170: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>