public function loadTypeSpecificValueFromRow($pa_value_array)
 {
     $this->opn_occurrence_id = $pa_value_array['value_integer1'];
     require_once __CA_MODELS_DIR__ . '/ca_occurrences.php';
     $t_occ = new ca_occurrences($this->opn_occurrence_id);
     $this->ops_text = $t_occ->getLabelForDisplay() . ($t_occ->get("idno") ? " [" . $t_occ->get("idno") . "]" : "");
 }
Esempio n. 2
0
 public function Index()
 {
     $t_occurrence = new ca_occurrences();
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     # --- get the most viewed occ records
     $va_occ_info = array();
     $va_most_viewed_occs = $t_occurrence->getMostViewedItems(3, array('checkAccess' => $va_access_values));
     foreach ($va_most_viewed_occs as $vn_occurrence_id => $va_occ_info) {
         $t_occurrence->load($vn_occurrence_id);
         $va_occ_info['title'] = $t_occurrence->getLabelForDisplay();
         $va_preview_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "widepreview", "showMediaInfo" => false, "returnAsArray" => true));
         if (sizeof($va_preview_stills) > 0) {
             $va_occ_info["mediaPreview"] = array_shift($va_preview_stills);
         }
         $va_medium_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "medium", "showMediaInfo" => false, "returnAsArray" => true));
         if (sizeof($va_medium_stills) > 0) {
             $va_occ_info["mediaMedium"] = array_shift($va_medium_stills);
         }
         $va_occ_info["repository"] = $t_occurrence->get("CLIR2_institution", array('convertCodesToDisplayText' => true));
         $va_most_viewed_occs[$vn_occurrence_id] = $va_occ_info;
     }
     $this->view->setVar('most_viewed_occs', $va_most_viewed_occs);
     $this->render('Engage/engage_index_html.php');
 }
