コード例 #1
0
 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") . "]" : "");
 }
コード例 #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');
 }
コード例 #3
0
ファイル: reports.php プロジェクト: ffarago/pawtucket2
 function caDownloadAttributeMedia($po_request, $po_response, $pn_occurrence_id, $ps_version, $pa_options = null)
 {
     $o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     if (!$t_occurrence->getPrimaryKey()) {
         return null;
     }
     $vs_path = $t_occurrence->get('ca_occurrences.report_file', array('version' => $ps_version, 'return' => 'path'));
     $vs_path_ext = pathinfo($vs_path, PATHINFO_EXTENSION);
     if (!($vs_title = trim($t_occurrence->get('ca_occurrences.preferred_labels.name')))) {
         $vs_title = "report";
     }
     $vs_name = _t(preg_replace('![^A-Za-z0-9\\,\\/\\?\\"\']+!', '_', $vs_title) . ".{$vs_path_ext}");
     $o_view->setVar('file_path', $vs_path);
     $o_view->setVar('file_name', $vs_name);
     // send download
     return $o_view->render('ca_attributes_download_media.php');
 }
コード例 #4
0
ファイル: xml_set_items.php プロジェクト: guaykuru/pawtucket
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * This source code is free and modifiable under the terms of 
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$vn_set_id = $this->getVar('set_id');
$t_set = $this->getVar('t_set');
$va_items = $this->getVar('items');
$t_occurrence = new ca_occurrences();
print '<?xml version="1.0" encoding="UTF-8"?>';
?>
<imageSet>
	<setInfo set_id="<?php 
