<?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.
// -----------------------------------------------------------------------

$menu_section = "magazine";

include "inc/header.inc.php";


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



if (isset($_REQUEST['list']) && $_REQUEST['list'] == "blog") {
	//get blogs -----------------------------------------------------
	require_once($c_node['dir']['class_path'] . 'Blog.class.php');
	$blog = new Blog($db, $c_node['rsp']['item_type']['blog'], $date, $file);
	$blog->rsp_level_id = $c_node['rsp']['rsp_level']['node'];
	$blog->rsp_status_id = $c_node['rsp']['status']['live'];
	$output_blogs = $blog->selBlogs();
}


if (isset($_REQUEST['list']) && $_REQUEST['list'] == "forum_subject") {
	//get subjects  -----------------------------------------------------
	require_once($c_node['dir']['class_path'] . 'Forum.class.php');
	$forum = new Forum($db, $c_node['rsp']['item_type']['forum'], $date, $file);
	$forum->rsp_level_id = $c_node['rsp']['rsp_level']['node'];
	$forum->rsp_status_id = $c_node['rsp']['status']['live'];
	$output_subjects = $forum->selSubjects();
}


if (isset($_REQUEST['list']) && $_REQUEST['list'] == "polls") {
	//get polls  -----------------------------------------------------
	require_once($c_node['dir']['class_path'] . 'Poll.class.php');
	$poll = new Poll($db, $c_node['rsp']['item_type']['poll'], $date);
	$poll->order_by = "p.poll_start_datetime desc";
	$poll->rsp_level_id = $c_node['rsp']['rsp_level']['node'];
	$poll->rsp_status_id = $c_node['rsp']['status']['live'];
	$output_polls = $poll->selPolls();
}

if (isset($_REQUEST['list']) && $_REQUEST['list'] == "library") {
	//get library items -----------------------------------------------------
	require_once($c_node['dir']['class_path'] . 'Library.class.php');
	$library = new Library($db, $c_node['rsp']['item_type']['library'], $date, $file);
	$library->rsp_level_id = $c_node['rsp']['rsp_level']['node'];
	$library->rsp_status_id = $c_node['rsp']['status']['live'];
	$library->limit = 10;
	$output_library_items = $library->selLibraryItems();
}






//move to template
if (!empty($output_blogs)) {
	$body->set('blogs', $output_blogs);
}

if (!empty($output_subjects)) {
	$body->set('subjects', $output_subjects);
}

if (!empty($output_polls)) {
	$body->set('polls', $output_polls);
}

if (!empty($output_library_items)) {
	$body->set('library_items', $output_library_items);
}

if (!empty($display)) {
	$body->set('display', $display);
}

$template_pageLink = $lang['txt_magazine_name'];
include "inc/footer.inc.php";
?>
