<?php
mt_srand();
$index = mt_rand(1, 9999);
?>
<div id="pjWrapper">
	<div class="container-fluid pjCfContainer">
		<?php include_once PJ_VIEWS_PATH . 'pjLoad/elements/header.php';?>
		
		<div class="panel panel-default pjCfBody pjCfForm pjCfFormAccess">
			<header class="panel-heading text-center pjCfFormHead">
				<p class="panel-title pjCfFormTitle"><?php __('front_login_to_your_account');?></p><!-- /.panel-title pjCfFormTitle -->
			</header><!-- /.panel-heading text-center pjCfFormHead -->
			<div class="panel-body pjCfFormBody">
				<form id="pjSFLogInForm_<?php echo $index;?>" action="<?php echo $_SERVER['PHP_SELF'];?>?controller=pjLoad&amp;action=pjActionLogin" method="post" data-toggle="validator" role="form">
					<input type="hidden" value="1" name="login">
					<?php
					if(isset($_SESSION[$controller->defaultReturn]))
					{
						$return_arr = $_SESSION[$controller->defaultReturn];
						if(isset($return_arr['qid']) && (int)$return_arr['qid'] > 0)
						{
							?><input type="hidden" value="<?php echo $return_arr['qid'];?>" name="qid"><?php
							if(isset($return_arr['rid']) && (int)$return_arr['rid'] > 0)
							{
								?><input type="hidden" value="<?php echo $return_arr['rid'];?>" name="rid"><?php
							}
						} 
					}
					?>
					<div class="row">
						<div class="col-lg-offset-3 col-lg-6 col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8 col-xs-12">
							<?php
							if(isset($tpl['err']))
							{
								$front_err = pjSanitize::clean(__('front_err', true));
								?>
								<div class="alert alert-danger" role="alert"><?php echo $front_err[$tpl['err']];?></div>
								<?php
							}
							if(isset($tpl['msg']))
							{
								$front_msg = pjSanitize::clean(__('front_msg', true));
								?>
								<div class="alert alert-success" role="alert"><?php echo $front_msg[$tpl['msg']];?></div>
								<?php
							} 
							?>
							<div class="form-group">
								<label for=""><?php __('front_email_address');?>: </label>
								
								<input type="email" name="email" class="form-control required email" data-msg-required="<?php __('front_field_required');?>" data-msg-email="<?php __('front_email_invalid');?>" data-msg-remote="<?php __('front_email_in_used');?>"/>
								<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
							</div><!-- /.form-group -->
		
							<div class="form-group">
								<label for=""><?php __('front_password');?>: </label>
								
								<input type="password" id="pjSFPassword" name="password" class="form-control required" data-msg-required="<?php __('front_field_required');?>"/>
								<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
							</div><!-- /.form-group -->
		
							<div class="form-group">
								<button type="submit" class="btn btn-default pjCfBtn pjCfBtnPrimary"><?php __('front_btn_login');?></button>
								<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjLoad&amp;action=pjActionForgot" class="btn btn-link pjCfBtn pjCfBtnLink"><?php __('front_forgot_password');?></a>
								<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjLoad&amp;action=pjActionRegister" class="btn btn-link pjCfBtn pjCfBtnLink"><?php __('front_menu_create_an_account');?></a>
							</div><!-- /.form-group -->
						</div><!-- /.col-lg-offset-3 col-lg-6 col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8 col-xs-12 -->
					</div><!-- /.row -->
				</form>
			</div>
		</div><!-- /.panel panel-default pjCfBody pjCfForm pjCfFormAccess -->
	</div><!-- /.container-fluid pjCfContainer -->
</div><!-- /#pjWrapper -->

<?php include_once PJ_VIEWS_PATH . 'pjLoad/elements/loadjs.php';?>