<?php

#############################################################################
# Site@School
# Site@School is a website management system designed for primary schools.

# About Site@School:
# Comissioned by: City District 'de Baarsjes', Amsterdam, Netherlands
# Original idea, coding (version 1.0) and design : Mark de Haan (mark@starwave.nl)
# Ideas, improvements, expansions (version 1.1 - 2.3): Fred Stuurman
# Current coder & maintainer: Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# teacher.php: last changed 15/06/2005   2.3
# by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: teacher_login_only.php,v 1.1 2006/10/03 10:47:24 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
##############################################################################
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}

if (IsSet ($userid) AND $usertype == "teacher")
{

	$query = "SELECT name, type FROM $table_users WHERE id='$userid'"; // getting the teachers name
	$result = mysql_query($query) or die_script($query, mysql_error());
	$teacher_name = mysql_result($result, 0, 0);
	$user_type = mysql_result($result, 0, 1);
	unset ($query);
	unset ($result);

	$check_sessioncode = $sas_config['sessioncode'];
	$sessioncode = "$check_sessioncode";
	$_SESSION['sessioncode'] = "$sessioncode";

	$prot_theme = $sas_config['protected_theme'];
	$table = $dbprefix . "prot_pages";
	$query = "SELECT name FROM $table";
	$result = mysql_query($query);
	$RecordCount = mysql_num_rows($result); //see if we have pages on the intranet
	unset ($query);
	unset ($result);

	if ($RecordCount > 0)
	{
		print "<input type=\"button\" value=\"" . $sas_lang['intranet'] . "\" 
		                           onClick=\"javascript:parent.location='index.php?site=protected';\">";
	}
	else
	{
		print "&nbsp";
	}

	print "<br><br><a href=index.php?section=$section&page=$page&logout=yes>
	            <b><font size=2><< " . $sas_lang['logout'] . " <b>" . $teacher_name . "</b> >>&nbsp;</b></font></a>";
}
?>
