<?php
mt_srand();
$index = mt_rand(1, 9999);
?>
<div id="pjWrapper">
	<div class="container-fluid pjMlContainer">
		<?php include_once PJ_VIEWS_PATH . 'pjLoad/elements/header.php';?>
		
		<?php
		if(!empty($tpl['arr']))
		{
			?>
			<div class="row pjMlBody pjMlMembers">
				<?php
				foreach($tpl['arr'] as $v)
				{
					$img = 'http://placehold.it/60x60';
					if(!empty($v['avatar_path']))
					{
						$img = PJ_INSTALL_URL . $v['avatar_path']; 
					}
					$url = $_SERVER['PHP_SELF'] . '?controller=pjLoad&amp;action=pjActionView&amp;id=' . $v['id'];
					if($tpl['option_arr']['o_seo_url'] == 'Yes')
					{
						$path = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
						$path = $path == '/' ? '' : $path;
						$url = $path .'/'. $controller->friendlyURL($v['name']) . "-". $v['id'] . ".html";
					}
					?>
					<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 pjMlMember">
						<a href="<?php echo $url;?>">
							<div class="panel panel-default pjMlMemberInner">
								<div class="panel-body pjMlMemberBody">
									<div class="pjMlMemberData">
										<div class="pjMlMemberImage">
											<img src="<?php echo $img;?>" alt="" />
										</div><!-- /.pjMlMemberImage -->
							
										<p class="pjMlMemberTitle"><?php echo pjSanitize::html($v['name']);?></p><!-- /.pjMlMemberTitle -->
										<?php
										if($v['age'] != '')
										{ 
											?><p><?php __('front_age')?>: <?php echo $v['age'];?></p><?php
										} 
										?>
									</div><!-- /.pjMlMemberData -->
									
									<div class="pjMlMemberContacts">
										<ul class="list-inline pjMlListContacts">
											<li>
												<i class="fa fa-envelope"></i> 
												<span class="pjMlMemberMail"><?php echo pjSanitize::html($v['email']);?></span>
											</li>
											<?php
											if(!empty($v['phone']))
											{
												?>
												<li>
													<i class="fa fa-phone-square"></i> 
													<span class="pjMlPhone"><?php echo pjSanitize::html($v['phone']);?></span>
												</li>
												<?php
											} 
											$add_arr = array();
											if(!empty($v['city']))
											{
												$add_arr[] = pjSanitize::html($v['city']);
											}
											if(!empty($v['state']))
											{
												$add_arr[] = pjSanitize::html($v['state']);
											}
											if(!empty($v['zip']))
											{
												$add_arr[] = pjSanitize::html($v['zip']);
											}
											if(!empty($v['country']))
											{
												$add_arr[] = pjSanitize::html($v['country']);
											}
											if(!empty($add_arr))
											{
												?>
												<li>
													<i class="fa fa-map-marker"></i> 
													<?php echo join(", ", $add_arr);?>
												</li>
												<?php
											} 
											?>
										</ul><!-- /.list-inline pjMlListContacts -->
									</div><!-- /.pjMlMemberContacts -->
								</div><!-- /.panel-body pjMlMemberBody -->
								
								<footer class="panel-footer pjMlMemberFoot">
									<?php
									if(!empty($v['skills']))
									{ 
										?>
										<ul class="list-inline pjMlListLabels">
											<?php
											foreach($v['skills'] as $skill)
											{
												?><li><span class="label label-default"><?php echo pjSanitize::html($skill);?></span></li><?php
											} 
											?>
										</ul><!-- /.list-inline pjMlListLabels -->
										<?php
									} 
									?>
							
									<p><?php echo pjSanitize::html($v['biography']);?></p>
								</footer><!-- /.panel-footer pjMlMemberFoot -->
							</div><!-- /.panel panel-default pjMlMemberInner -->	
						</a>
					</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 pjMlMember -->
					<?php
				} 
				?>
			</div><!-- /.row pjMlBody pjMlMembers -->
			<?php
			include_once PJ_VIEWS_PATH . 'pjLoad/elements/pagination.php';
		} else {
			?>
			<div class="row pjMlBody pjMlMembers">
				<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 pjMlMember">
					<p class="pjMlMemberNotFound"><?php __('front_no_members_found');?></p>
				</div>
			</div><!-- /.row pjMlBody pjMlMembers -->
			<?php
		}
		?>
			
	</div><!-- /.container-fluid pjMlContainer -->
</div><!-- /#pjWrapper -->
	
<?php include_once PJ_VIEWS_PATH . 'pjLoad/elements/loadjs.php';?>