<?php
page_open(array("sess" => "Poe_Session", "auth" => "Poe_Challenge_Auth", "perm" => "Cat_Perm", "user" => "Poe_User"));
$perm->check( "student" );
include( "display_student.inc" );
$PAGE_TITLE = "Sample Preview";
$no_menubar = 1;
require( "../firm/cat_header.inc" );
# print("Fetching ($what = $id) for Student = $who...<br>" );
$sess->register( "studentid" );
//include( "widgets.inc" ); // for the getStudentid() function.
$who = getStudentid();
// if( ! $studentid || $studentid != $who )
// {
// $studentid = $who;
// }
if( ! $stud )
{
# print "Welcome first-timer!<br>";
$stud = obClassFactory( "Student", $who );
# $sess->register( "stud" );
}
// should never happen at this point
if( $what == "Student" )
{
$ob = $stud;
if( ! is_array( $sess_protect_flag ) )
{
$sess_protect_flag = array();
}
// update the student's stats here
// don't let a single user affect this page more than once/session
if( empty( $sess_protect_flag['hits'][$who] ) )
{
// print( "TESTING123<br>" );
$query = "UPDATE student_stat SET hits = hits + 1 WHERE studentid = $who;";
$db = new DB_Poe;
$db->query( $query );
// really wish we had some kind of semaphore here!!
$sess_protect_flag['hits'][$who] = TRUE;
$sess->register( "sess_protect_flag" );
}
$stud->printLong();
}
elseif( $what == "User" )
{
$stud->l_show( $what );
} else {
$stwhatid = sprintf( "student_%sid", strtolower( $what ) );
$what .= "s";
$what = ucwords( $what );
// $stud->l_show( $what );
$ob = $stud->{$what};
$ob = $ob->get( $ss_id );
$ob->printLong();
}
?>
<!--</body>-->
<?
require( "../firm/cat_footer.inc" );
page_close();
?>