print $vn_set_id;
?>
">
		<name><![CDATA[<?php 
print $t_set->getLabelForDisplay();
?>
]]></name>
		<description><![CDATA[<?php 
print $t_set->getAttributesForDisplay("description");
?>
]]></description>
コード例 #5
0
 /**
  * Returns content for overlay containing details for object representation linked to occurrence
  */
 public function getOccurrenceMediaOverlay()
 {
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger);
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $this->view->setVar('object_id', $pn_object_id);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $this->view->setVar('occurrence_id', $pn_occurrence_id);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $this->view->setVar('object_id', $pn_object_id);
     $t_object = new ca_objects($pn_object_id);
     $this->view->setVar('t_object', $t_object);
     $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_occurrence->getPrimaryKey()) {
         die("Invalid occurrence_id");
     }
     if (!$t_object->getPrimaryKey()) {
         die("Invalid object_id");
     }
     if (!$t_rep->getPrimaryKey()) {
         die("Invalid representation_id");
     }
     if (sizeof($va_access_values) && !in_array($t_occurrence->get('access'), $va_access_values)) {
         die("Invalid occurrence_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");
     }
     // Get media for display using configured rules
     $va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     // set version
     $this->view->setVar('version', $va_rep_display_info['display_version']);
     unset($va_display_info['display_version']);
     // set poster frame URL
     //$va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
     //unset($va_display_info['poster_frame_version']);
     //$va_rep_display_info['viewer_base_url'] = $t_rep->getAppConfig()->get('ca_url_root');
     // set other options
     $this->view->setVar('display_options', $va_rep_display_info);
     if (!($ps_display_type = trim($this->request->getParameter('display_type', pString)))) {
         $ps_display_type = 'media_overlay';
     }
     if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) {
         $ps_containerID = 'caMediaPanelContentArea';
     }
     $this->view->setVar("display_type", $ps_display_type);
     $this->view->setVar("containerID", $ps_containerID);
     // Get all objects asscoiated with this occurrence and show primary reps as icons for navigation
     $va_exhibition_images = $t_occurrence->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
     if (sizeof($va_exhibition_images) > 0) {
         $t_image_objects = new ca_objects();
         $i = 1;
         foreach ($va_exhibition_images as $vn_rel_id => $va_info) {
             $t_image_objects->load($va_info["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_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                     $va_temp["object_id"] = $va_info["object_id"];
                     $va_thumbnails[$va_info["object_id"]] = $va_temp;
                     if ($vn_getNext == 1) {
                         $this->view->setVar("next_object_id", $va_info["object_id"]);
                         $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
                         $vn_getNext = 0;
                     }
                     if ($va_info["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 = $va_info["object_id"];
                     $vn_prev_rep_id = $t_primary_rep->get("representation_id");
                     $i++;
                 }
             }
         }
     }
     $this->view->setVar('reps', $va_thumbnails);
     return $this->render("Detail/ajax_ca_occurrences_media_overlay_html.php");
 }
コード例 #6
0
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * This source code is free and modifiable under the terms of 
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$vo_result = $this->getVar('result');
$vn_items_per_page = $this->getVar('current_items_per_page');
$t_occurrence = new ca_occurrences();
if ($vo_result) {
    print '<div id="occurrenceResults">';
    $vn_item_count = 0;
    $va_tooltips = array();
    $t_list = new ca_lists();
    $vn_i = 0;
    while ($vn_i < $vn_items_per_page && $vo_result->nextHit()) {
        $vs_idno = $vo_result->get('ca_occurrences.idno');
        $vs_class = "";
        $vn_item_count++;
        if ($vn_item_count == 2) {
            $vs_class = "resultBg";
            $vn_item_count = 0;
        }
        $vn_occurrence_id = $vo_result->get('ca_occurrences.occurrence_id');
コード例 #7
0
         print "</div>";
     }
     print "</div></div>";
     print "</div><!-- blockResults-->";
     print "</div><!-- blockTitle-->";
     print "</div><!-- occurrencesBlock-->";
 }
 # Related Events Block
 if (sizeof($va_events) > 0) {
     print "<div id='eventsBlock'>";
     print "<div class='blockTitle related'>" . _t('Related Events') . "</div>";
     print "<div class='blockResults scrollBlock'>";
     print "<div class='scrollingDiv'><div class='scrollingDivContent'>";
     foreach ($va_events as $occurrence_id => $va_event) {
         $vn_occurrence_id = $va_event['occurrence_id'];
         $t_occurrence = new ca_occurrences($vn_occurrence_id);
         $va_objects = $t_occurrence->get('ca_objects.object_id', array('returnAsArray' => true));
         $va_object_reps = caGetPrimaryRepresentationsForIDs($va_objects, array('versions' => array('resultthumb'), 'return' => array('tags')));
         print "<div class='occurrencesResult'>";
         print "<div class='exImage' {$vs_style}>" . $va_object_reps[0] . "</div>";
         print "<div class='exTitle'>" . caNavLink($this->request, $va_event['name'], '', '', 'Detail', 'Occurrences/' . $va_event['occurrence_id']) . "</div>";
         print "<div class='exDate'>" . $t_occurrence->get('ca_occurrences.event_dates') . "</div>";
         print "</div><!-- end occurrenceResult -->";
     }
     print "</div></div>";
     print "</div><!-- end blockResults -->";
     print "</div><!-- end entitiesBlock -->";
 }
 # Related Entities Block
 if (sizeof($va_entities) > 0) {
     print "<div id='entitiesBlock'>";
コード例 #8
0
        print $t_rel_place->getWithTemplate("<b><l>^ca_places.preferred_labels.name</l></b>");
        if ($vs_brief_description = $t_rel_place->get("ca_places.brief_description")) {
            print "<br/>" . $vs_brief_description;
        }
        if ($vs_thumb) {
            print "</div></div><!-- end row -->";
        } else {
            print "<br/>";
        }
        print "<br/>";
    }
}
$va_occurrences = $t_item->get("ca_occurrences", array("returnAsArray" => true, "checkAccess" => $va_access_values));
if (sizeof($va_occurrences)) {
    print "<H6>Related event" . (sizeof($va_occurrences) > 1 ? "s" : "") . "</H6>";
    $t_rel_occurrence = new ca_occurrences();
    foreach ($va_occurrences as $va_occurrence) {
        $t_rel_occurrence->load($va_occurrence["occurrence_id"]);
        $t_object_thumb->load($t_rel_occurrence->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_occurrence->getWithTemplate("<b><l>^ca_occurrences.preferred_labels.name</l></b>");
        if ($vs_brief_description = $t_rel_occurrence->get("ca_occurrences.brief_description")) {
            print "<br/>" . $vs_brief_description;
        }
        if ($vs_thumb) {
            print "</div></div><!-- end row -->";
        } else {
コード例 #9
0
     }
     print "</div>";
     print "</div><!-- end blockResults -->";
     print "</div><!-- end entitiesBlock -->";
 }
 # Related Events Block
 if (sizeof($va_events) > 0) {
     print "<div id='occurrencesBlock'>";
     print "<div class='blockTitle related'>" . _t('Related Events') . "</div>";
     print "<div class='blockResults scrollBlock'>";
     print "<div class='scrollingDiv'><div class='scrollingDivContent'>";
     $vn_i = 0;
     foreach ($va_events as $event_id => $va_event) {
         $vn_event_idno = $va_event['idno'];
         $vn_event_id = $va_event['occurrence_id'];
         $t_occurrence = new ca_occurrences($vn_event_id);
         if ($vn_i == 0) {
             print "<div class='eventSet'>";
         }
         print "<div class='eventsResult'>";
         print "<div>" . caNavLink($this->request, $va_event['label'], '', '', 'Detail', 'Occurrences/' . $vn_event_id) . "</div>";
         print "<div class='exDate'>" . $t_occurrence->get('ca_occurrences.event_dates') . "</div>";
         print "</div>";
         $vn_i++;
         if ($vn_i == 5) {
             print "</div>";
             $vn_i = 0;
         }
     }
     if (end($va_events) == $va_event && $vn_i < 5 && $vn_i != 0) {
         print "</div>";
コード例 #10
0
        print "<div class='unit'><b>" . _t('Collection Date') . ":</b> {$vs_collectionDate}</div><!-- end unit -->";
    }
    if ($va_track_type_status = $t_object->get('ca_objects.track_type_status', array('convertCodesToDisplayText' => true))) {
        print "<div class='unit'><b>" . _t('Type Status') . ":</b> " . $va_track_type_status . "</div>";
    }
    if ($vs_description = $t_object->get("ca_objects.description")) {
        print "<div class='unit'><b>" . _t('Description') . ":</b> {$vs_description}</div><!-- end unit -->";
    }
    if ($va_photographs = $t_object->get('ca_objects.photographs', array('convertCodesToDisplayText' => true))) {
        print "<div class='unit'><b>" . _t('Photographs') . ":</b> " . $va_photographs . "</div>";
    }
}
#end if statement
if ($va_citations = $t_object->get('ca_occurrences', array('returnAsArray' => true, 'checkAccess' => $va_access_values))) {
    if (sizeof($va_citations)) {
        $t_occurrence = new ca_occurrences();
        print "<br><div class='unit'><h2>" . (sizeof($va_citations) > 1 ? "Citations" : "Citation") . "</h2>";
        foreach ($va_citations as $va_citation) {
            $t_occurrence->load($va_citation["occurrence_id"]);
            $vs_citation = "";
            $vs_citation .= $t_occurrence->get("ca_entities.preferred_labels.displayname", array("restrict_to_relationship_types" => array("author"), "convertCodesToDisplayText" => true, "delimiter" => "; ")) . ". ";
            $vs_citation .= "\"" . $va_citation["name"] . ".\" ";
            if ($t_occurrence->get("ca_occurrences.journal")) {
                $vs_citation .= "<i>" . $t_occurrence->get("ca_occurrences.journal") . "</i> ";
            }
            if ($t_occurrence->get("ca_occurrences.month_volume")) {
                $vs_citation .= $t_occurrence->get("ca_occurrences.month_volume") . " ";
            }
            if ($t_occurrence->get("year")) {
                $vs_citation .= "(" . $t_occurrence->get("year") . ") ";
            }
コード例 #11
0
        }
        print "</div><!-- END chronologyText -->";
        $vn_item_count++;
        $i++;
    }
    if ($i > $vn_num_more_link) {
        print "</div>";
        print "<div class='moreLink'><a href='#' id='eventsMoreLink' onclick='jQuery(\"#eventsMore\").slideDown(250); jQuery(\"#eventsMoreLink\").hide(); return false;'>" . ($q_events->numHits() - $vn_num_more_link) . _t(" More like this") . " &rsaquo;</a></div>";
    }
    print "</div><!-- end unit -->";
}
# --- output exhibitions from the year
$qr_exhibitions = $va_years_info["exhibitions"];
if ($qr_exhibitions->numHits() > 0) {
    print "<div class='unit'><div class='chronologyHeading'>" . _t("Exhibitions in %1", $vs_year_label) . "</div>";
    $t_occ = new ca_occurrences();
    $i = 0;
    while ($qr_exhibitions->nextHit()) {
        if ($i == $vn_num_more_link) {
            print "<div id='exhibitionsMore' class='relatedMoreItems'>";
        }
        $vn_occurrence_id = $qr_exhibitions->get("ca_occurrences.occurrence_id");
        $t_occ->load($vn_occurrence_id);
        $va_labels = $qr_exhibitions->getDisplayLabels($this->request);
        $vs_label = "\"" . join("; ", $va_labels) . ",\" ";
        $vs_venue = "";
        $va_venues = array();
        $va_venues = $t_occ->get('ca_entities', array('returnAsArray' => 1, 'checkAccess' => $va_access_values, 'restrict_to_relationship_types' => array('primary_venue')));
        if (sizeof($va_venues) > 0) {
            $va_venue_name = array();
            foreach ($va_venues as $va_venue_info) {
コード例 #12
0
ファイル: landing_html.php プロジェクト: guaykuru/pawtucket
    print _t("Your Sets");
}
?>
</H1>
<div id="galleryLanding">
	<div class="textContent">
<?php 
if ($this->request->getController() == "Exhibits") {
    print $this->render('Exhibits/intro_text_html.php');
} else {
    print $this->render('Exhibits/your_sets_intro_text_html.php');
}
?>
	</div>
<?php 
$t_occurrence = new ca_occurrences();
foreach ($va_set_list as $vn_set_id => $va_set_info) {
    $va_item = $va_first_items_from_sets[$vn_set_id][array_shift(array_keys($va_first_items_from_sets[$vn_set_id]))];
    $t_occurrence->load($va_item['row_id']);
    $va_preview_stills = array();
    $vs_preview_still = "";
    $va_medium_stills = array();
    $vs_medium_still = "";
    $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) {
        $vs_preview_still = 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) {
        $vs_medium_still = array_shift($va_medium_stills);
    }
コード例 #13
0
						</unit>
					</ifcount>}}}
				</div><!-- end col -->
			</div><!-- end row -->
<?php 
        break;
        # -------------------------------------------------------------------------------
    # -------------------------------------------------------------------------------
    case "exhibitions":
        ?>
		
			<div class="row">
				<div class="col-sm-7">
<?php 
        $va_exhibitions = $t_item->get("ca_occurrences", array("returnAsArray" => true, "checkAccess" => $va_access_values, "restrictToRelationshipTypes" => array("exhibited"), "sort" => array("ca_occurrences.opening_closing"), "sortDirection" => "desc"));
        $t_occurrence = new ca_occurrences();
        if (sizeof($va_exhibitions) > 0) {
            foreach ($va_exhibitions as $va_exhibition) {
                $t_occurrence->load($va_exhibition["occurrence_id"]);
                print "<h2>" . caDetailLink($this->request, $t_occurrence->get("ca_occurrences.preferred_labels.name"), '', 'ca_occurrences', $va_exhibition["occurrence_id"], null, null, array("type_id" => $t_occurrence->get("ca_occurrences.type_id"))) . "</h2>";
                print "<h2>" . $t_occurrence->get("ca_occurrences.exhibition_subtitle") . "</h2>";
                print "<h4>" . $t_occurrence->get("ca_occurrences.opening_closing") . "</h4>";
                print "<br/>";
            }
        } else {
            print "<h2>No exhibitions</h2>";
        }
        ?>
				</div><!-- end col -->
				<div class="col-sm-4 col-sm-offset-1">
					{{{<ifcount code="ca_objects" min="1">
コード例 #14
0
 *
 * @package CollectiveAccess
 * @subpackage Core
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
 *
 * ----------------------------------------------------------------------
 */
$va_lists = $this->getVar('lists');
$va_type_info = $this->getVar('typeInfo');
$va_listing_info = $this->getVar('listingInfo');
foreach ($va_lists as $vn_type_id => $qr_list) {
    if (!$qr_list) {
        continue;
    }
    print "<h2>{$va_listing_info['displayName']}</h2>\n";
    print "<div class='row'>";
    while ($qr_list->nextHit()) {
        $t_occurrence = new ca_occurrences($qr_list->get('ca_occurrences.occurrence_id'));
        $va_related_objects = $t_occurrence->get('ca_objects.object_id', array('returnAsArray' => true));
        print "<div class='event col-sm-4 col-md-3 col-lg-2'>";
        $t_object = new ca_objects($va_related_objects[0]);
        if ($t_object->get('ca_object_representations.media.medium')) {
            print "<div class='eventImg'>" . $t_object->get('ca_object_representations.media.medium') . "</div>";
        } else {
            print "<div class='placeholder'></div>";
        }
        print $qr_list->get('ca_occurrences.preferred_labels.name');
        print "</div>";
    }
    print "</div>";
}
コード例 #15
0
ファイル: Content.php プロジェクト: kai-iak/pawtucket2
<?php

if ($pn_user_category = $this->request->getParameter('user_category', pInteger)) {
    require_once __CA_MODELS_DIR__ . "/ca_occurrences.php";
    $t_occurrence = new ca_occurrences();
    $t_occurrence->load($pn_user_category);
    $ps_user_category = strtolower($t_occurrence->get("ca_occurrences.preferred_labels.name"));
} else {
    $pn_user_category = $this->request->session->getVar("bokUserCategory");
    $ps_user_category = $this->request->session->getVar("bokUserCategoryLabel");
}
?>
<div class="container containerTextPadding" id="comp_content">
	<div class="row">
   		<div class="col-sm-12">
   			<H2>Choose content within the <span class='capital'><?php 
print $ps_user_category;
?>
</span> category below:</H2><br/>
   		</div>
   	</div>
   	<div class="row">
   		<div class="col-sm-5 col-sm-offset-1">
   			<table class="table">
   				<tr>
   					<td class="contentbox iconbox"><?php 
print caNavLink($this->request, caGetThemeGraphic($this->request, 'button_content.png') . "<br />content", "", "", "Browse", "Content", array("facet" => "category_facet", "id" => $pn_user_category));
?>
</td>
   					<td class="compsec_info"><?php 
print caNavLink($this->request, "Explore an e-learning platform for self-guided professional development based on competences.", "", "", "Browse", "Content", array("facet" => "category_facet", "id" => $pn_user_category));
コード例 #16
0
}
?>
		</div><!-- end infoArea-->
	</div><!-- end contentArea-->
	<div id='relatedInfo'>
<?php 
# Related Exhibitions Block
$va_occurrences = $t_item->get('ca_occurrences', array('restrictToTypes' => array('mf_exhibition'), 'returnAsArray' => true, 'checkAccess' => $va_access_values));
if (sizeof($va_occurrences) > 0) {
    print "<div id='occurrencesBlock'>";
    print "<div class='blockTitle related'>" . _t('Related Exhibitions') . "</div>";
    print "<div class='blockResults exhibitions'>";
    print "<div>";
    foreach ($va_occurrences as $occurrence_id => $va_occurrence) {
        $vn_occurrence_id = $va_occurrence['occurrence_id'];
        $t_occurrence = new ca_occurrences($vn_occurrence_id);
        $va_artworks = $t_occurrence->get('ca_collections.collection_id', array('returnAsArray' => true));
        print "<div class='occurrencesResult'>";
        $vn_ii = 0;
        if (sizeof($va_artworks) >= 4) {
            foreach ($va_artworks as $key => $vn_artwork_id) {
                $t_collection = new ca_collections($vn_artwork_id);
                $va_related_objects = $t_collection->get('ca_objects.object_id', array('returnAsArray' => true));
                $va_object_reps = caGetPrimaryRepresentationsForIDs($va_related_objects, array('versions' => array('resultthumb'), 'return' => array('tags')));
                if ($vn_ii % 2 == 0) {
                    $vs_style = "style='margin-right:10px;'";
                } else {
                    $vs_style = "";
                }
                if ($va_primary_rep = array_shift(array_values($va_object_reps))) {
                    print "<div class='exImage' {$vs_style}>" . caNavLink($this->request, $va_primary_rep, '', '', 'Detail', 'Occurrences/' . $va_occurrence['occurrence_id']) . "</div>";
コード例 #17
0
    foreach ($va_entities as $va_entity) {
        print ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, $va_entity["label"], '', 'Detail', 'Entity', 'Show', array('entity_id' => $va_entity["entity_id"])) : $va_entity["label"]) . " <span class='details'>(" . $va_entity['relationship_typename'] . ")</span>";
        if ($vn_i < sizeof($va_entities)) {
            print ", ";
        }
    }
    $vn_i++;
    ?>
				</p>				
<?php 
}
# --- occurrences
$va_occurrences = $t_object->get("ca_occurrences", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
$va_sorted_occurrences = array();
if (sizeof($va_occurrences) > 0) {
    $t_occ = new ca_occurrences();
    $va_item_types = $t_occ->getTypeList();
    foreach ($va_occurrences as $va_occurrence) {
        $t_occ->load($va_occurrence['occurrence_id']);
        $va_rel_entities = array();
        $va_rel_entities = $t_occ->get("ca_entities", array('restrictToTypes' => array('organization'), "returnAsArray" => 1, 'checkAccess' => $va_access_values, 'sort' => 'surname'));
        $va_occurrence["related_entities"] = $va_rel_entities;
        $va_sorted_occurrences[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = $va_occurrence;
    }
    $t_list = new ca_lists();
    $vn_exhibition_type_id = $t_list->getItemIDFromList("occurrence_types", "exhibition");
    foreach ($va_sorted_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
        ?>
						<h3><?php 
        print _t("Related") . " " . $va_item_types[$vn_occurrence_type_id]['name_singular'] . (sizeof($va_occurrence_list) > 1 ? "s" : "");
        ?>
コード例 #18
0
 /**
  * Returns occurrence_id for the occurrence with the specified name(and type) or idno (regardless of specified type.) If the occurrence does not already
  * exist then it will be created with the specified name, type and locale, as well as with any specified values in the $pa_values array.
  * $pa_values keys should be either valid occurrence fields or attributes.
  *
  * @param string $ps_occ_name Occurrence label name
  * @param int $pn_parent_id The parent_id of the occurrence; must be set to a non-null value
  * @param int $pn_type_id The type_id of the occurrence type to use if the occurrence needs to be created
  * @param int $pn_locale_id The locale_id to use if the occurrence needs to be created (will be used for both the occurrence locale as well as the label locale)
  * @param array $pa_values An optional array of additional values to populate newly created occurrence records with. These values are *only* used for newly created occurrences; they will not be applied if the occurrence named already exists. The array keys should be names of ca_occurrences fields or valid entity attributes. Values should be either a scalar (for single-value attributes) or an array of values for (multi-valued attributes)
  * @param array $pa_options An optional array of options, which include:
  *                outputErrors - if true, errors will be printed to console [default=false]
  *                matchOn = optional list indicating sequence of checks for an existing record; values of array can be "label" and "idno". Ex. array("idno", "label") will first try to match on idno and then label if the first match fails.
  *                dontCreate - if true then new occurrences will not be created [default=false]
  *                transaction - if Transaction object is passed, use it for all Db-related tasks [default=null]
  *                returnInstance = return ca_occurrences instance rather than occurrence_id. Default is false.
  *                generateIdnoWithTemplate = A template to use when setting the idno. The template is a value with automatically-set SERIAL values replaced with % characters. Eg. 2012.% will set the created row's idno value to 2012.121 (assuming that 121 is the next number in the serial sequence.) The template is NOT used if idno is passed explicitly as a value in $pa_values.
  *                importEvent = if ca_data_import_events instance is passed then the insert/update of the occurrence will be logged as part of the import
  *                importEventSource = if importEvent is passed, then the value set for importEventSource is used in the import event log as the data source. If omitted a default value of "?" is used
  *                nonPreferredLabels = an optional array of nonpreferred labels to add to any newly created occurrences. Each label in the array is an array with required occurrence label values.
  *                log = if KLogger instance is passed then actions will be logged
  * @return bool|\ca_occurrences|mixed|null
  */
 static function getOccurrenceID($ps_occ_name, $pn_parent_id, $pn_type_id, $pn_locale_id, $pa_values = null, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!isset($pa_options['outputErrors'])) {
         $pa_options['outputErrors'] = false;
     }
     $pa_match_on = caGetOption('matchOn', $pa_options, array('label', 'idno'), array('castTo' => "array"));
     /** @var ca_data_import_events $o_event */
     $o_event = isset($pa_options['importEvent']) && $pa_options['importEvent'] instanceof ca_data_import_events ? $pa_options['importEvent'] : null;
     $t_occurrence = new ca_occurrences();
     if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
         $t_occurrence->setTransaction($pa_options['transaction']);
         if ($o_event) {
             $o_event->setTransaction($pa_options['transaction']);
         }
     }
     $vs_event_source = isset($pa_options['importEventSource']) && $pa_options['importEventSource'] ? $pa_options['importEventSource'] : "?";
     /** @var KLogger $o_log */
     $o_log = isset($pa_options['log']) && $pa_options['log'] instanceof KLogger ? $pa_options['log'] : null;
     $vs_idno = isset($pa_values['idno']) ? (string) $pa_values['idno'] : null;
     if (preg_match('!\\%!', $vs_idno)) {
         $pa_options['generateIdnoWithTemplate'] = $vs_idno;
         $vs_idno = null;
     }
     if (!$vs_idno) {
         if (isset($pa_options['generateIdnoWithTemplate']) && $pa_options['generateIdnoWithTemplate']) {
             $vs_idno = $t_occurrence->setIdnoWithTemplate($pa_options['generateIdnoWithTemplate'], array('dontSetValue' => true));
         }
     }
     $vn_id = null;
     foreach ($pa_match_on as $vs_match_on) {
         switch (strtolower($vs_match_on)) {
             case 'label':
             case 'labels':
                 if (trim($ps_occ_name)) {
                     if ($vn_id = ca_occurrences::find(array('preferred_labels' => array('name' => $ps_occ_name), 'parent_id' => $pn_parent_id, 'type_id' => $pn_type_id), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']))) {
                         break 2;
                     }
                     break;
                 }
             case 'idno':
                 if ($vs_idno == '%') {
                     break;
                 }
                 // don't try to match on an unreplaced idno placeholder
                 // TODO: should we filter on type_id here?
                 if ($vn_id = ca_occurrences::find(array('idno' => $vs_idno ? $vs_idno : $ps_occ_name), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']))) {
                     break 2;
                 }
                 break;
         }
     }
     if (!$vn_id) {
         if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
             return false;
         }
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'I');
         }
         $t_occurrence->setMode(ACCESS_WRITE);
         $t_occurrence->set('locale_id', $pn_locale_id);
         $t_occurrence->set('type_id', $pn_type_id);
         $t_occurrence->set('parent_id', $pn_parent_id);
         $t_occurrence->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_occurrence->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_occurrence->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         $t_occurrence->set('idno', $vs_idno);
         $t_occurrence->set('hier_occurrence_id', isset($pa_values['hier_occurrence_id']) ? $pa_values['hier_occurrence_id'] : null);
         $t_occurrence->insert();
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
         $t_occurrence->addLabel(array('name' => $ps_occ_name), $pn_locale_id, null, true);
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             $vb_label_errors = true;
         }
         /** @var IIDNumbering $o_idno */
         if ($o_idno = $t_occurrence->getIDNoPlugInInstance()) {
             $va_values = $o_idno->htmlFormValuesAsArray('idno', $vs_idno);
             if (!($vs_sep = $o_idno->getSeparator())) {
                 $vs_sep = '';
             }
             if (!is_array($va_values)) {
                 $va_values = array($va_values);
             }
             if (($vs_proc_idno = join($vs_sep, $va_values)) && $vs_proc_idno != $vs_idno) {
                 $t_occurrence->set('idno', $vs_proc_idno);
                 $t_occurrence->update();
                 if ($t_occurrence->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not update idno for %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not idno for %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                     }
                     return null;
                 }
             }
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_id']);
         unset($pa_values['hier_occurrence_id']);
         $vb_attr_errors = false;
         if (is_array($pa_values)) {
             foreach ($pa_values as $vs_element => $va_values) {
                 if (!caIsIndexedArray($va_values)) {
                     $va_values = array($va_values);
                 }
                 foreach ($va_values as $va_value) {
                     if (is_array($va_value)) {
                         // array of values (complex multi-valued attribute)
                         $t_occurrence->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                     } else {
                         // scalar value (simple single value attribute)
                         if ($va_value) {
                             $t_occurrence->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                         }
                     }
                 }
             }
             $t_occurrence->update();
             if ($t_occurrence->numErrors()) {
                 if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                     print "[Error] " . _t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                 }
                 if ($o_log) {
                     $o_log->logError(_t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                 }
                 $vb_attr_errors = true;
             }
         }
         if (is_array($va_nonpreferred_labels = caGetOption("nonPreferredLabels", $pa_options, null))) {
             if (caIsAssociativeArray($va_nonpreferred_labels)) {
                 // single non-preferred label
                 $va_labels = array($va_nonpreferred_labels);
             } else {
                 // list of non-preferred labels
                 $va_labels = $va_nonpreferred_labels;
             }
             foreach ($va_labels as $va_label) {
                 $t_occurrence->addLabel($va_label, $pn_locale_id, null, false);
                 if ($t_occurrence->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not set non-preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not set non-preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
                     }
                 }
             }
         }
         $vn_occurrence_id = $t_occurrence->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_occurrence->getErrors())));
             } else {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new occurrence %1", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_occurrence;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'U');
         }
         $vn_occurrence_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing occurrence %1 in DataMigrationUtils::getOccurrenceID()", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             $t_occurrence = new ca_occurrences($vn_occurrence_id);
             if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
                 $t_occurrence->setTransaction($pa_options['transaction']);
             }
             return $t_occurrence;
         }
     }
     return $vn_occurrence_id;
 }
