<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	if (isset($_GET['err']))
	{
		$titles = __('error_titles', true);
		$bodies = __('error_bodies', true);
		pjUtil::printNotice(@$titles[$_GET['err']], @$bodies[$_GET['err']]);
	}
	$donation_statuses = __('donation_statuses', true);
	?>
	<div class="ui-tabs ui-widget ui-widget-content ui-corner-all b10">
		<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
			<li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminDonations&amp;action=pjActionIndex"><?php __('menuDonations'); ?></a></li>
			<?php
			if($controller->isAdmin())
			{ 
				?>
				<li class="ui-state-default ui-corner-top"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminDonations&amp;action=pjActionCreate"><?php __('lblAddDonation'); ?></a></li>
				<?php
			} 
			?>
		</ul>
	</div>
	<?php pjUtil::printNotice(__('infoDonationsTitle', true, false), __('infoDonationsDesc', true, false)); ?>
	<div class="b10">
		<form action="" method="get" class="float_left pj-form frm-filter">
			<input type="text" name="q" class="pj-form-field pj-form-field-search w150" placeholder="<?php __('btnSearch', false, true); ?>" />
		</form>
		<br class="clear_both" />
	</div>

	<div id="grid"></div>
	<script type="text/javascript">
	var pjGrid = pjGrid || {};
	pjGrid.isEditor = <?php echo $controller->isEditor() ? 'true' : 'false'; ?>;
	pjGrid.queryString = "";
	<?php
	if (isset($_GET['campaign_id']) && (int) $_GET['campaign_id'] > 0)
	{
		?>pjGrid.queryString += "&campaign_id=<?php echo (int) $_GET['campaign_id']; ?>";<?php
	}
	?>
	var myLabel = myLabel || {};
	myLabel.campaign = "<?php __('lblCampaign', false, true); ?>";
	myLabel.name = "<?php __('lblName', false, true); ?>";
	myLabel.date_time = "<?php __('lblDateTime', false, true); ?>";
	myLabel.amount = "<?php __('lblAmount', false, true); ?>";
	myLabel.exported = "<?php __('lblExport', false, true); ?>";
	myLabel.delete_selected = "<?php __('delete_selected', false, true); ?>";
	myLabel.delete_confirmation = "<?php __('delete_confirmation', false, true); ?>";
	myLabel.status = "<?php __('lblStatus', false, true); ?>";
	myLabel.paid = "<?php echo $donation_statuses['P']; ?>";
	myLabel.not_paid = "<?php echo $donation_statuses['N']; ?>";	
	</script>
	<?php
}
?>