<?php
/*
 * @component UserPoints
 * @copyright Copyright (C) 2015-2016 - Bernard Gilly - Adrien Roussel
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

defined( '_JEXEC' ) or die( 'Restricted access' );

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Filter\OutputFilter;

$doc	=  Factory::getDocument();
$app      = Factory::getApplication();

//$cparams 			= ComponentHelper::getParams( 'com_userpoints' );
//$showinformations 	= $caprams->get('showinformations',1);


	?>

	<div class="page-header">
			<h1><?php //echo $this->escape($params['page_heading']); ?></h1>
		</div>

	<div id="invite-form">
		<form action="<?php echo Route::_( 'index.php?option=com_userpoints&view=invite&Itemid='.$app->input->get('Itemid', '') , false );?>" method="post" name="inviteForm" id="inviteForm" class="form-validate form-horizontal">
		<fieldset>
		<legend><?php echo Text::_( 'AUP_INVITEYOURFRIENDSTOSIGNUP' ); ?></legend>
		<div class="alert alert-info">
		<button type="button" class="close" data-dismiss="alert">&times;</button>
		<?php if ( $this->params[ 'showinformations' ] ) { ?>
			<span style="text-decoration: underline;"><?php echo Text::_( 'AUP_INFORMATION' ); ?></span><br/>
			<span class="small"><?php echo Text::_( 'AUP_MAXEMAILPERINVITE' ); ?> <b><?php echo $this->params[ 'maxemailperinvite']; ?></b></span><br/>
			<span class="small"><?php echo Text::_( 'AUP_DELAYBETWEENINVITES' ); ?> <b><?php echo $this->params[ 'delaybetweeninvites' ]; ?> <?php echo Text::_( 'AUP_SECONDS' ); ?></b></span><br/>
			<span class="small"><?php echo Text::_( 'AUP_MAXINVITESPERDAY' ); ?> <b><?php echo $this->params['maxinvitesperday' ]; ?></b></span><br/>
			<?php if ( $this->referreid && $this->points ) { ?>
			<span class="small"><?php echo Text::_( 'AUP_POINTSEARNEDPERSUCCESSFULLINVITE' ); ?> <b><?php echo $this->points ; ?></b></span><br />
			<?php } ?>
		<?php } ?>
			<span class="small"><?php echo Text::_( 'AUP_LIST_RECIPIENTS' ); ?> </span><br/>
		</div>


		<div class="control-group">
			<div class="control-label">
					<div class="control-label">
					 <?php  echo $this->form->getLabel('other_recipients') ?>
					</div>
					<div class="controls">
					 <?php  echo $this->form->getInput('other_recipients')  	?>
					</div>
				   </div>
		</div>
		<div class="control-group">
			<div class="control-label">
					<div class="control-label">
					 <?php  echo $this->form->getLabel('sender') ?>
					</div>
					<div class="controls">
					 <?php  echo $this->form->getInput('sender')  	?>
					</div>
				   </div>
		</div>
		<div class="control-group">
			<div class="control-label">
					<div class="control-label">
					 <?php  echo $this->form->getLabel('custommessage') ?>
					</div>
					<div class="controls">
					 <?php  echo $this->form->getInput('custommessage')  	?>
					</div>
				   </div>
		</div>
		<?php
				PluginHelper::importPlugin('captcha');
				?>
                <div class="control-group">
				<div class="control-label">
					<div class="control-label">
					 <?php  //echo $this->form->getLabel('captcha') ?>
					</div>
					<div class="controls">
					 <?php  echo $this->form->getInput('captcha')  	?>
					</div>
				   </div>
                    </div>

		<div class="form-actions">
			<button type="submit" class="btn btn-primary validate"><?php echo Text::_('AUP_SEND');?></button>
			<a class="btn" href="<?php echo Route::_('');?>" title="<?php echo Text::_('JCANCEL');?>"><?php echo Text::_('JCANCEL');?></a>
		</div>
		<?php if ( $this->referrer_link && $this->user_name!='' ) { ?>

		<p>&nbsp;</p>
		<div class="alert alert-info"><span aria-hidden="true" class="icon-info-circle"></span>&nbsp;&nbsp;<?php echo Text::_( 'AUP_INVITATION_LINK' ); ?><br /><input type="text" name="referrer_link" id="referrer_link" onfocus="select();" readonly="readonly" class="inputbox" value="<?php echo $this->referrer_link; ?>" /></div>
		<?php }

		?>
		<input type="hidden" name="option" value="com_userpoints" />
		<input type="hidden" name="controller" value="invite" />
		<input type="hidden" name="referreid" value="<?php echo $this->referreid; ?>" />
		<input type="hidden" name="task" value="sendinvite" />
		<?php echo HTMLHelper::_('form.token'); ?>
		</fieldset>
	</form>
	</div>

<?php
	/**
	*
	*  Provide copyright on frontend
	*  If you remove or hide this line below,
	*  please make a donation if you find UserPoints useful
	*  and want to support its continued development.
	*  Your donations help by hardware, hosting services and other expenses that come up as we develop,
	*  protect and promote UserPoints and other free components.
	*
	*/
	echo $this->getCopyrightNotice ();
