示例#1
0
 public function ShowSearch(&$JS = '')
 {
     $show_count = array_reverse(array("20" => $this->lang['show_count_20'], "10" => $this->lang['show_count_10'], "5" => $this->lang['show_count_5'], "3" => $this->lang['show_count_3'], "2" => $this->lang['show_count_2'], "1" => $this->lang['show_count_1'], "0" => $this->lang['show_count_all']), true);
     if ($this->use_country) {
         $this->tpl->Set($this->tpl->Selection($this->countries, 'country_id', $this->search_array['country_id'], 'id="country_id_search"'), "{country}");
         $this->tpl->SetBlock('country');
     }
     if ($this->use_region) {
         $this->tpl->Set($this->tpl->Selection($this->regions, 'region_id', $this->search_array['region_id'], 'id="region_id_search"'), "{region}");
         $this->tpl->SetBlock('region');
     }
     $this->tpl->Set($this->tpl->Selection($this->cities, 'city_id', $this->search_array['city_id'], 'id="city_id_search"'), "{city}");
     $this->tpl->Set($this->tpl->Selection($this->marks, 'mark_id', $this->search_array['mark_id'], 'id="mark_id_search"'), "{mark}");
     $this->tpl->Set($this->tpl->Selection($this->models, 'model_id', $this->search_array['model_id'], 'id="model_id_search"'), "{model}");
     $this->tpl->Set($this->tpl->Selection($this->currency_array, 'currency', $this->search_array['currency']), "{currency}");
     $this->tpl->Set($this->tpl->Selection(array(0 => $this->lang['year_any']) + $this->year_array, 'year_min', $this->search_array['year_min']), "{year_min}");
     $this->tpl->Set($this->tpl->Selection(array(0 => $this->lang['year_any']) + $this->year_array, 'year_max', $this->search_array['year_max']), "{year_max}");
     $this->tpl->Set($this->tpl->inputCheckbox('isset_photo', 1, $this->search_array['isset_photo']), "{isset_photo}");
     $this->tpl->Set($this->tpl->Selection($show_count, 'search_count_day', $this->search_array['search_count_day']), "{sel_count}");
     $fields = array("race", "capacity_motor_min", "capacity_motor_max", "power_min", "power_max", "cost_min", "cost_max");
     foreach ($fields as $field) {
         $this->tpl->Set($this->search_array[$field], "{" . $field . "}");
     }
     foreach ($this->sel_fields as $name => $value) {
         if ($value['values']) {
             $this->tpl->Set($this->tpl->Selection(array(0 => $this->lang['any']) + $value['values'], $name, $this->search_array[$name]), "{" . $name . "}");
         }
     }
     foreach ($this->checkbox_fields as $name => $value) {
         $this->tpl->Set($this->tpl->InputCheckbox($name, 1, $this->search_array[$name]), "{" . $name . "}");
     }
     $JS .= $this->_getSearchJS();
 }
示例#2
0
 public function GetCompanyURL($id, $alt_name)
 {
     return $this->tpl->GetUrl(array('action' => 'company', 'id' => $id), array('id' => '/', $id . "-" . $alt_name));
 }
示例#3
0
 public function __construct($templateName)
 {
     parent::__construct($templateName);
 }
