<?php
/**
 * @package Sj Latest Jobs For Js Jobs
 * @version 1.0.0
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @copyright (c) 2015 YouTech Company. All Rights Reserved.
 * @author YouTech Company http://www.smartaddons.com
 *
 */

defined('_JEXEC') or die;

echo '<div class="sj_newest_jobs_show_newest_jobs_info">';
	echo '<div class="sj_newest_jobs_show_newest_jobs_info_title">'.$params->get('sj_newest_jobs_label_newest').'</div>';
	echo '<div class="sj_newest_jobs_show_newest_jobs_info_descreption">'.$params->get('sj_newest_jobs_des_newest').'</div>';
echo '</div>';

echo '<div class="sj_newest_jobs_show_newest_jobs_content">';
		$index = 0;
		foreach($nItems as $item){
			if($index%2 == 0){
				$cls_sj = ' sj_plus';
			}else{
				$cls_sj = ' sj_minus';
			}
			$index++;
			if($item->logo == ''){
				$logo = '<img src="'.JURI::root().'components/com_jsjobs/images/blank_logo.png" alt/>';
			}else{
				$logo = '<img src="'.JURI::root().'jsjobsdata/data/employer/comp_'.$item->companyid.'/logo/'.$item->logo.'" alt/>';
			}

			echo '<div class="sj_newest_jobs_show_newest_jobs_content_item sj_plus'.$cls_sj.'">';
				if($params->get('sj_newest_jobs_newest_show_logo') == 1){
					echo '<div class="sj_newest_jobs_item">';
						echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_logo">';
						echo $logo;
						echo '</div>';
					echo '</div>';
				}
				echo '<div class="sj_newest_jobs_newest_wrap_group">';
				if($params->get('sj_newest_jobs_newest_show_department') == 1){
					echo '<div class="sj_newest_jobs_item sj_newest_jobs_item_big">';
						$url = JURI::root();
						$array_url = explode('/index.php',$url);
						echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_department">';
							echo '<p><a href="'.$array_url[0].'index.php/component/jsjobs/job/viewjob/job-'.$item->alias.'-'.$item->id.'">'.$item->title.'</a></p>';
						echo '</div>';
					echo '</div>';
				}
				if($params->get('sj_newest_jobs_newest_show_category') == 1){
					echo '<div class="sj_newest_jobs_item">';
						echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_category sj_newest_jobs_show_category">';
							$url = JURI::getInstance();
							$array_url = explode('/index.php',$url);
							echo '<p>'.$item->cat_title.'</p>';
						echo '</div>';
					echo '</div>';
				}
				echo '</div>';
				if($params->get('sj_newest_jobs_newest_show_city') == 1){
					echo '<div class="sj_newest_jobs_item">';
					echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_city">';
					echo '<p><i class="fa fa-map-marker"></i>';
					foreach($Cityname as $city) {
						if($city->city_id == $item->city){
							echo $city->cityN;
						}
					}
					echo '</p>';
					echo '</div>';
					echo '</div>';
				}
				if($params->get('sj_newest_jobs_newest_show_type') == 1){
					echo '<div class="sj_newest_jobs_item">';
						echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_type">';
							echo '<p><i class="fa fa-adjust"></i>'.$item->jobtypetitle.'</p>';
						echo '</div>';
					echo '</div>';
				}
				if($params->get('sj_newest_jobs_newest_show_created') == 1){
					echo '<div class="sj_newest_jobs_item sj_newest_jobs_newest_show_created">';
						echo '<div class="sj_newest_jobs_show_newest_jobs_content_item_show_created">';
							$pub = $item->startpublishing;
							$array_pub = explode(' ',$pub);
							echo '<p><i class="fa fa-calendar"></i>'.$array_pub[0].'</p>';
						echo '</div>';
					echo '</div>';
				}
				echo '<div class="clear_both"></div>';
				if($params->get('sj_newest_jobs_newest_show_content') == 1){
					echo '<div class="sj_newest_jobs_future_item_description ">';
						$description = str_replace('</p>','',$item->description);
						$description = str_replace('<p>','',$description);
						if(strlen($description) <= $params->get('sj_newest_jobs_newest_limit_content')){
							echo '<p>'.$description.'</p>';
						}else{
							echo '<p>'.JHtmlString::truncate($description,$params->get('sj_newest_jobs_newest_limit_content'),true,false).'</p>';
						}
						
					echo '</div>';
				}
				if($params->get('sj_newest_jobs_newest_show_view_job') == 1){
					echo '<div class="sj_newest_jobs_future_item_read_more">';
						$url = JURI::root();
						$array_url = explode('/index.php',$url);
						echo '<p><a href="'.$array_url[0].'index.php/component/jsjobs/job/viewjob/job-'.$item->alias.'-'.$item->id.'">'.$params->get('sj_newest_jobs_newest_readmore_text').'</a></p>';
					echo '</div>';
				}
			echo '</div>';
		}
echo '</div>';

?>