コード例 #19
0
ファイル: ShowController.php プロジェクト: guaykuru/pawtucket
 /**
  *
  */
 private function _getActionsCollection($pn_collection_id, $pn_start = 0, $pn_num_actions = 10)
 {
     $o_search = new OccurrenceSearch();
     $o_search->setTypeRestrictions(array($this->opn_context_type_id, $this->opn_action_type_id));
     $o_search->addResultFilter("ca_occurrences.access", "IN", join(',', $this->opa_access_values));
     $qr_res = $o_search->search("ca_collections.collection_id:{$pn_collection_id}", array('sort' => 'ca_occurrences.date.dates_value', 'sort_direction' => 'asc'));
     $qr_res->seek($pn_start);
     $va_actions = array();
     $vn_c = 0;
     $t_occ = new ca_occurrences();
     while ($qr_res->nextHit()) {
         if (!($vs_date = trim($qr_res->get('ca_occurrences.date.dates_value', array('dateFormat' => 'delimited'))))) {
             continue;
         }
         if ($vs_date == 'present') {
             continue;
         }
         $va_silos = array();
         $va_projects = array();
         $t_occ->load($qr_res->get('ca_occurrences.occurrence_id'));
         $va_silos = $t_occ->get("ca_collections", array("restrictToTypes" => array("silo"), "returnAsArray" => 1, 'checkAccess' => $this->opa_access_values));
         # --- format silo icons here
         $vs_silos = "";
         if (is_array($va_silos) && sizeof($va_silos) > 0) {
             $vs_silos = "<div class='actionSiloIcons'>";
             foreach ($va_silos as $vn_i => $va_silo_info) {
                 $vs_bgColor = "";
                 switch ($va_silo_info["collection_id"]) {
                     case $this->request->config->get('silo_strawberry_flag'):
                         $vs_bgColor = $this->request->config->get('silo_strawberry_flag_bg');
                         break;
                         # --------------------------------------
                     # --------------------------------------
                     case $this->request->config->get('silo_silver_water'):
                         $vs_bgColor = $this->request->config->get('silo_silver_water_bg');
                         break;
                         # --------------------------------------
                     # --------------------------------------
                     default:
                         $vs_bgColor = "#000000";
                         break;
                 }
                 $vs_silos .= caNavLink($this->request, "<div class='actionSiloIcon siloIcon" . $va_silo_info["collection_id"] . "' style='background-color:" . $vs_bgColor . "'><!-- empty --></div>", '', 'Detail', 'Collection', 'Show', array('collection_id' => $va_silo_info["collection_id"]), array("title" => $va_silo_info["label"]));
             }
             $vs_silos .= "</div>";
         }
         $va_projects = $t_occ->get("ca_collections", array("restrictToTypes" => array("project"), "returnAsArray" => 1, 'checkAccess' => $this->opa_access_values));
         $va_timestamps = array_shift($qr_res->get('ca_occurrences.date.dates_value', array('rawDate' => true, 'returnAsArray' => true)));
         $va_actions[$vn_id = $qr_res->get('ca_occurrences.occurrence_id')] = array('occurrence_id' => $vn_id, 'label' => $qr_res->get('ca_occurrences.preferred_labels.name'), 'idno' => $qr_res->get('ca_occurrences.idno'), 'date' => $vs_date, 'timestamp' => $va_timestamps['start'], 'location' => $qr_res->get('ca_occurrences.georeference.geocode'), 'silos' => $va_silos, 'silos_formatted' => $vs_silos, 'projects' => $va_projects);
         $vn_c++;
         if ($vn_c >= $pn_num_actions) {
             break;
         }
     }
     return $va_actions;
 }
