Example #1
0
<?php

$t_collection = $this->getVar('t_collection');
$ps_template = $this->getVar('display_template');
$vs_page_title = $this->getVar('page_title');
$vs_intro_text = $this->getVar('intro_text');
$qr_top_level_collections = ca_collections::find(array('parent_id' => null), array('returnAs' => 'searchResult'));
?>
	<h1><?php 
print $vs_page_title;
?>
</h1>
	<div class='findingIntro'><?php 
print $vs_intro_text;
?>
</div>
	<div id='findingAidCont'>
<?php 
if ($qr_top_level_collections) {
    while ($qr_top_level_collections->nextHit()) {
        $vn_top_level_collection_id = $qr_top_level_collections->get('ca_collections.collection_id');
        //print $qr_top_level_collections->get('ca_collections.preferred_labels.name')."<br>\n";
        $va_hierarchy = $t_collection->hierarchyWithTemplate($ps_template, array('collection_id' => $vn_top_level_collection_id));
        foreach ($va_hierarchy as $vn_i => $va_hierarchy_item) {
            print "<div class='collHeader' style='margin-left: " . $va_hierarchy_item['level'] * 35 . "px'>";
            if ($va_hierarchy_item['level'] == 0 && $qr_top_level_collections->get('ca_collections.children.collection_id')) {
                print "<a href='#'><i class='fa fa-angle-double-down finding-aid down{$vn_top_level_collection_id}'></i></a>";
            } elseif ($va_hierarchy_item['level'] == 0) {
                print "<i class='fa fa-square-o finding-aid' {$va_opacity}></i>";
            } else {
                $va_opacity = "style='opacity: ." . (90 - $va_hierarchy_item['level'] * 20) . "' ";
Example #2
0
 /**
  * Returns name of hierarchy for currently loaded row or, if specified, row identified by optional $pn_id parameter
  */
 public function getHierarchyName($pn_id = null)
 {
     if (!$pn_id) {
         $pn_id = $this->getPrimaryKey();
     }
     $va_ancestors = $this->getHierarchyAncestors($pn_id, array('idsOnly' => true));
     if (is_array($va_ancestors) && sizeof($va_ancestors)) {
         $vn_parent_id = array_pop($va_ancestors);
         $t_collection = new ca_collections($vn_parent_id);
         return $t_collection->getLabelForDisplay(false);
     } else {
         if ($pn_id == $this->getPrimaryKey()) {
             return $this->getLabelForDisplay(true);
         } else {
             $t_collection = new ca_collections($pn_id);
             return $t_collection->getLabelForDisplay(false);
         }
     }
 }
Example #3
0
print caNavLink($this->request, 'Limerick City Archives', '', '', '', '');
$vs_controller = $this->request->getController();
switch ($vs_controller) {
    case "Browse":
        print " &gt; Browse";
        break;
    case "Search":
        print " &gt; Search";
        break;
    case "Object":
        print " &gt; Object";
        break;
    case "Collection":
        print " &gt; Showcase";
        if ($this->request->getParameter('collection_id', pInteger)) {
            $t_collection = new ca_collections($this->request->getParameter('collection_id', pInteger));
            print " &gt; " . $t_collection->getLabelForDisplay();
        }
        break;
    case "Favorites":
        print " &gt; Featured Artifacts";
        break;
    case "LoginReg":
        print " &gt; Login";
        break;
    default:
        break;
}
?>
 		
			</p>
Example #4
0
		<h1><?php 
print $vs_page_title;
?>
</h1>
		<div class='findingIntro'><?php 
print $vs_intro_text;
?>
</div>
		<div id='findingAidCont'>
	<?php 
if ($qr_top_level_collections) {
    while ($qr_top_level_collections->nextHit()) {
        $vn_top_level_collection_id = $qr_top_level_collections->get('ca_collections.collection_id', array('checkAccess' => caGetUserAccessValues($this->request)));
        $va_hierarchy = $t_collection->hierarchyWithTemplate($ps_template, array('collection_id' => $vn_top_level_collection_id));
        foreach ($va_hierarchy as $vn_i => $va_hierarchy_item) {
            $t_collection_item = new ca_collections($va_hierarchy_item['id']);
            if ($t_collection_item->get('ca_collections.fa_access') != 261 && $va_hierarchy_item['level'] == 0) {
                print "<div class='collHeader' >";
                print "<i class='fa fa-square-o finding-aid' {$va_opacity}></i>";
                if ($t_collection_item->get('ca_collections.fa_access') == 262) {
                    print "<div class='text'>" . caNavLink($this->request, $t_collection_item->get('ca_collections.preferred_labels') . " (" . $t_collection_item->get('ca_collections.idno') . ")", '', '', 'Detail', 'collections/' . $va_hierarchy_item['id']) . "</div><br/>";
                } else {
                    print "<div class='text'>" . caNavLink($this->request, $t_collection_item->get('ca_collections.preferred_labels.name') . " (" . $t_collection_item->get('ca_collections.idno') . ")", '', '', 'Detail', 'collections/' . $va_hierarchy_item['id']) . " <br/><div style='font-weight:200; width: auto; margin-left: 30px;' class='trimText'>" . $t_collection_item->get('ca_collections.abstract') . "</div></div><br/>";
                }
                print "</div><!-- end collHeader-->";
            }
        }
    }
} else {
    print _t('No collections available');
}
Example #5
0
 /**
  *
  */
 public function Index()
 {
     $o_cache = caGetCacheObject('MetabolicChronology', 3600);
     if (!is_array($va_silos = $o_cache->load('silo_list')) || $this->request->getParameter('nocache', pInteger) || !$this->opo_plugin_config->get('doCaching')) {
         $va_access_values = caGetUserAccessValues($this->request);
         $this->view->setVar('access_values', $va_access_values);
         // Get silos
         $t_list = new ca_lists();
         $o_db = new Db();
         $qr_ids = $o_db->query("SELECT collection_id FROM ca_collections WHERE type_id = ? AND deleted = 0 AND access IN (?)", $this->opn_silo_type_id, implode(", ", $this->opa_access_values));
         $t_collection = new ca_collections();
         $qr_silos = $t_collection->makeSearchResult('ca_collections', $qr_ids->getAllFieldValues('collection_id'));
         $o_search = new OccurrenceSearch();
         $va_silos = array();
         while ($qr_silos->nextHit()) {
             $vs_name = $qr_silos->get('ca_collections.preferred_labels.name');
             $vn_collection_id = $qr_silos->get('collection_id');
             if (strtolower($vs_name) == 'historical context') {
                 $o_search->setTypeRestrictions(array($this->opn_context_type_id));
             } else {
                 $o_search->setTypeRestrictions(array($this->opn_action_type_id));
             }
             $o_search->addResultFilter("ca_occurrences.access", "IN", join(',', $this->opa_access_values));
             $qr_res = $o_search->search("ca_occurrences.includeChronology:" . $this->opn_yes_list_id . " AND ca_collections.collection_id:{$vn_collection_id} AND ca_occurrences.date.dates_value:\"after 1000\"");
             $va_silos[$vn_collection_id] = array('collection_id' => $vn_collection_id, 'name' => $vs_name, 'actions' => $this->_getActions($vn_collection_id, 0, 25, strtolower($vs_name) == 'historical context'), 'num_actions' => $qr_res->numHits(), 'actionmap' => $this->_getActionMap($vn_collection_id, strtolower($vs_name) == 'historical context'));
         }
         $o_cache->save($va_silos);
     }
     $this->view->setVar('silos', $va_silos);
     $this->render('chronology_html.php');
 }
 /**
  *
  */
 private function _getHierarchyLocationHTMLFormBundleInfo($po_request, $ps_form_name, $ps_placement_code, $pa_options = null, $pa_bundle_settings = null)
 {
     $vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $po_request->getViewsDirectoryPath();
     $o_view = new View($po_request, "{$vs_view_path}/bundles/");
     if (!is_array($pa_bundle_settings)) {
         $pa_bundle_settings = array();
     }
     if (!($vs_label_table_name = $this->getLabelTableName())) {
         return '';
     }
     $o_view->setVar('id_prefix', $ps_form_name);
     $o_view->setVar('placement_code', $ps_placement_code);
     $o_view->setVar('t_subject', $this);
     if (!($vn_id = $this->getPrimaryKey())) {
         $vn_parent_id = $vn_id = $po_request->getParameter($this->HIERARCHY_PARENT_ID_FLD, pString);
     } else {
         $vn_parent_id = $this->get($this->HIERARCHY_PARENT_ID_FLD);
     }
     $vs_display_fld = $this->getLabelDisplayField();
     if ($this->supportsPreferredLabelFlag()) {
         if (!($va_ancestor_list = $this->getHierarchyAncestors($vn_id, array('additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'additionalTableWheres' => array('(' . $vs_label_table_name . '.is_preferred = 1 OR ' . $vs_label_table_name . '.is_preferred IS NULL)'), 'includeSelf' => true)))) {
             $va_ancestor_list = array();
         }
     } else {
         if (!($va_ancestor_list = $this->getHierarchyAncestors($vn_id, array('additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'includeSelf' => true)))) {
             $va_ancestor_list = array();
         }
     }
     $va_ancestors_by_locale = array();
     $vs_pk = $this->primaryKey();
     $vs_idno_field = $this->getProperty('ID_NUMBERING_ID_FIELD');
     $vs_hierarchy_type = $this->getProperty('HIERARCHY_TYPE');
     foreach ($va_ancestor_list as $vn_ancestor_id => $va_info) {
         switch ($vs_hierarchy_type) {
             case __CA_HIER_TYPE_SIMPLE_MONO__:
                 if (!$va_info['NODE']['parent_id']) {
                     continue 2;
                 }
                 break;
             case __CA_HIER_TYPE_MULTI_MONO__:
                 if (!$va_info['NODE']['parent_id']) {
                     $vn_item_id = $va_info['NODE'][$vs_pk];
                     $va_ancestors_by_locale[$vn_item_id][$vn_locale_id] = array('item_id' => $vn_item_id, 'parent_id' => $va_info['NODE']['parent_id'], 'label' => $this->getHierarchyName($vn_item_id), 'idno' => $va_info['NODE'][$vs_idno_field], 'locale_id' => null, 'table' => $this->tableName());
                     continue 2;
                 }
                 break;
         }
         if (!$va_info['NODE']['parent_id'] && $vb_dont_show_root) {
             continue;
         }
         $vn_locale_id = isset($va_info['NODE']['locale_id']) ? $va_info['NODE']['locale_id'] : null;
         $va_ancestor = array('item_id' => $vn_item_id = $va_info['NODE'][$vs_pk], 'parent_id' => $va_info['NODE']['parent_id'], 'label' => $va_info['NODE'][$vs_display_fld] ? $va_info['NODE'][$vs_display_fld] : $va_info['NODE'][$vs_idno_field], 'idno' => $va_info['NODE'][$vs_idno_field], 'locale_id' => $vn_locale_id, 'table' => $this->tableName());
         $va_ancestors_by_locale[$vn_item_id][$vn_locale_id] = $va_ancestor;
     }
     $va_ancestor_list = array_reverse(caExtractValuesByUserLocale($va_ancestors_by_locale), true);
     if (!$this->getPrimaryKey()) {
         $va_ancestor_list[null] = array($this->primaryKey() => '', $this->getLabelDisplayField() => _t('New %1', $this->getProperty('NAME_SINGULAR')));
     }
     $o_view->setVar('object_collection_collection_ancestors', array());
     // collections to display as object parents when ca_objects_x_collections_hierarchy_enabled is enabled
     if ($this->tableName() == 'ca_objects' && $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled')) {
         $vs_object_collection_rel_type = $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_relationship_type');
         // Is object part of a collection?
         $va_object_ids = array_keys($va_ancestor_list);
         $vn_top_object_id = array_shift($va_object_ids);
         if ($vn_top_object_id != $this->getPrimaryKey()) {
             $t_object = $this->getAppDatamodel()->getInstanceByTableName("ca_objects", true);
             $t_object->load($vn_top_object_id);
         } else {
             $t_object = $this;
         }
         if (is_array($va_collections = $t_object->getRelatedItems('ca_collections', array('restrictToRelationshipTypes' => array($vs_object_collection_rel_type))))) {
             $va_related_collections_by_level = array();
             foreach ($va_collections as $vs_key => $va_collection) {
                 $va_related_collections_by_level[$va_collection['collection_id']] = array('item_id' => $va_collection['collection_id'], 'parent_id' => $va_collection['parent_id'], 'label' => $va_collection['label'], 'idno' => $va_collection['idno'], 'table' => 'ca_collections');
                 $t_collection = new ca_collections();
                 if (!($va_collection_ancestor_list = $t_collection->getHierarchyAncestors($va_collection['collection_id'], array('additionalTableToJoin' => 'ca_collection_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name', 'locale_id'), 'additionalTableWheres' => array('(ca_collection_labels.is_preferred = 1 OR ca_collection_labels.is_preferred IS NULL)'), 'includeSelf' => false)))) {
                     $va_collection_ancestor_list = array();
                 }
                 $vn_i = 1;
                 foreach ($va_collection_ancestor_list as $vn_id => $va_collection_ancestor) {
                     $va_related_collections_by_level[$va_collection_ancestor['NODE']['collection_id']] = array('item_id' => $va_collection_ancestor['NODE']['collection_id'], 'parent_id' => $va_collection_ancestor['NODE']['parent_id'], 'label' => $va_collection_ancestor['NODE']['name'], 'idno' => $va_collection_ancestor['NODE']['idno'], 'table' => 'ca_collections');
                     $vn_i++;
                 }
                 break;
                 // only process the first collection (for now)
             }
             $o_view->setVar('object_collection_collection_ancestors', array_reverse($va_related_collections_by_level, true));
         }
     }
     $o_view->setVar('parent_id', $vn_parent_id);
     $o_view->setVar('ancestors', $va_ancestor_list);
     $o_view->setVar('id', $this->getPrimaryKey());
     $o_view->setVar('settings', $pa_bundle_settings);
     return $o_view;
 }
                 }
             }
             if ($vn_i < 4) {
                 while ($vn_i < 4) {
                     if ($vn_ii % 2 == 0) {
                         $vs_style = "style='margin-right:10px;'";
                     } else {
                         $vs_style = "";
                     }
                     print "<div class='exImage' {$vs_style}></div>";
                     $vn_i++;
                     $vn_ii++;
                 }
             }
         } else {
             $t_collection = new ca_collections($va_artworks[0]);
             $va_related_objects = $t_collection->get('ca_objects.object_id', array('returnAsArray' => true));
             $va_object_reps = caGetPrimaryRepresentationsForIDs($va_related_objects, array('versions' => array('exsingle'), 'return' => array('tags')));
             print "<div class='exImageSingle'>" . caNavLink($this->request, array_shift(array_values($va_object_reps)), '', '', 'Detail', 'Occurrences/' . $va_occurrence['occurrence_id']) . "</div>";
         }
         print "<div class='exTitle'>" . caNavLink($this->request, $va_occurrence['name'], '', '', 'Detail', 'Occurrences/' . $va_occurrence['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 Objects Block
 if (sizeof($va_objects) > 0) {
     foreach ($va_objects as $va_object_id => $va_object) {
 /** 
  * Returns collection_id for the collection with the specified name, regardless of specified type. If the collection 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 collection fields or attributes.
  *
  * @param string $ps_collection_name Collection label name
  * @param int $pn_type_id The type_id of the collection type to use if the collection needs to be created
  * @param int $pn_locale_id The locale_id to use if the collection needs to be created (will be used for both the collection locale as well as the label locale)
  * @param array $pa_values An optional array of additional values to populate newly created collection records with. These values are *only* used for newly created collections; they will not be applied if the collection named already exists. The array keys should be names of collection fields or valid collection 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 collections will not be created [default=false]
  * 				transaction - if Transaction object is passed, use it for all Db-related tasks [default=null]
  *				returnInstance = return ca_collections instance rather than collection_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 collection 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 getCollectionID($ps_collection_name, $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_collection = new ca_collections();
     if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
         $t_collection->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_collection->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_collections::find(array_merge(array('preferred_labels' => array('name' => $ps_collection_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_collections::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_collections', 'I');
         }
         $t_collection->setMode(ACCESS_WRITE);
         $t_collection->set('locale_id', $pn_locale_id);
         $t_collection->set('type_id', $pn_type_id);
         $t_collection->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_collection->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_collection->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         $t_collection->set('idno', $vs_idno);
         $t_collection->set('parent_id', isset($pa_values['parent_id']) ? $pa_values['parent_id'] : null);
         $t_collection->insert();
         if ($t_collection->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
         $t_collection->addLabel(array('name' => $ps_collection_name), $pn_locale_id, null, true);
         if ($t_collection->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
             }
             $vb_label_errors = true;
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_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_collection->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                 } else {
                     // scalar value (simple single value attribute)
                     if ($va_value) {
                         $t_collection->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                     }
                 }
             }
         }
         $t_collection->update();
         if ($t_collection->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set values for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set values for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
             }
             $vb_attr_errors = true;
         }
         $vn_collection_id = $t_collection->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_collection->getErrors())));
             } else {
                 $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new collection %1", $ps_collection_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_collection;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_collections', 'U');
         }
         $vn_collection_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing collection %1 in DataMigrationUtils::getCollectionID(); total of %2 collections were found", $ps_collection_name, sizeof($va_collection_ids) + 1));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return new ca_collections($vn_collection_id);
         }
     }
     return $vn_collection_id;
 }
Example #9
0
 /**
  * Returns HTML <select> element containing the specified list, or portion of the list.
  *
  * @param mixed $pm_list_name_or_id
  * @param string $ps_name
  * @param array $pa_attributes 
  * @param array $pa_options Array of options. Valid options include:
  * 	childrenOnlyForItemID = if set only items below item_id in the list item hierarchy are returned. Default (null) is to return all items in the list.
  * 	directChildrenOnly = if set only items with item_id=childrenOnlyForItemID as parent in the list item hierarchy are returned. Default (null) is to return all items in the list.
  *  nullOption = if set then a "null" (no value) option is available labeled with the value passed in this option
  *  additionalOptions = an optional array of options that will be passed through to caHTMLSelect; keys are display labels and values are used as option values
  *  value = if set, the <select> will have default selection set to the item whose *value* matches the option value. If none is set then the first item in the list will be selected
  *  key = ca_list_item field to be used as value for the <select> element list; can be set to either item_id or item_value; default is item_id
  *	width = the display width of the list in characters or pixels
  *  limitToItemsWithID = An optional array of list item_ids. Item_ids not in the array will be omitted from the returned list.
  *  omitItemsWithID = An optional array of list item_ids. Item_ids in the array will be omitted from the returned list.
  *  disableItemsWithID = An optional array of list item_ids. Item_ids in the array will be disabled in the returned list.	
  *
  *	limitToItemsRelatedToCollections = an array of collection_ids or collection idno's; returned items will be restricted to those attached to the specified collections
  *	limitToItemsRelatedToCollectionWithRelationshipTypes = array of collection type names or type_ids; returned items will be restricted to those attached to the specified collectionss with the specified relationship type
  *	limitToListIDs = array of list_ids to restrict returned items to when using "limitToItemsRelatedToCollections"
  *
  *  indentForHierarchy = indicate hierarchy with indentation. [Default is true]
  * 	transaction = transaction to perform database operations within. [Default is null]
  * 
  * @return string - HTML code for the <select> element; empty string if the list is empty
  */
 public static function getListAsHTMLFormElement($pm_list_name_or_id, $ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if ($o_trans = caGetOption('transaction', $pa_options, null)) {
         $t_list->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!(isset($pa_options['limitToItemsRelatedToCollection']) && is_array($pa_options['limitToItemsRelatedToCollections']))) {
         $vn_list_id = $t_list->_getListID($pm_list_name_or_id);
         $t_list->load($vn_list_id);
     }
     $vn_root_id = isset($pa_options['childrenOnlyForItemID']) && $pa_options['childrenOnlyForItemID'] ? $pa_options['childrenOnlyForItemID'] : null;
     $va_disabled_item_ids = caGetOption('disableItemsWithID', $pa_options, null);
     $vs_render_as = isset($pa_options['render']) ? $pa_options['render'] : '';
     $vn_sort_type = $t_list->get('default_sort');
     if ($vs_render_as == 'yes_no_checkboxes' && $vn_sort_type == __CA_LISTS_SORT_BY_LABEL__) {
         $vn_sort_type = __CA_LISTS_SORT_BY_IDENTIFIER__;
         // never allow sort-by-label when rendering as yes/no checkbox
     }
     if (!in_array($vs_render_as, array('lookup', 'horiz_hierbrowser', 'vert_hierbrowser'))) {
         if (isset($pa_options['limitToItemsRelatedToCollections']) && is_array($pa_options['limitToItemsRelatedToCollections'])) {
             $t_collection = new ca_collections();
             $va_collection_ids = array();
             foreach ($pa_options['limitToItemsRelatedToCollections'] as $vn_collection_id) {
                 if ($vn_collection_id && !is_numeric($vn_collection_id)) {
                     if ($vn_collection_id = $t_collection->load(array('idno' => $vn_collection_id))) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 } else {
                     if ($vn_collection_id) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 }
             }
             if (sizeof($va_collection_ids)) {
                 $qr_collections = $t_list->makeSearchResult('ca_collections', $va_collection_ids, array('restrictToRelationshipTypes' => isset($pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes']) ? $pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes'] : null));
                 $va_item_ids = array();
                 while ($qr_collections->nextHit()) {
                     $va_list_items = $qr_collections->get('ca_list_items', array('returnAsArray' => true));
                     foreach ($va_list_items as $vn_rel_id => $va_list_item) {
                         $va_item_ids[$vn_rel_id] = $va_list_item['item_id'];
                     }
                 }
                 if ($va_limit_to_listIDs = isset($pa_options['limitToListIDs']) && is_array($pa_options['limitToListIDs']) ? $pa_options['limitToListIDs'] : null) {
                     // for some reason the option comes back as array(0 => null) if no list is selected in UI
                     // -> have to make sure to catch this case here
                     if (sizeof($va_limit_to_listIDs) == 1 && empty($va_limit_to_listIDs[0])) {
                         $va_limit_to_listIDs = null;
                     }
                 }
                 if (is_array($va_limit_to_listIDs) && sizeof($va_item_ids)) {
                     // filter out items from tables we don't want
                     $qr_list_items = $t_list->makeSearchResult("ca_list_items", array_values($va_item_ids));
                     while ($qr_list_items->nextHit()) {
                         if (!in_array($qr_list_items->get('ca_list_items.list_id'), $va_limit_to_listIDs)) {
                             if (is_array($va_k = array_keys($va_item_ids, $qr_list_items->get('ca_list_items.item_id')))) {
                                 foreach ($va_k as $vs_k) {
                                     unset($va_list_items[$vs_k]);
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $va_list_items = $t_list->getItemsForList($pm_list_name_or_id, array_merge($pa_options, array('returnHierarchyLevels' => caGetOption('indentForHierarchy', $pa_options, true), 'item_id' => $vn_root_id, 'extractValuesByUserLocale' => true, 'sort' => $vn_sort_type)));
         }
     }
     if (!is_array($va_list_items)) {
         $va_list_items = array();
     }
     $va_options = array();
     $va_disabled_options = array();
     if (!isset($pa_options['value'])) {
         $pa_options['value'] = null;
     }
     if (!isset($pa_options['key'])) {
         $pa_options['key'] = 'item_id';
     }
     if (!in_array($pa_options['key'], array('item_id', 'item_value'))) {
         $pa_options['key'] = 'item_id';
     }
     if (!isset($pa_options['limitToItemsWithID']) || !is_array($pa_options['limitToItemsWithID']) || !sizeof($pa_options['limitToItemsWithID'])) {
         $pa_options['limitToItemsWithID'] = null;
     }
     if (!isset($pa_options['omitItemsWithID']) || !is_array($pa_options['omitItemsWithID']) || !sizeof($pa_options['omitItemsWithID'])) {
         $pa_options['omitItemsWithID'] = null;
     }
     if (isset($pa_options['nullOption']) && $pa_options['nullOption'] && $vs_render_as != 'checklist') {
         $va_options[''] = $pa_options['nullOption'];
     }
     $va_colors = array();
     $vn_default_val = null;
     foreach ($va_list_items as $vn_item_id => $va_item) {
         if (is_array($pa_options['limitToItemsWithID']) && !in_array($vn_item_id, $pa_options['limitToItemsWithID'])) {
             continue;
         }
         if (is_array($pa_options['omitItemsWithID']) && in_array($vn_item_id, $pa_options['omitItemsWithID'])) {
             continue;
         }
         $va_options[$va_item[$pa_options['key']]] = str_repeat('&nbsp;', intval($va_item['LEVEL']) * 3) . ' ' . $va_item['name_singular'];
         if (!$va_item['is_enabled'] || is_array($va_disabled_item_ids) && in_array($vn_item_id, $va_disabled_item_ids)) {
             $va_disabled_options[$va_item[$pa_options['key']]] = true;
         }
         $va_colors[$vn_item_id] = $va_item['color'];
         if ($va_item['is_default']) {
             $vn_default_val = $va_item[$pa_options['key']];
         }
         // get default value
         if ($va_item['is_default'] && !isset($pa_options['nullOption'])) {
             // set default if needed, but only if there's not a null option set
             if (!is_array($pa_options['value']) && (!isset($pa_options['value']) || !strlen($pa_options['value']))) {
                 $pa_options['value'] = $vn_default_val;
             } else {
                 if (is_array($pa_options['value']) && !sizeof($pa_options['value'])) {
                     $pa_options['value'] = array(0 => $vn_default_val);
                 }
             }
         }
     }
     if (isset($pa_options['additionalOptions']) && is_array($pa_options['additionalOptions'])) {
         $va_options = array_merge($va_options, array_flip($pa_options['additionalOptions']));
     }
     $pa_options['disabledOptions'] = $va_disabled_options;
     switch ($vs_render_as) {
         case 'radio_buttons':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vn_i = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 $va_attributes['value'] = $vm_value;
                 $va_attributes['id'] = $ps_name . '_' . $vn_i;
                 if ($pa_options['value'] == $vm_value) {
                     $va_attributes['checked'] = '1';
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 $vs_buf .= "<td>" . caHTMLRadioButtonInput($ps_name, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
                 $vn_i++;
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'yes_no_checkboxes':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vb_is_checked = false;
             if (!$pa_options['value']) {
                 $pa_options['value'] = (string) $vn_default_val;
             }
             foreach ($va_options as $vm_value => $vs_label) {
                 if (strlen($vm_value) == 0) {
                     continue;
                 }
                 // don't count null values when calculating the first value for the yes/no
                 switch ($vn_c) {
                     case 0:
                         if ($pa_options['value'] === (string) $vm_value) {
                             $vb_is_checked = true;
                         }
                         $pa_attributes['value'] = $pa_options['value'] = $vm_value;
                         $pa_options['label'] = $vs_label;
                         break;
                     case 1:
                         $pa_options['returnValueIfUnchecked'] = $vm_value;
                         break;
                     default:
                         // exit
                         break 2;
                 }
                 $vn_c++;
             }
             if ($vb_is_checked) {
                 $pa_attributes['checked'] = 1;
             }
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLCheckboxInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'checklist':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (is_array($pa_options['value']) && in_array($vm_value, $pa_options['value'])) {
                     $va_attributes['checked'] = '1';
                 }
                 $vs_buf .= "<td>" . caHTMLCheckboxInput($ps_name . '_' . $vm_value, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'lookup':
             $vs_value = $vs_hidden_value = "";
             if (caGetOption('forSearch', $pa_options)) {
                 if ($vs_val_id = caGetOption('value', $pa_options)) {
                     $vs_value = $t_list->getItemFromListForDisplayByItemID($pm_list_name_or_id, $vs_val_id);
                     $vs_hidden_value = $vs_val_id;
                 }
             } else {
                 $vs_value = "{" . $pa_options['element_id'] . "_label}";
                 $vs_hidden_value = "{" . $pa_options['element_id'] . "}";
             }
             $vs_buf = caHTMLTextInput($ps_name . '_autocomplete', array('width' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : 300, 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => $vs_value, 'maxlength' => 512, 'id' => $ps_name . "_autocomplete", 'class' => 'lookupBg')) . caHTMLHiddenInput($ps_name, array('value' => $vs_hidden_value, 'id' => $ps_name));
             if ($pa_options['request']) {
                 $vs_url = caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noInline' => 1, 'noSymbols' => 1, 'max' => 100));
             } else {
                 // hardcoded default for testing.
                 $vs_url = '/index.php/lookup/ListItem/Get';
             }
             $vs_buf .= '</div>';
             $vs_buf .= "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').autocomplete({\n\t\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (parseInt(ui.item.id) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').val('');\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val('');\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
             return $vs_buf;
             break;
         case 'horiz_hierbrowser':
         case 'horiz_hierbrowser_with_search':
         case 'vert_hierbrowser':
             $va_width = caParseFormElementDimension($pa_options['width'] ? $pa_options['width'] : $pa_options['width']);
             if ($va_width['type'] != 'pixels' && $va_width['dimension'] < 250) {
                 $va_width['dimension'] = 500;
             }
             $vn_width = $va_width['dimension'] . 'px';
             $va_height = caParseFormElementDimension($pa_options['height']);
             if ($va_height['type'] != 'pixels' && $va_height['dimension'] < 100) {
                 $va_height['dimension'] = 200;
             }
             $vn_height = $va_height['dimension'] . 'px';
             $t_root_item = new ca_list_items();
             $t_root_item->load(array('list_id' => $vn_list_id, 'parent_id' => null));
             JavascriptLoadManager::register("hierBrowser");
             $vs_buf = "<div style='width: {$vn_width}; height: {$vn_height};'><div id='{$ps_name}_hierarchyBrowser{n}' style='width: 100%; height: 100%;' class='" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserVertical' : 'hierarchyBrowser') . "'>\n\t\t\t\t\t<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->\n\t\t\t\t</div><!-- end hierarchyBrowser -->\t</div>";
             $vs_buf .= "\t<script type='text/javascript'>\n\t\tjQuery(document).ready(function() { \n\t\t\tvar oHierBrowser = caUI.initHierBrowser('{$ps_name}_hierarchyBrowser{n}', {\n\t\t\t\tuiStyle: '" . ($vs_render_as == 'vert_hierbrowser' ? 'vertical' : 'horizontal') . "',\n\t\t\t\tlevelDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyLevel', array('noSymbols' => 1)) . "',\n\t\t\t\tinitDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyAncestorList') . "',\n\t\t\t\t\n\t\t\t\tselectOnLoad : true,\n\t\t\t\tbrowserWidth: " . (int) $va_width['dimension'] . ",\n\t\t\t\t\n\t\t\t\tclassName: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserLevelVertical' : 'hierarchyBrowserLevel') . "',\n\t\t\t\tclassNameContainer: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserContainerVertical' : 'hierarchyBrowserContainer') . "',\n\t\t\t\t\n\t\t\t\teditButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_RIGHT_ARROW__) . "\",\n\t\t\t\tdisabledButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOT__) . "\",\n\t\t\t\tinitItemID: '{" . $pa_options['element_id'] . "}',\n\t\t\t\tdefaultItemID: '" . $t_list->getDefaultItemID() . "',\n\t\t\t\tuseAsRootID: '" . $t_root_item->getPrimaryKey() . "',\n\t\t\t\tindicatorUrl: '" . $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif',\n\t\t\t\t\n\t\t\t\tcurrentSelectionDisplayID: '{$ps_name}_browseCurrentSelectionText{n}',\n\t\t\t\tonSelection: function(item_id, parent_id, name, display) {\n\t\t\t\t\tjQuery('#{$ps_name}').val(item_id);\n\t\t\t\t}\n\t\t\t});";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "jQuery('#{$ps_name}_hierarchyBrowserSearch{n}').autocomplete(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noSymbols' => 1)) . "', \n\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\toHierBrowser.setUpHierarchy(ui.item.id);\t// jump browser to selected item\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);";
             }
             $vs_buf .= "});\n\t</script>";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "<div class='hierarchyBrowserSearchBar'>" . _t('Search') . ": <input type='text' id='{$ps_name}_hierarchyBrowserSearch{n}' class='hierarchyBrowserSearchBar' name='search' value='' size='20'/></div>";
             }
             if ($vs_render_as != 'vert_hierbrowser') {
                 $vs_buf .= "<div id='{$ps_name}_browseCurrentSelection{n}' class='hierarchyBrowserCurrentSelection'>" . _t("Current selection") . ": <span id='{$ps_name}_browseCurrentSelectionText{n}' class='hierarchyBrowserCurrentSelectionText'>?</span></div>";
             }
             $vs_buf .= caHTMLHiddenInput($ps_name, array('value' => "{" . $pa_options['element_id'] . "}", 'id' => $ps_name));
             return $vs_buf;
             break;
         case 'text':
             return caHTMLTextInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'options':
             return $va_options;
             break;
         default:
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLSelect($ps_name, $va_options, $pa_attributes, array_merge($pa_options, array('contentArrayUsesKeysForValues' => true, 'colors' => $va_colors, 'height' => null)));
             break;
     }
 }
    }
    if ($va_scope = $t_collection->get('ca_collections.scope_content')) {
        print "<h6 id='scope'>Scope and Content</h6><div class='trimText'>" . $va_scope . "</div>";
        $va_table_contents[] = "<a href='#scope'>Scope and Content</a>";
    }
    if ($va_arrangement = $t_collection->get('ca_collections.arrangement')) {
        print "<h6 id='arrangement'>Arrangement</h6><div>" . $va_arrangement . "</div>";
        $va_table_contents[] = "<a href='#arrangement'>Arrangement</a>";
    }
}
if ($t_collection->get('ca_collections.children')) {
    print "<h6 id='contents'>Collection Contents</h6>";
    $va_table_contents[] = "<a href='#contents'>Collection Contents</a>";
    $va_hierarchy = $t_collection->hierarchyWithTemplate("<l>^ca_collections.preferred_labels.name</l>", array('collection_id' => $va_collection_id, 'sort' => 'ca_collections.preferred_labels.name'));
    foreach ($va_hierarchy as $vn_i => $va_hierarchy_item) {
        $t_collection_item = new ca_collections($va_hierarchy_item['id']);
        if ($t_collection_item->get('ca_collections.fa_access') != 261 && $va_hierarchy_item['level'] != 0) {
            $va_indent = "style='margin-left:" . ($va_hierarchy_item['level'] * 15 - 15) . "px;' ";
            if ($va_hierarchy_item['level'] == 1) {
                $vn_top_level_collection_id = $va_hierarchy_item['id'];
                $vn_text_class = "";
            } else {
                $vn_text_class = "text" . $vn_top_level_collection_id;
            }
            print "<div class='collName {$vn_text_class}' {$va_indent} >";
            if ($va_hierarchy_item['level'] == 1) {
                print "<i class='fa fa-square-o finding-aid down{$vn_top_level_collection_id}'  ></i>";
                ?>
					<script>
						$(function() {
						  $('.down<?php 
Example #11
0
<?php

require_once __CA_MODELS_DIR__ . "/ca_collections.php";
require_once __CA_MODELS_DIR__ . '/ca_sets.php';
require_once __CA_MODELS_DIR__ . '/ca_lists.php';
$va_access_values = caGetUserAccessValues($this->request);
# --- most popular collections
$t_collections = new ca_collections();
$va_user_favorites_collections = $t_collections->getHighestRated(null, 5, $va_access_values);
if (is_array($va_user_favorites_collections) && sizeof($va_user_favorites_collections) > 0) {
    $va_most_popular_collections = array();
    foreach ($va_user_favorites_collections as $vn_fav_collection_id) {
        $t_collection = new ca_collections($vn_fav_collection_id);
        if ($t_collection->get("access") == 1) {
            $va_most_popular_collections[$vn_fav_collection_id] = $t_collection->getLabelForDisplay();
        }
    }
}
# - get staff picks sets
// get sets for public display
$t_list = new ca_lists();
$vn_public_set_type_id = $t_list->getItemIDFromList('set_types', 'Staff Pick');
// get value for public access status value
$va_tmp = $t_list->getItemFromList('access_statuses', 'public_access');
$vn_public_access = $va_tmp['item_value'];
$t_set = new ca_sets();
$va_staff_picks_sets = array();
#$va_staff_picks_sets = caExtractValuesByUserLocale($t_set->getSets('ca_collections', null, $va_access_values, null, $vn_public_set_type_id));
$va_staff_picks_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_collections', 'checkAccess' => $va_access_values, "setType" => $vn_public_set_type_id)));
if (is_array($va_most_popular_collections) && sizeof($va_most_popular_collections) > 0) {
    ?>
Example #12
0
 /**
  * Returns collection_id for the collection with the specified name (and type) or idno (regardless of specified type.) If the collection 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 collection fields or attributes.
  *
  * @param string $ps_collection_name Collection label name
  * @param int $pn_type_id The type_id of the collection type to use if the collection needs to be created
  * @param int $pn_locale_id The locale_id to use if the collection needs to be created (will be used for both the collection locale as well as the label locale)
  * @param array $pa_values An optional array of additional values to populate newly created collection records with. These values are *only* used for newly created collections; they will not be applied if the collection named already exists. The array keys should be names of collection fields or valid collection 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 collections will not be created [default=false]
  *                transaction - if Transaction object is passed, use it for all Db-related tasks [default=null]
  *                returnInstance = return ca_collections instance rather than collection_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 collection 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 collections. Each label in the array is an array with required collection label values.
  *                log = if KLogger instance is passed then actions will be logged
  * @return bool|\ca_collections|mixed|null
  */
 static function getCollectionID($ps_collection_name, $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_collection = new ca_collections();
     if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
         $t_collection->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_collection->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_collection_name)) {
                     if ($vn_id = ca_collections::find(array('preferred_labels' => array('name' => $ps_collection_name), 'parent_id' => caGetOption('parent_id', $pa_values, null), '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
                 if ($vn_id = ca_collections::find(array('idno' => $vs_idno ? $vs_idno : $ps_collection_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_collections', 'I');
         }
         $t_collection->setMode(ACCESS_WRITE);
         $t_collection->set('locale_id', $pn_locale_id);
         $t_collection->set('type_id', $pn_type_id);
         $t_collection->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_collection->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_collection->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         $t_collection->set('idno', $vs_idno);
         $t_collection->set('parent_id', isset($pa_values['parent_id']) ? $pa_values['parent_id'] : null);
         $t_collection->insert();
         if ($t_collection->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
         $t_collection->addLabel(array('name' => $ps_collection_name), $pn_locale_id, null, true);
         if ($t_collection->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not set preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not set preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
             }
             $vb_label_errors = true;
         }
         /** @var IIDNumbering $o_idno */
         if ($o_idno = $t_collection->getIDNoPlugInInstance()) {
             $va_values = $o_idno->htmlFormValuesAsArray('idno', $vs_idno);
             if (!is_array($va_values)) {
                 $va_values = array($va_values);
             }
             if (!($vs_sep = $o_idno->getSeparator())) {
                 $vs_sep = '';
             }
             if (($vs_proc_idno = join($vs_sep, $va_values)) && $vs_proc_idno != $vs_idno) {
                 $t_collection->set('idno', $vs_proc_idno);
                 $t_collection->update();
                 if ($t_collection->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not update idno for %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not idno for %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
                     }
                     return null;
                 }
             }
         }
         unset($pa_values['access']);
         unset($pa_values['status']);
         unset($pa_values['idno']);
         unset($pa_values['source_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_collection->addAttribute(array_merge($va_value, array('locale_id' => $pn_locale_id)), $vs_element);
                     } else {
                         // scalar value (simple single value attribute)
                         if ($va_value) {
                             $t_collection->addAttribute(array('locale_id' => $pn_locale_id, $vs_element => $va_value), $vs_element);
                         }
                     }
                 }
             }
             $t_collection->update();
             if ($t_collection->numErrors()) {
                 if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                     print "[Error] " . _t("Could not set values for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
                 }
                 if ($o_log) {
                     $o_log->logError(_t("Could not set values for collection %1: %2", $ps_collection_name, join('; ', $t_collection->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_collection->addLabel($va_label, $pn_locale_id, null, false);
                 if ($t_collection->numErrors()) {
                     if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                         print "[Error] " . _t("Could not set non-preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())) . "\n";
                     }
                     if ($o_log) {
                         $o_log->logError(_t("Could not set non-preferred label for collection %1: %2", $ps_collection_name, join('; ', $t_collection->getErrors())));
                     }
                 }
             }
         }
         $vn_collection_id = $t_collection->getPrimaryKey();
         if ($o_event) {
             if ($vb_attr_errors || $vb_label_errors) {
                 $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_collection->getErrors())));
             } else {
                 $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
             }
         }
         if ($o_log) {
             $o_log->logInfo(_t("Created new collection %1", $ps_collection_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             return $t_collection;
         }
     } else {
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_collections', 'U');
         }
         $vn_collection_id = $vn_id;
         if ($o_event) {
             $o_event->endItem($vn_collection_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
         }
         if ($o_log) {
             $o_log->logDebug(_t("Found existing collection %1 in DataMigrationUtils::getCollectionID()", $ps_collection_name));
         }
         if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
             $t_collection = new ca_collections($vn_collection_id);
             if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
                 $t_collection->setTransaction($pa_options['transaction']);
             }
             return $t_collection;
         }
     }
     return $vn_collection_id;
 }
Example #13
0
            }
            print "<div class='collHeader' style='margin-left: " . $va_hierarchy_item['level'] * 35 . "px; clear:both;'>";
            if ($va_hierarchy_item['level'] == 0 && $qr_top_level_collections->get('ca_collections.children.collection_id')) {
                print "<a href='#'><i class='fa fa-angle-double-down finding-aid down{$vn_top_level_collection_id}'></i></a>";
            } else {
                $va_opacity = "style='opacity: ." . (90 - $va_hierarchy_item['level'] * 20) . "' ";
                print "<i class='fa fa-angle-right finding-aid' {$va_opacity}></i>";
            }
            print "{$va_hierarchy_item['display']}\n";
            if ($va_hierarchy_item['level'] == 0) {
                print "<div class='collBlock" . $vn_top_level_collection_id . "'>";
            }
            //
            // Output objects
            //
            $t_this_level = new ca_collections($va_hierarchy_item['id']);
            if ($t_parent) {
                if ($t_this_level && $t_parent->get('ca_collections.type_id') != 104 && $t_parent->get('ca_collections.type_id') != 281) {
                    if (is_array($va_ids = $t_this_level->get('ca_objects.object_id', array('returnAsArray' => true, 'sort' => 'ca_objects.preferred_labels', 'checkAccess' => array(1, 2)))) && sizeof($va_ids)) {
                        $qr_objects = caMakeSearchResult('ca_objects', $va_ids);
                        print '<table class="table findingaid">
								<thead>
									<tr>
										<th>BOX/DRAWER</th>
										<th>FOLDER/ITEM</th>
										<th>TITLE</th>
										<th>DATE</th>
									</tr>
								</thead>
								<tbody>';
                        while ($qr_objects->nextHit()) {
<br/><br/>Katrina Dixon was the project media cataloger.
<br/>Karan Sheldon was the project director. <a href="mailto:karan@oldfilm.org">karan@oldfilm.org</a>

<br/><br/><br/>	
<div class="subTitle">Featured Collections</div>
	<div id="featuredCollections">
	
<?php 
$t_featured_set = new ca_sets();
$va_access_values = caGetUserAccessValues($this->request);
# --- featured collections - set_code hiddenCollections
$t_featured_set->load(array('set_code' => "hiddenCollections"));
#$va_featured_ids = array_keys(is_array($va_tmp = $t_featured_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());	// These are the collection ids in the set
$va_items = caExtractValuesByUserLocale($t_featured_set->getItems(array('returnItemAttributes' => array('caption'))));
if (is_array($va_items) && sizeof($va_items) > 0) {
    $t_collection = new ca_collections();
    foreach ($va_items as $vn_i => $va_set_item_info) {
        print "<div class='featuredCollection'>";
        $vn_collection_id = $va_set_item_info["row_id"];
        $t_collection->load($vn_collection_id);
        print caNavLink($this->request, $t_collection->getAttributesForDisplay("collection_still", null, array('version' => 'thumbnail', 'showMediaInfo' => false)), '', 'Detail', 'Collection', 'Show', array('collection_id' => $vn_collection_id));
        print caNavLink($this->request, $t_collection->getLabelForDisplay(), '', 'Detail', 'Collection', 'Show', array('collection_id' => $vn_collection_id)) . "<br/>\n";
        print "<div>" . $va_set_item_info["ca_attribute_caption"] . "</div>";
        print "</div>";
    }
}
?>
	
		</div>

		</div><!-- end introText -->
     if ($qr_res->get('ca_objects.dc_date.dc_dates_value')) {
         $vs_date_link = "<p>" . $qr_res->get('ca_objects.dc_date', array('returnAsLink' => true, 'delimiter' => '; ', 'template' => '^dc_dates_value')) . "</p>";
     } else {
         $vs_date_link = "";
     }
     if ($qr_res->get('ca_objects.type_id') == 23 || $qr_res->get('ca_objects.type_id') == 26 || $qr_res->get('ca_objects.type_id') == 25 || $qr_res->get('ca_objects.type_id') == 24 || $qr_res->get('ca_objects.type_id') == 27) {
         $vs_type_link = "<p>" . $qr_res->get('ca_objects.type_id', array('convertCodesToDisplayText' => true)) . "</p>";
     } else {
         $vs_type_link = "";
     }
     if ($qr_res->get('ca_objects.type_id') == 23 || $qr_res->get('ca_objects.type_id') == 26 || $qr_res->get('ca_objects.type_id') == 25 || $qr_res->get('ca_objects.type_id') == 24 || $qr_res->get('ca_objects.type_id') == 27) {
         $va_collection_id = $qr_res->get('ca_collections.collection_id');
         $t_collection = new ca_collections($va_collection_id);
         $vn_parent_ids = $t_collection->getHierarchyAncestors($va_collection_id, array('idsOnly' => true));
         $vn_highest_level = end($vn_parent_ids);
         $t_top_level = new ca_collections($vn_highest_level);
         $vs_collection_link = "<p>" . caNavLink($this->request, $t_top_level->get('ca_collections.preferred_labels'), '', 'Detail', 'collections', $vn_highest_level) . "</p>";
     }
 }
 if ($vs_table == 'ca_objects') {
     if ($qr_res->get('ca_objects.type_id') == 25) {
         $va_icon = "<i class='glyphicon glyphicon-volume-up'></i>";
     } elseif ($qr_res->get('ca_objects.type_id') == 26) {
         $va_icon = "<i class='glyphicon glyphicon-film'></i>";
     } elseif ($qr_res->get('ca_objects.type_id') == 30 && !$qr_res->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))) {
         $va_icon = "<i class='glyphicon glyphicon-book'></i>";
     } elseif ($qr_res->get('ca_objects.type_id') == 1903) {
         $vn_parent_id = $qr_res->get('ca_objects.parent_id');
         $t_copy = new ca_objects($vn_parent_id);
         if (!$t_copy->get('ca_object_representations.media.medium', array('checkAccess' => $va_access_values))) {
             $va_icon = "<i class='glyphicon glyphicon-book'></i>";
			</small>
			<div class='blockTitle'><?php 
        print $va_block_info['displayName'];
        ?>
</div>
			<div class='blockResults'>
				<div id="{{{block}}}scrollButtonPrevious" class="scrollButtonPrevious"><i class="fa fa-angle-left"></i></div><div id="{{{block}}}scrollButtonNext" class="scrollButtonNext"><i class="fa fa-angle-right"></i></div>
				<div id='{{{block}}}Results' class='scrollBlock'>
					<div class='blockResultsScroller'>
<?php 
    }
    $vn_count = 0;
    $vb_div_open = false;
    while ($qr_results->nextHit()) {
        $va_related_col_ids = $qr_results->get('ca_collections.collection_id', array('returnAsArray' => true, 'checkAccess' => $va_access_values));
        $t_collection = new ca_collections($va_related_col_ids[0]);
        $va_related_object_ids = $t_collection->get('ca_objects.object_id', array('returnAsArray' => true, 'checkAccess' => $va_access_values));
        print "<div class='{{{block}}}Result'>";
        $va_images = caGetPrimaryRepresentationsForIDs($va_related_object_ids, array('versions' => array('resultthumb'), 'return' => 'tags', 'checkAccess' => $va_access_values));
        if (sizeof($va_images) > 0) {
            foreach ($va_images as $vn_image_id => $vs_image) {
                print "<div class='objImage'>" . $qr_results->getWithTemplate("<l>{$vs_image}</l>") . "</div>";
                break;
            }
        } else {
            print caNavLink($this->request, "<div class='objImage'></div><!-- objImage-->", '', 'Detail', 'occurrences', $qr_results->get('ca_occurrences.occurrence_id'));
        }
        print "<div class=''>" . $qr_results->get('ca_occurrences.preferred_labels.name', array('returnAsLink' => true)) . "</div>";
        print "</div>";
        $vn_count++;
        if (!$vn_init_with_start && $vn_count == $vn_hits_per_block || $vn_init_with_start && $vn_count >= $vn_init_with_start) {
 /**
  * Given a item_id (request parameter 'id') returns a list of ancestors for use in the hierarchy browser
  * Returned data is JSON format
  */
 public function GetHierarchyAncestorList()
 {
     $vo_dm = Datamodel::load();
     $pn_id = $this->request->getParameter('id', pString);
     $va_params = $this->getItemIDComponents($pn_id, 'ca_objects');
     $vs_table = $va_params['table'];
     $vn_id = $va_params['id'];
     $vn_start = $va_params['start'];
     $t_item = $vo_dm->getInstanceByTableName($vs_table, true);
     $t_item->load($vn_id);
     $va_ancestors = array();
     if ($t_item->getPrimaryKey()) {
         $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'idsOnly' => true)));
     }
     $vn_top_id = $va_ancestors[0];
     foreach ($va_ancestors as $vn_i => $vn_ancestor_id) {
         $va_ancestors[$vn_i] = $vs_table . '-' . $vn_ancestor_id;
     }
     // get collections
     if ($vs_table == 'ca_objects') {
         $t_item->load($vn_top_id);
         // try to pull related collections ��� the first one is considered the parent
         $va_cross_table_items = $t_item->getRelatedItems('ca_collections');
         if (is_array($va_cross_table_items)) {
             $t_collection = new ca_collections();
             foreach ($va_cross_table_items as $vn_x_item_id => $va_x_item) {
                 array_unshift($va_ancestors, 'ca_collections-' . $va_x_item['collection_id']);
                 if (!($va_collection_ancestor_list = $t_collection->getHierarchyAncestors($va_x_item['collection_id'], array('additionalTableToJoin' => 'ca_collection_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name', 'locale_id'), 'additionalTableWheres' => array('(ca_collection_labels.is_preferred = 1 OR ca_collection_labels.is_preferred IS NULL)'), 'includeSelf' => false)))) {
                     $va_collection_ancestor_list = array();
                 }
                 foreach ($va_collection_ancestor_list as $vn_id => $va_collection_ancestor) {
                     array_unshift($va_ancestors, 'ca_collections-' . $va_collection_ancestor['NODE']['collection_id']);
                 }
                 break;
                 // for now only show first one
             }
         }
     }
     $this->view->setVar('ancestors', $va_ancestors);
     return $this->render(str_replace(' ', '_', $this->ops_name_singular) . '_hierarchy_ancestors_json.php');
 }
 /**
  * Override's BaseModel method to intercept calls for field 'idno'; uses the specified IDNumbering
  * plugin to generate HTML for idno. If no plugin is specified then the call is passed on to BaseModel::htmlFormElement()
  * Calls for fields other than idno are passed to BaseModel::htmlFormElement()
  */
 public function htmlFormElement($ps_field, $ps_format = null, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     foreach (array('name', 'form_name', 'request', 'field_errors', 'display_form_field_tips', 'no_tooltips', 'label', 'readonly') as $vs_key) {
         if (!isset($pa_options[$vs_key])) {
             $pa_options[$vs_key] = null;
         }
     }
     if (!$this->opo_idno_plugin_instance) {
         $this->loadIDNoPlugInInstance($pa_options);
     }
     if ($ps_field == $this->getProperty('ID_NUMBERING_ID_FIELD') && $this->opo_idno_plugin_instance && $pa_options['request']) {
         $vs_idno_fld = $this->getProperty('ID_NUMBERING_ID_FIELD');
         if ($this->tableName() == 'ca_objects' && $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && $pa_options['request'] && ($vn_collection_id = $pa_options['request']->getParameter('collection_id', pInteger))) {
             // Parent will be set to collection
             $t_coll = new ca_collections($vn_collection_id);
             if ($this->inTransaction()) {
                 $t_coll->setTransaction($this->getTransaction());
             }
             if ($t_coll->getPrimaryKey()) {
                 $this->opo_idno_plugin_instance->isChild(true, $t_coll->get('idno'));
                 if (!$this->opo_idno_plugin_instance->formatHas('PARENT')) {
                     $this->set($vs_idno_fld, $t_coll->get('idno'));
                 }
             }
         } elseif ($vn_parent_id = $this->get($this->getProperty('HIERARCHY_PARENT_ID_FLD'))) {
             // Parent will be set
             $t_parent = $this->getAppDatamodel()->getInstanceByTableName($this->tableName(), false);
             if ($this->inTransaction()) {
                 $t_parent->setTransaction($this->getTransaction());
             }
             if ($t_parent->load($vn_parent_id)) {
                 $this->opo_idno_plugin_instance->isChild(true, $t_parent->get($this->tableName() . ".{$vs_idno_fld}"));
                 if (!$this->getPrimaryKey() && !$this->opo_idno_plugin_instance->formatHas('PARENT')) {
                     $this->set($vs_idno_fld, $this->opo_idno_plugin_instance->makeTemplateFromValue($t_parent->get($vs_idno_fld), 1, true));
                 }
             }
         }
         // if it has a parent_id then set the id numbering plugin using "child_only" numbering schemes (if defined)
         $this->opo_idno_plugin_instance->setValue($this->get($ps_field));
         if (method_exists($this, "getTypeCode")) {
             $this->opo_idno_plugin_instance->setType($this->getTypeCode());
         }
         $vs_element = $this->opo_idno_plugin_instance->htmlFormElement($ps_field, $va_errors, array_merge($pa_options, array('error_icon' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/warning_small.gif", 'progress_indicator' => $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif", 'show_errors' => $this->getPrimaryKey() ? true : false, 'context_id' => isset($pa_options['context_id']) ? $pa_options['context_id'] : null, 'table' => $this->tableName(), 'row_id' => $this->getPrimaryKey(), 'check_for_dupes' => true, 'search_url' => caSearchUrl($pa_options['request'], $this->tableName(), ''))));
         if (is_null($ps_format)) {
             if (isset($pa_options['field_errors']) && is_array($pa_options['field_errors']) && sizeof($pa_options['field_errors'])) {
                 $ps_format = $this->_CONFIG->get('bundle_element_error_display_format');
                 $va_field_errors = array();
                 foreach ($pa_options['field_errors'] as $o_e) {
                     $va_field_errors[] = $o_e->getErrorDescription();
                 }
                 $vs_errors = join('; ', $va_field_errors);
             } else {
                 $ps_format = $this->_CONFIG->get('bundle_element_display_format');
                 $vs_errors = '';
             }
         }
         if ($ps_format != '') {
             $ps_formatted_element = $ps_format;
             $ps_formatted_element = str_replace("^ELEMENT", $vs_element, $ps_formatted_element);
             $va_attr = $this->getFieldInfo($ps_field);
             foreach (array('DISPLAY_DESCRIPTION', 'DESCRIPTION', 'LABEL', 'DESCRIPTION') as $vs_key) {
                 if (!isset($va_attr[$vs_key])) {
                     $va_attr[$vs_key] = null;
                 }
             }
             // TODO: should be in config file
             $pa_options["display_form_field_tips"] = true;
             if ($pa_options["display_form_field_tips"] || !isset($pa_options["display_form_field_tips"]) && $va_attr["DISPLAY_DESCRIPTION"] || !isset($pa_options["display_form_field_tips"]) && !isset($va_attr["DISPLAY_DESCRIPTION"]) && $vb_fl_display_form_field_tips) {
                 if (preg_match("/\\^DESCRIPTION/", $ps_formatted_element)) {
                     $ps_formatted_element = str_replace("^LABEL", isset($pa_options['label']) ? $pa_options['label'] : $va_attr["LABEL"], $ps_formatted_element);
                     $ps_formatted_element = str_replace("^DESCRIPTION", $va_attr["DESCRIPTION"], $ps_formatted_element);
                 } else {
                     // no explicit placement of description text, so...
                     $vs_field_id = '_' . $this->tableName() . '_' . $this->getPrimaryKey() . '_' . $pa_options["name"] . '_' . $pa_options['form_name'];
                     $ps_formatted_element = str_replace("^LABEL", '<span id="' . $vs_field_id . '">' . (isset($pa_options['label']) ? $pa_options['label'] : $va_attr["LABEL"]) . '</span>', $ps_formatted_element);
                     if (!$pa_options['no_tooltips']) {
                         TooltipManager::add('#' . $vs_field_id, "<h3>" . (isset($pa_options['label']) ? $pa_options['label'] : $va_attr["LABEL"]) . "</h3>" . $va_attr["DESCRIPTION"]);
                     }
                 }
             } else {
                 $ps_formatted_element = str_replace("^LABEL", isset($pa_options['label']) ? $pa_options['label'] : $va_attr["LABEL"], $ps_formatted_element);
                 $ps_formatted_element = str_replace("^DESCRIPTION", "", $ps_formatted_element);
             }
             $ps_formatted_element = str_replace("^ERRORS", $vs_errors, $ps_formatted_element);
             $vs_element = $ps_formatted_element;
         }
         return $vs_element;
     } else {
         return parent::htmlFormElement($ps_field, $ps_format, $pa_options);
     }
 }
        print $t_rel_entity->getWithTemplate("<b><l>^ca_entities.preferred_labels.displayname</l></b>");
        if ($vs_brief_description = $t_rel_entity->get("ca_entities.brief_description")) {
            print "<br/>" . $vs_brief_description;
        }
        if ($vs_thumb) {
            print "</div></div><!-- end row -->";
        } else {
            print "<br/>";
        }
        print "<br/>";
    }
}
$va_collections = $t_item->get("ca_collections", array("returnAsArray" => true, "checkAccess" => $va_access_values));
if (sizeof($va_collections)) {
    print "<H6>Related collection" . (sizeof($va_collections) > 1 ? "s" : "") . "</H6>";
    $t_rel_collection = new ca_collections();
    foreach ($va_collections as $va_collection) {
        $t_rel_collection->load($va_collection["collection_id"]);
        $t_object_thumb->load($t_rel_collection->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_collection->getWithTemplate("<b><l>^ca_collections.preferred_labels.name</l></b>");
        if ($vs_brief_description = $t_rel_collection->get("ca_collections.brief_description")) {
            print "<br/>" . $vs_brief_description;
        }
        if ($vs_thumb) {
            print "</div></div><!-- end row -->";
        } else {
    }
    print "</div>";
}
# --- collections
$va_collections = $t_object->get("ca_collections", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
if (sizeof($va_collections) > 0) {
    print "<h3>" . _t("Related Project/Silo") . (sizeof($va_collections) > 1 ? "s" : "") . "</h3>";
    #foreach($va_collections as $va_collection_info){
    #	print "<p>".(($this->request->config->get('allow_detail_for_ca_collections')) ? caNavLink($this->request, $va_collection_info['label'], '', 'Detail', 'Collection', 'Show', array('collection_id' => $va_collection_info['collection_id'])) : $va_collection_info['label'])." <span class='details'>(".$va_collection_info['relationship_typename'].")</span></p>";
    #}
    ?>
				<div class='scrollPane'>
<?php 
    $va_silos = array();
    $va_collection_links = array();
    $t_related_collection = new ca_collections();
    foreach ($va_collections as $va_collection_info) {
        if ($va_collection_info["item_type_id"] != $vn_silo_id) {
            # --- if the related collection is not a silo, check for a related silo to list it under
            $t_related_collection->load($va_collection_info['collection_id']);
            $va_related_silos = $t_related_collection->get("ca_collections", array("returnAsArray" => 1, 'checkAccess' => $va_access_values, 'restrictToTypes' => array('silo')));
            if (sizeof($va_related_silos)) {
                foreach ($va_related_silos as $va_related_silo) {
                    $va_silos[$va_related_silo["collection_id"]][] = $va_collection_info['collection_id'];
                    $va_collection_links[$va_related_silo["collection_id"]] = $this->request->config->get('allow_detail_for_ca_collections') ? caNavLink($this->request, $va_related_silo['label'], '', 'Detail', 'Collection', 'Show', array('collection_id' => $va_related_silo['collection_id'])) : $va_related_silo['label'];
                }
            } else {
                if (!$va_silos[$va_collection_info['collection_id']]) {
                    $va_silos[$va_collection_info['collection_id']] = array();
                }
            }
 /**
  *
  *
  * @param $ps_field -
  * @param $pa_options -
  *		returnAsArray - 
  * 		delimiter -
  *		template -
  *		locale -
  *		returnAllLocales - Returns requested value in all locales for which it is defined. Default is false. Note that this is not supported for hierarchy specifications (eg. ca_objects.hierarchy).
  *		direction - For hierarchy specifications (eg. ca_objects.hierarchy) this determines the order in which the hierarchy is returned. ASC will return the hierarchy root first while DESC will return it with the lowest node first. Default is ASC.
  *		top - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the root down. Default is to not limit.
  *		bottom - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the lowest node up. Default is to not limit.
  * 		hierarchicalDelimiter - Text to place between items in a hierarchy for a hierarchical specification (eg. ca_objects.hierarchy) when returning as a string
  *		removeFirstItems - If set to a non-zero value, the specified number of items at the top of the hierarchy will be omitted. For example, if set to 2, the root and first child of the hierarchy will be omitted. Default is zero (don't delete anything).
  *		checkAccess = array of access values to filter results by; if defined only items with the specified access code(s) are returned. Only supported for <table_name>.hierarchy.preferred_labels and <table_name>.children.preferred_labels because these returns sets of items. For <table_name>.parent.preferred_labels, which returns a single row at most, you should do access checking yourself. (Everything here applies equally to nonpreferred_labels)
  *		sort = optional bundles to sort returned values on. Only supported for <table_name>.children.preferred_labels. The bundle specifiers are fields with or without tablename.
  *		sort_direction = direction to sort results by, either 'asc' for ascending order or 'desc' for descending order; default is 'asc'
  *		convertCodesToDisplayText = if true then non-preferred label type_ids are automatically converted to display text in the current locale; default is false (return non-preferred label type_id raw)
  */
 public function get($ps_field, $pa_options = null)
 {
     $vs_template = isset($pa_options['template']) ? $pa_options['template'] : null;
     $vb_return_as_array = isset($pa_options['returnAsArray']) ? (bool) $pa_options['returnAsArray'] : false;
     $vb_return_all_locales = isset($pa_options['returnAllLocales']) ? (bool) $pa_options['returnAllLocales'] : false;
     $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : ' ';
     $vb_convert_codes_to_display_text = isset($pa_options['convertCodesToDisplayText']) ? (bool) $pa_options['convertCodesToDisplayText'] : false;
     if ($vb_return_all_locales && !$vb_return_as_array) {
         $vb_return_as_array = true;
     }
     // if desired try to return values in a preferred language/locale
     $va_preferred_locales = null;
     if (isset($pa_options['locale']) && $pa_options['locale']) {
         $va_preferred_locales = array($pa_options['locale']);
     }
     // does get refer to an attribute?
     $va_tmp = explode('.', $ps_field);
     if ($va_tmp[1] == 'hierarchy' && sizeof($va_tmp) == 2) {
         $va_tmp[2] = 'preferred_labels';
         $ps_field = join('.', $va_tmp);
     }
     $t_label = $this->getLabelTableInstance();
     $t_instance = $this;
     if (sizeof($va_tmp) >= 3 && ($va_tmp[2] == 'preferred_labels' && (!$va_tmp[3] || $t_label->hasField($va_tmp[3]))) || $va_tmp[1] == 'hierarchy') {
         switch ($va_tmp[1]) {
             case 'parent':
                 if ($this->isHierarchical() && ($vn_parent_id = $this->get($this->getProperty('HIERARCHY_PARENT_ID_FLD')))) {
                     $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
                     if (!$t_instance->load($vn_parent_id)) {
                         $t_instance = $this;
                     } else {
                         unset($va_tmp[1]);
                         $va_tmp = array_values($va_tmp);
                     }
                 }
                 break;
             case 'children':
                 if ($this->isHierarchical()) {
                     unset($va_tmp[1]);
                     // remove 'children' from field path
                     $va_tmp = array_values($va_tmp);
                     $vs_childless_path = join('.', $va_tmp);
                     $va_data = array();
                     $va_children_ids = $this->getHierarchyChildren(null, array('idsOnly' => true));
                     if (is_array($va_children_ids) && sizeof($va_children_ids)) {
                         $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
                         $vb_check_access = is_array($pa_options['checkAccess']) && $t_instance->hasField('access');
                         $va_sort = isset($pa_options['sort']) ? $pa_options['sort'] : null;
                         if (!is_array($va_sort) && $va_sort) {
                             $va_sort = array($va_sort);
                         }
                         if (!is_array($va_sort)) {
                             $va_sort = array();
                         }
                         $vs_sort_direction = isset($pa_options['sort_direction']) && in_array(strtolower($pa_options['sort_direction']), array('asc', 'desc')) ? strtolower($pa_options['sort_direction']) : 'asc';
                         $qr_children = $this->makeSearchResult($this->tableName(), $va_children_ids);
                         $vs_table = $this->tableName();
                         while ($qr_children->nextHit()) {
                             if ($vb_check_access && !in_array($qr_children->get("{$vs_table}.access"), $pa_options['checkAccess'])) {
                                 continue;
                             }
                             $vs_sort_key = '';
                             foreach ($va_sort as $vs_sort) {
                                 $vs_sort_key .= $vs_sort ? $qr_children->get($vs_sort) : 0;
                             }
                             if (!is_array($va_data[$vs_sort_key])) {
                                 $va_data[$vs_sort_key] = array();
                             }
                             $va_data[$vs_sort_key] = array_merge($va_data[$vs_sort_key], $qr_children->get($vs_childless_path, array_merge($pa_options, array('returnAsArray' => true))));
                         }
                         ksort($va_data);
                         if ($vs_sort_direction && $vs_sort_direction == 'desc') {
                             $va_data = array_reverse($va_data);
                         }
                         $va_sorted_data = array();
                         foreach ($va_data as $vs_sort_key => $va_items) {
                             foreach ($va_items as $vs_k => $vs_v) {
                                 $va_sorted_data[] = $vs_v;
                             }
                         }
                         $va_data = $va_sorted_data;
                     }
                     if ($vb_return_as_array) {
                         return $va_data;
                     } else {
                         return join($vs_delimiter, $va_data);
                     }
                 }
                 break;
             case 'hierarchy':
                 $vs_direction = isset($pa_options['direction']) ? strtoupper($pa_options['direction']) : null;
                 if (!in_array($vs_direction, array('ASC', 'DESC'))) {
                     $vs_direction = 'ASC';
                 }
                 $vn_top = (int) isset($pa_options['top']) ? strtoupper($pa_options['top']) : 0;
                 if ($vn_top < 0) {
                     $vn_top = 0;
                 }
                 $vn_bottom = (int) isset($pa_options['bottom']) ? strtoupper($pa_options['bottom']) : 0;
                 if ($vn_bottom < 0) {
                     $vn_bottom = 0;
                 }
                 $vs_pk = $this->primaryKey();
                 $vs_label_table_name = $this->getLabelTableName();
                 $t_label_instance = $this->getLabelTableInstance();
                 if (!$vs_template && ($vs_display_field = $t_label_instance->hasField($va_tmp[2]) ? $t_label_instance->tableName() . "." . $va_tmp[2] : ($this->hasField($va_tmp[2]) ? $this->tableName() . "." . $va_tmp[2] : null))) {
                     $vs_template = "^{$vs_display_field}";
                 }
                 $vn_top_id = null;
                 if (!($va_ancestor_list = $this->getHierarchyAncestors(null, array('idsOnly' => true, 'includeSelf' => true)))) {
                     $va_ancestor_list = array();
                 }
                 // TODO: this should really be in a model subclass
                 if ($this->tableName() == 'ca_objects' && $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && ($vs_coll_rel_type = $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_relationship_type'))) {
                     require_once __CA_MODELS_DIR__ . '/ca_objects.php';
                     if ($this->getPrimaryKey() == $vn_top_id) {
                         $t_object = $this;
                     } else {
                         $t_object = new ca_objects($vn_top_id);
                     }
                     if (is_array($va_collections = $t_object->getRelatedItems('ca_collections', array('restrictToRelationshipTypes' => $vs_coll_rel_type)))) {
                         require_once __CA_MODELS_DIR__ . '/ca_collections.php';
                         $t_collection = new ca_collections();
                         foreach ($va_collections as $vn_i => $va_collection) {
                             if ($va_collections_ancestor_list = $t_collection->getHierarchyAncestors($va_collection['collection_id'], array('idsOnly' => true, 'includeSelf' => true))) {
                                 $va_ancestor_list = array_merge($va_ancestor_list, $va_collections_ancestor_list);
                             }
                             break;
                             // for now only process first collection (no polyhierarchies)
                         }
                     }
                 }
                 // remove root and children if so desired
                 if (isset($pa_options['removeFirstItems']) && (int) $pa_options['removeFirstItems'] > 0) {
                     for ($vn_i = 0; $vn_i < (int) $pa_options['removeFirstItems']; $vn_i++) {
                         array_pop($va_ancestor_list);
                     }
                 }
                 if ($vs_display_field != $va_tmp[2]) {
                     if ($this->hasField($va_tmp[2])) {
                         $vs_display_field = $va_tmp[2];
                     }
                 }
                 $vb_check_access = is_array($pa_options['checkAccess']) && $this->hasField('access');
                 if ($vb_check_access) {
                     $va_access_values = $this->getFieldValuesForIDs($va_ancestor_list, array('access'));
                     $va_ancestor_list = array();
                     foreach ($va_access_values as $vn_ancestor_id => $vn_access_value) {
                         if (in_array($vn_access_value, $pa_options['checkAccess'])) {
                             $va_ancestor_list[] = $vn_ancestor_id;
                         }
                     }
                 }
                 if ($vs_template) {
                     $va_tmp = caProcessTemplateForIDs($vs_template, $this->tableName(), $va_ancestor_list, array('returnAsArray' => true));
                 } else {
                     $va_tmp = $this->getPreferredDisplayLabelsForIDs($va_ancestor_list, array('returnAsArray' => true, 'returnAllLocales' => $vb_return_all_locales));
                 }
                 if ($vn_top > 0) {
                     $va_tmp = array_slice($va_tmp, sizeof($va_tmp) - $vn_top, $vn_top, true);
                 } else {
                     if ($vn_bottom > 0) {
                         $va_tmp = array_slice($va_tmp, 0, $vn_bottom, true);
                     }
                 }
                 if ($vs_direction == 'ASC') {
                     $va_tmp = array_reverse($va_tmp, true);
                 }
                 if (caGetOption('returnAsLink', $pa_options, false)) {
                     $va_tmp = caCreateLinksFromText(array_values($va_tmp), $this->tableName(), array_keys($va_tmp));
                 }
                 if ($vb_return_as_array) {
                     return $va_tmp;
                 } else {
                     $vs_hier_delimiter = isset($pa_options['hierarchicalDelimiter']) ? $pa_options['hierarchicalDelimiter'] : $pa_options['delimiter'];
                     return join($vs_hier_delimiter, $va_tmp);
                 }
                 break;
         }
     }
     switch (sizeof($va_tmp)) {
         case 1:
             switch ($va_tmp[0]) {
                 # ---------------------------------------------
                 case 'preferred_labels':
                     if (!$vb_return_as_array) {
                         $va_labels = caExtractValuesByUserLocale($t_instance->getPreferredLabels(), null, $va_preferred_locales);
                         $vs_disp_field = $this->getLabelDisplayField();
                         $va_values = array();
                         foreach ($va_labels as $vn_row_id => $va_label_list) {
                             foreach ($va_label_list as $vn_i => $va_label) {
                                 if ($vs_template) {
                                     $va_values[] = caProcessTemplate($vs_template, $va_label, array('removePrefix' => 'preferred_labels.'));
                                 } else {
                                     $va_values[] = $va_label[$vs_disp_field];
                                 }
                             }
                         }
                         return join($vs_delimiter, $va_values);
                     } else {
                         $va_labels = $t_instance->getPreferredLabels(null, false);
                         if ($vb_return_all_locales) {
                             return $va_labels;
                         } else {
                             // Simplify array by getting rid of third level array which is unnecessary since
                             // there is only ever one preferred label for a locale
                             $va_labels = caExtractValuesByUserLocale($va_labels, null, $va_preferred_locales);
                             $va_processed_labels = array();
                             foreach ($va_labels as $vn_label_id => $va_label_list) {
                                 $va_processed_labels[$vn_label_id] = $va_label_list[0];
                             }
                             return $va_processed_labels;
                         }
                     }
                     break;
                     # ---------------------------------------------
                 # ---------------------------------------------
                 case 'nonpreferred_labels':
                     if (!$vb_return_as_array) {
                         $vs_disp_field = $this->getLabelDisplayField();
                         $va_labels = caExtractValuesByUserLocale($t_instance->getNonPreferredLabels(), null, $va_preferred_locales);
                         $t_list = new ca_lists();
                         if ($vb_convert_codes_to_display_text) {
                             $va_types = $t_list->getItemsForList($this->getLabelTableInstance()->getFieldInfo('type_id', 'LIST_CODE'), array('extractValuesByUserLocale' => true));
                         }
                         $va_values = array();
                         foreach ($va_labels as $vn_row_id => $va_label_list) {
                             foreach ($va_label_list as $vn_i => $va_label) {
                                 if ($vs_template) {
                                     $va_label_values = $va_label;
                                     $va_label_values['typename_singular'] = $va_types[$va_label['type_id']]['name_singular'];
                                     $va_label_values['typename_plural'] = $va_types[$va_label['type_id']]['name_plural'];
                                     if ($vb_convert_codes_to_display_text) {
                                         $va_label_values['type_id'] = $va_types[$va_label['type_id']]['name_singular'];
                                     }
                                     $va_values[] = caProcessTemplate($vs_template, $va_label_values, array('removePrefix' => 'nonpreferred_labels.'));
                                 } else {
                                     if ($vb_convert_codes_to_display_text && $vs_disp_field == 'type_id') {
                                         $va_values[] = $va_types[$va_label[$vs_disp_field]]['name_singular'];
                                     } else {
                                         $va_values[] = $va_label[$vs_disp_field];
                                     }
                                 }
                             }
                         }
                         return join($vs_delimiter, $va_values);
                         $va_labels = caExtractValuesByUserLocale($t_instance->getNonPreferredLabels(null, false));
                         $vs_disp_field = $this->getLabelDisplayField();
                         $va_processed_labels = array();
                         foreach ($va_labels as $vn_label_id => $va_label_list) {
                             foreach ($va_label_list as $vn_i => $va_label) {
                                 $va_processed_labels[] = $va_label[$vs_disp_field];
                             }
                         }
                         return join($vs_delimiter, $va_processed_labels);
                     } else {
                         $va_labels = $t_instance->getNonPreferredLabels(null, false);
                         if ($vb_return_all_locales) {
                             return $va_labels;
                         } else {
                             return caExtractValuesByUserLocale($va_labels, null, $va_preferred_locales);
                         }
                     }
                     break;
                     # ---------------------------------------------
             }
             break;
         case 2:
         case 3:
             if ($va_tmp[0] === $t_instance->tableName()) {
                 switch ($va_tmp[1]) {
                     # ---------------------------------------------
                     case 'preferred_labels':
                         if (!$vb_return_as_array) {
                             if (isset($va_tmp[2]) && $va_tmp[2]) {
                                 $vs_disp_field = $va_tmp[2];
                             } else {
                                 $vs_disp_field = $this->getLabelDisplayField();
                             }
                             $va_labels = caExtractValuesByUserLocale($t_instance->getPreferredLabels(), null, $va_preferred_locales);
                             $va_values = array();
                             foreach ($va_labels as $vn_row_id => $va_label_list) {
                                 foreach ($va_label_list as $vn_i => $va_label) {
                                     if ($vs_template) {
                                         $va_values[] = caProcessTemplate($vs_template, $va_label, array('removePrefix' => 'preferred_labels.'));
                                     } else {
                                         $va_values[] = $va_label[$vs_disp_field];
                                     }
                                 }
                             }
                             return join($vs_delimiter, $va_values);
                         } else {
                             $va_labels = $t_instance->getPreferredLabels(null, false);
                             if (!$vb_return_all_locales) {
                                 // Simplify array by getting rid of third level array which is unnecessary since
                                 // there is only ever one preferred label for a locale
                                 $va_labels = caExtractValuesByUserLocale($va_labels, null, $va_preferred_locales);
                                 $va_processed_labels = array();
                                 foreach ($va_labels as $vn_label_id => $va_label_list) {
                                     $va_processed_labels[$vn_label_id] = $va_label_list[0];
                                 }
                                 $va_labels = $va_processed_labels;
                             }
                             if (isset($va_tmp[2]) && $va_tmp[2]) {
                                 // specific field
                                 if ($vb_return_all_locales) {
                                     foreach ($va_labels as $vn_label_id => $va_labels_by_locale) {
                                         foreach ($va_labels_by_locale as $vn_locale_id => $va_label_list) {
                                             foreach ($va_label_list as $vn_i => $va_label) {
                                                 $va_labels[$vn_label_id][$vn_locale_id][$vn_i] = $va_label[$va_tmp[2]];
                                             }
                                         }
                                     }
                                 } else {
                                     // get specified field value
                                     foreach ($va_labels as $vn_label_id => $va_label_info) {
                                         $va_labels[$vn_label_id] = $va_label_info[$va_tmp[2]];
                                     }
                                 }
                             }
                             return $va_labels;
                         }
                         break;
                         # ---------------------------------------------
                     # ---------------------------------------------
                     case 'nonpreferred_labels':
                         if (!$vb_return_as_array) {
                             if (isset($va_tmp[2]) && $va_tmp[2]) {
                                 $vs_disp_field = $va_tmp[2];
                             } else {
                                 $vs_disp_field = $this->getLabelDisplayField();
                             }
                             $va_labels = caExtractValuesByUserLocale($t_instance->getNonPreferredLabels(), null, $va_preferred_locales);
                             $t_list = new ca_lists();
                             if ($vb_convert_codes_to_display_text) {
                                 $va_types = $t_list->getItemsForList($this->getLabelTableInstance()->getFieldInfo('type_id', 'LIST_CODE'), array('extractValuesByUserLocale' => true));
                             }
                             $va_values = array();
                             foreach ($va_labels as $vn_row_id => $va_label_list) {
                                 foreach ($va_label_list as $vn_i => $va_label) {
                                     if ($vs_template) {
                                         $va_label_values = $va_label;
                                         $va_label_values['typename_singular'] = $va_types[$va_label['type_id']]['name_singular'];
                                         $va_label_values['typename_plural'] = $va_types[$va_label['type_id']]['name_plural'];
                                         if ($vb_convert_codes_to_display_text) {
                                             $va_label_values['type_id'] = $va_types[$va_label['type_id']]['name_singular'];
                                         }
                                         $va_values[] = caProcessTemplate($vs_template, $va_label_values, array('removePrefix' => 'nonpreferred_labels.'));
                                     } else {
                                         if ($vb_convert_codes_to_display_text && $vs_disp_field == 'type_id') {
                                             $va_values[] = $va_types[$va_label[$vs_disp_field]]['name_singular'];
                                         } else {
                                             $va_values[] = $va_label[$vs_disp_field];
                                         }
                                     }
                                 }
                             }
                             return join($vs_delimiter, $va_values);
                         } else {
                             $va_labels = $t_instance->getNonPreferredLabels(null, false);
                             if (!$vb_return_all_locales) {
                                 $va_labels = caExtractValuesByUserLocale($va_labels, null, $va_preferred_locales);
                             }
                             if (isset($va_tmp[2]) && $va_tmp[2]) {
                                 // specific field
                                 if ($vb_return_all_locales) {
                                     foreach ($va_labels as $vn_label_id => $va_labels_by_locale) {
                                         foreach ($va_labels_by_locale as $vn_locale_id => $va_label_list) {
                                             foreach ($va_label_list as $vn_i => $va_label) {
                                                 $va_labels[$vn_label_id][$vn_locale_id][$vn_i] = $va_label[$va_tmp[2]];
                                             }
                                         }
                                     }
                                 } else {
                                     // get specified field value
                                     foreach ($va_labels as $vn_label_id => $va_label_info) {
                                         foreach ($va_label_info as $vn_id => $va_label) {
                                             $va_labels[$vn_label_id] = $va_label[$va_tmp[2]];
                                         }
                                     }
                                 }
                             }
                             return $va_labels;
                         }
                         break;
                         # ---------------------------------------------
                 }
             }
             break;
     }
     return parent::get($ps_field, $pa_options);
 }
    print "<div class='unit'><span class='metaTitle'>Format: </span><span class='meta'>" . $t_object->get('ca_objects.format_ephemera', array('delimiter' => '; ', 'convertCodesToDisplayText' => true)) . "</span></div>";
}
if ($t_object->get('ca_objects.format_textual') && $t_object->get('ca_objects.format_textual') != 316) {
    print "<div class='unit'><span class='metaTitle'>Format: </span><span class='meta'>" . $t_object->get('ca_objects.format_textual', array('delimiter' => '; ', 'convertCodesToDisplayText' => true)) . "</span></div>";
}
?>
				
				{{{<ifdef code="ca_objects.copyright_statement"><div class='unit'><span class='metaTitle'>Copyright Statement: </span><span class='meta'>^ca_objects.copyright_statement</span></div></ifdef>}}}
				{{{<ifdef code="ca_objects.language"><div class='unit'><span class='metaTitle'>Language: </span><span class='meta'>^ca_objects.language</span></div></ifdef>}}}				
				{{{<ifdef code="ca_objects.use_restrictions"><div class='unit'><span class='metaTitle'>Use Restrictions: </span><span class='meta'>^ca_objects.use_restrictions</span></div></ifdef>}}}				
				{{{<ifdef code="ca_objects.access_restrictions"><div class='unit'><span class='metaTitle'>Access Restrictions: </span><span class='meta'>^ca_objects.access_restrictions</span></div></ifdef>}}}				
<?php 
if ($va_collection_hierarchy = $t_object->get('ca_collections.hierarchy.preferred_labels', array('delimiter' => ' > '))) {
    print '<div class="unit"><span class="metaTitle">Parent Collection: </span><span class="meta">';
    $va_collection_id = $t_object->get('ca_collections.collection_id');
    $t_collection = new ca_collections($va_collection_id);
    $vn_parent_ids = $t_collection->getHierarchyAncestors($va_collection_id, array('idsOnly' => true));
    $vn_highest_level = end($vn_parent_ids);
    print caNavLink($this->request, $va_collection_hierarchy, '', 'Detail', 'collections', $vn_highest_level);
    print "</span></div>";
}
?>
				
				{{{<ifcount min="1" relativeTo="ca_occurrences" code="ca_occurrences.preferred_labels"><div class="unit"><span class="metaTitle">Exhibition: </span><span class="meta"><unit relativeTo="ca_occurrences" delimiter="<br/>"><l>^ca_occurrences.preferred_labels</l></unit></span></div></ifcount>}}}				
<?php 
if ($va_rel_entities = $t_object->get('ca_entities', array('template' => '<l>^ca_entities.preferred_labels (^relationship_typename)</l>', 'delimiter' => '<br/>', 'convertCodesToDisplayText' => true))) {
    print "<div class='unit'><span class='metaTitle'>Related Entities: </span><span class='meta'>" . $va_rel_entities . "</span></div>";
}
if ($va_lcsh_terms = $t_object->get('ca_objects.lcsh_terms', array('returnAsArray' => true))) {
    print "<div class='unit '><span class='metaTitle'>Library of Congress Subject Headings</span><span class='meta'>";
    foreach ($va_lcsh_terms as $k_lchs => $va_lcsh_term) {