-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcustom.php
More file actions
32 lines (29 loc) · 1.03 KB
/
custom.php
File metadata and controls
32 lines (29 loc) · 1.03 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
<?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);
$exhibitImage = get_db()->getTable('File')->findWithImages($exhibitItem[0]->id, 0);
if ($exhibitImage) {
$html = 'style="background-image:url(\'';
$html .= file_display_url($exhibitImage, 'original');
$html .= '\')"';
return $html;
} else {
return;
}
}
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;
}
}
?>