public static function at_manufacturers($atts = null, $content = null)
 {
     if ($atts == 'generator') {
         return array("name" => __("Make", AT_ADMIN_TEXTDOMAIN), "base" => "at_manufacturers", 'icon' => "im-icon-spinner-4", "class" => "at-manufacturers-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Enter shortcode title.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Columns", AT_ADMIN_TEXTDOMAIN), "param_name" => "columns", "default" => "1", "min" => "1", "max" => "7", "step" => "1", "unit" => 'col', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
     }
     $shortcode_id = self::_shortcode_id();
     extract(shortcode_atts(array('title' => '', 'columns' => '1', 'el_class' => ''), $atts));
     $car_model = AT_Loader::get_instance()->model('car_model');
     $manufacturers = $car_model->get_manufacturers();
     $output = '';
     if (!empty($title)) {
         $output .= '<h2>' . $title . '</h2>';
     }
     if ($columns > 1) {
         $output .= '<div class="auto-columns col-' . $columns . '">';
     }
     $output .= '<ul>';
     foreach ($manufacturers as $manufacturer) {
         $output .= '<li><a href="' . AT_Common::site_url('catalog/' . $manufacturer['alias']) . '">' . $manufacturer['name'] . '</a></li>';
     }
     $output .= '</ul>';
     if ($columns > 1) {
         $output .= '</div>';
     }
     $output .= '<div class="clear"></div>';
     return $output;
 }
 public function info($dealer = '')
 {
     try {
         if (empty($dealer)) {
             throw new Exception();
         }
         if (is_numeric($dealer)) {
             $dealer_id = $dealer;
         } else {
             $segment = explode('-', $dealer);
             if (count($segment) == 1) {
                 throw new Exception();
             }
             $dealer_id = $segment[count($segment) - 1];
             if (!is_numeric($dealer_id)) {
                 throw new Exception();
             }
         }
         $user_model = $this->load->model('user_model');
         if (!($dealer_info = $user_model->get_user_by_id($dealer_id)) || !$dealer_info['is_dealer'] || $dealer_info['is_block']) {
             throw new Exception();
         }
         if (is_numeric($dealer) && !empty($dealer_info['alias'])) {
             wp_redirect(AT_Common::site_url('dealer/info/' . trim($dealer_info['alias'] . '-' . $dealer_info['id'], '-') . '/'), 301);
             exit;
         }
     } catch (Exception $e) {
         AT_Core::show_404();
     }
     switch ($dealer_info['layout']) {
         case 'layout_2':
             $layout = 'content';
             $right_side = 'content/right_side';
             break;
         default:
             $layout = 'content_right';
             $right_side = 'right_side';
             break;
     }
     $car_model = $this->load->model('car_model');
     $reference_model = $this->load->model('reference_model');
     $dealer_contact = array();
     $affiliate = $user_model->get_dealer_main_affiliate($dealer_info['id']);
     if ($affiliate) {
         $phones = array();
         if (trim($affiliate['phone']) != '') {
             $phones[] = trim($affiliate['phone']);
         }
         if (trim($affiliate['phone_2']) != '') {
             $phones[] = trim($affiliate['phone_2']);
         }
         $dealer_contact = array('phones' => implode('<br/>', $phones), 'email' => $affiliate['email'], 'adress' => (!empty($affiliate['region']) ? $affiliate['region'] . ', ' : '') . $affiliate['adress'], 'url' => AT_Common::site_url('dealer/info/' . trim($dealer_info['alias'] . '-' . $dealer_info['id'], '-') . '/'));
     }
     $affiliates = $user_model->get_dealer_affiliates($dealer_info['id']);
     $paginator = $this->load->library('paginator');
     $paginator = $paginator->get(3, $car_model->get_cars_count_by_user_id($dealer_info['id']), $dealer_info['per_page']);
     $this->breadcrumbs->add_item(__('Catalog', AT_TEXTDOMAIN), 'catalog');
     $this->breadcrumbs->add_item($dealer_info['name'], 'dealer/info/' . trim($dealer_info['alias'] . '-' . $dealer_info['id'], '-') . '/');
     $this->view->use_layout('header_' . $layout . '_footer')->add_block('page_title', 'general/page_title', array('page_title' => $dealer_info['name']))->add_block($right_side, 'dealer/right_side', array('dealer_info' => $dealer_info, 'dealer_contact' => $dealer_contact, 'affiliate' => $affiliate, 'affiliates' => $user_model->get_dealer_affiliates($dealer_info['id'])))->add_block('content', 'dealer/info', array('layout' => $layout, 'best_offers' => $car_model->get_best_offers($dealer_info['id']), 'cars' => $car_model->get_cars_by_user_id($dealer_info['id'], $paginator['offset'], $paginator['per_page'])))->add_block('content/pagination', 'general/pagination', $paginator);
 }
    public static function at_recent_cars($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            return array("name" => __("Recent Listings", AT_ADMIN_TEXTDOMAIN), "base" => "at_recent_cars", 'icon' => "im-icon-spinner-4", "class" => "at-recent-cars-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Description will appear below each chart.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "12", "min" => "0", "max" => "20", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array("Any" => "0"), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('title' => '', 'manufacturer_id' => 0, 'model_id' => 0, 'limit' => 12, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts));
        $width = wpb_translateColumnWidthToSpan($width);
        $car_model = AT_Loader::get_instance()->model('car_model');
        $cars = array();
        $params = array();
        if ($manufacturer_id > 0) {
            $params['manufacturer_id'] = $manufacturer_id;
            if ($model_id == 0) {
                $params['model_id'] = $model_id;
            }
        }
        $cars = $car_model->get_cars($params, $offset = 0, $limit);
        $output = '<div class="recent ' . $el_class . '">
					<h2>' . $title . '</h2>
					<div class="recent_carousel" data-settings=\'{
						"auto": ' . $autoplay . ',
						"pause": ' . $pause . ',
						"slideWidth": 220,
						"minSlides": 1,
						"infiniteLoop": 1,
						"maxSlides": 4,
						"slideMargin": 20,
						"controls" : true,
						"pager" : false,
						"infiniteLoop": true
					}\'>';
        foreach ($cars as $key => $car) {
            if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'])) {
                $static = $car['photo']['photo_url'] . '213x164/' . $car['photo']['photo_name'];
                $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>';
            } else {
                if (has_post_thumbnail()) {
                    $image = get_the_post_thumbnail($post_id = get_the_ID(), $size = array(213, 164));
                } else {
                    $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-small.jpg') . '" alt="' . $title . '"/>';
                }
            }
            // OLD WAY:
            // <img src="' . AT_Common::static_url( $car['photo']['photo_path'] . '213x164/' . $car['photo']['photo_name'] ) . '" alt="' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . '"/>
            $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']);
            $output .= '<div class="slide">
							<a href="' . get_permalink($car['ID']) . '">
							' . $image . '
								<div class="description">
									Registration ' . $car['options']['_fabrication'] . '<br/>' . (!empty($car['options']['_cilindrics']) ? $car['options']['_cilindrics'] . ' cm³ ' : '') . (!empty($car['options']['_fuel_id']['name']) ? $car['options']['_fuel_id']['name'] . '<br/>' : '') . (!empty($car['options']['_engine_power']) ? $car['options']['_engine_power'] . ' HP<br/>' : '') . (!empty($car['options']['_body_type_id']['name']) ? 'Body ' . $car['options']['_body_type_id']['name'] . '<br/>' : '') . (!empty($car['options']['_mileage']) ? number_format((int) $car['options']['_mileage'], 0, '', ' ') . ' ' . AT_Common::car_mileage(0) : '') . '</div>
								<div class="title">' . $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'] . ' <span class="price">' . $cost . '</span></div>
							</a>
						</div>';
        }
        $output .= '</div>
				</div>';
        return $output;
    }
    public static function at_slider_posts($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            return array("name" => __("Slider: Posts", AT_ADMIN_TEXTDOMAIN), "base" => "at_slider_posts", 'icon' => "im-icon-spinner-4", "class" => "at-auto-gallery-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "5", "min" => "0", "max" => "12", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Post type", AT_ADMIN_TEXTDOMAIN), "param_name" => "post_type", "width" => 200, "value" => array("Posts" => "post", "News" => "news", "Reviews" => "reviews"), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('limit' => 5, 'post_type' => 'post', 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts));
        $width = wpb_translateColumnWidthToSpan($width);
        $query = array('post_type' => $post_type, 'showposts' => $limit, 'nopaging' => false, 'ignore_sticky_posts' => 1);
        $results = new WP_Query();
        $results->query($query);
        if ($results->have_posts()) {
            $output = '<div class="home_slider ' . $el_class . '">
							<div class="slider slider_1" data-settings=\'{
								"auto": ' . $autoplay . ',
								"slideWidth": 940,
								"pause": ' . $pause . ',
								"minSlides": 1,
								"infiniteLoop" : "true",
								"maxSlides": 1,
								"slideMargin": 0,
								"controls" : false}\'>';
            while ($results->have_posts()) {
                $results->the_post();
                $title = get_the_title();
                if (has_post_thumbnail()) {
                    $image = get_the_post_thumbnail($post_id = get_the_ID(), $size = array(640, 428));
                } else {
                    $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-large.jpg') . '" alt="' . $title . '"/>';
                }
                $output .= '<div class="slide" data-onclick="location.href=' . get_permalink(get_the_ID()) . '">
							<a title="' . $title . '" href="' . get_permalink(get_the_ID()) . '">' . $image . '</a>
							<div class="description">
								<a title="' . $title . '" href="' . get_permalink(get_the_ID()) . '"><h2 class="title">' . $title . '</h2></a>
								<p class="desc">' . AT_Common::truncate($content = get_the_excerpt(), $limit = 80) . '</p>
							</div>
						</div>';
            }
            $output .= '</div>
				</div>';
        } else {
            $output = '<div class="home_slider ' . $el_class . '">' . __("Please add more posts.", AT_TEXTDOMAIN) . '</div>';
        }
        return $output;
    }
 public static function at_recent_dealers($atts = null, $content = null)
 {
     if ($atts == 'generator') {
         return array("name" => __("Recent Dealers", AT_ADMIN_TEXTDOMAIN), "base" => "at_recent_dealers", 'icon' => "im-icon-spinner-4", "class" => "at-resent-posts-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => __("Enter custom title.", AT_ADMIN_TEXTDOMAIN), 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "12", "min" => "0", "max" => "20", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Carousel", AT_ADMIN_TEXTDOMAIN), "param_name" => "carousel", "width" => 'carousel', "value" => array("Use carousel" => "carousel", "Static" => "static"), "description" => ''), array("type" => "range", "heading" => __("View post", AT_ADMIN_TEXTDOMAIN), "param_name" => "spans", "value" => "4", "min" => "0", "max" => "6", "step" => "1", "unit" => '', "description" => __("Select limit to display on one row", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
     }
     $shortcode_id = self::_shortcode_id();
     extract(shortcode_atts(array('title' => '', 'limit' => 3, 'trim' => 80, 'spans' => 4, 'disable' => '', 'carousel' => 'carousel', 'el_class' => '', 'width' => '1/1', 'post_type' => 'post'), $atts));
     $style = '';
     if ($carousel == 'static') {
         $style .= ' style="';
         $style .= 'max-width:' . 100 / $spans . '%';
         $style .= '"';
     }
     $width = wpb_translateColumnWidthToSpan($width);
     $dealers = AT_Loader::get_instance()->model('user_model');
     $results = $dealers->get_dealers(0, $limit);
     $total = $dealers->get_dealers_count();
     $output = '';
     if (count($results > 0)) {
         $c = 0;
         $class = "dealer-wrapper";
         $output .= '<div class="' . $class . '">';
         // $output .= '<a href="#" class="all">Show all...</a>';
         $output .= '<div class="results"><span>' . sprintf(__('Total %s dealers', AT_TEXTDOMAIN), $total) . '</span></div>';
         $output .= '<div class="clear"></div>';
         $output .= '<div class="tabs_' . $carousel . '">';
         foreach ($results as $dealer) {
             $c++;
             $url = AT_Common::site_url('dealer/info/' . trim($dealer['alias'] . '-' . $dealer['id'], '-') . '/');
             if (!file_exists($dealer['photo']['photo_path'] . '138x138/' . $dealer['photo']['photo_name'])) {
                 $photo = AT_URI . '/assets/images/default-dealer-small.jpg';
             } else {
                 $photo = $dealer['photo']['photo_url'] . '138x138/' . $dealer['photo']['photo_name'];
             }
             $output .= '<div class="slide"' . $style . '>';
             $output .= '<a class="thumb img" href="' . $url . '"><img src="' . $photo . '" /></a>';
             $output .= '<a class="title" href="' . $url . '">' . $dealer['name'] . '</a>';
             $output .= '</div>';
         }
         $output .= '</div>';
         $output .= '</div>';
     }
     $output .= '<div class="clear"></div>';
     return $output;
 }
 function __construct($meta_box)
 {
     if (!is_admin()) {
         return;
     }
     $this->view = new AT_View();
     $this->view->add_style('style.css', 'assets/css/admin/admin.css');
     $this->view->add_style('fonts.css', 'assets/css/fonts.css');
     $this->view->add_style('icons.css', 'assets/css/icons.css');
     $this->view->add_style('datetimepicker.css', 'assets/css/jquery/jquery.datetimepicker.css');
     $this->view->add_script('admin-common', 'assets/js/common.js');
     $this->view->add_style('select2.css', 'assets/css/select2/select2.css');
     $this->view->add_localize_script('admin-common', 'theme_site_url', AT_Common::site_url('/'));
     $this->view->add_script('admin-options', 'assets/js/admin/options/options.js');
     $this->view->add_script('select2', 'assets/js/select2/select2.min.js');
     $this->view->add_script('jquery.datetimepicker', 'assets/js/jquery/jquery.datetimepicker.js', array('jquery'));
     parent::__construct();
     $this->_meta_box = $meta_box;
     add_action('admin_menu', array(&$this, 'add'));
     add_action('save_post', array(&$this, 'save'));
 }
 public function add_item($name, $url)
 {
     $this->_data[] = array('name' => $name, 'url' => AT_Common::site_url($url));
 }
					<input type="text" id="email" class="text" name="email" placeholder="<?php 
echo __('Email', AT_TEXTDOMAIN);
?>
">
					<input type="password" class="text" name="password" id="password" placeholder="<?php 
echo __('Password', AT_TEXTDOMAIN);
?>
">
					<div class="col1"><a href="#" class="btn1 login" /><?php 
echo __('LOGIN', AT_TEXTDOMAIN);
?>
</a></div>
					<?php 
/*<div class="col2"><a href="<?php echo AT_Common::site_url('/auth/registration/');?>" class="btn2" class="registration" /><?php echo __('REGISTRATION', AT_TEXTDOMAIN); ?></a></div> */
?>
					<div class="col1"><a href="<?php 
echo AT_Common::site_url('/auth/recovery/');
?>
" class="lost_password"><?php 
echo __('Lost password?', AT_TEXTDOMAIN);
?>
</a></div>
					<div class="col2"><label class="checkbox"><input type="checkbox" name="remember" id=""> <?php 
echo __('Remember me', AT_TEXTDOMAIN);
?>
</label></div>
				</form>
			</div>
		</div>
	</div>
</div>
?>

<div class="wrapper_login_page">
	<div class="background">
		<img src="<?php 
echo AT_Common::static_url('assets/images/bg_auto/' . $background);
?>
">
		<div id="registration-page" class="popup">
			<div class="popup_title"><?php 
echo __('Registration', AT_TEXTDOMAIN);
?>
</div>
			<div class="popup_content">
				<form method="post" action="<?php 
echo AT_Common::site_url('/auth/registration/');
?>
" id="registration-form-page" class="registration-form">
					<input type="text" class="text" name="name" value="" placeholder="<?php 
echo __('Username', AT_TEXTDOMAIN);
?>
" />
					<input type="text" class="text" name="email" placeholder="<?php 
echo __('Email', AT_TEXTDOMAIN);
?>
">
					<!-- <input type="password" class="text" name="pass" placeholder="<?php 
echo __('Password', AT_TEXTDOMAIN);
?>
" id="pass">
					<input type="password" class="text" name="pass_again" id="pass_again" placeholder="<?php 
    echo __('<strong>Add</strong> Car', AT_TEXTDOMAIN);
    ?>
</h1>
	<form method="post" action="<?php 
    echo AT_Common::site_url('profile/vehicles/add/');
    ?>
" id="vehicle-form">
<?php 
} else {
    ?>
	<h1><?php 
    echo __('<strong>Edit</strong> Car', AT_TEXTDOMAIN);
    ?>
</h1>
	<form method="post" action="<?php 
    echo AT_Common::site_url('profile/vehicles/edit/' . $car_info['ID'] . '/');
    ?>
" id="vehicle-form">
<?php 
}
?>
	<div class="step_breadcrumb">
		<a href="#" class="active" id="step_1"><?php 
