public function getSetItemRep() { $pn_set_id = $this->request->getParameter('set_id', pInteger); $t_set = new ca_sets($pn_set_id); $t_set->load($pn_set_id); $va_set_items = caExtractValuesByUserLocale($t_set->getItems(array("thumbnailVersions" => array("icon"), "checkAccess" => $this->opa_access_values))); $this->view->setVar("set_id", $pn_set_id); $pn_item_id = $this->request->getParameter('item_id', pInteger); $t_rep = new ca_object_representations($va_set_items[$pn_item_id]["representation_id"]); $va_rep_info = $t_rep->getMediaInfo("media", "mediumlarge"); $this->view->setVar("rep", $t_rep->getMediaTag("media", "mediumlarge")); $this->view->setVar("repToolBar", caRepToolbar($this->request, $t_rep, $va_set_items[$pn_item_id]["row_id"])); $this->view->setVar("representation_id", $va_set_items[$pn_item_id]["representation_id"]); $this->view->setVar("object_id", $va_set_items[$pn_item_id]["row_id"]); $pn_previous_id = 0; $pn_next_id = 0; $va_set_item_ids = array_keys($va_set_items); $vn_current_index = array_search($pn_item_id, $va_set_item_ids); if ($va_set_item_ids[$vn_current_index - 1]) { $pn_previous_id = $va_set_item_ids[$vn_current_index - 1]; } if ($va_set_item_ids[$vn_current_index + 1]) { $pn_next_id = $va_set_item_ids[$vn_current_index + 1]; } $this->view->setVar("next_item_id", $pn_next_id); $this->view->setVar("previous_item_id", $pn_previous_id); $this->render("Gallery/set_item_rep_html.php"); }
$va_related_objects_links = $t_occurrence->get("ca_objects_x_occurrences.relation_id", array("returnAsArray" => true)); if (sizeof($va_related_objects_links)) { $t_objects_x_occurrences = new ca_objects_x_occurrences(); $t_object = new ca_objects(); foreach ($va_related_objects_links as $vn_relation_id) { $t_objects_x_occurrences->load($vn_relation_id); $va_reps = $t_objects_x_occurrences->get("ca_objects_x_occurrences.representation_list", array("returnAsArray" => true, 'idsOnly' => true)); if (is_array($va_reps)) { foreach ($va_reps as $vn_i => $va_attr) { $t_rep = new ca_object_representations($va_attr['representation_list']); print "<div class='unit'>"; if ($ps_mode == "print") { print "<input type='checkbox' checked name='print_fields[]' value='rep" . $t_rep->get("representation_id") . "'> "; } # --- open in media viewer print "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'Detail', 'Object', 'GetRepresentationInfo', array('object_id' => $t_objects_x_occurrences->get("ca_objects.object_id"), 'representation_id' => $t_rep->getPrimaryKey())) . "\"); return false;' >" . $t_rep->getMediaTag('media', 'medium') . "</a>"; #print $t_rep->getMediaTag('media', 'medium'); print "</div><!-- end unit -->"; } } print "<div class='unit' style='font-size:11px; font-style:italic;'>" . caNavLink($this->request, $t_objects_x_occurrences->get("ca_objects.preferred_labels.name"), '', 'Detail', 'Object', 'Show', array('object_id' => $t_objects_x_occurrences->get("ca_objects.object_id"))); if ($va_dates = $t_objects_x_occurrences->get("ca_objects.date", array("returnAsArray" => true))) { foreach ($va_dates as $va_date_info) { if ($va_date_info["dc_dates_types"] == $vn_original_date) { print ", " . $va_date_info["dates_value"]; } } } if ($t_objects_x_occurrences->get("ca_objects.repository")) { print ", " . $t_objects_x_occurrences->get("ca_objects.repository", array('delimiter' => ', ', 'convertCodesToDisplayText' => true)); }
</div><!-- end col --> <div class='col-xs-10 col-sm-10 col-md-10 col-lg-10'> <div class="container"> <div class="row"> <div class='col-sm-12 col-md-6 col-lg-6'> <H1>{{{<unit relativeTo="ca_collections" delimiter="_➔_"><l>^ca_collections.hierarchy.preferred_labels.name</l></unit><ifcount min="1" code="ca_collections"> ➔ </ifcount>}}}{{{ca_objects.preferred_labels.name}}}</H1> </div><!-- end col --> </div><!-- end row --> <div class="row"> <div class='col-sm-12 col-md-12 col-lg-12'> <?php if ($vn_audio_rep_id) { $t_rep->load($vn_audio_rep_id); $va_annotations = $t_rep->getAnnotations(array("checkAccess" => $this->getVar("access_values"))); #print_r($va_annotations); print $t_rep->getMediaTag("media", $va_audio_media_display_info["display_version"], $va_audio_media_display_info, array("id" => "caPlayer")); } ?> <div id="detailTools"> <div class="detailTool detailToolRight"><span class="glyphicon glyphicon-share-alt"></span>{{{shareLink}}}</div><!-- end detailTool --> <?php print "<div class='detailTool'>"; if (caObjectsDisplayDownloadLink($this->request) && $vn_audio_rep_id) { # -- get version to download configured in media_display.conf $va_download_display_info = caGetMediaDisplayInfo('download', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE')); $vs_download_version = $va_download_display_info['display_version']; print caNavLink($this->request, " <span class='glyphicon glyphicon-download-alt'></span>", '', 'Detail', 'DownloadRepresentation', '', array('representation_id' => $t_rep->getPrimaryKey(), "object_id" => $t_object->get("object_id"), "download" => 1, "version" => $vs_download_version), array("title" => _t("Download"))) . " "; } print $vs_transcript_link; print "</div>"; ?>
print $vn_item_id; ?> ' class='imagecontainer'> <div class='remove'><a href='#' class='setDeleteButton' id='setItemDelete<?php print $vn_item_id; ?> '>X</a></div> <div class='setItemThumbnail'> <?php $vn_num_reps_selected = is_array($va_item['selected_representations']) ? sizeof($va_item['selected_representations']) : 0; if ($vn_num_reps_selected == 0 && $va_item['representation_tag_thumbnail']) { print caNavLink($this->request, $va_item['representation_tag_thumbnail'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id'])); } else { if ($vn_num_reps_selected > 0) { $t_rep = new ca_object_representations($va_item['selected_representations'][0]); print caNavLink($this->request, $t_rep->getMediaTag('media', 'thumbnail'), '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id'])); } } $vs_title = ''; if ($va_item['name']) { if (mb_strlen($va_item['name']) > 70) { $vs_title .= '<em>' . mb_substr($va_item['name'], 0, 67) . '...</em>'; } else { $vs_title .= '<em>' . $va_item['name'] . '</em>'; } } if ($va_item['idno']) { $vs_title .= " (" . $va_item['idno'] . ")"; } ?> </div>
$va_labels = $vo_result->getDisplayLabels($this->request); print "<div" . ($vs_class ? " class='{$vs_class}'" : "") . " style='clear:both;'>"; $t_occurrence->load($vn_occurrence_id); $vs_padding = 0; $va_related_objects_links = $t_occurrence->get("ca_objects_x_occurrences.relation_id", array("returnAsArray" => true)); if (sizeof($va_related_objects_links)) { $t_objects_x_occurrences = new ca_objects_x_occurrences(); foreach ($va_related_objects_links as $vn_relation_id) { $t_objects_x_occurrences->load($vn_relation_id); $va_reps = $t_objects_x_occurrences->get("ca_objects_x_occurrences.representation_list", array("returnAsArray" => true, 'idsOnly' => true)); if (is_array($va_reps)) { foreach ($va_reps as $vn_relation_id => $va_attr) { $t_rep = new ca_object_representations($va_attr['representation_list']); $va_info = $t_rep->getMediaInfo("media"); $vs_padding = round($va_info["thumbnail"]["HEIGHT"] / 2) - 7; print "<div class='occThumb'>" . $t_rep->getMediaTag('media', 'thumbnail') . "</div><!-- end occThumb -->"; break; } } break; } } print "<div style='padding-top:" . $vs_padding . "px;'>" . caNavLink($this->request, join($va_labels, "; "), '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_occurrence_id)); print ", " . $vo_result->get('ca_occurrences.type_id', array("convertCodesToDisplayText" => true)); if ($vo_result->get('ca_occurrences.blankWorksheet')) { print ", <span class='blankWorksheet' style='text-decoration:underline;'>Blank Worksheet*</span>"; } print "</div></div>\n"; $vn_i++; } TooltipManager::add(".blankWorksheet", "Blank worksheets are shells of lessons included here so you can customize and download them for classroom use.");
$va_audio_video_rep = array_shift($va_videos); $vn_audio_video_rep_id = $va_audio_video_rep["representation_id"]; $va_audio_video_media_display_info = caGetMediaDisplayInfo('detail', $va_audio_video_rep["mimetype"]); } elseif (sizeof($va_audios)) { $va_audio_video_rep = array_shift($va_audios); $vn_audio_video_rep_id = $va_audio_video_rep["representation_id"]; $va_audio_video_media_display_info = caGetMediaDisplayInfo('detail', $va_audio_video_rep["mimetype"]); if (sizeof($va_images)) { $va_image_rep = array_shift($va_images); $vn_image_rep_id = $va_image_rep["representation_id"]; $va_image_media_display_info = caGetMediaDisplayInfo('detail', $va_image_rep["mimetype"]); } } if ($vn_image_rep_id) { $t_rep->load($vn_image_rep_id); print "<div id='cont'>" . $t_rep->getMediaTag("media", $va_image_media_display_info["display_version"], $va_image_media_display_info) . "</div>"; } if ($vn_audio_video_rep_id) { $t_rep->load($vn_audio_video_rep_id); print $t_rep->getMediaTag("media", $va_audio_video_media_display_info["display_version"], $va_audio_video_media_display_info, array("id" => "caPlayer")); # --- get the annotations for this audio/video rep $va_annotations = $t_rep->getAnnotations(array("checkAccess" => $this->getVar("access_values"))); } ?> </div><!-- end col --> <div class='col-sm-6 col-md-6 col-lg-6'> <H4>{{{<unit relativeTo="ca_collections" delimiter="<br/>"><l>^ca_collections.preferred_labels.name</l></unit><ifcount min="1" code="ca_collections"> ➔ </ifcount>}}}{{{ca_objects.preferred_labels.name}}}</H4> <H6>{{{<unit>^ca_objects.type_id</unit>}}}</H6> <HR> {{{<ifdef code="ca_objects.idno"><H6>Identifer:</H6>^ca_objects.idno<br/></ifdef>}}}
<div id="caSetsSlideshowContainer"> <h1><?php print $t_set->getLabelForDisplay(); ?> </h1> <div id="caSetsSlideshow"> <?php if (is_array($va_items) && sizeof($va_items)) { $i = 1; $t_set_item = new ca_objects(); $t_rep = new ca_object_representations(); foreach ($va_items as $va_item) { $t_set_item->load($va_item["row_id"]); #print_r($va_item); $t_rep->load($t_set_item->getPrimaryRepresentationId()); $vs_image = $t_rep->getMediaTag("media", $vs_version); $va_media_info = $t_rep->getMediaInfo("media", $vs_version); # --- pad the top to center vertically if ($vn_public_display) { $vn_height = 450; } else { $vn_height = 600; } $vn_top_padding = round(($vn_height - $va_media_info["HEIGHT"]) / 2) . "px"; print "<div><div style='width:" . $va_media_info["WIDTH"] . "px; margin: 0px auto 0px auto; position:relative;'>"; print "<div style='padding-top: " . $vn_top_padding . "'>" . caNavLink($this->request, $vs_image, "", "Detail", "Object", "Show", array("object_id" => $va_item["object_id"])) . "</div>"; print "<div class='caSetsSlideshowCaption'>(" . $i . "/" . sizeof($va_items) . ")</br>"; if ($t_rep->get("image_credit_line")) { print "<i>" . $t_rep->get("image_credit_line") . "</i>"; } print " – © INFGM";
public function downloadCustomWorksheet() { $o_purifier = new HTMLPurifier(); $pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger); $pn_relation_id = $this->request->getParameter('relation_id', pInteger); $t_objects_x_occurrences = new ca_objects_x_occurrences($pn_relation_id); # --- get the images $pa_print_rep = $this->request->getParameter('print_reps', pArray); $va_images = array(); if (is_array($pa_print_rep)) { $t_rep = new ca_object_representations(); foreach ($pa_print_rep as $vn_i => $vn_rep_id) { $t_rep->load($vn_rep_id); $va_media_info = $t_rep->getMediaInfo('media'); $vn_height = $va_media_info["large"]["HEIGHT"]; $vn_width = $va_media_info["large"]["WIDTH"]; if ($vn_height > 900) { $vn_new_width = 900 * $vn_width / $vn_height; $vs_image = "<img src='" . $t_rep->getMediaUrl('media', 'large') . "' style='height:900px; width:" . $vn_new_width . "px;'>"; } else { $vs_image = $t_rep->getMediaTag("media", "large"); } $va_images[] = $vs_image; } } $this->view->setVar("images", $va_images); $t_lists = new ca_lists(); $vn_original_date = $t_lists->getItemIDFromList("date_types", "dateOriginal"); $vs_image_info = "<div style='font-size:11px; font-style:italic;'>" . $t_objects_x_occurrences->get("ca_objects.preferred_labels.name"); if ($va_dates = $t_objects_x_occurrences->get("ca_objects.date", array("returnAsArray" => true))) { foreach ($va_dates as $va_date_info) { if ($va_date_info["dc_dates_types"] == $vn_original_date) { $vs_image_info .= ", " . $va_date_info["dates_value"]; } } } if ($t_objects_x_occurrences->get("ca_objects.repository")) { $vs_image_info .= ", " . $t_objects_x_occurrences->get("ca_objects.repository", array('delimiter' => ', ', 'convertCodesToDisplayText' => true)); } $vs_image_info .= ", " . $t_objects_x_occurrences->get("ca_objects.idno") . "</div>"; $this->view->setVar("image_info", $vs_image_info); # --- get the attributes the user may have altered $va_info = array(); $va_attributes = $this->opa_worksheet_attributes; foreach ($va_attributes as $vs_attribute_code => $vs_title) { if ($vs_value = str_replace("\n", "<br/>", $o_purifier->purify($this->request->getParameter($vs_attribute_code, pString)))) { if ($vs_attribute_code == "title") { $va_info[$vs_attribute_code] = $vs_value; } else { $va_info[$vs_attribute_code] = "<b>" . $vs_title . "</b><br/>" . $vs_value; } } else { $va_info[$vs_attribute_code] = ""; } } $this->view->setvar("worksheet_info", $va_info); require_once __CA_LIB_DIR__ . '/core/Parsers/dompdf/dompdf_config.inc.php'; if ($vs_title = $o_purifier->purify($this->request->getParameter($vs_attribute_code, pString))) { $vs_output_filename = $vs_title; } else { $vs_output_filename = "NYSA_Custom_WorkSheet"; } $vs_output_file_name = preg_replace("/[^A-Za-z0-9\\-]+/", '_', $vs_output_filename); header("Content-Disposition: attachment; filename=export_results.pdf"); header("Content-type: application/pdf"); $vs_content = $this->render($this->ops_theme . '/custom_worksheet_html.php'); $o_pdf = new DOMPDF(); // Page sizes: 'letter', 'legal', 'A4' // Orientation: 'portrait' or 'landscape' $o_pdf->set_paper("letter", "portrait"); $o_pdf->load_html($vs_content, 'utf-8'); $o_pdf->render(); $o_pdf->stream($vs_output_file_name . ".pdf"); return; }