コード例 #20
0
             print "</div>";
             print "<div class='moreLink'><a href='#' id='entitiesMoreLink' onclick='jQuery(\"#entitiesMore\").slideDown(250); jQuery(\"#entitiesMoreLink\").hide(); return false;'>" . (sizeof($va_entities) - $vn_num_more_link) . _t(" More like this") . " &rsaquo;</a></div>";
         }
     }
     print "</div><!-- end unit -->";
 }
 if (trim($t_occurrence->get("ca_occurrences.internal_notes"))) {
     print "<H3>Comments</H3><div class='unit'>";
     print $t_occurrence->get("ca_occurrences.internal_notes", null, array('convertLinkBreaks' => true));
     print "</div><!-- end unit -->";
 }
 # --- occurrences
 $va_occurrences = $t_occurrence->get("ca_occurrences", array("returnAsArray" => 1, 'checkAccess' => $va_access_values, 'sort' => array('ca_occurrences.date.parsed_date')));
 $va_sorted_occurrences = array();
 if (sizeof($this->getVar('occurrences'))) {
     $t_occ = new ca_occurrences();
     $va_item_types = $t_occ->getTypeList();
     foreach ($this->getVar('occurrences') as $va_occurrence) {
         $t_occ->load($va_occurrence['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[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = array("label" => $va_occurrence['label'], "date" => $t_occ->get("ca_occurrences.date.display_date"), "year_published" => $t_occ->get("ca_occurrences.bib_year_published"), "venue" => $vs_venue, "relationship_type_id" => $va_occurrence['relationship_type_id'], "bib_full_citation" => $t_occ->get("ca_occurrences.bib_full_citation"));
     }
コード例 #21
0
        foreach ($this->getVar('entities') as $va_entity) {
            ?>
					<div><?php 
            print ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, $va_entity["label"], '', 'Detail', 'Entity', 'Show', array('entity_id' => $va_entity["entity_id"])) : $va_entity["label"]) . " (" . unicode_ucfirst($va_entity_rel_types[$va_entity['relationship_type_id']]['typename']) . ")";
            ?>
</div>
<?php 
        }
        ?>
				</div><!-- end unit -->
<?php 
    }
    # --- occurrences
    $va_occurrences = array();
    if (sizeof($this->getVar('occurrences'))) {
        $t_occ = new ca_occurrences();
        $va_item_types = $t_occ->getTypeList();
        foreach ($this->getVar('occurrences') as $va_occurrence) {
            $t_occ->load($va_occurrence['occurrence_id']);
            $va_occurrences[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = array("label" => $va_occurrence['label'], "date" => $t_occ->getAttributesForDisplay("dates", '^dates_value'), "relationship_type_id" => $va_occurrence['relationship_type_id']);
        }
        $va_occ_rel_types = $t_rel_types->getRelationshipInfo('ca_places_x_occurrences');
        foreach ($va_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
            ?>
						<div class="unit"><H2><?php 
            print _t("Related") . " " . $va_item_types[$vn_occurrence_type_id]['name_singular'] . (sizeof($va_occurrence_list) > 1 ? "s" : "");
            ?>
</H2>
<?php 
            foreach ($va_occurrence_list as $vn_rel_occurrence_id => $va_info) {
                ?>
コード例 #22
0
 *
 * @package CollectiveAccess
 * @subpackage Core
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
 *
 * ----------------------------------------------------------------------
 */
?>
<div class="row">
<?php 
$va_access_values = $this->getVar("access_values");
$o_config = caGetFrontConfig();
# --- grab the set that has the featured
$t_set = new ca_sets();
$t_set->load(array('set_code' => $o_config->get("front_page_exhibit_set_code")));
$t_exhibition = new ca_occurrences();
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
    $va_exhibition_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    $t_exhibition->load($va_exhibition_ids[0]);
}
# --- check to see if there is an image set configured
if ($this->getVar("featured_set_id")) {
    $qr_res = $this->getVar('featured_set_items_as_search_result');
    if ($qr_res && $qr_res->numHits()) {
        while ($qr_res->nextHit()) {
            if ($vs_media = $qr_res->getWithTemplate('^ca_object_representations.media.front', array("checkAccess" => $va_access_values))) {
                print "<div class='col-sm-12'><div class='frontSlide'>" . $vs_media . "</div></div>";
                break;
            }
        }
    }
コード例 #23
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');
 }
コード例 #24
0
        print _t("Related") . " " . (sizeof($va_entities) > 1 ? _t("Entities") : _t("Entity"));
        ?>
</h2>
<?php 
        foreach ($va_entities as $va_entity) {
            print "<div>" . ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, $va_entity["label"], '', 'Detail', 'Entity', 'Show', array('entity_id' => $va_entity["entity_id"])) : $va_entity["label"]) . " (" . $va_entity['relationship_typename'] . ")</div>";
        }
        ?>
				</div><!-- end unit -->
<?php 
    }
    # --- occurrences
    $va_occurrences = $t_place->get("ca_occurrences", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
    $va_sorted_occurrences = array();
    if (sizeof($va_occurrences) > 0) {
        $t_occ = new ca_occurrences();
        $va_item_types = $t_occ->getTypeList();
        foreach ($va_occurrences as $va_occurrence) {
            $t_occ->load($va_occurrence['occurrence_id']);
            $va_sorted_occurrences[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = $va_occurrence;
        }
        foreach ($va_sorted_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
            ?>
						<div class="unit"><h2><?php 
            print _t("Related") . " " . $va_item_types[$vn_occurrence_type_id]['name_singular'] . (sizeof($va_occurrence_list) > 1 ? "s" : "");
            ?>
</h2>
<?php 
            foreach ($va_occurrence_list as $vn_rel_occurrence_id => $va_info) {
                print "<div>" . ($this->request->config->get('allow_detail_for_ca_occurrences') ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"]) . " (" . $va_info['relationship_typename'] . ")</div>";
            }
コード例 #25
0
         }
         print "</div>";
     }
     print "</div></div>";
     print "</div><!-- blockResults-->";
     print "</div><!-- objectsBlock-->";
 }
 # Related Exhibitions Block
 if (sizeof($va_occurrences) > 0) {
     print "<div id='occurrencesBlock'>";
     print "<div class='blockTitle related'>" . _t('Related Exhibitions') . "</div>";
     print "<div class='blockResults exhibitions scrollBlock'>";
     print "<div class='scrollingDiv'><div class='scrollingDivContent'>";
     foreach ($va_occurrences as $occurrence_id => $va_occurrence) {
         $vn_occurrence_id = $va_occurrence['occurrence_id'];
         $t_occurrence = new ca_occurrences($vn_occurrence_id);
         $va_artworks = $t_occurrence->get('ca_collections.collection_id', array('returnAsArray' => true, 'restrictToTypes' => array('installation')));
         print "<div class='occurrencesResult' style='width:320px'>";
         $vn_ii = 0;
         $vn_i = 0;
         if (sizeof($va_artworks) >= 4) {
             foreach ($va_artworks as $key => $vn_artwork_id) {
                 $t_collection = new ca_collections($vn_artwork_id);
                 $va_related_objects = $t_collection->get('ca_objects.object_id', array('returnAsArray' => true));
                 $va_object_reps = caGetPrimaryRepresentationsForIDs($va_related_objects, array('versions' => array('resultthumb'), 'return' => array('tags')));
                 if ($vn_ii % 2 == 0) {
                     $vs_style = "style='margin-right:10px;'";
                 } else {
                     $vs_style = "";
                 }
                 if ($va_primary_rep = array_shift(array_values($va_object_reps))) {
コード例 #26
0
 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');
 }
コード例 #27
0
 /** 
  * Returns occurrence_id for the occurrence with the specified name, regardless of specified type. If the occurrence does not already 
  * exist then it will be created with the specified name, type and locale, as well as with any specified values in the $pa_values array.
  * $pa_values keys should be either valid occurrence fields or attributes.
  *
  * @param string $ps_occurrence_name Occurrence label name
  * @param int $pn_parent_id The parent_id of the occurrence; must be set to a non-null value
  * @param int $pn_type_id The type_id of the occurrence type to use if the occurrence needs to be created
  * @param int $pn_locale_id The locale_id to use if the occurrence needs to be created (will be used for both the occurrence locale as well as the label locale)
  * @param array $pa_values An optional array of additional values to populate newly created occurrence records with. These values are *only* used for newly created occurrences; they will not be applied if the occurrence named already exists. The array keys should be names of ca_occurrences fields or valid entity attributes. Values should be either a scalar (for single-value attributes) or an array of values for (multi-valued attributes)
  * @param array $pa_options An optional array of options, which include:
  *				outputErrors - if true, errors will be printed to console [default=false]
  *				matchOnIdno - try to match on idno if name match fails [default=false]
  *				dontCreate - if true then new entities will not be created [default=false]
  * 				transaction - if Transaction object is passed, use it for all Db-related tasks [default=null]
  *				returnInstance = return ca_occurrences instance rather than occurrence_id. Default is false. 
  *				generateIdnoWithTemplate = A template to use when setting the idno. The template is a value with automatically-set SERIAL values replaced with % characters. Eg. 2012.% will set the created row's idno value to 2012.121 (assuming that 121 is the next number in the serial sequence.) The template is NOT used if idno is passed explicitly as a value in $pa_values.
  *				importEvent = if ca_data_import_events instance is passed then the insert/update of the occurrence will be logged as part of the import
  *				importEventSource = if importEvent is passed, then the value set for importEventSource is used in the import event log as the data source. If omitted a default value of "?" is used
  *				log = if KLogger instance is passed then actions will be logged
  */
 static function getOccurrenceID($ps_occ_name, $pn_parent_id, $pn_type_id, $pn_locale_id, $pa_values = null, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!isset($pa_options['outputErrors'])) {
         $pa_options['outputErrors'] = false;
     }
     $pb_match_on_idno = caGetOption('matchOnIdno', $pa_options, false);
     $t_occurrence = new ca_occurrences();
     if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
         $t_occurrence->setTransaction($pa_options['transaction']);
     }
     $o_event = isset($pa_options['importEvent']) && $pa_options['importEvent'] instanceof ca_data_import_events ? $pa_options['importEvent'] : null;
     $vs_event_source = isset($pa_options['importEventSource']) && $pa_options['importEventSource'] ? $pa_options['importEventSource'] : "?";
     $o_log = isset($pa_options['log']) && $pa_options['log'] instanceof KLogger ? $pa_options['log'] : null;
     if (!($vs_idno = isset($pa_values['idno']) ? (string) $pa_values['idno'] : null)) {
         if (isset($pa_options['generateIdnoWithTemplate']) && $pa_options['generateIdnoWithTemplate']) {
             $vs_idno = $t_occurrence->setIdnoTWithTemplate($pa_options['generateIdnoWithTemplate'], array('dontSetValue' => true));
         }
     }
     $va_find_arr = array();
     if ($pn_type_id) {
         $va_find_arr['type_id'] = $pn_type_id;
     }
     if ($pn_parent_id) {
         $va_find_arr['parent_id'] = $pn_parent_id;
     }
     if (!($vn_id = ca_occurrences::find(array_merge(array('preferred_labels' => array('name' => $ps_occ_name)), $va_find_arr), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction'])))) {
         if ($pb_match_on_idno && $vs_idno) {
             $va_find_arr['idno'] = $vs_idno;
             $vn_id = ca_occurrences::find($va_find_arr, array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']));
         }
     }
     if (!$vn_id) {
         if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
             return false;
         }
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'I');
         }
         $t_occurrence->setMode(ACCESS_WRITE);
         $t_occurrence->set('locale_id', $pn_locale_id);
         $t_occurrence->set('type_id', $pn_type_id);
         $t_occurrence->set('parent_id', $pn_parent_id);
         $t_occurrence->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_occurrence->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_occurrence->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         $t_occurrence->set('idno', $vs_idno);
         $t_occurrence->set('hier_occurrence_id', isset($pa_values['hier_occurrence_id']) ? $pa_values['hier_occurrence_id'] : null);
         $t_occurrence->insert();
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
         $t_occurrence->addLabel(array('name' => $ps_occ_name), $pn_locale_id, null, true);
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set preferred label for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             $vb_label_errors = true;
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_id']);
         unset($pa_values['hier_occurrence_id']);
         $vb_attr_errors = false;
         if (is_array($pa_values)) {
             foreach ($pa_values as $vs_element => $va_value) {
                 if (is_array($va_value)) {
                     // array of values (complex multi-valued attribute)
                     $t_occurrence->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                 } else {
                     // scalar value (simple single value attribute)
                     if ($va_value) {
                         $t_occurrence->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                     }
                 }
             }
         }
         $t_occurrence->update();
         if ($t_occurrence->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set values for occurrence %1: %2", $ps_occ_name, join('; ', $t_occurrence->getErrors())));
             }
             $vb_attr_errors = true;
         }
         $vn_occurrence_id = $t_occurrence->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_occurrence->getErrors())));
             } else {
                 $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new occurrence %1", $ps_occ_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_occurrence;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_occurrences', 'U');
         }
         $vn_occurrence_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_occurrence_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing occurrence %1 in DataMigrationUtils::getOccurrenceID(); total of %2 occurrences were found", $ps_occ_name, sizeof($va_occurrence_ids) + 1));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return new ca_occurrences($vn_occurrence_id);
         }
     }
     return $vn_occurrence_id;
 }