echo __('step 1. announcement', AT_TEXTDOMAIN);
?>
</a>
		<a href="#" class="" id="step_2"><?php 
echo __('step 2. specifications', AT_TEXTDOMAIN);
?>
</a>
		<a href="#" class="" id="step_3"><?php 
        echo $car['ID'];
        ?>
" /></div>
			<div class="img">
				<?php 
        if (count($car['photo']) > 0) {
            ?>
				<img src="<?php 
            echo AT_Common::static_url($car['photo']['photo_url'] . '165x120/' . $car['photo']['photo_name']);
            ?>
" alt=""/>
				<?php 
        } else {
            ?>
				<img src="<?php 
            echo AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-small.jpg');
            ?>
" alt="" />
				<!--img src="/wp-content/themes/winterjuice/framework/assets/images/pics/catalog.jpg" alt=""/-->
				<?php 
        }
        ?>
			</div>
			<div class="general_info">
				<h2><?php 
        echo $car['options']['_manufacturer_id']['name'];
        ?>
 <?php 
        echo $car['options']['_model_id']['name'];
        ?>
 <?php 
$this->add_script('vehicles', 'assets/js/confirm_email.js');
?>
<div class="wrapper_login_page">
	<div class="background">
		<img src="<?php 
echo AT_Common::static_url('assets/images/bg_auto/' . $background);
?>
">
		<div id="confirm-email-page" class="popup">
			<div class="popup_title"><?php 
