-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfunctions.php
93 lines (76 loc) · 3.04 KB
/
functions.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
<?php
function centerrow_random_featured_records_html($recordType, $featuredRecords, $countStart)
{
$html = '';
$i = $countStart;
if ($featuredRecords) {
foreach ($featuredRecords as $featuredRecord) {
$html .= get_view()->partial('common/featured.php', array('recordType' => $recordType, 'featuredRecord' => $featuredRecord, 'slideCount' => $i));
$i++;
}
}
if ($recordType == 'exhibit') {
$html = apply_filters('exhibit_builder_display_random_featured_exhibit', $html);
}
return $html;
}
function centerrow_get_random_featured_records($recordType, $num = 0, $hasImage = true)
{
return get_records($recordType, array('featured' => 1,
'sort_field' => 'random',
'hasImage' => $hasImage), $num);
}
function centerrow_featured_html() {
$recordTypes = ['Exhibit', 'Collection', 'Item'];
$html = '';
$countStart = 1;
foreach ($recordTypes as $recordType) {
if ($recordType == 'Exhibit' && !plugin_is_active('ExhibitBuilder')) {
continue;
}
$randomRecords = null;
$randomRecords = centerrow_get_random_featured_records($recordType);
if ((get_theme_option("Display Featured $recordType") !== '0') && ($randomRecords !== null)) {
$html .= centerrow_random_featured_records_html(strtolower($recordType), $randomRecords, $countStart);
$countStart = $countStart + count($randomRecords);
}
}
return $html;
}
function centerrow_check_for_featured_records() {
$recordTypes = ['Exhibit', 'Collection', 'Item'];
$featuredPresent = false;
foreach ($recordTypes as $recordType) {
if (get_theme_option('display_featured_' . strtolower($recordType)) == '1') {
if ($recordType == 'Exhibit' && !plugin_is_active('ExhibitBuilder')) {
continue;
}
$randomRecords = centerrow_get_random_featured_records($recordType);
if (count($randomRecords) > 0) {
$featuredPresent = true;
break;
}
}
}
return $featuredPresent;
}
function centerrow_get_square_thumbnail_url($file, $view) {
if ($file->hasThumbnail()) {
$squareThumbnail = file_display_url($file, 'square_thumbnail');
} else {
$mimeType = $file->mime_type;
$fileType = (strpos($mimeType, 'image')) ? 'image' : 'video';
$squareThumbnail = $view->baseUrl() . '/application/views/scripts/images/fallback-' . $fileType . '.png';
}
return $squareThumbnail;
}
function centerrow_public_nav_main() {
$view = get_view();
$nav = new Omeka_Navigation;
$nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);
$nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME);
$html = $view->navigation()->menu($nav)->setPartial('common/accessible-megamenu.php')->render();
$view->navigation()->menu($nav)->setPartial(null);
return $html;
}
?>