<?php
	class cStudentApplication extends cApplication
	{
	
		function GetPageById($pageId)
	  {
	  	
			foreach ($_POST as &$item)
	  	{
	  		if (!is_array($item)) 
				{
					$item = mysql_real_escape_string($item);
					$item = htmlspecialchars($item);
				}
	  		else
	  		{
	  			foreach ($item as &$subitem)
	  			{
						$subitem = mysql_real_escape_string($subitem);
						$subitem = htmlspecialchars($subitem);
	  			}
	  		}
	  	}
	  	
			foreach ($_GET as &$item)
	  	{
	  		if (!is_array($item)) 
				{
					$item = mysql_real_escape_string($item);
					$item = htmlspecialchars($item);
				}
	  		else
	  		{
	  			foreach ($item as &$subitem)
	  			{
						$subitem = mysql_real_escape_string($subitem);
						$subitem = htmlspecialchars($subitem);
	  			}
	  		}
	  	}
	  	
			if ( $pageId === "courses" )
	      return new cCourseListPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "courseDetail" )
	      return new cCourseDetailPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "examDetail" )
	      return new cExamDetailPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "changePassword" )
	      return new cChangePasswordPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "test" )
	      return new cTestPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "demoTest" )
	      return new cDemoTestPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else if ( $pageId === "evaluateTest" ) 
	      return new cEvaluateTestPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
	    else 
	      return new cMainPage($this->smarty, $this->db, $this->action, $_POST, $_GET);
		}
	}
?>
