<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
//
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
//
// 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, 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 program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

include "inc/header_my.inc.php";


//setup bookmark items
require_once($c_node['dir']['class_path'] . 'Bookmark.class.php');
$bookmark = new Bookmark($db, null, $date, $user_id);


//get watched bookmark ids
$bookmark->bookmark_type = $c_node['bookmark']['type']['watch'];
$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['blog'];
if (isset($_POST['watch_blog_delete_id']) && $_POST['watch_blog_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['watch_blog_delete_id']);
}
$watched_blog_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['schedule'];
if (isset($_POST['watch_schedule_delete_id']) && $_POST['watch_schedule_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['watch_schedule_delete_id']);
}
$watched_schedule_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['library'];
if (isset($_POST['watch_library_delete_name']) && $_POST['watch_library_delete_name'] > 0) {
	$bookmark->deleteBookmark($_POST['watch_library_delete_name']);
}
$watched_library_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['forum'];
if (isset($_POST['watch_subject_delete_id']) && $_POST['watch_subject_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['watch_subject_delete_id']);
}
$watched_subject_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['poll'];
if (isset($_POST['watch_poll_delete_id']) && $_POST['watch_poll_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['watch_poll_delete_id']);
}
$watched_poll_ids = $bookmark->getBookmarks();


//get recommended item ids
$bookmark->bookmark_type = $c_node['bookmark']['type']['recommend'];
$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['blog'];
if (isset($_POST['rec_blog_delete_id']) && $_POST['rec_blog_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['rec_blog_delete_id']);
}
$recommended_blog_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['schedule'];
if (isset($_POST['rec_schedule_delete_id']) && $_POST['rec_schedule_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['rec_schedule_delete_id']);
}
$recommended_schedule_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['library'];
if (isset($_POST['rec_library_delete_id']) && $_POST['rec_library_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['rec_library_delete_id']);
}
$recommended_library_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['forum'];
if (isset($_POST['rec_subject_delete_id']) && $_POST['rec_subject_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['rec_subject_delete_id']);
}
$recommended_subject_ids = $bookmark->getBookmarks();


$bookmark->rsp_item_type_id = $c_node['rsp']['item_type']['poll'];
if (isset($_POST['rec_poll_delete_id']) && $_POST['rec_poll_delete_id'] > 0) {
	$bookmark->deleteBookmark($_POST['rec_poll_delete_id']);
}
$recommended_poll_ids = $bookmark->getBookmarks();

//setup file
$file->noimage = $c_node['file']['image']['thumb'][3]['noimage'];
$file->thumb = $c_node['file']['image']['thumb'][3]['name'];


//setup forum
require_once($c_node['dir']['class_path'] . 'Forum.class.php');
$forum = new Forum($db, null, $date, $file);
$forum->include_hidden = 1;


//setup blog
require_once($c_node['dir']['class_path'] . 'Blog.class.php');
$blog = new Blog($db, null, $date, $file);
$blog->user_id = $user_id;


//library setup
require_once($c_node['dir']['class_path'] . 'Library.class.php');
$library = new Library($db, null, $date, $file);
$library->user_id = $user_id;


//event setup
require_once($c_node['dir']['class_path'] . 'Schedule.class.php');
$schedule = new Schedule($db, null, $date, $file);
$schedule->user_id = $user_id;


// poll setup
require_once($c_node['dir']['class_path'] . 'Poll.class.php');
$poll = new Poll($db, null, $date);
$poll->user_id = $user_id;



//get watched blogs
if (!empty($watched_blog_ids)) {
	$blog->blog_ids = $watched_blog_ids;
	$output_watched_blogs = $blog->selBlogs();
}
//get watched subjects
if (!empty($watched_subject_ids)) {
	$forum->subject_ids = $watched_subject_ids;
	$output_watched_subjects = $forum->selSubjects();
}
//get watched group library items
if (!empty($watched_library_ids)) {
	$library->library_ids = $watched_library_ids;
	$output_watched_library_items = $library->selLibraryItems();
}
//get watched events
if (!empty($watched_schedule_ids)) {
	$schedule->schedule_ids = $watched_schedule_ids;
	$output_watched_schedule_items = $schedule->selScheduleItems();
}
//get watched polls
if (!empty($watched_poll_ids)) {
	$poll->poll_ids = $watched_poll_ids;
	$output_watched_polls = $poll->selPolls();
}

//get recommended user blogs
if (!empty($recommended_blog_ids)) {
	$blog->blog_ids = $recommended_blog_ids;
	$output_recommended_blogs = $blog->selBlogs();
}
//get recommended subjects
if (!empty($recommended_subject_ids)) {
	$forum->subject_ids = $recommended_subject_ids;
	$output_recommended_subjects = $forum->selSubjects();
}
//get recommended group library items
if (!empty($recommended_library_ids)) {
	$library->library_ids = $recommended_library_ids;
	$output_recommended_library_items = $library->selLibraryItems();
}
//get recommended events
if (!empty($recommended_schedule_ids)) {
	$schedule->schedule_ids = $recommended_schedule_ids;
	$output_recommended_schedule_items = $schedule->selScheduleItems();
}
//get recommended polls
if (!empty($recommended_poll_ids)) {
	$poll->poll_ids = $recommended_poll_ids;
	$output_recommended_polls = $poll->selPolls();
}

//move to template
if (isset($output_user)) {
	$body->set('user', $output_user);
}

if (isset($output_watched_subjects)) {
	$body->set('watched_subjects', $output_watched_subjects);
}

if (isset($output_watched_library_items)) {
	$body->set('watched_library', $output_watched_library_items);
}

if (isset($output_watched_blogs)) {
	$body->set('watched_blogs', $output_watched_blogs);
}

if (isset($output_watched_schedule_items)) {
	$body->set('watched_schedule_items', $output_watched_schedule_items);
}

if (isset($output_watched_polls)) {
	$body->set('watched_polls', $output_watched_polls);
}

if (isset($output_recommended_subjects)) {
	$body->set('recommended_subjects', $output_recommended_subjects);
}

if (isset($output_recommended_library_items)) {
	$body->set('recommended_library', $output_recommended_library_items);
}

if (isset($output_recommended_schedule_items)) {
	$body->set('recommended_schedule_items', $output_recommended_schedule_items);
}

if (isset($output_recommended_blogs)) {
	$body->set('recommended_blogs', $output_recommended_blogs);
}

if (isset($output_recommended_polls)) {
	$body->set('recommended_polls', $output_recommended_polls);
}

$body->set('section_group', $c_acs['arr_section']['group']);

$template_pageLink = $lang['href_watching'];
include "inc/footer.inc.php";

?>
