forked from chnm/mall-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcustom.php
More file actions
43 lines (40 loc) · 1.36 KB
/
custom.php
File metadata and controls
43 lines (40 loc) · 1.36 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
<?php
function mall_exhibit_background($exhibit)
{
if (!$exhibit) {
$exhibit = get_current_record($exhibit);
}
$exhibitId = $exhibit->id;
$exhibitItem = get_records('Item', array('exhibit' => $exhibitId, 'random' => true, 'has files' => true), 1);
if (!empty($exhibitItem)) {
$exhibitImage = get_db()->getTable('File')->findWithImages($exhibitItem[0]->id, 0);
} else {
return;
}
if ($exhibitImage) {
$html = 'style="background-image:url(\'';
$html .= file_display_url($exhibitImage, 'original');
$html .= '\')"';
return $html;
}
}
function mall_sort_events($firstPeriodItem, $secondPeriodItem) {
if (element_exists('Item Type Metadata', 'Event Sort Date')) {
$firstDate = metadata($firstPeriodItem, array('Item Type Metadata', "Event Sort Date"));
$secondDate = metadata($secondPeriodItem, array('Item Type Metadata', "Event Sort Date"));
if ($firstDate == $secondDate) return 0;
return ($firstDate < $secondDate) ? -1 : 1;
} else {
return;
}
}
function default_index_bg()
{
$headerImage = get_theme_option('index_background_image');
if ($headerImage) {
$storage = Zend_Registry::get('storage');
$headerImage = $storage->getUri($storage->getPathByType($headerImage, 'theme_uploads'));
return $headerImage;
}
}
?>