echo __('Confirm Email', AT_TEXTDOMAIN);
?>
</div>
			<div class="popup_content">
				<form method="post" action="<?php 
echo AT_Common::site_url('/auth/confirm_email/');
?>
" class="confirm-form">
					<input type="text" id="code" class="text" name="code" placeholder="<?php 
echo __('Auth-Code', AT_TEXTDOMAIN);
?>
">
					<a href="#" class="btn1 confirm" /><?php 
echo __('Confirm', AT_TEXTDOMAIN);
?>
</a> 
					<a href="#" class="btn2 send_mail_again" style="float:right;" /><?php 
echo __('Resend code', AT_TEXTDOMAIN);
?>
</a>
				</form>
    }
    ?>
				</div>
			<?php 
}
?>
			</div>
			<?php 
if ($add_car_button) {
    ?>
			<div class="add_car">
				<?php 
    if (AT_Common::is_user_logged()) {
        ?>
				<a href="<?php 
        echo AT_Common::site_url('/profile/vehicles/add/');
        ?>
" class="btn2"><?php 
        echo __('+ Add auto', AT_TEXTDOMAIN);
        ?>
</a>
				<?php 
    }
    ?>
			</div>
			<?php 
}
?>
			<?php 
if ($sociable_view) {
    ?>
 public function single()
 {
     $car_model = $this->load->model('car_model');
     $user_model = $this->load->model('user_model');
     if (!($car_info = $car_model->get_car_info(get_the_ID()))) {
         AT_Core::show_404();
     }
     $car_model->set_car_views(get_the_ID());
     $reference_model = $this->load->model('reference_model');
     $photo_model = $this->load->model('photo_model');
     $owner_info = $user_model->get_user_by_id($car_info['options']['_owner_id']);
     $contacts_owner = array();
     if ($owner_info['is_dealer']) {
         if ($car_info['options']['_affiliate_id'] > 0) {
             $affiliate = $user_model->get_dealer_affiliate_by_id($car_info['options']['_affiliate_id']);
         }
         if (empty($affiliate)) {
             $affiliate = $user_model->get_dealer_main_affiliate($car_info['options']['_owner_id']);
         }
         if ($affiliate) {
             $phones = array();
             if (!empty($affiliate['phone'])) {
                 $phones[] = $affiliate['phone'];
             }
             if (!empty($affiliate['phone_2'])) {
                 $phones[] = $affiliate['phone_2'];
             }
             $contacts_owner = array('phones' => implode(', ', $phones), 'email' => $affiliate['email'], 'adress' => (!empty($affiliate['region']) ? $affiliate['region'] . ', ' : '') . $affiliate['adress'], 'url' => AT_Common::site_url('dealer/info/' . trim($owner_info['alias'] . '-' . $car_info['options']['_owner_id'], '-') . '/'), 'add_offer' => true, 'is_dealer' => true, 'name' => $owner_info['name'], 'photo' => $owner_info['photo']);
         } else {
             $phones = array();
             if (!empty($owner_info['phone'])) {
                 $phones[] = $owner_info['phone'];
             }
             if (!empty($owner_info['phone_2'])) {
                 $phones[] = $owner_info['phone_2'];
             }
             $contacts_owner = array('phones' => implode(', ', $phones), 'email' => '', 'adress' => '', 'url' => AT_Common::site_url('dealer/info/' . trim($owner_info['alias'] . '-' . $car_info['options']['_owner_id'], '-') . '/'), 'add_offer' => true, 'is_dealer' => true, 'name' => $owner_info['name'], 'photo' => $owner_info['photo']);
         }
     } else {
         $phones = array();
         if (!empty($owner_info['phone'])) {
             $phones[] = $owner_info['phone'];
         }
         if (!empty($owner_info['phone_2'])) {
             $phones[] = $owner_info['phone_2'];
         }
         if (isset($owner_info['region_id'])) {
             $region = $reference_model->get_region_by_id($owner_info['region_id']);
         }
         $contacts_owner = array('phones' => implode(', ', $phones), 'email' => $owner_info['email'], 'adress' => !empty($region['name']) ? $region['name'] : '', 'url' => '', 'add_offer' => false, 'is_dealer' => false, 'name' => $owner_info['name'], 'photo' => $owner_info['photo']);
     }
     $this->breadcrumbs->add_item(__('Catalog', AT_TEXTDOMAIN), 'catalog/');
     if ($manufacturer_data = $reference_model->get_manufacturer_by_id($car_info['options']['_manufacturer_id'])) {
         $this->breadcrumbs->add_item($manufacturer_data['name'], 'catalog/' . $manufacturer_data['alias']);
         if ($model_data = $reference_model->get_model_by_id($car_info['options']['_model_id'])) {
             $this->breadcrumbs->add_item($model_data['name'], 'catalog/' . $manufacturer_data['alias'] . '/' . $model_data['alias']);
         }
     }
     $this->breadcrumbs->add_item($car_info['post_title'], '');
     $this->view->use_layout('header_content_footer')->add_block('content', 'car/view', array('car_info' => $car_info, 'contacts_owner' => $contacts_owner, 'car_photos' => $photo_model->get_photos_by_post(get_the_ID(), 'car'), 'equipments' => $reference_model->get_equipments(), 'car_views' => $car_model->get_car_views(get_the_ID()), 'is_dealer' => $owner_info['is_dealer']))->add_block('content/recent_cars', 'car/recent_cars', array('cars' => $car_model->get_similar_car(get_the_ID())));
     //->add_block('content/loan_calculator', 'additions/loan_calculator');
 }
    public static function at_auto_gallery($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            return array("name" => __("Slider: Auto Gallery", AT_ADMIN_TEXTDOMAIN), "base" => "at_auto_gallery", 'icon' => "im-icon-spinner-4", "class" => "at-auto-gallery-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "range", "heading" => __("Limit", AT_ADMIN_TEXTDOMAIN), "param_name" => "limit", "value" => "5", "min" => "0", "max" => "12", "step" => "1", "unit" => '', "description" => __("Select limit to display on this block", AT_ADMIN_TEXTDOMAIN)), array("type" => "dropdown", "heading" => __("Display options", AT_ADMIN_TEXTDOMAIN), "param_name" => "display", "width" => 200, "value" => array("Show all item" => "all", "Only featured" => "featured"), "description" => ''), array("type" => "dropdown", "heading" => __("Make", AT_ADMIN_TEXTDOMAIN), "param_name" => "manufacturer_id", "width" => 200, "value" => AT_VC_Helper::get_manufacturers(), "description" => ''), array("type" => "dropdown", "heading" => __("Model", AT_ADMIN_TEXTDOMAIN), "param_name" => "model_id", "width" => 200, "value" => array_merge(array("Any" => "0"), AT_VC_Helper::get_manufacturers()), "description" => ''), array("type" => "dropdown", "heading" => __("Autoplay", AT_ADMIN_TEXTDOMAIN), "param_name" => "autoplay", "width" => 200, "value" => array("Yes" => "true", "No" => "false"), "description" => ''), array("type" => "textfield", "heading" => __("Pause", AT_ADMIN_TEXTDOMAIN), "param_name" => "pause", "value" => "4000", "description" => __("Specify slideshow timeout in ms.", AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('manufacturer_id' => 0, 'model_id' => 0, 'display' => 'all', 'limit' => 5, 'autoplay' => 'false', 'pause' => '4000', 'el_class' => '', 'width' => '1/1'), $atts));
        $width = wpb_translateColumnWidthToSpan($width);
        $car_model = AT_Loader::get_instance()->model('car_model');
        $cars = array();
        $params = array();
        if ($manufacturer_id > 0) {
            $params['manufacturer_id'] = $manufacturer_id;
            if ($model_id == 0) {
                $params['model_id'] = $model_id;
            }
        }
        if ($display == "featured") {
            $params['featured'] = true;
        }
        $cars = $car_model->get_cars($params, $offset = 0, $limit);
        if (count($cars) > 0) {
            $output = '<div class="home_slider ' . $el_class . '">
								<div class="slider slider_1" data-settings=\'{
									"auto": ' . $autoplay . ',
									"slideWidth": 940,
									"pause": ' . $pause . ',
									"minSlides": 1,
									"infiniteLoop" : true,
									"maxSlides": 1,
									"slideMargin": 0,
									"controls" : false}\'>';
            foreach ($cars as $key => $car) {
                $title = $car['options']['_manufacturer_id']['name'] . ' ' . $car['options']['_model_id']['name'];
                if (isset($car['photo']['photo_name']) && file_exists($car['photo']['photo_path'] . 'original/' . $car['photo']['photo_name'])) {
                    $static = $car['photo']['photo_url'] . 'original/' . $car['photo']['photo_name'];
                    $image = '<img src="' . AT_Common::static_url($static) . '" alt="' . $title . '"/>';
                } else {
                    if (has_post_thumbnail()) {
                        $image = get_the_post_thumbnail($post_id = $car['ID'], $size = array(640, 428));
                    } else {
                        $image = '<img src="' . AT_Common::site_url(AT_URI_THEME . '/framework/assets/images/pics/noimage-large.jpg') . '" alt="' . $title . '"/>';
                    }
                }
                $cost = AT_Common::show_full_price($value = $car['options']['_price'], $currency = $car['options']['_currency_id']);
                $output .= '<div class="slide" data-onclick="location.href=' . get_permalink($car['ID']) . '">
								<a title="' . $title . '" href="' . get_permalink($car['ID']) . '">' . $image . '</a>
								<div class="description">
									<a title="' . $title . '" href="' . get_permalink($car['ID']) . '"><h2 class="title">' . $car['options']['_fabrication'] . ' ' . $title . '</h2></a>
									<p class="desc">' . (!empty($car['options']['_mileage']) ? '<span><strong>' . AT_Common::car_mileage(0) . ': </strong>' . number_format((int) $car['options']['_mileage'], 0, '', ',') . '</span>' : '') . (!empty($car['options']['_cilindrics']) ? '<span><strong>' . __('Engine', AT_TEXTDOMAIN) . ': </strong>' . $car['options']['_cilindrics'] . ' ' . __('cm³', AT_TEXTDOMAIN) . '</span> ' : '') . '</p>
									<div class="price">' . $cost . '</div>
								</div>
							</div>';
            }
            $output .= '</div>
					</div>';
        } else {
            $output = '<div class="home_slider ' . $el_class . '">' . __('Login and add new vehicles.', AT_TEXTDOMAIN) . '</div>';
        }
        return $output;
    }
 public function confirm_email($confirm_code = '')
 {
     if (AT_Common::is_user_logged() && $this->core->get_option('confirm_email_enable', true)) {
         $user_info = $this->registry->get('user_info');
         if (!empty($user_info['date_active'])) {
             AT_Common::redirect('/profile');
         }
         if ($this->uri->is_ajax_request() && !empty($_POST)) {
             try {
                 $user_model = $this->load->model('user_model');
                 $user_info = $this->registry->get('user_info');
                 if (isset($_POST['action']) && $_POST['action'] == 'send_again') {
                     $mail_model = $this->load->model('mail_model');
                     $code = $user_model->get_confirm_email_code($user_info['id'], $user_info['email']);
                     $data = array('username' => $user_info['name'], 'confirm_url' => AT_Common::site_url('auth/confirm_email/' . $code . '/'), 'confirm_code' => $code);
                     if (!$mail_model->send('template_mail_confirm_email', $user_info['email'], $data)) {
                         throw new Exception(serialize(array('code' => __('Error send email! Try later.', AT_TEXTDOMAIN))));
                     }
                     $response = array('status' => 'OK', 'message' => __('Message was sent!', AT_TEXTDOMAIN));
                 } else {
                     if (!$this->validation->run('confirm_email')) {
                         throw new Exception(serialize($this->validation->get_errors()));
                     }
                     $code = $user_model->get_confirm_email_code($user_info['id'], $user_info['email']);
                     if ($_POST['code'] != $code) {
                         throw new Exception(serialize(array('code' => __('Сode is not valid.', AT_TEXTDOMAIN))));
                     }
                     $user_model->update($user_info['id'], array('date_active' => current_time('mysql')));
                     $response = array('status' => 'OK', 'message' => __('Сode is valid!', AT_TEXTDOMAIN), 'redirect_url' => AT_Common::site_url('profile/'));
                 }
             } catch (Exception $e) {
                 $response = array('status' => 'ERROR', 'message' => unserialize($e->getMessage()));
             }
             $this->view->add_json($response)->display();
             exit;
         }
         if (!empty($confirm_code)) {
             $user_model = $this->load->model('user_model');
             $user_info = $this->registry->get('user_info');
             $code = $user_model->get_confirm_email_code($user_info['id'], $user_info['email']);
             if ($confirm_code == $code) {
                 $user_model->update($user_info['id'], array('date_active' => current_time('mysql')));
                 AT_Common::redirect('profile/');
             }
         }
         $this->view->use_layout('header_content2_footer');
         $this->view->add_block('content', 'auth/confirm_email', array('background' => $this->_get_rand_bg()));
     } else {
         AT_Common::redirect('/');
     }
 }
			<div class="loader"></div>
		</div>
		<div class="upload-photo">
			<div class="username"><?php 
echo $user_info['name'];
?>
</div>
			<a href="#" class="btn1" id="upload-photo"><?php 
echo __('upload a logo', AT_TEXTDOMAIN);
?>
</a>
			<a href="#" class="btn2 photo_delete">X</a>
		</div>
	</div>
	<form action="<?php 
echo AT_Common::site_url('profile/settings/');
?>
" method="post" id="settings-form">
		<div class="settings_form">
			<div class="col1">
				<label class="text"><?php 
echo __('Dealer name:', AT_TEXTDOMAIN);
?>
</label>
				<input type="text" class="text" name="name" id="name" value="<?php 
echo $user_info['name'];
?>
"/>
			</div>
			<div class="col2">
				<label class="text"><?php 
    ?>
 <?php 
    echo AT_Common::car_mileage(0);
    ?>
</span>
					<span><strong><?php 
    echo $car['options']['_category_id'] == 1 ? __('New car', AT_TEXTDOMAIN) : __('Used', AT_TEXTDOMAIN);
    ?>
</strong></span>
				</div>
				<div style="float:right">
					<?php 
    if ($car['owner_info']['is_dealer']) {
        ?>
						<a href="<?php 
        echo AT_Common::site_url('dealer/info/' . trim($car['owner_info']['alias'] . '-' . $car['owner_info']['id'], '-') . '/');
        ?>
"><i class="icon-award-empty is-dealer award"></i><?php 
        echo $car['owner_info']['name'];
        ?>
</a>
					<?php 
    } else {
        ?>
						<?php 
        echo $car['owner_info']['name'];
        ?>
					<?php 
    }
    ?>
				</div>
    public static function at_search_auto($atts = null, $content = null)
    {
        if ($atts == 'generator') {
            $shortcode_options = array();
            $view = new AT_View();
            if (is_array($view->get_option('shortcode_search_forms', array()))) {
                foreach ($view->get_option('shortcode_search_forms', array()) as $key => $value) {
                    $shortcode_options['Item ' . ($key + 1)] = $key;
                }
            }
            return array("name" => __("Search auto", AT_ADMIN_TEXTDOMAIN), "base" => "at_search_auto", 'icon' => "im-icon-spinner-4", "class" => "at-search-auto-class", 'category' => __("Theme Short-Codes", AT_ADMIN_TEXTDOMAIN), "params" => array(array("type" => "textfield", "heading" => __("Title", AT_ADMIN_TEXTDOMAIN), "param_name" => "title", "value" => "", "description" => '', 'dependency' => array('element' => 'content_type', 'value' => array('custom_text'))), array("type" => "dropdown", "heading" => __("Shortcode Options", AT_ADMIN_TEXTDOMAIN), "param_name" => "shortcode_options", "width" => 200, "value" => $shortcode_options, "description" => __('<b>You can edit settings form`s fields in <a target="_blank" href="admin.php?page=at_site_options_catalog">Catalog Site Options</a> ( "Shortcode Search Form" )</b>', AT_ADMIN_TEXTDOMAIN)), array("type" => "textfield", "heading" => __("Extra class name", AT_ADMIN_TEXTDOMAIN), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in Custom CSS Shortcode or Masterkey Custom CSS option.", AT_ADMIN_TEXTDOMAIN))));
        }
        $shortcode_id = self::_shortcode_id();
        extract(shortcode_atts(array('title' => '', 'el_class' => '', 'shortcode_options' => '0', 'width' => '1/1'), $atts));
        $view = new AT_View();
        $shortcode_search_forms = $view->get_option('shortcode_search_forms', array());
        if ($shortcode_options == '' || empty($shortcode_search_forms) || !isset($shortcode_search_forms[$shortcode_options])) {
            return '';
        }
        $width = wpb_translateColumnWidthToSpan($width);
        $view->add_script('jquery.selectik', 'assets/js/jquery/jquery.selectik.js');
        $view->add_script('catalog', 'assets/js/catalog.js', array('jquery'));
        $output = '<form method="GET" class="vehicle-filter" action="' . AT_Common::site_url('catalog') . '/">
        				<div class="search_auto">';
        foreach ($shortcode_search_forms[$shortcode_options]['option'] as $key => $value) {
            switch ($key) {
                case 'title':
                    $output .= '<h3>' . $title . '</h3>';
                    break;
                case 'transport_type':
                    $output .= '<div class="categories">';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_transport_types'), true) as $key => $value) {
                        $output .= '<input class="transport_type" type="radio" id="search_radio_' . $value['id'] . '" value="' . $value['id'] . '" name="transport_type_id"' . ($value['is_default'] ? 'checked="checked"' : '') . ' />
						<label for="search_radio_' . $value['id'] . '" title="' . $value['name'] . '"><i class="' . $value['alias'] . '"></i></label>';
                    }
                    $output .= '</div>';
                    break;
                case 'manufacturer_model':
                    $output .= '
							<div class="clear"></div>
							<label><strong>' . __("Make", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_1">
								<select name="manufacturer_id" id="manufacturer_id" class="custom-select select_1 select2">';
                    $output .= '<option value="0">' . __("Any", AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_manufacturers'), true) as $key => $value) {
                        $output .= '<option value="' . $value['alias'] . '">' . $value['name'] . '</option>';
                    }
                    // foreach (AT_VC_Helper::get_manufacturers() as $value => $key) {
                    // 	$output .= '<option value="' . $key. '">' . $value . '</option>';
                    // }
                    $output .= '
								</select>
							</div>
							<label><strong>' . __("Model", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_1">
								<select name="model_id" id="model_id" class="custom-select select_1 select2">
									<option value="0">' . __("Any", AT_TEXTDOMAIN) . '</option>
								</select>
							</div>';
                    break;
                case 'year':
                    $output .= '<label><strong>' . __("Year", AT_TEXTDOMAIN) . ':</strong></label>
						<div class="select_box_2">
							<select name="fabrication_from" id="fabrication_from" class="custom-select select_2 select2">
								<option value="0">' . __("From", AT_TEXTDOMAIN) . '</option>';
                    foreach (AT_VC_Helper::get_years_range() as $value) {
                        $output .= '<option value="' . $value . '">' . $value . '</option>';
                    }
                    $output .= '
							</select>
							<select name="fabrication_to" id="fabrication_to" class="custom-select select_2 select2">
								<option value="0">' . __("To", AT_TEXTDOMAIN) . '</option>';
                    foreach (AT_VC_Helper::get_years_range() as $value) {
                        $output .= '<option value="' . $value . '">' . $value . '</option>';
                    }
                    $output .= '
							</select>
							<div class="clear"></div>
						</div>';
                    break;
                case 'price':
                    $output .= '<label><strong>' . __("Price", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_2">
								<input type="text" name="price_from" placeholder="' . __('From', AT_TEXTDOMAIN) . '" id="price_from" value="" class="txb custom-text"/>
								<input type="text" name="price_to" placeholder="' . __('To', AT_TEXTDOMAIN) . '" id="price_to" value="" class="txb custom-text"/>
								<div class="clear"></div>
							</div>';
                    break;
                case 'mileage':
                    $output .= '<label><strong>' . __("Mileage", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_2">' . '<input type="text" name="mileage_from" placeholder="' . __('From', AT_TEXTDOMAIN) . '" id="mileage_from"  value="" class="txb custom-text"/>
								<input type="text" name="mileage_to" placeholder="' . __('To', AT_TEXTDOMAIN) . '" id="mileage_to" value="" class="txb custom-text"/>
								<div class="clear"></div>
							</div>';
                    break;
                case 'body_type':
                    $output .= '<label><strong>' . __('Body type:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="body_type_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_body_types'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'fuel':
                    $output .= '<label><strong>' . __('Fuel:', AT_TEXTDOMAIN) . '</strong></label>
							<div class="select_box_1">
								<select class="custom-select select_3" id="fuel_id">
									<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_fuels'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
							</div>';
                    break;
                case 'transmission':
                    $output .= '<label><strong>' . __('Transmission:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="transmission_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_transmissions'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'doors':
                    $output .= '<label><strong>' . __('Doors:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="door_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_doors'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'region':
                    $output .= '<label><strong>' . __('Region:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="region_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_regions'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'region_state':
                    $output .= '
							<div class="clear"></div>
							<label><strong>' . __("Country", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_1">
								<select name="region_id" id="region_id" class="custom-select select_1 select2">';
                    $output .= '<option value="0">' . __("Any", AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_regions'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    // foreach (AT_VC_Helper::get_manufacturers() as $value => $key) {
                    // 	$output .= '<option value="' . $key. '">' . $value . '</option>';
                    // }
                    $output .= '
								</select>
							</div>
							<label><strong>' . __("State", AT_TEXTDOMAIN) . ':</strong></label>
							<div class="select_box_1">
								<select name="state_id" id="state_id" class="custom-select select_1 select2">
									<option value="0">' . __("Any", AT_TEXTDOMAIN) . '</option>
								</select>
							</div>';
                    break;
                case 'drive':
                    $output .= '<label><strong>' . __('Drive:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="drive_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_drive'), true) as $key => $value) {
                        $output .= '<option value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'color':
                    $output .= '<label><strong>' . __('Color:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_1">
							<select class="custom-select select_3" id="color_id">
								<option value="0">' . __('Any', AT_TEXTDOMAIN) . '</option>';
                    foreach ($view->add_widget('reference_widget', array('method' => 'get_colors'), true) as $key => $value) {
                        $output .= '<option data-selectik="<span style=\'background-color:' . $value['alias'] . '\'></span>' . $value['name'] . '" data-color="' . $value['alias'] . '" value="' . $value['id'] . '">' . $value['name'] . '</option>';
                    }
                    $output .= '</select>
						</div>';
                    break;
                case 'cilindrics':
                    $output .= '<label><strong>' . __('Engine, cm³:', AT_TEXTDOMAIN) . '</strong></label>
						<div class="select_box_2">
							<select class="custom-select select_4" name="engine_from" id="engine_from">
								<option value="0">' . __('From', AT_TEXTDOMAIN) . '</option>';
                    $car_engine_range = $view->get_option('car_engine_range', array('min' => 900, 'max' => 6500));
                    for ($i = $car_engine_range['min']; $i <= $car_engine_range['max']; $i = $i + 100) {
                        $output .= '<option value="' . $i . '">' . $i . '</option>';
                    }
                    $output .= '</select>
							<select class="custom-select select_4" name="engine_to" id="engine_to">
								<option value="0">' . __('To', AT_TEXTDOMAIN) . '</option>';
                    $car_engine_range = $view->get_option('car_engine_range', array('min' => 900, 'max' => 6500));
                    for ($i = $car_engine_range['min']; $i <= $car_engine_range['max']; $i = $i + 100) {
                        $output .= '<option value="' . $i . '">' . $i . '</option>';
                    }
                    $output .= '</select>
							<div class="clear"></div>
						</div>';
                    break;
                case 'only_new_car':
                    $output .= '<div class="chb_wrapper">
								<input id="cars_categories" name="cars_categories" type="checkbox" value="new" />
								<label class="check_label" for="cars_categories">' . __("Only new cars", AT_TEXTDOMAIN) . '</label>
							</div>';
                    break;
                case 'submit':
                    $output .= '<input type="submit" value="' . __("Search", AT_TEXTDOMAIN) . '" class="btn_search btn5 float-right" id="search_car_shortcode"/>';
                    break;
            }
        }
        $output .= '<div class="clear"></div>
				</div>
				<input type="hidden" name="view" value="' . $view->get_option('catalog_car_type_view_default', 'list') . '"/>
				<div class="clear"></div>
				</form>';
        return $output;
    }
?>
<div class="main_wrapper">
	<h1><?php 
_e('Payment System (BETA)', AT_TEXTDOMAIN);
?>
</h1>



	<?php 
echo sprintf(__('You\'re going to promote %s with paid service.', AT_TEXTDOMAIN), '<strong>' . $cars['post_title'] . '</strong>');
?>

	<p>&nbsp;</p>
	<form action="<?php 
echo AT_Common::site_url('payments/checkout');
?>
" method="POST">
	<h2><?php 
_e('Select Plan', AT_TEXTDOMAIN);
?>
</h2>
	<?php 
_e('Please specify your plan', AT_TEXTDOMAIN);
?>
	<?php 
if (is_array($plans)) {
    // echo 1;
    $width = 100 / count($plans);
    echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
    echo '<tr>';
			<div class="settings_form affiliate_item <?php 
    if ($affiliate['is_main']) {
        echo 'main_affiliate';
    }
    ?>
" data-id="<?php 
    echo $key;
    ?>
">
			  <div class="item-title"><?php 
    echo $affiliate['name'];
    ?>
</div>
			  <div class="item-content">
			  	<form action="<?php 
    echo AT_Common::site_url('profile/settings/dealer_affiliates/');
    ?>
" method="post" class="settings-form">
			  		<input type="hidden" name="affiliate_id" value="<?php 
    echo $affiliate['id'];
    ?>
">
				<div class="col1">
					<label class="text"><?php 
    echo __('Affiliates name:', AT_TEXTDOMAIN);
    ?>
</label>
					<input type="text" class="text" name="name" value="<?php 
    echo $affiliate['name'];
    ?>
"/>
 public function get_query_string($param_key, $maxObjects, $objectsPerPage = 12, $border = 1, $center = 2, $url = false)
 {
     if ($maxObjects > $this->maxToDisplay) {
         $maxObjects = $this->maxToDisplay;
     }
     // count pages
     $pages = ceil($maxObjects / $objectsPerPage);
     if ($pages <= 1) {
         return array('offset' => 0, 'per_page' => $objectsPerPage);
     }
     $queryParams = $_GET;
     $current = isset($queryParams[$param_key]) ? (int) $queryParams[$param_key] : 0;
     switch ($current) {
         case 0:
         case 1:
             $center += 2;
             break;
         case 2:
             $center += 1;
             break;
         case $current == $pages:
             $center += 3;
             break;
         case $current == $pages - 1:
             $center += 2;
             break;
         case $current == $pages - 2:
             $center += 1;
             break;
     }
     // save GET params
     if (isset($queryParams[$param_key])) {
         unset($queryParams[$param_key]);
     }
     if (is_admin()) {
         $url = get_admin_url() . $url;
     } else {
         if (!$url) {
             $url = AT_Common::site_url(implode('/', $this->uri->segments()));
         } else {
             $url = AT_Common::site_url($url);
         }
     }
     if ($current == 0) {
         $current = 1;
     }
     $url = rtrim($url, '/');
     $offset = ($current - 1) * $objectsPerPage;
     $result = array('list' => array(), 'current_page' => $current, 'offset' => $offset, 'per_page' => $objectsPerPage);
     // next
     if ($current != $pages) {
         $result['next'] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $current + 1), 'page' => $current + 1);
     }
     // prev
     if ($current != 1) {
         if ($current != 2) {
             $result['prev'] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $current - 1), 'page' => $current - 1);
         } else {
             $result['prev'] = array('url' => $this->_get_query_string_url($url, $queryParams), 'page' => $current - 1);
         }
     }
     //print_r($result['prev']);
     // last
     if ($current != $pages) {
         $result['last'] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $pages), 'page' => $pages);
     }
     for ($i = 1; $i <= $border; $i++) {
         if ($i <= $pages) {
             if ($current != $i) {
                 if ($i != 1) {
                     $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => FALSE);
                 } else {
                     $result['first'] = array('url' => $this->_get_query_string_url($url, $queryParams), 'page' => $i, 'current' => FALSE);
                     if ($current == 2 || $current == 3) {
                         $result['list'][] = $result['first'];
                     }
                 }
             } else {
                 if ($i != 1) {
                     $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => TRUE);
                 } else {
                     $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams), 'page' => $i, 'current' => TRUE);
                 }
             }
         } else {
             break;
         }
     }
     if ($current - $center > $border + 1) {
         $left = $current - $center;
     } else {
         $left = $border + 1;
     }
     $right = $current + $center;
     for ($i = $left; $i <= $right; $i++) {
         if ($i <= $pages) {
             if ($current != $i) {
                 $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => FALSE);
             } else {
                 $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => TRUE);
             }
         } else {
             break;
         }
     }
     if ($right < $pages) {
         if ($pages - $border + 1 > $border + 1) {
             $left = $pages - $border + 1;
         } else {
             $left = $border + 1;
         }
         $right = $pages;
         for ($i = $left; $i <= $right; $i++) {
             if ($i <= $pages) {
                 if ($current != $i) {
                     $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => FALSE);
                 } else {
                     $result['list'][] = array('url' => $this->_get_query_string_url($url, $queryParams, $param_key, $i), 'page' => $i, 'current' => TRUE);
                 }
             } else {
                 break;
             }
         }
     }
     return $result;
 }