Esempio n. 3
0
 public function setItemInfo()
 {
     $va_access_values = caGetUserAccessValues($this->request);
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets($pn_set_id);
     $this->view->setVar('set_id', $pn_set_id);
     $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger);
     $t_set_item = new ca_set_items($pn_set_item_id);
     $va_set_item_info = array();
     $va_items = $t_set->getItemIDs(array("checkAccess" => $va_access_values));
     $pn_previous_id = "";
     foreach ($va_items as $vn_item_id => $va_item_info) {
         if ($va_set_item_info["item_id"]) {
             $va_set_item_info["next_id"] = $vn_item_id;
             break;
         }
         if ($pn_set_item_id == $vn_item_id) {
             $va_set_item_info["previous_id"] = $pn_previous_id;
             $va_set_item_info["item_id"] = $vn_item_id;
         }
         $pn_previous_id = $vn_item_id;
     }
     $va_set_item_info["item_id"] = $t_set_item->get("item_id");
     $va_set_item_info["info"] = $va_rep[0]['info'];
     $va_set_item_info["label"] = $t_set_item->getLabelForDisplay();
     $va_set_item_info["description"] = $t_set_item->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLineBreaks' => true));
     $va_set_item_info["row_id"] = $t_set_item->get("row_id");
     $t_occurrence = new ca_occurrences($t_set_item->get("row_id"));
     $va_set_item_info["label"] = $t_occurrence->getLabelForDisplay();
     $va_mediumlarge_stills = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_media', array('version' => "mediumlarge", "showMediaInfo" => false, "returnAsArray" => true));
     if (sizeof($va_mediumlarge_stills) > 0) {
         $va_set_item_info["media_still"] = array_shift($va_mediumlarge_stills);
         $va_image_caption = $t_occurrence->get('ca_occurrences.ic_stills.ic_stills_credit', array("returnAsArray" => true));
         $vs_image_caption = array_shift($va_image_caption);
         if ($vs_image_caption) {
             $va_set_item_info["media_still_caption"] = $vs_image_caption;
         }
     }
     if ($vs_video = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_media', array('version' => 'original', 'showMediaInfo' => false, 'viewer_width' => 580, 'viewer_height' => 450, 'poster_frame_version' => 'mediumlarge'))) {
         $va_set_item_info["media_video"] = $vs_video;
         if ($vs_video_caption = $t_occurrence->get('ca_occurrences.ic_moving_images.ic_moving_images_credit')) {
             $va_set_item_info["media_video_caption"] = $vs_video_caption;
         }
     }
     $this->view->setVar('item_info', $va_set_item_info);
     $this->render('Exhibits/ajax_item_info_html.php');
 }
         while ($q_obj->nextRow()) {
             $va_related_obj_idnos[] = $q_obj->get("ca_objects.idno");
         }
     }
     $t_occ->load($q_occs->get('occurrence_id'));
     $vs_venue = "";
     $va_venues = array();
     $va_venues = $t_occ->get('ca_entities', array('restrict_to_relationship_types' => array('primary_venue'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
     if (sizeof($va_venues) > 0) {
         $va_venue_name = array();
         foreach ($va_venues as $va_venue_info) {
             $va_venue_name[] = $va_venue_info["displayname"];
         }
         $vs_venue = implode($va_venue_name, ", ");
     }
     $va_sorted_occurrences[$q_occs->get('ca_occurrences.type_id')][$q_occs->get('occurrence_id')] = array("label" => $t_occ->getLabelForDisplay(), "date" => $t_occ->get("ca_occurrences.date.display_date"), "year_published" => $t_occ->get("ca_occurrences.bib_year_published"), "venue" => $vs_venue, "bib_full_citation" => $t_occ->get("ca_occurrences.bib_full_citation"), "idno" => $t_occ->get("ca_occurrences.idno"), "source_info" => caUnserializeForDatabase($va_occurrence['source_info']), "status" => $t_occ->get("ca_occurrences.status"), "object_idno" => join(", ", $va_related_obj_idnos));
 }
 krsort($va_sorted_occurrences);
 foreach ($va_sorted_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
     $vs_title = "";
     switch ($va_item_types[$vn_occurrence_type_id]['idno']) {
         case "bibliography":
             $vs_title = "Bibliography";
             break;
             # --------------------------------------
         # --------------------------------------
         case "exhibition":
             $vs_title = $va_item_types[$vn_occurrence_type_id]['name_singular'] . (sizeof($va_occurrence_list) > 1 ? "s" : "");
             break;
             # --------------------------------------
     }
 function RefineSearch()
 {
     $vs_refine = "";
     $pn_entity_id = $this->request->getParameter('entity_id', pInteger);
     $this->view->setVar('entity_id', $pn_entity_id);
     $t_entity = new ca_entities($pn_entity_id);
     $this->view->setVar('entity_name', $t_entity->getLabelForDisplay());
     if ($pn_entity_id) {
         $vs_refine = " AND ca_entities.entity_id:" . $pn_entity_id;
     }
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger);
     $this->view->setVar('occurrence_id', $pn_occurrence_id);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $this->view->setVar('occurrence_name', $t_occurrence->getLabelForDisplay());
     if ($pn_occurrence_id) {
         $vs_refine = " AND ca_occurrences.occurrence_id:" . $pn_occurrence_id;
     }
     # --- style school
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     $this->view->setVar('item_id', $pn_item_id);
     $t_list_item = new ca_list_items($pn_item_id);
     $this->view->setVar('style_school_name', $t_list_item->getLabelForDisplay());
     if ($pn_item_id) {
         $vs_refine = " AND ca_objects.style_school:" . $pn_item_id;
     }
     $vn_y = $this->ops_date_range;
     $va_period_data = array();
     $o_obj_search_refine = new ObjectSearch();
     $qr_objects_refine = $o_obj_search_refine->search("ca_objects.creation_date:\"" . $vn_y . "\" AND (ca_object.object_status:349 OR ca_object.object_status:347 OR ca_object.object_status:193)" . $vs_refine, array("sort" => "ca_objects.creation_date", "no_cache" => !$this->opb_cache_searches, "checkAccess" => $this->opa_access_values));
     $va_object_ids = array();
     while ($qr_objects_refine->nextHit()) {
         $va_object_ids[] = $qr_objects_refine->get("ca_objects.object_id");
     }
     $qr_objects_refine->seek(0);
     $this->opo_result_context->setAsLastFind();
     $this->opo_result_context->setResultList($va_object_ids);
     $this->opo_result_context->setParameter("period", $this->opn_period);
     $this->opo_result_context->saveContext();
     $va_period_data["objects"] = $qr_objects_refine;
     $this->view->setVar('period_data', $va_period_data);
     $this->render('chronology_object_results_html.php');
 }
Esempio n. 6
0
 /**
  * Returns name of hierarchy for currently loaded row or, if specified, row identified by optional $pn_id parameter
  */
 public function getHierarchyName($pn_id = null)
 {
     if (!$pn_id) {
         $pn_id = $this->getPrimaryKey();
     }
     $va_ancestors = $this->getHierarchyAncestors($pn_id, array('idsOnly' => true));
     if (is_array($va_ancestors) && sizeof($va_ancestors)) {
         $vn_parent_id = array_pop($va_ancestors);
         $t_occ = new ca_occurrences($vn_parent_id);
         return $t_occ->getLabelForDisplay(false);
     } else {
         if ($pn_id == $this->getPrimaryKey()) {
             return $this->getLabelForDisplay(true);
         } else {
             $t_occ = new ca_occurrences($pn_id);
             return $t_occ->getLabelForDisplay(false);
         }
     }
 }
Esempio n. 7
0
 public function Full()
 {
     $t_lists = new ca_lists();
     $t_list_items = new ca_list_items();
     $o_purifier = new HTMLPurifier();
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pString);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $va_access_values = caGetUserAccessValues($this->request);
     $va_occ_info[] = "<b>" . _t("Lesson type") . "</b>: " . $t_occurrence->getTypeName();
     $va_occ_info2 = array();
     foreach (array("gradelevel", "lessonTopic", "learning_standard", "commonCore", "skills", "EdProject", "funder") as $vs_attribute_code) {
         if ($va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertCodesToDisplayText" => false, "returnAsArray" => true))) {
             $va_output_parts = array();
             foreach ($va_values as $k => $va_value) {
                 if ($va_value[$vs_attribute_code]) {
                     # --- display hierarchy path for "lessonTopic", "learning_standard", "commonCore"
                     if (in_array($vs_attribute_code, array("lessonTopic", "learning_standard", "commonCore"))) {
                         $vs_tmp = "";
                         $va_hierarchy_ancestors = $t_list_items->getHierarchyAncestors($va_value[$vs_attribute_code], array("idsOnly" => true, "includeSelf" => true));
                         if (is_array($va_hierarchy_ancestors) && sizeof($va_hierarchy_ancestors)) {
                             # --- remove the root - we don't want to display it
                             $va_root = array_pop($va_hierarchy_ancestors);
                             if (is_array($va_hierarchy_ancestors) && sizeof($va_hierarchy_ancestors)) {
                                 foreach ($va_hierarchy_ancestors as $vni => $vn_list_item_id) {
                                     $vs_tmp = $t_lists->getItemForDisplayByItemID($vn_list_item_id) . ($vni > 0 ? " > " . $vs_tmp : "");
                                 }
                                 $va_output_parts[] = $vs_tmp;
                             }
                         }
                     } else {
                         $vs_value = "";
                         if ($vs_value = trim($va_value[$vs_attribute_code])) {
                             $va_output_parts[] = $t_lists->getItemForDisplayByItemID($vs_value);
                         }
                     }
                 }
             }
             if (sizeof($va_output_parts)) {
                 $va_occ_info[$vs_attribute_code] = "<b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b>: " . join(", ", $va_output_parts);
             }
         }
     }
     $va_occ_info["HR"] = "<HR>";
     $va_attributes = array("theme", "guidelines", "sure", "directions", "context", "task", "glossary", "instructions", "essay", "essential", "check");
     foreach ($va_attributes as $vs_attribute_code) {
         if ($vs_value = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>"))) {
             if ($vs_attribute_code == "glossary") {
                 $va_glossary_terms = array();
                 $va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "returnAsArray" => true));
                 foreach ($va_values as $va_value) {
                     $va_glossary_terms[] = $va_value["glossary"];
                 }
                 sort($va_glossary_terms);
                 $vs_value = implode("<br/>", $va_glossary_terms);
                 $va_occ_info[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . $vs_value . "</div><!-- end unit -->";
             } else {
                 $va_occ_info[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . str_replace("*", "&bull; ", $vs_value) . "</div><!-- end unit -->";
             }
         }
     }
     $va_attributes = array("questions", "challenge", "connections", "resources", "transcription", "translation", "essay");
     foreach ($va_attributes as $vs_attribute_code) {
         if ($vs_value = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>"))) {
             if (in_array($vs_attribute_code, array("questions", "resources"))) {
                 $va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>", "returnAsArray" => true));
                 $vs_tmp = "";
                 $vs_tmp .= "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><ol>";
                 foreach ($va_values as $va_value_info) {
                     $vs_tmp .= "<li>" . $va_value_info[$vs_attribute_code] . "</li>";
                 }
                 $vs_tmp .= "</ol></div><!-- end unit -->";
                 $va_occ_info2[$vs_attribute_code] = $vs_tmp;
             } else {
                 $va_occ_info2[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . str_replace("*", "&bull; ", $vs_value) . "</div><!-- end unit -->";
             }
         }
     }
     # --- related objects
     $va_related_objects_links = $t_occurrence->get("ca_objects_x_occurrences.relation_id", array("returnAsArray" => true));
     $va_related_objects_info = array();
     if (sizeof($va_related_objects_links)) {
         $t_objects_x_occurrences = new ca_objects_x_occurrences();
         foreach ($va_related_objects_links as $vn_relation_id) {
             $va_object_info = array();
             $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));
             $va_reps_info = array();
             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_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;
                         $va_reps_info[] = "<img src='" . $t_rep->getMediaUrl('media', 'large') . "' style='height:900px; width:" . $vn_new_width . "px;'>";
                     } else {
                         $va_reps_info[] = $t_rep->getMediaTag('media', 'large');
                     }
                 }
             }
             $va_object_info["reps"] = $va_reps_info;
             # --- attributes on objects_x_occurrences record
             $va_attributes = array("caption", "transcription", "translation", "description", "questions");
             $va_md = array();
             foreach ($va_attributes as $vs_attribute_code) {
                 if ($vs_value = $t_objects_x_occurrences->get("ca_objects_x_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>"))) {
                     $va_md[$vs_attribute_code] = "<b>" . $t_objects_x_occurrences->getDisplayLabel("ca_objects_x_occurrences.{$vs_attribute_code}") . "</b><br/>" . $vs_value;
                 }
             }
             # --- info from the related object record
             $t_lists = new ca_lists();
             $vn_original_date = $t_lists->getItemIDFromList("date_types", "dateOriginal");
             $vs_related_object_caption_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_related_object_caption_info .= ", " . $va_date_info["dates_value"];
                     }
                 }
             }
             if ($t_objects_x_occurrences->get("ca_objects.repository")) {
                 $vs_related_object_caption_info .= ", " . $t_objects_x_occurrences->get("ca_objects.repository", array('delimiter' => ', ', 'convertCodesToDisplayText' => true));
             }
             $vs_related_object_caption_info .= ", " . $t_objects_x_occurrences->get("ca_objects.idno") . "</div>";
             $va_object_info["object_caption_info"] = $vs_related_object_caption_info;
             $va_object_info["md"] = $va_md;
             $va_related_objects_info[$vn_relation_id] = $va_object_info;
         }
     }
     $this->view->setVar('related_objects_info', $va_related_objects_info);
     $this->view->setVar('title', $t_occurrence->getLabelForDisplay());
     $this->view->setVar('occ_info', $va_occ_info);
     $this->view->setVar('occ_info2', $va_occ_info2);
     require_once __CA_LIB_DIR__ . '/core/Parsers/dompdf/dompdf_config.inc.php';
     $vs_output_filename = $t_occurrence->getLabelForDisplay();
     $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 . '/ca_occ_pdf_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;
 }