-
Notifications
You must be signed in to change notification settings - Fork 0
/
trump_card.php
280 lines (202 loc) · 12.8 KB
/
trump_card.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $this->inc('inc/topIncludes.php'); ?>
<div id="system-cener-body" class="pageType-default pageType-subpage keyBenefits pageType-trumpCard">
<!--start of main content section-->
<div class="thirdSecBg">
<div class="container">
<div class="row">
<div class="mapBg">
<div class="col-md-8">
<div class="mainContentBg trumpTopSection">
<div class="mainContentHead">
<?php
$page = Page::getCurrentPage();
?>
<h2><?php echo $page->getCollectionName(); ?></h2>
<!--mainContentHead-->
</div>
<div class="mainContentSec main-content">
<!-- get image back here -->
<?php $a = new Area ('company image'); $a->display($c); ?>
<!--mainContentSec-->
</div>
<!--mainContentBg-->
</div>
<div class="mainContentBg">
<div class="mainContentSec main-content">
<?php $a = new Area ('main'); $a->display($c); ?>
<!--mainContentSec-->
</div>
<!--mainContentBg-->
</div>
<!--col-md-8-->
</div>
<div class="col-md-4">
<div class="contact-us-section sideForm">
<?php $a = new Area ('form side'); $a->display($c); ?>
<script>
$( ".sideForm h3" ).click(function() {
$( ".formblock" ).slideToggle( "slow" );
});
</script>
</div>
<?php
Loader::model('page_list');
$nh = Loader::helper('navigation');
$pl = new PageList();
$th = Loader::helper('text');
$ih = Loader::helper('image');
$pl->filterByAttribute('not_visable_in_search', '0'); // if this is not selected
$pl->filterByCollectionTypeHandle("trump_card");
$pl->sortByDisplayOrder();
//$pl->sortByMultiple('p1.cParentID ASC, p1.cDisplayOrder ASC'); //<--this might work better for sorting if the pages are scattered throughout the site
$pagelist = $pl->get();
$total = $pl->getTotal();
$randomPage = rand(1,$total);
foreach ($pagelist as $page) {
/* olny get back trump card for current page */
if ($page->getCollectionID() == Page::getCurrentPage()->getCollectionID()) {
$lowToHigh = "";
$fleetSizeNumber = "";
$rawSaving = $page->getAttribute('saving');
$saving = $rawSaving;
$saving = preg_replace('/[^0-9]+/', '', $saving); // remove any letters leaving number only
if ($rawSaving == "") {
$rawSaving = "N/A";
}
if ($saving != "") {
$lowToHigh = "data-myorder='$saving'";
}
$companyName = $page->getAttribute('company_name');
if ($companyName == "") { $companyName = "No company name yet"; }
$companyIndustry = $page->getAttribute('company_Industry');
if ($companyIndustry == "") { $companyIndustry = "No company industry yet"; }
$fleetSize = $page->getAttribute('fleet_size');
$fleetSizeNumber = $fleetSize;
$fleetSizeNumber = preg_replace('/[^0-9]+/', '', $fleetSizeNumber); // remove any letters leaving number only
if ($fleetSize == "") { $fleetSize = "No company fleet size yet"; }
$yearlyMileage = $page->getAttribute('yearly_mileage');
if ($yearlyMileage == "") { $yearlyMileage = "No yearly mileage yet"; }
$keyBenefits = $page->getAttribute('key_benefits');
if ($keyBenefits == "") { $keyBenefits = "No key benefits yet"; }
$companyIndustryRaw = $companyIndustry;
$companyIndustry = preg_replace('/\s+/', '', $companyIndustry); // remove all whitespace to fix class name
echo '<a class="linkToCompany clearfix width100" href="' . $nh->getLinkToCollection($page) . '">';
?>
<div class="trumpCardBG">
<div class="trumpCard">
<div class="trumpCardTop">
<div class="companyLogo">
<?php
$img = $page->getAttribute('logo_image');
if ($img) {
$thumb = $ih->getThumbnail($img, 350, 125, FALSE);
?><img src="<?php echo $thumb->src ?>" width="<?php echo $thumb->width ?>" height="<?php echo $thumb->height ?>" alt="logo image" /><?php
}
else {
?><img src="<?php echo $this->getThemePath()?>/img/noImage.jpg" width="<?php echo $thumb->width ?>" height="<?php echo $thumb->height ?>" alt="no image" /><?php
}
?>
</div> <!--companyLogo-->
</div> <!--trumpCardTop-->
<div class="trumpTextOutside">
<div class="trumpText">
<span class="trumpCardInfoLeft">Company Name:</span>
<span class="trumpCardInfoRight"><?php echo $companyName; ?></span>
</div>
<div class="trumpText"><span class="trumpCardInfoLeft">Industry:</span>
<span class="trumpCardInfoRight"><?php echo $companyIndustryRaw; ?></span></div>
<div class="trumpText">
<span class="trumpCardInfoLeft">Fleet Size:</span>
<span class="trumpCardInfoRight"><?php echo $fleetSize; ?></span>
</div>
<div class="trumpText">
<span class="trumpCardInfoLeft">Yearly Mileage:</span>
<span class="trumpCardInfoRight"><?php echo $yearlyMileage; ?></span>
</div>
<div class="trumpText">
<span class="trumpCardInfoLeft">Savings Using GTrak:</span>
<span class="trumpCardInfoRight"><!-- £ --><?php echo $rawSaving; ?></span>
</div>
<div class="trumpText">
<span class="trumpCardInfoLeft">Key Benefits:</span>
<span class="trumpCardInfoRight"><?php echo $keyBenefits; ?></span>
</div>
</div>
</div> <!--trumpCard-->
</div>
<?php
echo '</a>'; // link to company wrap close
} // if $i = random page
} // foreach
?>
</div> <!--col-md-4-->
</div> <!--thisBg-->
</div> <!--row-->
</div> <!--container-->
</div> <!--thirdSecBg-->
<div class="greyWrap">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Key Benefits of Vehicle Tracking</h2>
</div> <!--col-md-12-->
</div> <!--row-->
</div> <!--container-->
</div> <!--greyWrap-->
<!--start of benefit icons-->
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="iconBenefits">
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/hand.png" alt="hand"/>
<p>Increase productivity
& efficiency.</p>
</div>
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/gasStation.png" alt="Gas Station"/>
<p>Reduce labour & fuel costs.</p>
</div>
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/truck.png" alt="truck"/>
<p>Monitor driving behaviour.</p>
</div>
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/smile.png" alt="Customer service"/>
<p>Improve customer service.</p>
</div>
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/firstAid.png" alt="Health and Safety"/>
<p>Improved health & safety standards.</p>
</div>
<div class="iconImages">
<img src="<?php echo $this->getThemePath()?>/processAndBuild/stylesheets/images/spanner.png" alt="maintenance"/>
<p>Monitor vehicle maintenance records.</p>
</div>
</div> <!--iconBenefits-->
</div> <!--col-md-12-->
</div> <!--row-->
</div> <!--container-->
</div> <?php //close pageType-default ?>
<script type="text/javascript">
//fix overflow breaking trump card
$(window).resize(test_overflow);
function test_overflow()
{
sections= $(".trumpTextOutside")[0];
if(overflow(sections))
{
$(".trumpCard").addClass("overflow");
}
else
{
$(".trumpCard").removeClass("overflow");
}
}
function overflow(element)
{
return element.offsetHeight < element.scrollHeight;
}
test_overflow();
</script>
<?php $this->inc('inc/bottomIncludes.php'); ?>