<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
//
// Copyright (C) 2003 - 2007 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.
// -----------------------------------------------------------------------

?>

<style type="text/css">
<!--
@import url(<?php echo $template_path_core;?>css/aroundme_form.css);
-->
</style>

<script type="text/javascript" src="speller/spellChecker.js"></script>
<script type="text/javascript">
	function openSpellChecker() {
		var speller = new spellChecker();
		speller.spellCheckAll();
	}
</script>


<form action="index.php?amn=core_testimonial&amp;identity_id=<?php echo $_REQUEST['identity_id']; ?>&amp;module_id=<?php echo $_REQUEST['module_id']; ?>&amp;item_id=<?php echo $_REQUEST['item_id']; ?>" method="post" name="frm" id="id_frm">
<input type="hidden" name="identity_id" value="<?php echo isset($_REQUEST['identity_id']) ? $_REQUEST['identity_id'] : '';?>" />


<div class="col_left1">
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_testimonials'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<p>
					<b><?php echo $lang['hdr_testimonials_received'];?></b><br />
				</p>
				<?php if (isset($testimonials['received']) && !empty($testimonials['received'])) { ?>
				<?php foreach($testimonials['received'] as $t): ?>
				<p>
					<div style="text-align:right; font-size: 80%; color: #666;"><?php echo $t['testimonial_create_datetime']; ?></div>
					<?php echo $lang['txt_from']; ?> <a href="index.php?amn=core_profile&amp;identity_id=<?php echo $t['testifier_identity_id']; ?>"><b><?php echo $t['identity_nic']; ?></b></a>
					<?php echo $lang['txt_to']; ?> <?php echo $t['identity_nic_reciever']; ?><br />
					<p>
						<i>
							<?php echo $t['testimonial_body']; ?>
						</i>
					</p>
					<br />
					<hr />
				</p>				
				<?php endforeach; ?>
				<?php } else { ?>
					<?php if (isset($_REQUEST['identity_id'])) { ?>
					<p>
					<?php echo $lang['txt_no_received']; ?>				
					</p>
					<?php } else { ?>
					<p>
					<?php echo $lang['txt_no_recieved_me']; ?>
					</p>
				<?php }} ?>
				<p>
					<b><?php echo $lang['hdr_testimonials_written'];?></b><br />
				</p>
				<?php if (isset($testimonials['written']) && !empty($testimonials['written'])) { ?>
				<?php foreach($testimonials['written'] as $t): ?>
				<p>
					<div style="text-align:right; font-size: 80%; color: #666;">
					<?php if (!isset($_REQUEST['identity_id'])) { ?>					
						<a href="index.php?amn=core_testimonial&amp;delete=<?php echo $t['testimonial_id']; ?>"><?php echo $lang['txt_delete']; ?></a>
					<?php } ?>
					<?php echo $t['testimonial_create_datetime']; ?>
					</div>
					<?php echo $lang['txt_from']; ?> <?php echo $t['identity_nic']; ?>
					<?php echo $lang['txt_to']; ?> <a href="index.php?amn=core_profile&amp;identity_id=<?php echo $t['identity_id'];?>"><b><?php echo $t['identity_nic_reciever'];?></b></a>
					<br />
					<p>
						<i><?php echo $t['testimonial_body']; ?></i>
						<br />
						<hr />
					</p>
					<br />
				</p>				
				<?php endforeach; ?>
				<?php } else { ?>
					<?php if (isset($_REQUEST['identity_id'])) { ?>
					<p>
					<?php echo $lang['txt_no_written']; ?>				
					</p>
					<?php } else { ?>
					<p>
					<?php echo $lang['txt_no_written_me']; ?>
					</p>				
				<?php }} ?>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
</div>

<div class="col_right1">
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_about_testimonials'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php echo $lang['txt_about_testimonial']; ?><br />
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<?php if (isset($_REQUEST['identity_id'])) { ?>
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_write_testimonial']; ?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($identity)) {
					$id_card = $identity;
					include("inc/identity.inc.php");
				?>
					<label for="id_frm_testimonial"><?php echo $lang['txt_frm_write']; ?></label>
					<textarea onKeyUp="checkLength('id_frm_testimonial',255,'id_characters_left');" name="frm_testimonial" id="id_frm_testimonial" cols="51" rows="5"></textarea>				
					<p align="right">
						<span id="id_characters_left">(255)</span>				
						<?php
						if (isset($allow_spellcheck)) {
						?>
						<input type="button" class="input_submit" value="<?php echo $lang['sub_check_spelling'];?>" onClick="openSpellChecker();" />&nbsp;&nbsp;
						<?php }?>
						<input type="submit" class="input_submit" name="frm_submit" id="id_frm_submit" value="<?php echo $lang['txt_frm_send']; ?>"/>
					</p>
				<?php } ?>
			</div>
		</div>
	</div>
		
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	<?php } ?>
</div>
			
</form>			
