/** * Prefetch MIME types and media classes for representations attached to objects in this result set */ private function _prefetchMimeTypes($pa_options) { $o_db = new Db(); $va_check_access = isset($pa_options['checkAccess']) ? $pa_options['checkAccess'] : null; $vs_sql_access = ''; if (is_array($va_check_access) && sizeof($va_check_access)) { $vs_sql_access = ' AND caor.access IN (' . join(",", $va_check_access) . ')'; } $va_ids = $this->getRowIDsToPrefetch('ca_objects', $this->currentIndex(), 5); $qr_res = $o_db->query("\n\t\t\tSELECT oxor.object_id, caor.representation_id, caor.mimetype\n\t\t\tFROM ca_object_representations caor\n\t\t\tINNER JOIN ca_objects_x_object_representations AS oxor ON caor.representation_id = oxor.representation_id\n\t\t\tWHERE\n\t\t\t\toxor.object_id IN (" . join(",", $va_ids) . ") {$vs_sql_access}\n\t\t"); while ($qr_res->nextRow()) { $this->opa_mimetype_cache[(int) $qr_res->get('object_id')][$qr_res->get('mimetype')][] = (int) $qr_res->get('representation_id'); $this->opa_class_cache[(int) $qr_res->get('object_id')][caGetMediaClass($qr_res->get('mimetype'))][] = (int) $qr_res->get('representation_id'); } return true; }
while ($vn_item_count < $vn_items_per_page && $vo_result->nextHit()) { $vn_object_id = $vo_result->get('object_id'); $va_labels = $vo_result->getDisplayLabels(); $vs_caption = ""; foreach ($va_labels as $vs_label) { $vs_caption .= $vs_label; } # --- get the height of the image so can calculate padding needed to center vertically if ($vo_result->get("ca_objects.object_status") != 348) { $va_media_info = $vo_result->getMediaInfo('ca_object_representations.media', 'thumbnail', null, array('checkAccess' => $va_access_values)); $vn_padding_top = 0; $vn_padding_top_bottom = (130 - $va_media_info["HEIGHT"]) / 2; } $va_media_info_orig = $vo_result->getMediaInfo('ca_object_representations.media', 'original'); $vs_video_icon = ""; if (caGetMediaClass($va_media_info_orig["MIMETYPE"]) == "video") { $vs_video_icon = "<div class='videoIconResults'><!-- empty --></div>"; } print "<td align='center' valign='top' class='searchResultTd'>" . caNavLink($this->request, $vs_video_icon, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "<div class='searchThumbBg searchThumbnail" . $vn_object_id . "' style='padding: " . $vn_padding_top_bottom . "px 0px " . $vn_padding_top_bottom . "px 0px;'>"; if ($vo_result->get("ca_objects.object_status") != 348) { print caNavLink($this->request, $vo_result->getMediaTag('ca_object_representations.media', 'thumbnail', array('checkAccess' => $va_access_values)), '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)); $this->setVar('tooltip_no_image', 0); } else { print "<div class='imagePlaceholderThumb'>Image not available</div>"; $this->setVar('tooltip_no_image', 1); } // Get thumbnail caption $this->setVar('object_id', $vn_object_id); $this->setVar('caption_title', $vs_caption); $this->setVar('caption_idno', $vo_result->get("ca_objects.idno")); $this->setVar('tooltip_caption', $vo_result->get("ca_objects.caption"));