This repository has been archived by the owner on Nov 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
142 lines (128 loc) · 5.65 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
if( osc_count_items() == 0 || stripos($_SERVER['REQUEST_URI'], 'search') ) {
osc_add_hook('header', 'mtx_nofollow_construct');
} else {
osc_add_hook('header', 'mtx_follow_construct');
}
mtx_add_body_class('search');
$listClass = '';
$buttonClass = '';
if(osc_search_show_as() == 'gallery'){
$listClass = 'listing-grid';
$buttonClass = 'active';
}
osc_add_hook('before-main', function() {
osc_current_web_theme_path('search-sidebar.php');
});
osc_add_hook('footer', function() {
?>
<script type="text/javascript">
$(function() {
function log( message ) {
$( "<div/>" ).text( message ).prependTo( "#log" );
$( "#log" ).attr( "scrollTop", 0 );
}
$( "#sCity" ).autocomplete({
source: "<?php echo osc_base_url(true); ?>?page=ajax&action=location",
minLength: 2,
select: function( event, ui ) {
$("#sRegion").attr("value", ui.item.region);
log( ui.item ?
"<?php echo osc_esc_html( __('Selected', 'matrix') ); ?>: " + ui.item.value + " aka " + ui.item.id :
"<?php echo osc_esc_html( __('Nothing selected, input was', 'matrix') ); ?> " + this.value );
}
});
});
</script>
<?php
});
osc_current_web_theme_path('header.php');
?>
<div class="list-header">
<div class="resp-wrapper">
<?php osc_run_hook('search_ads_listing_top'); ?>
<h1><?php echo search_title(); ?></h1>
<?php if(osc_count_items() == 0) { ?>
<p class="empty" ><?php printf(__('There are no results matching "%s"', 'matrix'), osc_search_pattern()) ; ?></p>
<?php } else { ?>
<span class="counter-search"><?php
$search_number = mtx_search_number();
printf(__('%1$d - %2$d of %3$d listings', 'matrix'), $search_number['from'], $search_number['to'], $search_number['of']);
?></span>
<div class="actions">
<a href="#" data-bclass-toggle="display-filters" class="resp-toogle show-filters-btn"><?php _e('Show filters','matrix'); ?></a>
<span class="doublebutton <?php echo $buttonClass; ?>">
<a href="<?php echo osc_esc_html(osc_update_search_url(array('sShowAs'=> 'list'))); ?>" class="list-button" data-class-toggle="listing-grid" data-destination="#listing-card-list"><span><?php _e('List','matrix'); ?></span></a>
<a href="<?php echo osc_esc_html(osc_update_search_url(array('sShowAs'=> 'gallery'))); ?>" class="grid-button" data-class-toggle="listing-grid" data-destination="#listing-card-list"><span><?php _e('Grid','matrix'); ?></span></a>
</span>
<!-- START sort by -->
<span class="see_by">
<span><?php _e('Sort by', 'matrix'); ?>:</span>
<?php
$orders = osc_list_orders();
$current = '';
foreach($orders as $label => $params) {
$orderType = ($params['iOrderType'] == 'asc') ? '0' : '1';
if(osc_search_order() == $params['sOrder'] && osc_search_order_type() == $orderType) {
$current = $label;
}
}
?>
<label><?php echo $current; ?><b class="arrow-envelope"><b class="arrow-down"></b></b></label>
<?php $i = 0; ?>
<ul>
<?php
foreach($orders as $label => $params) {
$orderType = ($params['iOrderType'] == 'asc') ? '0' : '1'; ?>
<?php if(osc_search_order() == $params['sOrder'] && osc_search_order_type() == $orderType) { ?>
<li><a class="current" href="<?php echo osc_esc_html(osc_update_search_url($params)); ?>"><?php echo $label; ?></a></li>
<?php } else { ?>
<li><a href="<?php echo osc_esc_html(osc_update_search_url($params)); ?>"><?php echo $label; ?></a></li>
<?php } ?>
<?php $i++; ?>
<?php } ?>
</ul>
</span>
<!-- END sort by -->
</div>
<?php } ?>
</div>
</div>
<?php
$i = 0;
osc_get_premiums();
if(osc_count_premiums() > 0) {
echo '<h5>'.__('Premium listings','matrix').'</h5>';
View::newInstance()->_exportVariableToView("listType", 'premiums');
View::newInstance()->_exportVariableToView("listClass",$listClass.' premium-list');
osc_current_web_theme_path('loop.php');
echo '<div style="clear:both;"></div><br/>';
}
?>
<?php if(osc_count_items() > 0) { ?>
<?php
echo '<h5>'.__('Listings','matrix').'</h5>';
View::newInstance()->_exportVariableToView("listType", 'items');
View::newInstance()->_exportVariableToView("listClass",$listClass);
osc_current_web_theme_path('loop.php');
?>
<div class="clear"></div>
<?php if(osc_rewrite_enabled()) {
$footerLinks = osc_search_footer_links();
if(count($footerLinks) > 0) { ?>
<div id="related-searches">
<h5><?php _e('Other searches that may interest you','matrix'); ?></h5>
<ul class="footer-links">
<?php foreach($footerLinks as $f) { View::newInstance()->_exportVariableToView('footer_link', $f); ?>
<?php if($f['total'] < 3) continue; ?>
<li><a href="<?php echo osc_footer_link_url(); ?>"><?php echo osc_footer_link_title(); ?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php } ?>
<div class="paginate">
<?php echo osc_search_pagination(); ?>
</div>
<?php } ?>
<?php osc_current_web_theme_path('footer.php') ; ?>