コード例 #28
0
        ?>
		</div>
<?php 
    }
}
?>
			
			{{{<ifcount code="ca_occurrences.description" min="1"><span class='metaTitle'>Description</span><span class='meta'><unit>^ca_occurrences.description</unit></span></ifcount>}}}
			{{{<ifcount relativeTo="ca_occurrences" code="ca_occurrences.locationText" min="1"><span class='metaTitle'>Location</span><span class='meta'><unit relativeTo="ca_occurrences">^ca_occurrences.locationText</unit></span></ifcount>}}}
			{{{<ifcount relativeTo="ca_occurrences" code="ca_occurrences.legacyLocation" min="1"><span class='metaTitle'>Location (legacy text)</span><span class='meta'><unit relativeTo="ca_occurrences">^ca_occurrences.legacyLocation</unit></span></ifcount>}}}
<?php 
if ($va_rel_works = $t_object->get('ca_occurrences.occurrence_id', array('returnAsArray' => true))) {
    print "<span class='metaTitle'>Related places</span>";
    print "<div class='meta'>";
    foreach ($va_rel_works as $va_key => $va_occurrence_id) {
        $t_occurrence = new ca_occurrences($va_occurrence_id);
        print $t_occurrence->get('ca_places.preferred_labels');
    }
    print "</div>";
}
if (is_array($va_occurrence_ids = $t_object->get('ca_occurrences.occurrence_id', array('returnAsArray' => true)))) {
    $qr_occ = caMakeSearchResult('ca_occurrences', $va_occurrence_ids);
    while ($qr_occ->nextHit()) {
        if (is_array($va_contributors = $qr_occ->get('ca_entities', array('restrictToRelationshipTypes' => array('subject', 'interviewee'), 'returnWithStructure' => true, 'checkAccess' => caGetUserAccessValues($this->request)))) && sizeof($va_contributors)) {
            print "<div><span class='metaTitle'>Subjects</span><div class='meta'>";
            foreach ($va_contributors as $cont_key => $va_contributor) {
                print "<div>" . caNavLink($this->request, $va_contributor['displayname'] . " (" . $va_contributor['relationship_typename'] . ")", '', 'Detail', 'entities', $va_contributor['entity_id']) . "</div>";
            }
            print "</div></div>";
        }
    }
コード例 #29
0
ファイル: displayHelpers.php プロジェクト: kai-iak/providence
/**
 *
 */
function caGetTableDisplayName($pm_table_name_or_num, $pb_use_plural = true)
{
    require_once __CA_MODELS_DIR__ . '/ca_occurrences.php';
    $o_dm = Datamodel::load();
    $vs_table = $o_dm->getTableName($pm_table_name_or_num);
    switch ($vs_table) {
        case 'ca_occurrences':
            $t_occ = new ca_occurrences();
            $va_types = $t_occ->getTypeList();
            $va_type_labels = array();
            foreach ($va_types as $vn_item_id => $va_type_info) {
                $va_type_labels[] = $va_type_info[$pb_use_plural ? 'name_plural' : 'name_singular'];
            }
            return join('/', $va_type_labels);
            break;
        default:
            if ($t_instance = $o_dm->getInstanceByTableName($vs_table, true)) {
                return $t_instance->getProperty($pb_use_plural ? 'NAME_PLURAL' : 'NAME_SINGULAR');
            }
            break;
    }
    return null;
}
コード例 #30
0
ファイル: ca_objects.php プロジェクト: kai-iak/pawtucket2
 /**
  * Return array with list of significant events in object life cycle as configured for 
  * a ca_objects_history editor bundle.
  *
  * @param array $pa_bundle_settings The settings for a ca_objects_history editing BUNDLES
  * @param array $pa_options Array of options. Options include:
  *		noCache = Don't use any cached history data. [Default is false]
  *		currentOnly = Only return history entries dates before or on the current date. [Default is false]
  *		limit = Only return a maximum number of history entries. [Default is null; no limit]
  *
  * @return array A list of life cycle events, indexed by historic timestamp for date of occurrrence. Each list value is an array of history entries.
  *
  * @used-by ca_objects::getObjectHistoryHTMLFormBundle
  */
 public function getObjectHistory($pa_bundle_settings = null, $pa_options = null)
 {
     global $g_ui_locale;
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!is_array($pa_bundle_settings)) {
         $pa_bundle_settings = array();
     }
     $vs_cache_key = caMakeCacheKeyFromOptions(array_merge($pa_bundle_settings, $pa_options, array('object_id' => $this->getPrimaryKey())));
     $pb_no_cache = caGetOption('noCache', $pa_options, false);
     if (!$pb_no_cache && isset(ca_objects::$s_object_use_cache[$vs_cache_key])) {
         return ca_objects::$s_object_use_cache[$vs_cache_key];
     }
     $pb_display_label_only = caGetOption('displayLabelOnly', $pa_options, false);
     $pb_get_current_only = caGetOption('currentOnly', $pa_options, false);
     $pn_limit = caGetOption('limit', $pa_options, null);
     $vs_display_template = caGetOption('display_template', $pa_bundle_settings, _t('No template defined'));
     $vs_history_template = caGetOption('history_template', $pa_bundle_settings, $vs_display_template);
     $vn_current_date = caDateToHistoricTimestamp(_t('now'));
     $o_media_coder = new MediaInfoCoder();
     //
     // Get history
     //
     $va_history = array();
     // Lots
     if (is_array($va_lot_types = caGetOption('ca_object_lots_showTypes', $pa_bundle_settings, null)) && ($vn_lot_id = $this->get('lot_id'))) {
         $t_lot = new ca_object_lots($vn_lot_id);
         if (!$t_lot->get('deleted')) {
             $va_lot_type_info = $t_lot->getTypeList();
             $vn_type_id = $t_lot->get('type_id');
             $vs_color = $va_lot_type_info[$vn_type_id]['color'];
             if (!$vs_color || $vs_color == '000000') {
                 $vs_color = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
             }
             $va_dates = array();
             $va_date_elements = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null);
             if (!is_array($va_date_elements) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (is_array($va_date_elements) && sizeof($va_date_elements)) {
                 foreach ($va_date_elements as $vs_date_element) {
                     $va_dates[] = array('sortable' => $t_lot->get($vs_date_element, array('getDirectDate' => true)), 'display' => $t_lot->get($vs_date_element));
                 }
             }
             if (!sizeof($va_dates)) {
                 $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($t_lot->getCreationTimestamp(null, array('timestampOnly' => true))), 'display' => caGetLocalizedDate($vn_date));
             }
             foreach ($va_dates as $va_date) {
                 if (!$va_date['sortable']) {
                     continue;
                 }
                 if (!in_array($vn_type_id, $va_lot_types)) {
                     continue;
                 }
                 if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                     continue;
                 }
                 $vs_default_display_template = '^ca_object_lots.preferred_labels.name (^ca_object_lots.idno_stub)';
                 $vs_display_template = $pb_display_label_only ? "" : caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
                 $va_history[$va_date['sortable']][] = array('type' => 'ca_object_lots', 'id' => $vn_lot_id, 'display' => $t_lot->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_lot_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_lot_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_lot_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
             }
         }
     }
     // Loans
     $va_loans = $this->get('ca_loans.loan_id', array('returnAsArray' => true));
     if (is_array($va_loan_types = caGetOption('ca_loans_showTypes', $pa_bundle_settings, null)) && is_array($va_loans) && sizeof($va_loans)) {
         $qr_loans = caMakeSearchResult('ca_loans', $va_loans);
         $t_loan = new ca_loans();
         $va_loan_type_info = $t_loan->getTypeList();
         $va_date_elements_by_type = array();
         foreach ($va_loan_types as $vn_type_id) {
             if (!is_array($va_date_elements = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (!$va_date_elements) {
                 continue;
             }
             $va_date_elements_by_type[$vn_type_id] = $va_date_elements;
         }
         while ($qr_loans->nextHit()) {
             $vn_loan_id = $qr_loans->get('loan_id');
             if ((string) $qr_loans->get('ca_loans.deleted') !== '0') {
                 continue;
             }
             // filter out deleted
             $vn_type_id = $qr_loans->get('type_id');
             $va_dates = array();
             if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) {
                 foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) {
                     $va_dates[] = array('sortable' => $qr_loans->get("ca_loans.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_loans->get("ca_loans.{$vs_date_element}"));
                 }
             }
             if (!sizeof($va_dates)) {
                 $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_loans->get('lastModified')), 'display' => caGetLocalizedDate($vn_date));
             }
             $vs_default_display_template = '^ca_loans.preferred_labels.name (^ca_loans.idno)';
             $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
             foreach ($va_dates as $va_date) {
                 if (!$va_date['sortable']) {
                     continue;
                 }
                 if (!in_array($vn_type_id, $va_loan_types)) {
                     continue;
                 }
                 if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                     continue;
                 }
                 $vs_color = $va_loan_type_info[$vn_type_id]['color'];
                 if (!$vs_color || $vs_color == '000000') {
                     $vs_color = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
                 }
                 $va_history[$va_date['sortable']][] = array('type' => 'ca_loans', 'id' => $vn_loan_id, 'display' => $qr_loans->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_loan_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_loan_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_loan_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
             }
         }
     }
     // Movements
     $va_movements = $this->get('ca_movements.movement_id', array('returnAsArray' => true));
     if (is_array($va_movement_types = caGetOption('ca_movements_showTypes', $pa_bundle_settings, null)) && is_array($va_movements) && sizeof($va_movements)) {
         $qr_movements = caMakeSearchResult('ca_movements', $va_movements);
         $t_movement = new ca_movements();
         $va_movement_type_info = $t_movement->getTypeList();
         $va_date_elements_by_type = array();
         foreach ($va_movement_types as $vn_type_id) {
             if (!is_array($va_date_elements = caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (!$va_date_elements) {
                 continue;
             }
             $va_date_elements_by_type[$vn_type_id] = $va_date_elements;
         }
         while ($qr_movements->nextHit()) {
             $vn_movement_id = $qr_movements->get('movement_id');
             if ((string) $qr_movements->get('ca_movements.deleted') !== '0') {
                 continue;
             }
             // filter out deleted
             $vn_type_id = $qr_movements->get('type_id');
             $va_dates = array();
             if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) {
                 foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) {
                     $va_dates[] = array('sortable' => $qr_movements->get("ca_movements.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_movements->get("ca_movements.{$vs_date_element}"));
                 }
             }
             if (!sizeof($va_dates)) {
                 $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_movements->get('lastModified')), 'display' => caGetLocalizedDate($vn_date));
             }
             $vs_default_display_template = '^ca_movements.preferred_labels.name (^ca_movements.idno)';
             $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
             foreach ($va_dates as $va_date) {
                 if (!$va_date['sortable']) {
                     continue;
                 }
                 if (!in_array($vn_type_id, $va_movement_types)) {
                     continue;
                 }
                 if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                     continue;
                 }
                 $vs_color = $va_movement_type_info[$vn_type_id]['color'];
                 if (!$vs_color || $vs_color == '000000') {
                     $vs_color = caGetOption("ca_movements_{$va_movement_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
                 }
                 $va_history[$va_date['sortable']][] = array('type' => 'ca_movements', 'id' => $vn_movement_id, 'display' => $qr_movements->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_movement_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_movement_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_movement_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
             }
         }
     }
     // Occurrences
     $va_occurrences = $this->get('ca_occurrences.occurrence_id', array('returnAsArray' => true));
     if (is_array($va_occurrence_types = caGetOption('ca_occurrences_showTypes', $pa_bundle_settings, null)) && is_array($va_occurrences) && sizeof($va_occurrences)) {
         $qr_occurrences = caMakeSearchResult('ca_occurrences', $va_occurrences);
         $t_occurrence = new ca_occurrences();
         $va_occurrence_type_info = $t_occurrence->getTypeList();
         $va_date_elements_by_type = array();
         foreach ($va_occurrence_types as $vn_type_id) {
             if (!is_array($va_date_elements = caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (!$va_date_elements) {
                 continue;
             }
             $va_date_elements_by_type[$vn_type_id] = $va_date_elements;
         }
         while ($qr_occurrences->nextHit()) {
             $vn_occurrence_id = $qr_occurrences->get('occurrence_id');
             if ((string) $qr_occurrences->get('ca_occurrences.deleted') !== '0') {
                 continue;
             }
             // filter out deleted
             $vn_type_id = $qr_occurrences->get('type_id');
             $va_dates = array();
             if (is_array($va_date_elements_by_type[$vn_type_id]) && sizeof($va_date_elements_by_type[$vn_type_id])) {
                 foreach ($va_date_elements_by_type[$vn_type_id] as $vs_date_element) {
                     $va_dates[] = array('sortable' => $qr_occurrences->get("ca_occurrences.{$vs_date_element}", array('getDirectDate' => true)), 'display' => $qr_occurrences->get("ca_occurrences.{$vs_date_element}"));
                 }
             }
             if (!sizeof($va_dates)) {
                 $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($qr_occurrences->get('lastModified')), 'display' => caGetLocalizedDate($vn_date));
             }
             $vs_default_display_template = '^ca_occurrences.preferred_labels.name (^ca_occurrences.idno)';
             $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
             foreach ($va_dates as $va_date) {
                 if (!$va_date['sortable']) {
                     continue;
                 }
                 if (!in_array($vn_type_id, $va_occurrence_types)) {
                     continue;
                 }
                 if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                     continue;
                 }
                 $vs_color = $va_occurrence_type_info[$vn_type_id]['color'];
                 if (!$vs_color || $vs_color == '000000') {
                     $vs_color = caGetOption("ca_occurrences_{$va_occurrence_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
                 }
                 $va_history[$va_date['sortable']][] = array('type' => 'ca_occurrences', 'id' => $vn_occurrence_id, 'display' => $qr_occurrences->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_occurrence_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_occurrence_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_occurrence_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
             }
         }
     }
     // Storage locations
     $va_locations = $this->get('ca_objects_x_storage_locations.relation_id', array('returnAsArray' => true));
     if (is_array($va_location_types = caGetOption('ca_storage_locations_showRelationshipTypes', $pa_bundle_settings, null)) && is_array($va_locations) && sizeof($va_locations)) {
         $t_location = new ca_storage_locations();
         $va_location_type_info = $t_location->getTypeList();
         $vs_name_singular = $t_location->getProperty('NAME_SINGULAR');
         $vs_name_plural = $t_location->getProperty('NAME_PLURAL');
         $qr_locations = caMakeSearchResult('ca_objects_x_storage_locations', $va_locations);
         $vs_default_display_template = '^ca_storage_locations.parent.preferred_labels.name ➜ ^ca_storage_locations.preferred_labels.name (^ca_storage_locations.idno)';
         $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption('ca_storage_locations_displayTemplate', $pa_bundle_settings, $vs_default_display_template);
         Debug::msg($qr_locations->numHits());
         while ($qr_locations->nextHit()) {
             $vn_location_id = $qr_locations->get('ca_objects_x_storage_locations.location_id');
             if ((string) $qr_locations->get('ca_storage_locations.deleted') !== '0') {
                 continue;
             }
             // filter out deleted
             $va_date = array('sortable' => $qr_locations->get("ca_objects_x_storage_locations.effective_date", array('getDirectDate' => true)), 'display' => $qr_locations->get("ca_objects_x_storage_locations.effective_date"));
             if (!$va_date['sortable']) {
                 continue;
             }
             if (!in_array($vn_rel_type_id = $qr_locations->get('ca_objects_x_storage_locations.type_id'), $va_location_types)) {
                 continue;
             }
             $vn_type_id = $qr_locations->get('ca_storage_locations.type_id');
             if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                 continue;
             }
             $vs_color = $va_location_type_info[$vn_type_id]['color'];
             if (!$vs_color || $vs_color == '000000') {
                 $vs_color = caGetOption("ca_storage_locations_color", $pa_bundle_settings, 'ffffff');
             }
             $va_history[$va_date['sortable']][] = array('type' => 'ca_storage_locations', 'id' => $vn_location_id, 'relation_id' => $qr_locations->get('relation_id'), 'display' => $qr_locations->getWithTemplate("<unit relativeTo='ca_storage_locations'>{$vs_display_template}</unit>"), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_location_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_name_singular, 'typename_plural' => $vs_name_plural, 'type_id' => $vn_type_id, 'rel_type_id' => $vn_rel_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_name_singular . '</div>') . '</div></div>', 'date' => $va_date['display']);
         }
     }
     // Deaccession
     if ($this->get('is_deaccessioned') && caGetOption('showDeaccessionInformation', $pa_bundle_settings, false)) {
         $vs_color = caGetOption('deaccession_color', $pa_bundle_settings, 'cccccc');
         $vn_date = $this->get('deaccession_date', array('getDirectDate' => true));
         $vs_default_display_template = '^ca_objects.deaccession_notes';
         $vs_display_template = $pb_display_label_only ? $vs_default_display_template : caGetOption('deaccession_displayTemplate', $pa_bundle_settings, $vs_default_display_template);
         if (!($pb_get_current_only && $vn_date > $vn_current_date)) {
             $va_history[$vn_date][] = array('type' => 'ca_objects_deaccession', 'id' => $this->getPrimaryKey(), 'display' => $this->getWithTemplate("<unit>{$vs_display_template}</unit>"), 'color' => $vs_color, 'icon_url' => '', 'typename_singular' => $vs_name_singular = _t('deaccession'), 'typename_plural' => $vs_name_plural = _t('deaccessions'), 'type_id' => null, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon"><div class="caUseHistoryIconText">' . $vs_name_singular . '</div>' . '</div></div>', 'date' => $this->get('deaccession_date'));
         }
     }
     ksort($va_history);
     $va_history = array_reverse($va_history);
     if ($pn_limit > 0) {
         $va_history = array_slice($va_history, 0, $pn_limit);
     }
     if (sizeof(ca_objects::$s_object_use_cache[$vs_cache_key]) > 100) {
         ca_objects::$s_object_use_cache[$vs_cache_key] = array_slice(ca_objects::$s_object_use_cache[$vs_cache_key], 0, 50);
     }
     return ca_objects::$s_object_use_cache[$vs_cache_key] = $va_history;
 }