<?php

if (!defined("AT_DIR")) {
    die('!!!');
}
?>
<a href="<?php 
echo AT_Common::site_url('auth/login');
?>
">Sign In</a>
 public function edit($car_id = '')
 {
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-ui-sortable');
     $car_id = (int) $car_id;
     $car_model = $this->load->model('car_model');
     if (!$car_id || ($car_info = $car_model->get_car_info($car_id)) === false || $car_info['options']['_owner_id'] != AT_Common::get_logged_user_id()) {
         AT_Core::show_404();
     }
     if ($this->uri->is_ajax_request() && !empty($_POST)) {
         try {
             // if ( empty( $_POST['post_title'] ) || empty( $_POST['post_content'] ) ) {
             // 	throw new Exception( 'Enter Title && Content!' );
             // }
             if (isset($_POST['_price'])) {
                 $_POST['_price'] = str_replace(array(',', ' '), array('', ''), $_POST['_price']);
             }
             $reference_model = $this->load->model('reference_model');
             $manufacturer = $reference_model->get_manufacturer_by_id($_POST['_manufacturer_id']);
             $model = $reference_model->get_model_by_id($_POST['_model_id']);
             $version = isset($_POST['_version']) ? $_POST['_version'] : '';
             $region = $reference_model->get_manufacturer_by_id($_POST['_region_id']);
             $state = $reference_model->get_model_by_id($_POST['_state_id']);
             $_POST['post_title'] = trim($manufacturer['name'] . ' ' . $model['name'] . ' ' . $version);
             $car_model->update_car_info($car_id, $_POST);
             $photo_model = $this->load->model('photo_model');
             $photos = $photo_model->get_photos_by_post($car_id, 'car');
             $main_photo = $photo_model->get_photo_by_post($car_id, 'car', 1);
             if (isset($_POST['photos'])) {
                 foreach ($photos as $key => $value) {
                     if (!isset($_POST['photos'][$value['id']])) {
                         $photo_model->del_photo_by_id($value['id']);
                     } else {
                         if ($_POST['photos'][$value['id']] && $value['id'] != $main_photo['id']) {
                             $photo_model->set_photo_main_by_id($car_id, 'car', $value['id']);
                         }
                     }
                 }
                 $sort = 0;
                 foreach ($_POST['photos'] as $key => $photo) {
                     $sort++;
                     if (!is_numeric($key)) {
                         $key = explode('/', $key);
                         if (count($key) > 1) {
                             continue;
                         }
                         if (($photo_id = $photo_model->resize_uploaded_image(AT_DIR_THEME . '/uploads/' . $key[0], $car_id, 'car', $photo_model->car_sizes)) && $photo) {
                             $photo_model->set_photo_main_by_id($car_id, 'car', $photo_id);
                             $photo_model->set_photo_sort($key, $sort);
                         }
                     } else {
                         $photo_model->set_photo_sort($key, $sort);
                     }
                 }
             } else {
                 if (count($photos) > 0) {
                     $photo_model->del_photos_by_post($car_id, 'car');
                 }
             }
             $response = array('status' => 'OK', 'redirect_url' => AT_Common::site_url('profile/vehicles/'));
         } catch (Exception $e) {
             $response = array('status' => 'ERROR', 'message' => $e->getMessage());
         }
         $this->view->add_json($response)->display();
     }
     $this->breadcrumbs->add_item('My vehicles', 'profile/vehicles/');
     $this->breadcrumbs->add_item('Edit ' . $car_info['post_title'], '');
     $reference_model = $this->load->model('reference_model');
     $photo_model = $this->load->model('photo_model');
     $user_model = $this->load->model('user_model');
     $owner_info = $user_model->get_user_by_id($car_info['options']['_owner_id']);
     $block_params = array('car_info' => $car_info, 'manufacturers' => $reference_model->get_manufacturers(), 'equipments' => $reference_model->get_equipments(), 'body_types' => $reference_model->get_body_types(), 'fuels' => $reference_model->get_fuels(), 'transmissions' => $reference_model->get_transmissions(), 'doors' => $reference_model->get_doors(), 'technical_conditions' => $reference_model->get_technical_conditions(), 'currencies' => $reference_model->get_currencies(), 'transport_types' => $reference_model->get_transport_types(), 'regions' => $reference_model->get_regions(), 'states' => array(), 'drive' => $reference_model->get_drive(), 'colors' => $reference_model->get_colors(), 'photos' => $photo_model->get_photos_by_post($car_id, 'car'), 'affiliates' => $owner_info['is_dealer'] ? $user_model->get_dealer_affiliates($car_info['options']['_owner_id']) : array(), 'owner_info' => $owner_info);
     if (isset($car_info['options']) && isset($car_info['options']['_region_id']) && !empty($car_info['options']['_region_id'])) {
         $block_params['states'] = $reference_model->get_states_by_region_id($car_info['options']['_region_id']);
     }
     $this->view->use_layout('header_content_footer');
     $this->view->add_block('content', 'vehicles/add', $block_params);
     $menu_model = $this->load->model('menu_model');
     $this->view->add_block('right_side', 'general/navigation', $menu_model->get_menu('main', 'vehicles'));
 }