protected function getAllItemInfo() { $va_info = parent::getAllItemInfo(); if ($this->getTableName() == 'ca_objects' && is_array($va_info) && sizeof($va_info) > 0) { $t_object = new ca_objects($va_info['object_id']['value']); if (!$t_object->getPrimaryKey()) { return $va_info; } // include number of 'likes' (comments) $va_info['likes'] = (int) $t_object->getNumComments(null); // include copyright holder $vs_copyright_holder = $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => 'copyright')); if ($vs_copyright_holder) { $va_info['copyright_holder'] = $vs_copyright_holder; } // include urls for reference img $va_objects = $t_object->getRelatedItems('ca_objects', array('restrictToRelationshipTypes' => 'reference')); if (!is_array($va_objects) || sizeof($va_objects) != 1) { return $va_info; } $va_object = array_shift($va_objects); $t_rel_object = new ca_objects($va_object['object_id']); $va_rep = $t_rel_object->getPrimaryRepresentation(array('preview170', 'medium', 'alhalqa1000', 'alhalqa2000')); if (!is_array($va_rep) || !is_array($va_rep['urls'])) { return $va_info; } $va_info['reference_image_urls'] = $va_rep['urls']; } return $va_info; }
public function testGets() { $vm_ret = $this->opt_object->get('ca_objects.type_id', array('convertCodesToDisplayText' => true)); $this->assertEquals('Image', $vm_ret); // there are two internal notes but we assume that only the current UI locale is returned, unless we explicitly say otherwise $vm_ret = $this->opt_object->get('ca_objects.internal_notes'); $this->assertEquals("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ullamcorper sapien nec velit porta luctus.", $vm_ret); $vm_ret = $this->opt_object->get('internal_notes'); $this->assertEquals("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ullamcorper sapien nec velit porta luctus.", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.external_link.url_source'); $this->assertEquals("My URL source;Another URL source", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.dimensions.dimensions_length'); $this->assertEquals("10.0 in", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.dimensions.dimensions_weight'); $this->assertEquals("2.0000 lb", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.integer_test', array('delimiter' => ' / ')); $this->assertEquals("23 / 1984", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.currency_test'); $this->assertEquals("USD 100.00", $vm_ret); $vm_ret = $this->opt_object->get('ca_objects.georeference'); $this->assertRegExp("/^1600 Amphitheatre Parkway, Mountain View, CA \\[[\\d\\.\\,\\-]+\\]/", $vm_ret); // This is how we fetch the bundle preview for containers: $vs_template = "<unit relativeTo='ca_objects.dimensions'><if rule='^measurement_notes =~ /foo/'>^ca_objects.dimensions.dimensions_length</if></unit>"; $vm_ret = $this->opt_object->getAttributesForDisplay('dimensions', $vs_template); $this->assertEquals('10.0 in', $vm_ret); // shouldn't return anything because the expression is false $vs_template = "<unit relativeTo='ca_objects.dimensions'><if rule='^measurement_notes =~ /bar/'>^ca_objects.dimensions.dimensions_length</if></unit>"; $vm_ret = $this->opt_object->getAttributesForDisplay('dimensions', $vs_template); $this->assertEmpty($vm_ret); // 'flat' informationservice attribues $this->assertEquals('Coney Island', $this->opt_object->get('ca_objects.tgn')); $this->assertContains('Aaron Burr', $this->opt_object->get('ca_objects.wikipedia')); // new subfield notation $this->assertContains('Burr killed his political rival Alexander Hamilton in a famous duel', $this->opt_object->get('ca_objects.wikipedia.abstract')); // informationservice attributes in container $this->assertEquals('[500024253] Haring, Keith (Persons, Artists) - American painter, muralist, and cartoonist, 1958-1990', $this->opt_object->get('ca_objects.informationservice.ulan_container')); $this->assertContains('Aaron Burr', $this->opt_object->get('ca_objects.informationservice.wiki')); $this->assertContains('Burr killed his political rival Alexander Hamilton in a famous duel', $this->opt_object->get('ca_objects.informationservice.wiki.abstract')); }
protected function search($pa_bundles = null) { $va_return = parent::search($pa_bundles); if ($this->getTableName() == 'ca_objects' && is_array($va_return['results']) && sizeof($va_return['results']) > 0) { $pb_only_with_likes = (bool) $this->opo_request->getParameter('likesOnly', pInteger); foreach ($va_return['results'] as $vn_k => &$va_result) { $t_object = new ca_objects($va_result['object_id']); if (!$t_object->getPrimaryKey()) { continue; } // include number of 'likes' (comments) $va_result['likes'] = (int) $t_object->getNumComments(null); if ($pb_only_with_likes && !$va_result['likes']) { unset($va_return['results'][$vn_k]); continue; } // include copyright holder $vs_copyright_holder = $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => 'copyright')); if ($vs_copyright_holder) { $va_result['copyright_holder'] = $vs_copyright_holder; } // include urls for reference img $va_objects = $t_object->getRelatedItems('ca_objects', array('restrictToRelationshipTypes' => 'reference')); if (!is_array($va_objects) || sizeof($va_objects) != 1) { continue; } $va_object = array_shift($va_objects); $t_rel_object = new ca_objects($va_object['object_id']); $va_rep = $t_rel_object->getPrimaryRepresentation(array('preview170', 'medium', 'alhalqa1000', 'alhalqa2000')); if (!is_array($va_rep) || !is_array($va_rep['urls'])) { continue; } $va_result['reference_image_urls'] = $va_rep['urls']; } if ($this->opo_request->getParameter('sort', pString) == 'likes') { if (strtolower($this->opo_request->getParameter('sortDirection', pString)) == 'asc') { usort($va_return['results'], function ($a, $b) { return $a['likes'] - $b['likes']; }); } else { // default is desc usort($va_return['results'], function ($a, $b) { return $b['likes'] - $a['likes']; }); } } } return $va_return; }
/** * Returns content for overlay containing details for object representation */ private function _renderMediaView($ps_view_name, $ps_media_context) { $pn_object_id = $this->request->getParameter('object_id', pInteger); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); $pn_year = $this->request->getParameter('year', pInteger); $this->view->setVar("year", $pn_year); $va_periods = $this->ops_periods; $this->view->setVar('object_id', $pn_object_id); $t_object = new ca_objects($pn_object_id); # --- get caption and photocredit $this->view->setVar("caption", $t_object->get("description")); $this->view->setVar("photographer", $t_object->get("provenance")); $t_rep = new ca_object_representations($pn_representation_id); $this->view->setVar('representation_id', $pn_representation_id); $this->view->setVar('t_object_representation', $t_rep); if ($this->request->config->get("dont_enforce_access_settings")) { $va_access_values = array(); } else { $va_access_values = caGetUserAccessValues($this->request); } if (!$t_object->getPrimaryKey()) { die("Invalid object_id"); } if (!$t_rep->getPrimaryKey()) { die("Invalid representation_id"); } if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) { die("Invalid object_id"); } if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) { die("Invalid rep_id"); } $this->view->setVar('t_display_rep', $t_rep); // Get media for display using configured rules $va_rep_display_info = caGetMediaDisplayInfo($ps_media_context, $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE')); // set version $this->view->setVar('display_version', $va_rep_display_info['display_version']); // set other options $this->view->setVar('display_options', $va_rep_display_info); // Get all representation as icons for navigation # --- do a search for all chronology image objects # --- determine the period from the year foreach ($va_periods as $i => $va_per_info) { if ($pn_year >= $va_per_info["start"] && $pn_year <= $va_per_info["end"]) { $vn_period = $i; break; } } # --- what is year to search by? $vn_y = ""; if ($va_periods[$vn_period]["displayAllYears"] == 1) { $vn_y = $va_periods[$vn_period]["start"] . "-" . $va_periods[$vn_period]["end"]; } else { $vn_y = $pn_year; } # --- get type is for chron images $t_list = new ca_lists(); $vn_chron_images_type_id = $t_list->getItemIDFromList('object_types', 'chronology_image'); $o_obj_search = new ObjectSearch(); $qr_chron_images = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_chron_images_type_id}", array("sort" => "ca_objects.date.parsed_date", "no_cache" => !$this->opb_cache_searches)); $va_thumbnails = array(); if ($qr_chron_images->numHits() > 0) { $t_image_objects = new ca_objects(); $i = 1; while ($qr_chron_images->nextHit()) { $t_image_objects->load($qr_chron_images->get("ca_objects.object_id")); if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) { $va_temp = array(); if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) { $va_temp["representation_id"] = $t_primary_rep->get("representation_id"); $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon'); $va_temp["rep_tiny"] = $t_primary_rep->getMediaTag('media', 'tinyicon'); $va_temp["object_id"] = $qr_chron_images->get("ca_objects.object_id"); $va_thumbnails[$qr_chron_images->get("ca_objects.object_id")] = $va_temp; if ($vn_getNext == 1) { $this->view->setVar("next_object_id", $qr_chron_images->get("object_id")); $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id")); $vn_getNext = 0; } if ($qr_chron_images->get("object_id") == $pn_object_id) { $this->view->setVar("representation_index", $i); $this->view->setVar("previous_object_id", $vn_prev_obj_id); $this->view->setVar("previous_representation_id", $vn_prev_rep_id); $vn_getNext = 1; } $vn_prev_obj_id = $qr_chron_images->get("object_id"); $vn_prev_rep_id = $t_primary_rep->get("representation_id"); $i++; } } } } $this->view->setVar('reps', $va_thumbnails); return $this->render("Chronology/{$ps_view_name}.php"); }
$vn_highest_level = end($vn_parent_ids); $t_top_level = new ca_collections($vn_highest_level); $vs_collection_link = "<p>" . caNavLink($this->request, $t_top_level->get('ca_collections.preferred_labels'), '', 'Detail', 'collections', $vn_highest_level) . "</p>"; } } if ($vs_table == 'ca_objects') { if ($qr_res->get('ca_objects.type_id') == 25) { $va_icon = "<i class='glyphicon glyphicon-volume-up'></i>"; } elseif ($qr_res->get('ca_objects.type_id') == 26) { $va_icon = "<i class='glyphicon glyphicon-film'></i>"; } elseif ($qr_res->get('ca_objects.type_id') == 30 && !$qr_res->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))) { $va_icon = "<i class='glyphicon glyphicon-book'></i>"; } elseif ($qr_res->get('ca_objects.type_id') == 1903) { $vn_parent_id = $qr_res->get('ca_objects.parent_id'); $t_copy = new ca_objects($vn_parent_id); if (!$t_copy->get('ca_object_representations.media.medium', array('checkAccess' => $va_access_values))) { $va_icon = "<i class='glyphicon glyphicon-book'></i>"; } else { $va_icon = ""; } } elseif ($qr_res->get('ca_objects.type_id') == 23 && !$qr_res->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))) { $va_icon = "<i class='fa fa-archive'></i>"; } elseif ($qr_res->get('ca_objects.type_id') == 24 && !$qr_res->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))) { $va_icon = "<i class='fa fa-archive'></i>"; } elseif ($qr_res->get('ca_objects.type_id') == 27 && !$qr_res->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))) { $va_icon = "<i class='fa fa-archive'></i>"; } else { $va_icon = ""; } if ($qr_res->get('ca_objects.type_id') == 1903) { $vs_rep_detail_link = caDetailLink($this->request, $va_icon . $t_copy->get('ca_object_representations.media.medium', array('checkAccess' => $va_access_values)), '', $vs_table, $vn_parent_id);
public function testChildrenGet() { $t_object = new ca_objects(); $this->assertTrue($t_object->load(array('idno' => $this->ops_object_idno)), "Could not load test record"); // // Get intrinsic field from children // $vs_value = 'CIHP.TEST.1; CIHP.TEST.2'; $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => false, 'returnAllLocales' => false, 'delimiter' => '; ')); $this->assertInternalType("string", $va_val, "Returned value should be string"); $this->assertEquals($vs_value, $va_val, "Returned value is incorrect"); $vs_value = 'CIHP.TEST.1'; $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => true, 'returnAllLocales' => false)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0"); $this->assertContains($vs_value, $va_val, "Value in array is incorrect"); $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => true, 'returnAllLocales' => true)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Second level of returned value should be array"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Third level of returned value should be array"); $va_val = array_shift($va_val); $this->assertContains($vs_value, $va_val, "Value in array is incorrect"); // // Get preferred labels from children // $vs_value = 'Canonical test sub-record No. 1; Canonical test sub-record No. 2'; $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => false, 'returnAllLocales' => false, 'delimiter' => '; ')); $this->assertInternalType("string", $va_val, "Returned value should be string"); $this->assertEquals($vs_value, $va_val, "Returned value is incorrect"); $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => true, 'returnAllLocales' => false)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0"); $vs_value = 'Canonical test sub-record No. 1'; $this->assertContains($vs_value, $va_val, "Value in array is incorrect"); $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => true, 'returnAllLocales' => true)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Second level of returned value should be array"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Third level of returned value should be array"); $this->assertContains($vs_value, $va_val, "Value in array is incorrect"); // // Get attributes from children // $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => false, 'returnAllLocales' => false)); $this->assertInternalType("string", $va_val, "Returned value should be string"); $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => true, 'returnAllLocales' => false)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should greater than 0"); $this->assertArrayHasKey('description', $va_tmp = array_shift($va_val), "Returned array should have key 'description'"); $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => true, 'returnAllLocales' => true)); $this->assertInternalType("array", $va_val, "Returned value should be array"); $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Second level of returned value should be array"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Third level of returned value should be array"); $va_val = array_shift($va_val); $this->assertInternalType("array", $va_val, "Fourth level of returned value should be array"); $this->assertArrayHasKey('description', $va_val, "Returned array should have key 'description'"); }
</div><!-- end col 12--> </div><!-- end row --> <div class="row"> <div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'> <div class="row"> <?php $va_related_artworks = $t_item->get('ca_objects.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'returnAsArray' => true)); foreach ($va_related_artworks as $vn_id => $va_related_artwork) { $t_object = new ca_objects($va_related_artwork); $va_reps = $t_object->getPrimaryRepresentation(array('versions' => 'medium'), null, array("checkAccess" => $va_access_values, 'scaleCSSHeightTo' => '260px', 'scaleCSSWidthTo' => '220px')); print "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6 relatedLoan'>"; print "<div class='loanImg'>" . caNavLink($this->request, $va_reps['tags']['medium'], '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</div>"; print "<div class='lotCaption'>"; print "<p>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . caNavLink($this->request, "<i>" . $t_object->get('ca_objects.preferred_labels') . "</i>, " . $t_object->get('ca_objects.creation_date'), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . $t_object->get('ca_objects.medium') . "</p>"; print "<p>" . $t_object->get('ca_objects.dimensions.display_dimensions') . "</p>"; if ($this->request->user->hasUserRole("founders_new") || $this->request->user->hasUserRole("admin") || $this->request->user->hasUserRole("curatorial_all_new") || $this->request->user->hasUserRole("curatorial_basic_new") || $this->request->user->hasUserRole("archives_new") || $this->request->user->hasUserRole("library_new")) { print "<p>" . $t_object->get('ca_objects.idno') . "</p>"; } print "</div><!-- end lotCaption -->"; print "</div>"; } ?> </div><!-- end row --> </div><!-- end col 6--> <div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>
$va_related_objects = $qr_res->get('ca_objects.object_id', array('returnAsArray' => true)); $va_first_object_id = $va_related_objects[0]; $t_object = new ca_objects($va_first_object_id); $va_rep = $t_object->get('ca_object_representations.media.small'); if ($t_object->get('ca_object_representations.media.small')) { $va_cell_width = "style='width:auto'"; #$va_cell_width = "style='width:".$t_object->get('ca_object_representations.media.small.width')."px;'"; } else { $va_cell_width = "style='width:180px;'"; } } else { if ($vs_table == "ca_collections") { $va_related_objects = $qr_res->get('ca_objects.object_id', array('returnAsArray' => true)); $va_first_object_id = $va_related_objects[0]; $t_object = new ca_objects($va_first_object_id); $va_rep = $t_object->get('ca_object_representations.media.small'); if ($t_object->get('ca_object_representations.media.small')) { $va_cell_width = "style='width:auto'"; #$va_cell_width = "style='width:".$t_object->get('ca_object_representations.media.small.width')."px;'"; } else { $va_cell_width = "style='width:180px;'"; } } else { $va_rep = $qr_res->get('ca_object_representations.media.small'); if ($qr_res->get('ca_object_representations.media.small')) { $va_cell_width = "style='width:auto'"; #$va_cell_width = "style='width:".$qr_res->get('ca_object_representations.media.small.width')."px;'"; } else { $va_cell_width = "style='width:180px;'"; } }
public function Index() { $va_participate_ids = array(); $t_participate = new ca_sets(); # --- participate set - set name assigned in eastend.conf - plugin conf file $t_participate->load(array('set_code' => $this->opo_plugin_config->get('participate_set_name'))); # Enforce access control on set if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_participate->get("access"), $this->opa_access_values)) { $this->view->setVar('participate_set_id', $t_participate->get("set_id")); $va_participate_ids = array_keys(is_array($va_tmp = $t_participate->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array()); // These are the entity ids in the set } # --- loop through featured ids and grab the object's image $t_object = new ca_objects(); $va_participate_images = array(); foreach ($va_participate_ids as $vn_participate_object_id) { $va_tmp = array(); $t_object->load($vn_participate_object_id); $va_tmp["object_id"] = $vn_participate_object_id; $va_image = $t_object->getPrimaryRepresentation(array("mediumlarge")); # --- don't show records with status ars/vaga don't show image if ($t_object->get("ca_objects.object_status") != 348) { if ($t_object->get("ca_objects.object_status") == 349) { $va_tmp["vaga_class"] = "vagaDisclaimer"; } $va_tmp["image"] = $va_image["tags"]["mediumlarge"]; $va_tmp["caption"] = $t_object->get("ca_objects.caption"); $va_tmp["title"] = $t_object->getLabelForDisplay(); } $va_participate_images[$vn_participate_object_id] = $va_tmp; } $this->view->setVar("participate_images", $va_participate_images); $this->render('participate_html.php'); }
$t_featured = new ca_sets(); $t_featured->load(array('set_code' => 'featuredSet')); $va_set_items = $t_featured->getItems(); ?> <div id="featuredSlideshow"> <div class='blockTitle'>Featured Items</div> <div class='blockFeatured scrollBlock' > <div class='scrollingDiv'><div class='scrollingDivContent'> <?php foreach ($va_set_items as $va_set_id => $va_set_item_a) { foreach ($va_set_item_a as $va_set_item_id => $va_set_item) { $va_object_id = $va_set_item['row_id']; $t_object = new ca_objects($va_object_id); $va_image_width = $t_object->get('ca_object_representations.media.mediumlarge.width'); print "<div class='featuredObject' style='width:{$va_image_width}px;'>"; print "<div class='featuredObjectImg'>"; print caNavLink($this->request, $t_object->get('ca_object_representations.media.mediumlarge'), '', '', 'Detail', 'objects/' . $va_object_id); print "</div>"; print "<div class='artwork'>"; print $va_set_item['caption']; print "</div>"; print "</div>"; } } ?> </div><!-- scrollingDivContent --></div><!-- scrollingdiv --> </div><!-- block Featured --> <div class='clearfix'></div>
<?php $vn_count = 0; $t_object = new ca_objects($vn_object_id); $thumb_rep = $t_object->getPrimaryRepresentation(array('preview')); // Skip first few columns as needed if ($vn_count < $vn_start) { $vn_count++; continue; } if ($tr_count == 0) { print "<tr>"; } $vs_display_value = $t_display->getDisplayValue($vo_result, $vn_placement_id, array('forReport' => true, 'purify' => true)); print "<td valign='bottom' align='center' width='100'><table cellpadding='0' cellspacing='0' width='100' height='100%' align='center' border='0'><tr align='center' border='0' valign='middle'><td align='center' border='0' valign='middle' style='text-align:center;'>" . $thumb_rep["tags"]["preview"]; print "</td></tr><tr valign='bottom' align='center'><td nowrap='wrap' border='0' align='center' style='word-wrap: break-word; width: 150px; background-color:#eee;' border='1px solid #ccc;'>" . $t_object->get('ca_objects.preferred_labels') . "<br/>" . $t_object->get('ca_objects.idno') . "<br/>" . $t_object->get('ca_collections.preferred_labels'); print "</td></tr></table></td>"; $vn_count++; if ($tr_count == 4) { print "</tr>"; $tr_count = 0; } else { $tr_count++; } if ($vn_count >= $vn_start + 6) { break; } ?> <?php
</div> <?php if (!$this->request->config->get('dont_allow_registration_and_login')) { ?> <div class="dontmiss noh2 yellowbar"> <h1><a href="local-studies.html">My Favourites</a></h1> <?php if ($this->request->isLoggedIn()) { # --- get the last item added to the users sets $o_db = new Db(); $qr_set_item = $o_db->query("\n\t\t\t\t\t\t\t\tSELECT csi.row_id\n\t\t\t\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\t\t\t\tINNER JOIN ca_set_items AS csi ON cs.set_id = csi.set_id\n\t\t\t\t\t\t\t\tWHERE cs.user_id = ?\n\t\t\t\t\t\t\t\tORDER BY csi.item_id DESC\n\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t", $this->request->getUserID()); if ($qr_set_item->numRows() > 0) { while ($qr_set_item->nextRow()) { $t_lastSetObject = new ca_objects($qr_set_item->get("row_id")); if (in_array($t_lastSetObject->get("access"), $va_access_values)) { $vn_lastSetObjectId = $qr_set_item->get("row_id"); $vs_lastSetObjectLabel = $t_lastSetObject->get("preferred_labels"); $va_reps = $t_lastSetObject->getPrimaryRepresentation(array('icon'), null, array('return_with_access' => $va_access_values)); $vs_lastSetObjectIcon = $va_reps["tags"]["icon"]; $vs_lastSetObjectIconLink = caNavLink($this->request, $vs_lastSetObjectIcon, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_lastSetObjectId)); } } } if ($vs_lastSetObjectIconLink) { print $vs_lastSetObjectIconLink; } else { print '<a href="local-studies.html"><img src="' . $this->request->getThemeUrlPath() . '/graphics/bookicon.jpg" alt="" title="" /></a>'; } ?> <p>Click <?php
} ?> </div> <?php if ($va_item['idno']) { $va_title[] = '<span class="resultidno">' . $va_item['idno'] . "</span>"; } if ($va_item['name']) { if (unicode_strlen($va_item['name']) > 70) { $va_title[] = '<em>' . unicode_substr($va_item['name'], 0, 67) . '...</em>'; } else { $va_title[] = '<em>' . $va_item['name'] . '</em>'; } } $t_set_item->load($va_item['row_id']); if ($t_set_item->get("ca_objects.date.display_date")) { $va_title[] = $t_set_item->get("ca_objects.date.display_date"); } if ($t_set_item->get("ca_objects.technique")) { $va_title[] = $t_set_item->get("ca_objects.technique"); } $vs_caption = join('<br/>', $va_title); ?> <div id='caption<?php print $vn_item_id; ?> ' class='setItemCaption'><?php print caNavLink($this->request, $vs_caption, '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id'])); ?> </div>
?> <div id="featuredHeader">Featured Objects</div> <div class="textContent"> <?php print $this->render('Favorites/favorites_intro_text_html.php'); ?> </div><!-- end textContent --> <div class="favoritesColumn" id="featuredCol"> <div id="scrollFeatured"> <div id="scrollFeaturedContainer"> <?php $vn_featured_count = 0; if (is_array($this->getVar("featured")) && sizeof($this->getVar("featured")) > 0) { foreach ($this->getVar("featured") as $vn_object_id => $vs_thumb) { if ($vn_featured_count <= 4) { $va_featured_desc = $t_object->get("ca_objects.description"); $va_featured_description = substr($va_featured_desc, 0, 485); ?> <div id="featuredWrapper"> <div id="featuredImage"><table><tr><td><?php print caNavLink($this->request, $vs_thumb, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)); ?> </td></tr></table></div><div id="featuredText"><div id="featuredTextTitle"><?php print $vs_featured_content_label; ?> </div> <?php print $va_featured_description; if (strlen($va_featured_desc) > 480) { print "..."; }
$vs_caption = $vs_label_artist . $vs_label_detail_link . $vs_collection_link . $vs_type_link . $vs_date_link . $vs_art_idno_link . $vs_library_info . $vs_deaccessioned; if ($q_set_items->get('ca_objects.type_id') == 25) { $va_icon = "<i class='glyphicon glyphicon-volume-up'></i>"; } elseif ($q_set_items->get('ca_objects.type_id') == 26) { $va_icon = "<i class='glyphicon glyphicon-film'></i>"; } elseif ($q_set_items->get('ca_objects.type_id') == 1903) { $vn_parent_id = $q_set_items->get('ca_objects.parent_id'); $t_copy = new ca_objects($vn_parent_id); } else { $va_icon = ""; } if ($va_icon && ($q_set_items->get('ca_objects.type_id') == 25 || !$q_set_items->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values)))) { $va_icon = "<div class='lbSetImgPlaceholder'>" . $va_icon . "</div>"; } if ($q_set_items->get('ca_objects.type_id') == 1903) { $vs_rep = $va_icon . $t_copy->get('ca_object_representations.media.medium', array('checkAccess' => $va_access_values)); #$vs_rep_detail_link = caDetailLink($this->request, $va_icon.$t_copy->get('ca_object_representations.media.medium', array('checkAccess' => $va_access_values)), '', $vs_table, $vn_parent_id); } elseif ($q_set_items->get('ca_objects.type_id') == 25) { $vs_rep = $va_icon; #$vs_rep_detail_link = caDetailLink($this->request, $va_icon, '', $vs_table, $vn_id); } else { $vs_rep = $va_icon . $q_set_items->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values)); #$vs_rep_detail_link = caDetailLink($this->request, $va_icon.$q_set_items->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values)), '', $vs_table, $vn_id); } print "<div class='col-xs-6 col-sm-4 col-md-3 col-lg-3 lbItem" . $t_set_item->get("item_id") . "' id='row-" . $q_set_items->get("object_id") . "'><div class='lbItemContainer'>"; print caLightboxSetDetailItem($this->request, $q_set_items->get('ca_objects.type_id') == 1903 ? $t_copy : $q_set_items, $t_set_item, array("write_access" => $vb_write_access, "caption" => $vs_caption, "representation" => $vs_rep)); print "</div></div><!-- end col 3 -->"; $vn_c++; } } } else {
foreach ($va_items as $vn_i => $va_item) { $t_item = new ca_objects($va_item["row_id"]); $t_set_item = new ca_set_items($va_item["item_id"]); ?> <section> <h3><?php print $va_item['name']; ?> </h3> <p style="float:left; width:50%"><?php print $va_item['representation_tag_medium']; ?> </p> <p style="float:right; width:50%"> <div><?php print $t_item->get("ca_objects.dateSet.setDisplayValue"); ?> </div> <div><?php print $t_item->get("ca_entities", array("delimiter" => "<br/>")); ?> </div> <?php # --- comments $va_comments = $t_set_item->getComments(); if (sizeof($va_comments)) { $t_author = new ca_users(); ?> <div><br/><strong><small><?php print sizeof($va_comments) . " " . (sizeof($va_comments) == 1 ? _t("comment") : _t("comments")); ?>
} } if ($this->getVar("featured_set_id")) { $t_featured_set = new ca_sets($this->getVar("featured_set_id")); ?> <div id="contentcontainer"> <div id="objectcontainerHP"> <div class="homeIntro">Navigate through some of the collections of Nova Scotia's community museums to learn about the province's past, and share your own stories and information about what is important to you.</div><!-- end home intro --> <div id="objectslidesContainerHP"> <?php # --- featured objects foreach ($va_item_media as $vn_object_id => $va_media) { if ($va_media['urls']['frontpage']) { $vs_image_tag = $va_media["tags"]["frontpage"]; $t_title_object = new ca_objects($vn_object_id); $va_repo_name = $t_title_object->get('ca_entities.preferred_labels', array("restrictToRelationshipTypes" => array("repository"), "checkAccess" => $va_access_values)); print "<div>"; print "<div class='objectslidesHP'>" . caNavLink($this->request, $vs_image_tag, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . ""; print "<div class='objectslidesCaptionHP'><b>" . _t("Featured Item") . "</b><br/>" . caNavLink($this->request, $va_item_labels[$vn_object_id], '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . " from the " . $va_repo_name . "</div></div>"; print "</div>"; } } # --- featured member inst if ($vs_featured_member_image) { print "<div>"; print "<div class='objectslidesHP'>" . caNavLink($this->request, $vs_featured_member_image, '', 'Detail', 'Entity', 'Show', array('entity_id' => $vn_featured_member_id)) . ""; print "<div class='objectslidesCaptionHP'><b>" . _t("Featured Member") . "</b><br/>" . caNavLink($this->request, $vs_featured_member_name, '', 'Detail', 'Entity', 'Show', array('entity_id' => $vn_featured_member_id)) . "</div></div>"; print "</div>"; } # --- share your knowledge if ($vs_featured_share_image) {
<![endif]--> </head> <body> <div class="reveal"> <?php print caNavLink($this->request, _t("Back to Lightbox"), "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id")), array("style" => "font-size:14px; padding:20px;")); ?> <!-- Any section element inside of this container is displayed as a slide --> <div class="slides"> <?php foreach ($va_items as $vn_i => $va_item) { $t_object = new ca_objects($va_item['row_id']); ?> <section> <h3><?php print $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))); ?> </h3> <h3><?php print "<i>" . $va_item['name'] . "</i>"; ?> </h3> <p><?php print $va_item['representation_tag_mediumlarge']; ?> </p> <h3><?php print $va_item['idno']; ?> </h3> </section>
</div><!-- end rightCol --> <?php if (sizeof($va_featured_object)) { foreach ($va_featured_object as $va_featured_object_info) { $vn_featured_object_id = $va_featured_object_info["object_id"]; break; } $t_object = new ca_objects($vn_featured_object_id); $vs_media = $t_object->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values)); $ca_lists = new ca_lists(); ?> <div id="leftCol"> <?php print "<div id='featuredMedia'>" . $vs_media . "</div>"; # --- get caption for object $vs_caption = $t_object->get("ca_objects.image_caption.image_caption_text"); if (!$vs_caption) { $vs_caption = $t_object->getLabelForDisplay(); } print "<br/>" . $vs_caption; ?> </div><!-- end leftCol --> <?php } ?> <div style="clear:both;"><!-- empty --></div> </div><!-- end productionTopArea --> <?php } if ($qr_hits->numHits()) { if (!$this->request->isAjax()) {
</div><!--end row--> <div class="row"> <div class="col-sm-12"> <?php switch ($ps_view) { case "info": default: ?> <div class="thumbnail thumbnailImgLeft"> <?php $va_objects = $t_item->get("ca_objects", array("restrictToRelationshipTypes" => array("used_website"), "returnAsArray" => true, "checkAccess" => $va_access_values)); foreach ($va_objects as $va_object) { $t_object = new ca_objects($va_object["object_id"]); print $t_object->get("ca_object_representations.media.mediumlarge"); ?> <div class="caption"><?php print sefaFormatCaption($this->request, $t_object); ?> </div> <?php } ?> </div> <!--end thumbnail--> <p> <h1>{{{ca_occurrences.preferred_labels.name}}}</h1> {{{<ifdef code="ca_occurrences.exhibition_subtitle"> <h2>^ca_occurrences.exhibition_subtitle</h2> </ifdef>}}} <h4>{{{^ca_occurrences.opening_closing}}}{{{<ifdef code="ca_occurrences.opening_reception"> | Opening Reception: ^ca_occurrences.opening_reception</ifdef>}}}</h4>
/** * Return array containing information about all hierarchies, including their root_id's * For non-adhoc hierarchies such as places, this call returns the contents of the place_hierarchies list * with some extra information such as the # of top-level items in each hierarchy. * * For an ad-hoc hierarchy like that of an object, there is only ever one hierarchy to display - that of the current object. * So for adhoc hierarchies we just return a single entry corresponding to the root of the current object hierarchy */ public function getHierarchyList($pb_dummy = false) { $vn_pk = $this->getPrimaryKey(); $vs_template = $this->getAppConfig()->get('ca_objects_hierarchy_browser_display_settings'); if (!$vn_pk) { $o_db = new Db(); if (is_array($va_type_ids = caMergeTypeRestrictionLists($this, array())) && sizeof($va_type_ids)) { $qr_res = $o_db->query("\n\t\t\t\t\tSELECT o.object_id, count(*) c\n\t\t\t\t\tFROM ca_objects o\n\t\t\t\t\tINNER JOIN ca_objects AS p ON p.parent_id = o.object_id\n\t\t\t\t\tWHERE o.parent_id IS NULL AND o.type_id IN (?)\n\t\t\t\t\tGROUP BY o.object_id\n\t\t\t\t", array($va_type_ids)); } else { $qr_res = $o_db->query("\n\t\t\t\t\tSELECT o.object_id, count(*) c\n\t\t\t\t\tFROM ca_objects o\n\t\t\t\t\tINNER JOIN ca_objects AS p ON p.parent_id = o.object_id\n\t\t\t\t\tWHERE o.parent_id IS NULL\n\t\t\t\t\tGROUP BY o.object_id\n\t\t\t\t"); } $va_hiers = array(); $va_object_ids = $qr_res->getAllFieldValues('object_id'); $qr_res->seek(0); $va_labels = $this->getPreferredDisplayLabelsForIDs($va_object_ids); while ($qr_res->nextRow()) { $va_hiers[$vn_object_id = $qr_res->get('object_id')] = array('object_id' => $vn_object_id, 'item_id' => $vn_object_id, 'name' => caProcessTemplateForIDs($vs_template, 'ca_objects', array($vn_object_id)), 'hierarchy_id' => $vn_object_id, 'children' => (int) $qr_res->get('c')); } return $va_hiers; } else { // return specific object as root of hierarchy $vs_label = $this->getLabelForDisplay(false); $vs_hier_fld = $this->getProperty('HIERARCHY_ID_FLD'); $vs_parent_fld = $this->getProperty('PARENT_ID_FLD'); $vn_hier_id = $this->get($vs_hier_fld); if ($this->get($vs_parent_fld)) { // currently loaded row is not the root so get the root $va_ancestors = $this->getHierarchyAncestors(); if (!is_array($va_ancestors) || sizeof($va_ancestors) == 0) { return null; } $t_object = new ca_objects($va_ancestors[0]); } else { $t_object =& $this; } $va_children = $t_object->getHierarchyChildren(null, array('idsOnly' => true)); $va_object_hierarchy_root = array($t_object->get($vs_hier_fld) => array('object_id' => $vn_pk, 'item_id' => $vn_pk, 'name' => $vs_name = caProcessTemplateForIDs($vs_template, 'ca_objects', array($vn_pk)), 'hierarchy_id' => $vn_hier_id, 'children' => sizeof($va_children))); return $va_object_hierarchy_root; } }
<a href="#" onclick="showOverlayForItem(<?php print $va_item['item_id']; ?> ); return false;"> <div class="setItemContainer"> <div class="setItem" id="item<?php print $va_item['item_id']; ?> "><?php print $va_item['representation_tag_widepreview']; ?> <br/></div> <div class="setItemCaption"> <?php print "<b>" . $t_object->get("ca_objects.preferred_labels") . "</b><br/>"; print "ID: " . $t_object->get("ca_objects.idno") . "<br/>"; print "Date: " . $t_object->get("ca_objects.date") . "<br/>"; print "Runtime: " . $t_object->get("ca_objects.length"); ?> </div> </div></a> <?php if ($va_item['caption'] || $va_item['representation_tag_medium']) { // set view vars for tooltip $this->setVar('tooltip_image_name', $t_object->get("ca_objects.preferred_labels")); $this->setVar('tooltip_text', "ID: " . $t_object->get("ca_objects.idno") . "<br/>Date: " . $t_object->get("ca_objects.date") . "<br/>Runtime: " . $t_object->get("ca_objects.length")); $this->setVar('tooltip_image', $va_item['representation_tag_medium']); TooltipManager::add("#item{$va_item['item_id']}", $this->render('default/tooltip_html.php'));
{{{<ifdef code="ca_places.description"><br/>^ca_places.description<br/></ifdef>}}}<br/> <?php print "<p>" . caNavLink($this->request, _t("View all related objects"), "btn btn-default", "", "Browse", "objects", array("facet" => "place_facet", "id" => $t_item->get("place_id"))) . "</p>"; $t_object_thumb = new ca_objects(); $va_entities = $t_item->get("ca_entities", array("returnAsArray" => true, "checkAccess" => $va_access_values)); if (sizeof($va_entities)) { if (sizeof($va_entities) == 1) { print "<H6>Related person/organisation</H6>"; } else { print "<H6>Related people/organisations</H6>"; } $t_rel_entity = new ca_entities(); foreach ($va_entities as $va_entity) { $t_rel_entity->load($va_entity["entity_id"]); $t_object_thumb->load($t_rel_entity->get("ca_objects.object_id", array("restrictToRelationshipTypes" => array("cover"), "checkAccess" => $va_access_values))); $vs_thumb = $t_object_thumb->get("ca_object_representations.media.icon", array("checkAccess" => $va_access_values)); if ($vs_thumb) { print "<div class='row'><div class='col-sm-3 col-md-3 col-lg-3'>" . $vs_thumb . "</div>\n"; print "<div class='col-sm-9 col-md-9 col-lg-9'>\n"; } print $t_rel_entity->getWithTemplate("<b><l>^ca_entities.preferred_labels.displayname</l></b>"); if ($vs_brief_description = $t_rel_entity->get("ca_entities.brief_description")) { print "<br/>" . $vs_brief_description; } if ($vs_thumb) { print "</div></div><!-- end row -->"; } else { print "<br/>"; } print "<br/>"; }
{{{<ifdef code="ca_objects.description"><h6>Description</h6>^ca_objects.description<br/></ifdef>}}} {{{<ifdef code="ca_objects.courtesy"><div class='unit'><h6>Courtesy<h6><span class='metaFloat'>^ca_objects.courtesy</span></div></ifdef>}}} {{{<ifdef code="ca_objects.rights.rightsText"><div class='unit'><h6>Rights</h6><span class='metaFloat'>^ca_objects.rights.rightsText</span></div></ifdef>}}} <?php if ($vs_entities = $t_object->get("ca_entities", array('delimiter' => '<br/>', 'template' => '^preferred_labels (^relationship_typename)', "returnAsLink" => true))) { print "<div class='unit'><H6>" . _t('Related Entities') . "</H6> <span class='metaData'>{$vs_entities}</span></div><!-- end unit -->"; } if ($t_object->get('type_id') == 21) { $va_children = $t_object->getHierarchyChildren(null, array('idsOnly' => true)); print "<div class='unit rings'><h6><b>" . _t("Rings") . "</b></h6>"; foreach ($va_children as $va_child_key => $va_child_id) { $t_ring = new ca_objects($va_child_id); print caNavLink($this->request, $t_ring->get("ca_objects.preferred_labels.name"), '', '', 'Detail', 'objects/' . $va_child_id) . "<br/>"; } print "</div>"; } ?> </div><!-- end col --> </div><!-- end row --></div><!-- end container --> </div><!-- end col --> <div class='navLeftRight col-xs-1 col-sm-1 col-md-1 col-lg-1'> <div class="detailNavBgRight"> {{{nextLink}}} </div><!-- end detailNavBgLeft --> </div><!-- end col --> </div><!-- end row -->
<H4>Loan</H4> <H6></H6> </div><!-- end col 12--> </div><!-- end row --> <div class="row"> <div class='col-xs-12 col-sm-7 col-md-6 col-lg-6'> <div class="row"> <?php $va_related_artworks = $t_item->get('ca_objects.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'returnAsArray' => true)); foreach ($va_related_artworks as $vn_id => $va_related_artwork) { $t_object = new ca_objects($va_related_artwork); $va_reps = $t_object->getPrimaryRepresentation(array('versions' => 'medium'), null, array("checkAccess" => $va_access_values, 'scaleCSSHeightTo' => '260px', 'scaleCSSWidthTo' => '220px')); print "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6 relatedLoan'>"; print "<div class='loanImg'>" . caNavLink($this->request, $va_reps['tags']['medium'], '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</div>"; print "<div class='lotCaption'>"; print "<p>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . caNavLink($this->request, "<i>" . $t_object->get('ca_objects.preferred_labels') . "</i>, " . $t_object->get('ca_objects.creation_date'), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>"; print "<p>" . $t_object->get('ca_objects.medium') . "</p>"; print "<p>" . $t_object->get('ca_objects.dimensions.display_dimensions') . "</p>"; if ($this->request->user->hasUserRole("founders_new") || $this->request->user->hasUserRole("admin") || $this->request->user->hasUserRole("curatorial_all_new") || $this->request->user->hasUserRole("curatorial_basic_new") || $this->request->user->hasUserRole("archives_new") || $this->request->user->hasUserRole("library_new")) { print "<p>" . $t_object->get('ca_objects.idno') . "</p>"; } print "</div><!-- end lotCaption -->"; print "</div>"; } ?> </div><!-- end row --> </div><!-- end col 6--> <div class='col-xs-12 col-sm-5 col-md-6 col-lg-6'> {{{<ifcount code="ca_entities" min="1" relativeTo="ca_entities" restrictToRelationshipTypes="borrower" ><div class="unit"><span class='metaTitle'>Borrower: </span><span class="meta"><unit relativeTo="ca_entities" delimiter="<br/>" restrictToRelationshipTypes="borrower"><l>^ca_entities.preferred_labels.displayname</l></unit></span></div></ifcount>}}}
public function getFeaturedArtistSlideshow() { $va_featured_ids = array(); $t_featured = new ca_sets(); # --- featured artists set - set name assigned in eastend.conf - plugin conf file $t_featured->load(array('set_code' => $this->opo_plugin_config->get('featured_artists_set_name'))); # Enforce access control on set if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_featured->get("access"), $this->opa_access_values)) { $this->view->setVar('featured_set_id', $t_featured->get("set_id")); $va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array()); // These are the entity ids in the set } if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) { # put random entities in the features variable $o_db = new Db(); $q_entities = $o_db->query("SELECT e.entity_id from ca_entities e WHERE e.access IN (" . implode($this->opa_access_values, ", ") . ") ORDER BY RAND() LIMIT 10"); if ($q_entities->numRows() > 0) { while ($q_entities->nextRow()) { $va_featured_ids[] = $q_entities->get("entity_id"); } } } # --- loop through featured ids and grab the entity's name, portrait, lifespan -lifespans_date, indexing_notes (brief description abouthow they relate to the east end) $t_entity = new ca_entities(); $t_object = new ca_objects(); $va_featured_artists = array(); foreach ($va_featured_ids as $vn_featured_entity_id) { $va_tmp = array(); $t_entity->load($vn_featured_entity_id); $va_tmp["entity_id"] = $vn_featured_entity_id; $va_tmp["lifespan"] = $t_entity->get("lifespans_date"); $va_tmp["indexing_notes"] = $t_entity->get("indexing_notes"); $va_tmp["name"] = $t_entity->getLabelForDisplay(); $va_objects = $t_entity->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $this->opa_access_values, 'restrict_to_relationship_types' => array('portrait'))); $va_object = array_shift($va_objects); $t_object->load($va_object["object_id"]); $va_portrait = $t_object->getPrimaryRepresentation(array("abSlideShow")); # --- don't show records with status ars/vaga don't show image if ($t_object->get("ca_objects.object_status") != 348) { if ($t_object->get("ca_objects.object_status") == 349) { $va_tmp["vaga_class"] = "vagaDisclaimer"; } $va_tmp["image"] = $va_portrait["tags"]["abSlideShow"]; $va_tmp["caption"] = $t_object->get("ca_objects.caption"); } $va_featured_artists[$vn_featured_entity_id] = $va_tmp; } $this->view->setVar("featured_artists", $va_featured_artists); $this->render('featured_artists_html.php'); }
<h1>Artists by Last Name</h1> <?php //$o_artist_search = new ObjectSearch(); //$qr_artists = $o_artist_search->search("ca_entities.preferred_labels.displayname/artist:*"); $o_db = new Db(); $qr_res = $o_db->query("\n\t\t\tSELECT DISTINCT e.entity_id FROM ca_entities e\n\t\t\tINNER JOIN ca_entity_labels AS el ON el.entity_id = e.entity_id\n\t\t\tINNER JOIN ca_objects_x_entities AS oxe ON e.entity_id = oxe.entity_id\n\t\t\tWHERE\n\t\t\t\toxe.type_id = 103 AND e.deleted = 0 AND el.is_preferred = 1\n\t\t\tORDER BY\n\t\t\t\tel.surname, el.forename\n\t\t"); $qr_artists = caMakeSearchResult('ca_entities', $qr_res->getAllFieldValues('entity_id')); $va_artists = array(); while ($qr_artists->nextHit()) { $va_has_artwork = false; if ($qr_artists->get('ca_objects', array('restrictToRelationshipTypes' => 'artist', 'checkAccess' => $va_access_values))) { $va_artworks = $qr_artists->get('ca_objects', array('restrictToRelationshipTypes' => 'artist', 'checkAccess' => $va_access_values, 'returnAsArray' => true)); foreach ($va_artworks as $vn_artwork_key => $va_artwork) { $vn_artwork_id = $va_artwork['object_id']; $t_object = new ca_objects($vn_artwork_id); if ($t_object->get('ca_objects.type_id') == 28) { $va_has_artwork = true; } } if ($va_has_artwork == true) { $va_first_letter = substr($qr_artists->get('ca_entities.preferred_labels.surname'), 0, 1); $va_artists[$va_first_letter][] = $qr_artists->get('ca_entities.preferred_labels.displayname', array('returnAsLink' => true)); } } } #print "<pre>"; #print_r($va_artists); #print "<pre>"; foreach ($va_artists as $va_letter_key => $va_artist_name) { print "<div class='letterMenu'><a href='#" . $va_letter_key . "'>" . $va_letter_key . "</a></div>"; }
/** * */ public function SaveTransaction() { $ps_item_list = $this->request->getParameter('item_list', pString); $pa_item_list = json_decode($ps_item_list, true); $t_checkout = new ca_object_checkouts(); $va_ret = array('status' => 'OK', 'errors' => array(), 'checkins' => array()); foreach ($pa_item_list as $vn_i => $va_item) { if ($t_checkout->load($va_item['checkout_id'])) { $vn_object_id = $t_checkout->get('object_id'); $t_object = new ca_objects($vn_object_id); if ($t_checkout->isOut()) { try { $t_checkout->checkin($vn_object_id, $va_item['note'], array('request' => $this->request)); $t_user = new ca_users($t_checkout->get('user_id')); $vs_user_name = $t_user->get('ca_users.fname') . ' ' . $t_user->get('ca_users.lname'); $vs_borrow_date = $t_checkout->get('ca_object_checkouts.checkout_date', array('timeOmit' => true)); if ($t_checkout->numErrors() == 0) { $va_ret['checkins'][] = _t('Returned <em>%1</em> (%2) borrowed by %3 on %4', $t_object->get('ca_objects.preferred_labels.name'), $t_object->get('ca_objects.idno'), $vs_user_name, $vs_borrow_date); } else { $va_ret['errors'][] = _t('Could not check in <em>%1</em> (%2): %3', $t_object->get('ca_objects.preferred_labels.name'), $t_object->get('ca_objects.idno'), join("; ", $t_checkout->getErrors())); } } catch (Exception $e) { $va_ret['errors'][] = _t('<em>%1</em> (%2) is not out', $t_object->get('ca_objects.preferred_labels.name'), $t_object->get('ca_objects.idno')); } } else { $va_ret['errors'][] = _t('<em>%1</em> (%2) is not out', $t_object->get('ca_objects.preferred_labels.name'), $t_object->get('ca_objects.idno')); } } } $this->view->setVar('data', $va_ret); $this->render('checkin/ajax_data_json.php'); }
#$va_media_array = array_slice($va_media_array, 0); $i = 0; foreach ($va_item_media as $vn_object_id => $va_media) { # print "<pre>"; # print_r($va_media); # print "</pre>"; if ($i != 0) { $t_object = new ca_objects($vn_object_id); $vs_image_tag = $va_media["tags"]["widepreview"]; print "<div class='featuredImg'>" . caNavLink($this->request, $vs_image_tag, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)); print "<div class='featuredTitleSmall'>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div></div>"; } else { $t_object = new ca_objects($vn_object_id); print "<div id='hpFeatured'>"; print "<div class='featuredImg' style='margin-bottom:5px'>" . caNavLink($this->request, $va_media["tags"]["splashpic"], '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div>"; print "<div class='featuredTitle'>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div>"; print "</div>"; } if ($i == 3) { print "<div style='clear:both;height:0px; width:100%'></div>"; } $i++; } ?> <div id="newsList" style="width:200px; margin-top:30px;"> <div class="item detail"> <?php # print $this->render('Splash/splash_intro_text_html.php'); ?>
/** * Download single representation from currently open object */ public function DownloadRepresentation() { if (!caObjectsDisplayDownloadLink($this->request)) { $this->postError(1100, _t('Cannot download media'), 'DetailController->DownloadMedia'); return; } $vn_object_id = $this->request->getParameter('object_id', pInteger); $t_object = new ca_objects($vn_object_id); $pn_representation_id = $this->request->getParameter('representation_id', pInteger); $ps_version = $this->request->getParameter('version', pString); $this->view->setVar('representation_id', $pn_representation_id); $t_rep = new ca_object_representations($pn_representation_id); $this->view->setVar('t_object_representation', $t_rep); $va_versions = $t_rep->getMediaVersions('media'); if (!in_array($ps_version, $va_versions)) { $ps_version = $va_versions[0]; } $this->view->setVar('version', $ps_version); $va_rep_info = $t_rep->getMediaInfo('media', $ps_version); $this->view->setVar('version_info', $va_rep_info); $va_info = $t_rep->getMediaInfo('media'); $vs_idno_proc = preg_replace('![^A-Za-z0-9_\\-]+!', '_', $t_object->get('idno')); switch ($this->request->user->getPreference('downloaded_file_naming')) { case 'idno': $this->view->setVar('version_download_name', $vs_idno_proc . '.' . $va_rep_info['EXTENSION']); break; case 'idno_and_version': $this->view->setVar('version_download_name', $vs_idno_proc . '_' . $ps_version . '.' . $va_rep_info['EXTENSION']); break; case 'idno_and_rep_id_and_version': $this->view->setVar('version_download_name', $vs_idno_proc . '_representation_' . $pn_representation_id . '_' . $ps_version . '.' . $va_rep_info['EXTENSION']); break; case 'original_name': default: if ($va_info['ORIGINAL_FILENAME']) { $va_tmp = explode('.', $va_info['ORIGINAL_FILENAME']); if (sizeof($va_tmp) > 1) { if (strlen($vs_ext = array_pop($va_tmp)) < 3) { $va_tmp[] = $vs_ext; } } $this->view->setVar('version_download_name', str_replace(" ", "_", join('_', $va_tmp) . '.' . $va_rep_info['EXTENSION'])); } else { $this->view->setVar('version_download_name', $vs_idno_proc . '_representation_' . $pn_representation_id . '_' . $ps_version . '.' . $va_rep_info['EXTENSION']); } break; } // // Perform metadata embedding if ($vs_path = caEmbedMetadataIntoRepresentation($t_object, $t_rep, $ps_version)) { $this->view->setVar('version_path', $vs_path); } else { $this->view->setVar('version_path', $t_rep->getMediaPath('media', $ps_version)); } $this->response->sendHeaders(); $vn_rc = $this->render('Details/object_representation_download_binary.php'); $this->response->sendContent(); if ($vs_path) { unlink($vs_path); } return $vn_rc; }