-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoolbar.php
More file actions
139 lines (120 loc) · 4 KB
/
Copy pathtoolbar.php
File metadata and controls
139 lines (120 loc) · 4 KB
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
<?php
/**
* Part of Plugin mcatalogue
*
* @package cfdev
* @version 1.0
* @date 01/06/2016
* @author Cyril Frausti ®All right reserved
* @url http://cfdev.fr
**/
class toolBar {
private $types;
private $cats;
private $brands;
/**
* Constructeur de la classe
*
* @param default_lang langue par défaut
* @return stdio
* @author CFDEV
**/
public function __construct($default_lang) {
global $plxShow;
$plxMotor = plxMotor::getInstance();
# Parcour le tableau data types
$o = array();
$o["table"] = "mcatalogue_type";
$o["out"] = "array_asso";
$tmp = $plxMotor->plxPlugins->aPlugins["spxdatas"];
$this->types = $tmp->getData($o);
# Parcour le tableau data category
$o = array();
$o["table"] = "mcatalogue_category";
$o["out"] = "array_asso";
$tmp = $plxMotor->plxPlugins->aPlugins["spxdatas"];
$this->cats = $tmp->getData($o);
# Parcour le tableau data brand
$o = array();
$o["table"] = "mcatalogue_brand";
$o["out"] = "array_asso";
$tmp = $plxMotor->plxPlugins->aPlugins["spxdatas"];
$this->brands = $tmp->getData($o);
}
/**
* Affiche la toolbar
*
* @return echo
* @author CFDEV
**/
public function show($cat) {
plxUtils::debug($_POST);
// Types
foreach($this->types as $type) {
if($_POST['type'] == $type["mcatalogue_type_id"]) $selected = 'selected';
else $selected = '';
$typesName .= '<option value="'.$type["mcatalogue_type_id"].'" '.$selected.'>'.$type["title"].'</option>';
}
// Marques
foreach($this->brands as $brand) {
if( $_POST['brand'] == $brand["mcatalogue_brand_id"]) $selected = 'selected';
else $selected = '';
$brandsName .= '<option value="'.$brand["mcatalogue_brand_id"].'" '.$selected.'>'.$brand["title"].'</option>';
}
// Orders
foreach($this->brands as $brand) {
if( $_POST['order'] == "A"){
$ordersName = '<option value="A" selected>Croissant</option>';
$ordersName .= '<option value="D">Décroissant</option>';
}
else {
$ordersName = '<option value="A">Croissant</option>';
$ordersName .= '<option value="D" selected>Décroissant</option>';
}
}
/*
<div class="form-group">
<label>Puissance (kW): </label>
<input type="number" class="form-control" placeholder="6" value="6" name="power" style="max-width:65px" >
</div>
*/
echo (
'<nav class="navbar navbar-default" id="nav-filter">
<div class="container-fluid">
<!-- mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-filter" aria-expanded="false">
<span class="sr-only">filter</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">Filtrer</span>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-filter">
<form class="navbar-form navbar-left" method="post" action="#nav-filter">
<label>Type: </label>
<select id="name" name="type" class="form-control">
<option value="">Tout</option>
'.$typesName.'
</select>
<label>Marque: </label>
<select name="brand" class="form-control">
<option value="">Toutes</option>
'.$brandsName.'
</select>
<div class="form-group">
<label>Prix: </label>
<select name="order" class="form-control">
'.$ordersName.'
</select>
<button type="valid" class="btn btn-warning">valider</button>
</div>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>');
}
} // End Class
?>