#! /usr/bin/perl

=head1 NAME

myclass - overview of the logged in students projects

=head1 SYNOPSIS

 https://server/schulkonsole/myprojects

=head1 DESCRIPTION

C<myprojects> is the students projects page. The HTML template is myprojects.tt.

=head2 Template variables

Additionally to the variables of Schulkonsole::Session C<myprojects>
provides the following variables:

=over

=cut

use strict;
use utf8;
use lib '/usr/share/schulkonsole';
use Schulkonsole::Session;
use Schulkonsole::Info;
use Schulkonsole::Sophomorix;

my $this_file = 'myprojects';


my $sk_session = new Schulkonsole::Session($this_file);
if (not $sk_session->get_password()) {
	my $q = new CGI;
	my $url = $q->url( -full => 1 );

	# we send cookies over secure connections only
	if ($url =~ s/^http:/https:/g) {
		$sk_session->redirect($url);
	} else {
		$sk_session->exit_with_login_page($this_file);
	}
}

my $q = $sk_session->query();


my $myprojects = $sk_session->param('myprojects');

if( not $myprojects ) {
	$myprojects = Schulkonsole::Info::groups_projects($sk_session->groups());
	$sk_session->param('myprojects',$myprojects);
}




if ($myprojects) {

=item C<myprojects>

The hash of the users' projects

=cut

	$sk_session->set_var('myprojects', $myprojects);

}

$sk_session->print_page("$this_file.tt", $this_file);


