include "functions.php";
include "nusoap/lib/nusoap.php";
if (isset($_REQUEST['print']) && $_REQUEST['print'] == "y") {
    $print_mode = TRUE;
} else {
    $print_mode = FALSE;
}
if ($_COOKIE['cookie_user_id'] == "0") {
    unset($_COOKIE['cookie_user_id']);
}
// Grab the cookie data.
if (isset($_COOKIE['cookie_user_id'])) {
    $cookie_user_id = $_COOKIE['cookie_user_id'];
    $cookie_user_password = $_COOKIE['cookie_user_password'];
    $active_user = new User();
    $active_user->populateFromID($cookie_user_id);
    $show_user_menu = TRUE;
} else {
    /*$new_user = new User();
    	$new_user->username = "******";
    	$new_user->password = "";
    	$new_user->insertNew();
    	$new_user->setCookies();
    	$cookie_user_id = $new_user->id;*/
    $show_user_menu = FALSE;
}
// Log user in users_active.
if ($active_user->logged_in && substr($_SERVER['REQUEST_URI'], 0, 19) != "/insert_message.php" && substr($_SERVER['REQUEST_URI'], 0, 22) != "/show_active_users.php") {
    $found = false;
    $result = mysql_do("SELECT id FROM users_active WHERE user_id='{$active_user->id}'");
    while ($query_data = mysql_fetch_array($result)) {
**    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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////// */
/* this file is the parent of every project-specific page. It needs to be cleaned up: divs, JS scripts and PHP
	are pretty messy here */
include "code/includes.php";
$id = $_REQUEST['id'];
$part = $_REQUEST['part'];
$active_project = new Project();
$active_project->populateFromID($id);
$active_project->getUsers();
$active_owner = new User();
$active_owner->populateFromID($active_project->user_id);
?>



<html>
<head>
	<title>
	<?php 
if ($active_project->id === NULL) {
    ?>
	
		ACH: This project does not exist
	<?php 
} else {
    if (!in_array($active_user->id, $active_project->users) && $active_project->directory != "y") {
		<div class="inner">
			<div class="main">

<h2>Classes matching "<span class="hilight"><?php 
    echo $tag;
    ?>
</span>"</h2>



<?php 
    $tag_space = $tag . " ";
    $result = mysql_do("SELECT * FROM classes WHERE tags LIKE '%{$tag_space}%'");
    while ($query_data = mysql_fetch_array($result)) {
        $this_teacher = new User();
        $this_teacher->populateFromID($query_data['user_id']);
        ?>

<p><a href="<?php 
        echo $base_URL;
        ?>
class/<?php 
        echo $query_data['id'];
        ?>
"><?php 
        echo $query_data['title'];
        ?>
</a><br />
<span class="classListInfo">Taught by <a href="<?php 
        echo $base_URL;
        ?>