<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
//
// Copyright (C) 2003 - 2006 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., 51 Franklin St, Fifth Floor, Boston, MA
// 02110-1301, USA.
// -----------------------------------------------------------------------

?>

<div class="col_main">
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_latest_network'];?><br />
		</div>

		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($latest_contacts)) {
				?>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">
					<tr>
						<?php
						foreach($latest_contacts as $key => $i):
						?>
						<td width="25%" align="center" valign="top">
							<a href="sn_profile.php?user_id=<?php echo $i['user_id'];?>"><img src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture" alt="<?php echo $i['image']['file_title'];?>" /></a><br />
							<a href="sn_profile.php?user_id=<?php echo $i['user_id'];?>"><?php echo $i['profile_nic'];?></a><br />
							<?php
							if ($i['online_status'] == 1) {
								echo "<b>" . $lang['arr_user_online_status'][1] . "</b><br />";
							}
							else {
									echo $lang['arr_user_online_status'][$i['online_status']] . "<br />";
							}
							?>
						</td>
						<?php
						endforeach;
						?>
					</tr>
				</table>
				<?php }?>
				
				<p align="right">
					<a href="sn_invite.php"><?php echo $lang['href_invite'];?></a><br />
				</p>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
				
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_latest_activity'];?><br />
		</div>

		<div class="box_mid">
			<div class="content">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="50%" valign="top">
							<?php
							if (isset($recommended_item)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<tr>
									<td colspan="2">
										<?php echo $lang['txt_latest_recommendation'];?>: <a href="sn_profile.php?user_id=<?php echo $recommended_item['user']['user_id'];?>"><?php echo $recommended_item['user']['profile_nic'];?></a><br />
									</td>
								</tr>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $recommended_item['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $recommended_item['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $recommended_item['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<?php
										if ($recommended_item['rsp_item_type_id'] == $rsp_item_type_ids['blog']) {
										?>
										<a href="blg_view.php?blog_id=<?php echo $recommended_item['blog_id'];?>"><b><?php echo $recommended_item['blog_title'];?></b></a><br />
										<?php echo dots(100, $recommended_item['blog_synopsis']);?><br />
										<?php
										}
										elseif ($recommended_item['rsp_item_type_id'] == $rsp_item_type_ids['forum']) {
										?>
										<a href="frm_view.php?subject_id=<?php echo $recommended_item['subject_id'];?>"><b><?php echo $recommended_item['subject_title'];?></b></a><br />
										<?php echo dots(100, $recommended_item['subject_synopsis']);?><br />
										<?php
										}
										elseif ($recommended_item['rsp_item_type_id'] == $rsp_item_type_ids['library']) {
										?>
										<a href="lib_view.php?library_id=<?php echo $recommended_item['library_id'];?>"><b><?php echo $recommended_item['library_title'];?></b></a><br />
										<?php echo dots(100, $recommended_item['library_synopsis']);?><br />
										<?php }?>
									</td>
								</tr>
							</table>
							
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
							<?php }?>
							
							<p>
								<b><?php echo $lang['txt_latest_blog_entries'];?></b><br />
							</p>
							
							<?php
							if (isset($blog_entries)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<?php
								foreach ($blog_entries as $key => $i):
								?>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $i['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $i['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $i['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<a href="blg_view.php?blog_id=<?php echo $i['blog_id'];?>"><b><?php echo $i['blog_title'];?></b></a><br />
										<?php echo dots(100, $i['blog_synopsis']);?><br />
									</td>
								</tr>
								<?php
								endforeach;
								?>
							</table>
							<?php }?>
						</td>
						<td>
							<img src="<?php echo $templatePath;?>img/pixel.png" width="10" height="1" alt="" /><br />
						</td>
						<td width="50%" valign="top">
							<?php
							if (isset($latest_subject)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<tr>
									<td colspan="2">
										<?php echo $lang['txt_latest_discussion'];?>: <a href="sn_profile.php?user_id=<?php echo $latest_subject['user']['user_id'];?>"><?php echo $latest_subject['user']['profile_nic'];?></a><br />
									</td>
								</tr>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $latest_subject['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $latest_subject['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $latest_subject['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<a href="frm_view.php?subject_id=<?php echo $latest_subject['subject_id'];?>"><b><?php echo $latest_subject['subject_title'];?></b></a><br />
										<?php echo dots(100, $latest_subject['subject_synopsis']);?><br />
									</td>
								</tr>
							</table>
							
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
							<?php }?>
							
							<p>
								<b><?php echo $lang['txt_latest_forum_comments'];?></b><br />
							</p>
							
							<?php
							if (isset($forum_comments)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<?php
								foreach ($forum_comments as $key => $i):
								?>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $i['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $i['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $i['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<a href="frm_view.php?subject_id=<?php echo $i['item_id'];?>"><b><?php echo $i['comment_create_datetime'];?></b></a><br />
										<?php 
										$i['comment_body'] = str_replace("<br />", "", $i['comment_body']);
										$i['comment_body'] = str_replace("<p>", "", $i['comment_body']);
										$i['comment_body'] = str_replace("</p>", "", $i['comment_body']);
										$i['comment_body'] = trim ($i['comment_body']);
										echo dots(100, $i['comment_body']);
										?><br />
									</td>
								</tr>
								<?php
								endforeach;
								?>
							</table>
							
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
							<?php }?>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
				
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_latest_schedule'];?><br />
		</div>

		<div class="box_mid">
			<div class="content">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="50%" valign="top">
							<p>
								<?php echo $lang['txt_network_events'];?><br />
							<p>
							
							<?php
							if (isset($schedule_items)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<?php
								foreach ($schedule_items as $key => $i):
								if ($i['schedule_type_id'] == $schedule_config['type']['event']) {
								?>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $i['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $i['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $i['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<a href="sch_view.php?schedule_id=<?php echo $i['schedule_id'];?>"><b><?php echo $i['schedule_create_datetime'];?></b></a><br />
										<?php echo $i['schedule_synopsis'];?><br />
									</td>
								</tr>
								<?php
								unset ($schedule_items[$key]);
								}
								endforeach;
								?>
							</table>
							<?php }?>
						</td>
						<td>
							<img src="<?php echo $templatePath;?>img/pixel.png" width="10" height="1" alt="" /><br />
						</td>
						<td width="50%" valign="top">
							<p>
								<?php echo $lang['txt_network_tasks'];?><br />
							<p>
							
							<?php
							if (isset($schedule_items)) {
							?>
							<table width="100%" border="0" cellspacing="0" cellpadding="4">
								<?php
								foreach ($schedule_items as $key => $i):
								if ($i['schedule_type_id'] == $schedule_config['type']['task']) {
								?>
								<tr>
									<td valign="top">
										<a href="sn_profile.php?user_id=<?php echo $i['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $i['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $i['user']['image']['file_title'];?>" /></a><br />
									</td>
									<td valign="top">
										<a href="sch_view.php?schedule_id=<?php echo $i['schedule_id'];?>"><b><?php echo $i['schedule_create_datetime'];?></b></a><br />
										<?php echo $i['schedule_synopsis'];?><br />
									</td>
								</tr>
								<?php
								unset ($schedule_items[$key]);
								}
								endforeach;
								?>
							</table>
							<?php }?>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
</div>

<div class="col_side">
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_social_network'];?><br />
		</div>

		<div class="box_mid">
			<div class="content">
				<table width="100%" border="0" cellspacing="2" cellpadding="2" class="picture_light">
					<?php
					if (isset($sn_statistics['degrees'])) {
					foreach($sn_statistics['degrees'] as $key => $i):
					?>
					<tr>
						<td class="bg3">
							<?php echo $lang['sn']['degree'][$i['degree_id']];?><br />
						</td>
						<td align="center" valign="top" class="bg4" width="10%">
							<?php echo $i['sn_total'];?><br />
						</td>
					</tr>
					
					<?php
					endforeach;
					}
					
					if (isset($sn_statistics['total_pending'])) {
					?>
					<tr>
						<td class="bg3">
							<?php echo $lang['txt_outstanding_invites'];?><br />
						</td>
						<td align="center" valign="top" class="bg4">
							<?php echo $sn_statistics['total_pending'];?><br />
						</td>
					</tr>
					<?php 
					}
					
					if (isset($sn_statistics['directory'])) {
					?>
					<tr>
						<td class="bg3">
							<?php echo $lang['txt_directory'];?><br />
						</td>
						<td align="center" valign="top" class="bg4">
							<?php echo $sn_statistics['total_directory'];?><br />
						</td>
					</tr>
					<?php 
					}
					if (isset($sn_statistics['total'])) {
					?>
					<tr>
						<td class="bg3">
							<?php echo $lang['txt_your_social_network'];?><br />
						</td>
						<td align="center" valign="top" class="bg1">
							<?php echo $sn_statistics['total'];?><br />
						</td>
					</tr>
					<?php }?>
				</table>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
				
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_latest_skill'];?><br />
		</div>

		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($latest_skill)) {
				?>
				
				<p>
					<a href="sn_profile.php?user_id=<?php echo $latest_skill['user']['user_id'];?>"><b><?php echo $latest_skill['user']['profile_nic'];?></b></a><br />
				</p>
				
				<p align="center">
					<a href="sn_profile.php?user_id=<?php echo $latest_skill['user']['user_id'];?>"><img src="get_file.php?file=<?php echo $latest_skill['user']['image']['file'];?>" border="0" class="picture" alt="<?php echo $latest_skill['user']['image']['file_title'];?>" /></a><br />
				</p>
				
				<p>
					<b><?php echo $latest_skill['skill_name'];?></b><br />
					<?php echo $latest_skill['skill_experience'];?><br />
					<?php 
					if (isset($lang['arr_skill']['rating'][$latest_skill['skill_rating']])) {
						echo $lang['arr_skill']['rating'][$latest_skill['skill_rating']];
					}
					?><br />
				</p>
				
				<p align="right">
					<a href="msg_edit.php?to_user_id=<?php echo $latest_skill['user_id'];?>"><?php echo $lang['menu_send_message'];?></a><br />
				</p>
				<?php }?>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
</div>