示例#4
0
 public function PageNavigation(array $url, $count_all, $per_page, $cur_page = 1, $i = 0, array $options = array())
 {
     $default_options = array("link_script" => '');
     $options = array_merge($default_options, $options);
     if (!$i) {
         $i = $per_page;
     }
     if ((int) $cur_page <= 0) {
         $cur_page = 1;
     }
     $current_show_sub = self::$show_sub;
     $this_2 = $this->_clone();
     $this_2->tpl->load_template('navigation.tpl');
     $no_prev = false;
     $no_next = false;
     $cstart = ((int) $cur_page - 1) * $per_page;
     $i += $cstart;
     if (isset($cstart) and $cstart != "" and $cstart > 0) {
         $prev = $cstart / $per_page;
         if ($prev > 1) {
             $page_url = $this_2->GetUrl($url, array(), array("page" => $prev), array(), $options);
         } else {
             $page_url = $this_2->GetUrl($url, array(), array(), array(), $options);
         }
         $this_2->Set("<a {$options['link_script']} href=\"" . $page_url . "\">", "[prev-link]");
         $this_2->Set("</a>", "[/prev-link]");
     } else {
         $no_prev = TRUE;
     }
     if ($per_page) {
         if ($count_all > $per_page) {
             $enpages_count = @ceil($count_all / $per_page);
             $pages = "";
             $cstart = $cstart / $per_page + 1;
             if ($enpages_count <= 10) {
                 for ($j = 1; $j <= $enpages_count; $j++) {
                     if ($j > 1) {
                         $page_url = $this_2->GetUrl($url, array(), array("page" => $j), array(), $options);
                     } else {
                         $page_url = $this_2->GetUrl($url, array(), array(), array(), $options);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a {$options['link_script']} href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
             } else {
                 $start = 1;
                 $end = 10;
                 $nav_prefix = "... ";
                 if ($cstart > 0) {
                     if ($cstart > 5) {
                         $start = $cstart - 4;
                         $end = $start + 8;
                         if ($end >= $enpages_count) {
                             $start = $enpages_count - 9;
                             $end = $enpages_count - 1;
                             $nav_prefix = "";
                         } else {
                             $nav_prefix = "... ";
                         }
                     }
                 }
                 if ($start >= 2) {
                     $pages .= "<a {$options['link_script']} href=\"" . $this_2->GetUrl($url, array(), array(), array(), $options) . "\">1</a> ... ";
                 }
                 for ($j = $start; $j <= $end; $j++) {
                     if ($j > 1) {
                         $page_url = $this_2->GetUrl($url, array(), array("page" => $j), array(), $options);
                     } else {
                         $page_url = $this_2->GetUrl($url, array(), array(), array(), $options);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a {$options['link_script']} href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
                 if ($cstart != $enpages_count) {
                     $pages .= $nav_prefix . "<a {$options['link_script']} href=\"" . $this_2->GetUrl($url, array(), array("page" => $enpages_count), array(), $options) . "\">{$enpages_count}</a>";
                 } else {
                     $pages .= "<span>{$enpages_count}</span> ";
                 }
             }
         }
         $this_2->Set($pages, '{pages}');
     }
     if ($per_page and $per_page < $count_all and $i < $count_all) {
         $next_page = @floor($i / $per_page) + 1;
         $this_2->Set("<a {$options['link_script']} href=\"" . $this_2->GetUrl($url, array(), array("page" => $next_page), array(), $options) . "\">", "[next-link]");
         $this_2->Set("</a>", "[/next-link]");
     } else {
         $no_next = TRUE;
     }
     if (!$no_prev or !$no_next) {
         $this_2->Compile('PageNavigation');
     }
     $this->tpl->result['PageNavigation'] = $this_2->tpl->result['PageNavigation'];
     unset($this_2);
     self::$show_sub = $current_show_sub;
     return $this;
 }
示例#5
0
require_once ENGINE_DIR . "/Core_modules/ExceptionCore.php";
$exc = new ExceptionErrorHandler(array(E_ERROR, E_WARNING, E_USER_WARNING));
if ($car_conf['general_debug']) {
    ExceptionErrorHandler::$log_type = 'show';
    ExceptionDataBase::$log_type = 'show';
    ExceptionAllError::$log_type = 'show';
} else {
    ExceptionErrorHandler::$log_type = 'file';
    ExceptionErrorHandler::$log_file = ENGINE_DIR . "/car-market/logs/HandlerErrors.log";
    ExceptionDataBase::$log_type = 'file';
    ExceptionDataBase::$log_file = ENGINE_DIR . "/car-market/logs/database.log";
    ExceptionAllError::$log_type = 'file';
    ExceptionAllError::$log_file = ENGINE_DIR . "/car-market/logs/errors.log";
}
require_once ENGINE_DIR . "/Core_modules/TemplateUser.php";
$template = new TemplateUser($tpl, 'car-market/');
$template->setBasePath($config['http_home_url']);
require_once ENGINE_DIR . "/Core_modules/Timer.php";
$timer = new Timer($_TIME);
if ($db->mysql_extend == 'MySQLi') {
    require_once ENGINE_DIR . "/Core_modules/MySQLi_DLE.php";
    $base = new MySQLi_DLE($db, $timer, $tables, PREFIX . "_");
} else {
    require_once ENGINE_DIR . "/Core_modules/MySQL_DLE.php";
    $base = new MySQL_DLE($db, $timer, $tables, PREFIX . "_");
}
if (!$base->isConnect()) {
    $base->Connect(DBHOST, $port = '', DBUSER, DBPASS, DBNAME, $usepconnect = false, COLLATE);
}
require ENGINE_DIR . "/car-market/classes/CarMarketUser.php";
$auto = new CarMarketUser($base, $car_conf, $lang_car, $member_id, $other_fields_array, $checkboxes_array);