public function Index()
 {
     $va_participate_ids = array();
     $t_participate = new ca_sets();
     # --- participate set - set name assigned in eastend.conf - plugin conf file
     $t_participate->load(array('set_code' => $this->opo_plugin_config->get('participate_set_name')));
     # Enforce access control on set
     if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_participate->get("access"), $this->opa_access_values)) {
         $this->view->setVar('participate_set_id', $t_participate->get("set_id"));
         $va_participate_ids = array_keys(is_array($va_tmp = $t_participate->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
         // These are the entity ids in the set
     }
     # --- loop through featured ids and grab the object's image
     $t_object = new ca_objects();
     $va_participate_images = array();
     foreach ($va_participate_ids as $vn_participate_object_id) {
         $va_tmp = array();
         $t_object->load($vn_participate_object_id);
         $va_tmp["object_id"] = $vn_participate_object_id;
         $va_image = $t_object->getPrimaryRepresentation(array("mediumlarge"));
         # --- don't show records with status ars/vaga don't show image
         if ($t_object->get("ca_objects.object_status") != 348) {
             if ($t_object->get("ca_objects.object_status") == 349) {
                 $va_tmp["vaga_class"] = "vagaDisclaimer";
             }
             $va_tmp["image"] = $va_image["tags"]["mediumlarge"];
             $va_tmp["caption"] = $t_object->get("ca_objects.caption");
             $va_tmp["title"] = $t_object->getLabelForDisplay();
         }
         $va_participate_images[$vn_participate_object_id] = $va_tmp;
     }
     $this->view->setVar("participate_images", $va_participate_images);
     $this->render('participate_html.php');
 }
 public function testInsertLoadAndDeleteCycleWithCaObjectsModel()
 {
     $t_list = new ca_lists();
     $va_object_types = $t_list->getItemsForList('object_types');
     $this->assertGreaterThan(0, sizeof($va_object_types), "No object types available");
     $va_object_types = caExtractValuesByUserLocale($va_object_types);
     $this->assertGreaterThan(0, sizeof($va_object_types), "No locale-filtered object types available");
     $vn_locale_id = 1;
     $t_object = new ca_objects();
     $t_object->setMode(ACCESS_WRITE);
     $vn_item_id = 0;
     foreach ($va_object_types as $va_object_type) {
         if (intval($va_object_type['is_enabled']) === 1) {
             $vn_item_id = $va_object_type['item_id'];
         }
     }
     $this->assertGreaterThan(0, $vn_item_id, 'No enabled object type found');
     $t_object->set('type_id', $vn_item_id);
     $t_object->set('locale_id', $vn_locale_id);
     $t_object->set('idno', time());
     $t_object->addAttribute(array('description' => 'Test description', 'locale_id' => $vn_locale_id), 'description');
     $vb_res = $t_object->insert();
     $this->assertTrue($vb_res !== false, 'Insert returned non-true value');
     // insert() returns false OR the primary key, therefore simply asserting $vb_res being true doesn't cut it
     $this->assertEquals($t_object->numErrors(), 0, "Errors on insert: " . join('; ', $t_object->getErrors()));
     $this->opa_test_record_ids['ca_objects'][] = $t_object->getPrimaryKey();
     $vb_res = $t_object->addLabel(array('name' => 'Unit test object'), $vn_locale_id, null, true);
     $this->assertGreaterThan(0, $vb_res, 'AddLabel returned zero value but should return non-zero label_id: ' . join('; ', $t_object->getErrors()));
     $t_object2 = new ca_objects();
     $vb_res = $t_object2->load($t_object->getPrimaryKey());
     $this->assertTrue($vb_res, 'Load of newly created record failed [record does not seem to exist or return row id was invalid?]');
     $this->assertEquals($t_object2->getLabelForDisplay(), 'Unit test object', 'Retrieved row label does not match');
     $this->assertEquals($t_object2->getAttributesForDisplay('description'), 'Test description', 'Retrieved value for attribute "description" does not match expected value');
     // try to search for it
     $o_search = new ObjectSearch();
     $qr_hits = $o_search->search("Unit test object");
     $this->assertGreaterThan(0, $qr_hits->numHits(), 'Search for ca_object by label found no results');
     $vb_found_object = false;
     while ($qr_hits->nextHit()) {
         if ($qr_hits->get('object_id') == $t_object->getPrimaryKey()) {
             $vb_found_object = true;
             break;
         }
     }
     $this->assertTrue($vb_found_object, 'ca_object was not in returned search results for ca_object by label');
     // try delete
     $t_object->delete(true, array('hard' => true));
     $this->assertEquals($t_object->numErrors(), 0, "Errors on delete: " . join('; ', $t_object->getErrors()));
 }
 /**
  *
  */
 public function renderWidget($ps_widget_id, &$pa_settings)
 {
     parent::renderWidget($ps_widget_id, $pa_settings);
     $t_object = new ca_objects();
     # get a random object for display
     $va_random_item = $t_object->getRandomItems(1, array('hasRepresentations' => 1));
     if (sizeof($va_random_item) > 0) {
         foreach ($va_random_item as $vn_object_id => $va_object_info) {
             $t_object->load($vn_object_id);
             $va_rep = $t_object->getPrimaryRepresentation(array('medium'));
             $this->opo_view->setVar('object_id', $vn_object_id);
             $this->opo_view->setVar('image', $va_rep["tags"]["medium"]);
             $this->opo_view->setVar('label', $t_object->getLabelForDisplay());
         }
     }
     $this->opo_view->setVar('request', $this->getRequest());
     return $this->opo_view->render('main_html.php');
 }
 public function Index()
 {
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     $t_object = new ca_objects();
     $t_user_favs = new ca_sets();
     // redirect user if not logged in
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
     } elseif ($this->request->config->get('show_bristol_only') && $this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "bristol", "Show", "Index"));
     }
     # --- user favs - highest ranked
     $va_user_favs = array();
     $va_user_favs_ids = $t_object->getHighestRated(true, 12, $va_access_values);
     if (is_array($va_user_favs_ids) && sizeof($va_user_favs_ids) > 0) {
         foreach ($va_user_favs_ids as $vn_uf_object_id) {
             $t_object = new ca_objects($vn_uf_object_id);
             $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
             $va_user_favs[$vn_uf_object_id] = $va_reps["tags"]["preview"];
         }
     } else {
         # --- get random objects
         $this->view->setVar('user_favorites_is_random', 1);
         $va_random_ids = $t_object->getRandomItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
         if (is_array($va_random_ids) && sizeof($va_random_ids) > 0) {
             $va_random = array();
             foreach ($va_random_ids as $va_item_info) {
                 $vn_rand_object_id = $va_item_info['object_id'];
                 $t_object->load($vn_rand_object_id);
                 $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
                 $va_random[$vn_rand_object_id] = $va_reps["tags"]["preview"];
             }
             $va_user_favs = $va_random;
         }
     }
     $this->view->setVar('user_favs', $va_user_favs);
     # --- featured items set set_code defined in app.conf
     $t_featured = new ca_sets();
     $t_featured->load(array('set_code' => $this->request->config->get('featured_set_name')));
     # Enforce access control on set
     if (sizeof($va_access_values) && !in_array($t_featured->get("access"), $va_access_values)) {
         $t_featured = new ca_sets();
     }
     $va_featured = array();
     if (is_array($va_row_ids = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values)))) {
         $va_featured_ids = array_keys($va_row_ids);
         // These are the object ids in the set
         foreach ($va_featured_ids as $vn_f_object_id) {
             $t_object = new ca_objects($vn_f_object_id);
             $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
             $va_featured[$vn_f_object_id] = $va_reps["tags"]["preview"];
         }
     } else {
         # --- get random objects
         $va_random_ids = $t_object->getRandomItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
         if (is_array($va_random_ids) && sizeof($va_random_ids) > 0) {
             $va_random = array();
             foreach ($va_random_ids as $va_item_info) {
                 $vn_rand_object_id = $va_item_info['object_id'];
                 $t_object->load($vn_rand_object_id);
                 $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
                 $va_random[$vn_rand_object_id] = $va_reps["tags"]["preview"];
             }
             $va_featured = $va_random;
         }
     }
     $this->view->setVar('featured', $va_featured);
     # --- most viewed
     $va_most_viewed_ids = $t_object->getMostViewedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
     if (is_array($va_most_viewed_ids) && sizeof($va_most_viewed_ids) > 0) {
         $va_most_viewed = array();
         foreach ($va_most_viewed_ids as $va_item_info) {
             $vn_r_object_id = $va_item_info['object_id'];
             $t_object->load($vn_r_object_id);
             $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
             $va_most_viewed[$vn_r_object_id] = $va_reps["tags"]["preview"];
         }
     }
     $this->view->setVar('most_viewed', $va_most_viewed);
     # --- recently added
     $va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
     if (is_array($va_recently_added_ids) && sizeof($va_recently_added_ids) > 0) {
         $va_recently_added = array();
         foreach ($va_recently_added_ids as $va_item_info) {
             $vn_r_object_id = $va_item_info['object_id'];
             $t_object->load($vn_r_object_id);
             $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
             $va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
         }
     }
     $this->view->setVar('recently_added', $va_recently_added);
     $this->render('Favorites/favorites_landing_html.php');
 }
 /**
  *
  */
 private function _setCurrent($pm_rel_table_name_or_num, $pn_rel_id)
 {
     switch ($this->tableName()) {
         case 'ca_movements':
             // Calcuate current flag for relationships to storage locations and objects
             if (($vs_date_element = $this->getAppConfig()->get('movement_storage_location_date_element')) && ($vs_rel_table = $this->getAppDatamodel()->getTableName($pm_rel_table_name_or_num)) == 'ca_objects') {
                 // get all other movements for this object
                 $t_object = new ca_objects();
                 $t_object->setTransaction($this->getTransaction());
                 if ($t_object->load($pn_rel_id)) {
                     if ($qr_movements_for_object = ca_movements_x_objects::find(array('object_id' => $pn_rel_id), array('returnAs' => 'SearchResult'))) {
                         $va_list = array();
                         while ($qr_movements_for_object->nextHit()) {
                             $va_list[$qr_movements_for_object->get("ca_movements.{$vs_date_element}", array('sortable' => true))] = $qr_movements_for_object->get('ca_movements_x_objects.relation_id');
                         }
                         ksort($va_list, SORT_NUMERIC);
                         $vn_current = array_pop($va_list);
                         if (sizeof($va_list)) {
                             $t_object->getDb()->query("UPDATE ca_movements_x_objects SET source_info = '' WHERE relation_id IN (?)", array(array_values($va_list)));
                             $t_object->getDb()->query("UPDATE ca_movements_x_storage_locations SET source_info = '' WHERE movement_id IN (SELECT movement_id FROM ca_movements_x_objects WHERE relation_id IN (?))", array(array_values($va_list)));
                         }
                         if ($vn_current) {
                             $t_object->getDb()->query("UPDATE ca_movements_x_objects SET source_info = 'current' WHERE relation_id = ?", array($vn_current));
                             $t_object->getDb()->query("UPDATE ca_movements_x_storage_locations SET source_info = 'current' WHERE movement_id IN (SELECT movement_id FROM ca_movements_x_objects WHERE relation_id = ?)", array($vn_current));
                         }
                     }
                 }
             }
             break;
     }
 }
					<H4>{{{^ca_places.preferred_labels.name}}}</H4>
					{{{<ifdef code="ca_places.description"><br/>^ca_places.description<br/></ifdef>}}}<br/>
<?php 
print "<p>" . caNavLink($this->request, _t("View all related objects"), "btn btn-default", "", "Browse", "objects", array("facet" => "place_facet", "id" => $t_item->get("place_id"))) . "</p>";
$t_object_thumb = new ca_objects();
$va_entities = $t_item->get("ca_entities", array("returnAsArray" => true, "checkAccess" => $va_access_values));
if (sizeof($va_entities)) {
    if (sizeof($va_entities) == 1) {
        print "<H6>Related person/organisation</H6>";
    } else {
        print "<H6>Related people/organisations</H6>";
    }
    $t_rel_entity = new ca_entities();
    foreach ($va_entities as $va_entity) {
        $t_rel_entity->load($va_entity["entity_id"]);
        $t_object_thumb->load($t_rel_entity->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_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_caption[] = $vo_result->get("ca_objects.extent") . " " . _t("example") . ($vo_result->get("ca_objects.extent") == 1 ? "" : "s");
 }
 $vs_caption = join(', ', $va_caption);
 $vs_result = join('<br/>', $va_caption);
 print "<div class='searchFullTitle'>" . caNavLink($this->request, $vs_result, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div>";
 print "</div><!-- END searchFullText --></td>";
 // set view vars for tooltip if there is an image
 #if($vo_result->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values))){
 $va_children_caption = array();
 $vs_child_caption = "";
 $this->setVar('tooltip_representation', $vo_result->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values)));
 # --- if this is a group object, get the children to display in the tooltip
 if ($vo_result->get("type_id") == $vn_object_type_group) {
     $va_children = $vo_result->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'checkAccess' => $va_access_values));
     foreach ($va_children as $k => $va_child_info) {
         $t_child->load($va_child_info["object_id"]);
         $vs_child_caption = "<span class='resultidno'>" . trim($t_child->get("ca_objects.idno")) . "</span>, ";
         #$vs_child_caption .= "<i>".$va_child_info["name"]."</i>, ";
         if ($t_child->get("ca_objects.date.display_date")) {
             $vs_child_caption .= $t_child->get("ca_objects.date.display_date") . ", ";
         }
         if ($t_child->get("ca_objects.technique")) {
             $vs_child_caption .= $t_child->get("ca_objects.technique");
         }
         if ($t_child->get("ca_objects.type_id") == $vn_object_type_group) {
             $vs_child_caption .= $t_child->get("ca_objects.extent") . " " . _t("example") . ($t_child->get("ca_objects.extent") == 1 ? "" : "s");
         }
         $va_children_caption[] = $vs_child_caption;
     }
     $this->setVar('tooltip_children', "<b>" . sizeof($va_children_caption) . " " . _t("example%1", sizeof($va_children_caption) == 1 ? "" : "s") . "</b><br/>" . join("; ", $va_children_caption));
 } else {
Example #8
0
 /**
  * Download all media attached to specified object (not necessarily open for editing)
  * Includes all representation media attached to the specified object + any media attached to oter
  * objects in the same object hierarchy as the specified object. Used by the book viewer interfacce to 
  * initiate a download.
  */
 public function DownloadMedia()
 {
     if (!caObjectsDisplayDownloadLink($this->request)) {
         $this->postError(1100, _t('Cannot download media'), 'DetailController->DownloadMedia');
         return;
     }
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $t_object = new ca_objects($pn_object_id);
     if (!($vn_object_id = $t_object->getPrimaryKey())) {
         return;
     }
     $ps_version = $this->request->getParameter('version', pString);
     if (!$ps_version) {
         $ps_version = 'original';
     }
     $this->view->setVar('version', $ps_version);
     $va_ancestor_ids = $t_object->getHierarchyAncestors(null, array('idsOnly' => true, 'includeSelf' => true));
     if ($vn_parent_id = array_pop($va_ancestor_ids)) {
         $t_object->load($vn_parent_id);
         array_unshift($va_ancestor_ids, $vn_parent_id);
     }
     $va_child_ids = $t_object->getHierarchyChildren(null, array('idsOnly' => true));
     foreach ($va_ancestor_ids as $vn_id) {
         array_unshift($va_child_ids, $vn_id);
     }
     $vn_c = 1;
     $va_file_names = array();
     $va_file_paths = array();
     foreach ($va_child_ids as $vn_object_id) {
         $t_object = new ca_objects($vn_object_id);
         if (!$t_object->getPrimaryKey()) {
             continue;
         }
         $va_reps = $t_object->getRepresentations(array($ps_version));
         $vs_idno = $t_object->get('idno');
         foreach ($va_reps as $vn_representation_id => $va_rep) {
             $va_rep_info = $va_rep['info'][$ps_version];
             $vs_idno_proc = preg_replace('![^A-Za-z0-9_\\-]+!', '_', $vs_idno);
             switch ($this->request->user->getPreference('downloaded_file_naming')) {
                 case 'idno':
                     $vs_file_name = $vs_idno_proc . '_' . $vn_c . '.' . $va_rep_info['EXTENSION'];
                     break;
                 case 'idno_and_version':
                     $vs_file_name = $vs_idno_proc . '_' . $ps_version . '_' . $vn_c . '.' . $va_rep_info['EXTENSION'];
                     break;
                 case 'idno_and_rep_id_and_version':
                     $vs_file_name = $vs_idno_proc . '_representation_' . $vn_representation_id . '_' . $ps_version . '.' . $va_rep_info['EXTENSION'];
                     break;
                 case 'original_name':
                 default:
                     if ($va_rep['info']['original_filename']) {
                         $va_tmp = explode('.', $va_rep['info']['original_filename']);
                         if (sizeof($va_tmp) > 1) {
                             if (strlen($vs_ext = array_pop($va_tmp)) < 3) {
                                 $va_tmp[] = $vs_ext;
                             }
                         }
                         $vs_file_name = join('_', $va_tmp);
                     } else {
                         $vs_file_name = $vs_idno_proc . '_representation_' . $vn_representation_id . '_' . $ps_version;
                     }
                     if (isset($va_file_names[$vs_file_name . '.' . $va_rep_info['EXTENSION']])) {
                         $vs_file_name .= "_{$vn_c}";
                     }
                     $vs_file_name .= '.' . $va_rep_info['EXTENSION'];
                     break;
             }
             $va_file_names[$vs_file_name] = true;
             $this->view->setVar('version_download_name', $vs_file_name);
             //
             // Perform metadata embedding
             $t_rep = new ca_object_representations($va_rep['representation_id']);
             if (!($vs_path = caEmbedMetadataIntoRepresentation($t_object, $t_rep, $ps_version))) {
                 $vs_path = $t_rep->getMediaPath('media', $ps_version);
             }
             $va_file_paths[$vs_path] = $vs_file_name;
             $vn_c++;
         }
     }
     if (sizeof($va_file_paths) > 1) {
         if (!($vn_limit = ini_get('max_execution_time'))) {
             $vn_limit = 30;
         }
         set_time_limit($vn_limit * 2);
         $o_zip = new ZipFile();
         foreach ($va_file_paths as $vs_path => $vs_name) {
             $o_zip->addFile($vs_path, $vs_name, null, array('compression' => 0));
             // don't try to compress
         }
         $this->view->setVar('archive_path', $vs_path = $o_zip->output(ZIPFILE_FILEPATH));
         $this->view->setVar('archive_name', preg_replace('![^A-Za-z0-9\\.\\-]+!', '_', $t_object->get('idno')) . '.zip');
         $this->response->sendHeaders();
         $vn_rc = $this->render('Details/object_download_media_binary.php');
         $this->response->sendContent();
         if ($vs_path) {
             unlink($vs_path);
         }
     } else {
         foreach ($va_file_paths as $vs_path => $vs_name) {
             $this->view->setVar('archive_path', $vs_path);
             $this->view->setVar('archive_name', $vs_name);
         }
         $this->response->sendHeaders();
         $vn_rc = $this->render('Details/object_download_media_binary.php');
         $this->response->sendContent();
     }
     return $vn_rc;
 }
?>
</h3>
			<div class="searchboxitemtext">
<?php 
# --- identifier
if ($t_object->get('idno')) {
    print "<div class='unit'><b>" . _t("Reference Code") . ":</b> " . $t_object->get('idno') . "</div><!-- end unit -->";
}
# --- hirearchy breadcrumb trail
$va_ancestors = array();
$va_ancestors = $t_object->getHierarchyAncestors();
if (sizeof($va_ancestors) > 0) {
    $va_hier_path = array();
    $t_hier_object = new ca_objects();
    foreach ($va_ancestors as $va_ancestor) {
        $t_hier_object->load($va_ancestor['NODE']['object_id']);
        $va_hier_path[] = caNavLink($this->request, $t_hier_object->getLabelForDisplay(), '', 'Detail', 'Object', 'Show', array('object_id' => $va_ancestor['NODE']['object_id']));
    }
    print "<div class='unit'><b>" . _t("Part Of") . ":</b> " . join(" > ", array_reverse($va_hier_path)) . "</div>";
}
# --- child hierarchy info
$va_children = $t_object->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'checkAccess' => $va_access_values));
if (sizeof($va_children) > 0) {
    print "<div class='unit'><b>" . _t("Part%1", sizeof($va_children) > 1 ? "s" : "") . ":</b><br/>";
    $i = 0;
    foreach ($va_children as $va_child) {
        # only show the first 5 and have a more link
        if ($i == 5) {
            print "<div id='moreChildrenLink'><a href='#' onclick='\$(\"#moreChildren\").slideDown(250); \$(\"#moreChildrenLink\").hide(1); return false;'>[" . _t("More") . "]</a></div><!-- end moreChildrenLink -->";
            print "<div id='moreChildren' style='display:none;'>";
        }
 // 					print "<div class='moreLink'><a href='#' id='artworkMoreLink' onclick='jQuery(\"#artworkMore\").slideDown(250); jQuery(\"#artworkMoreLink\").hide(); return false;'>".($qr_hits->numHits() - $vn_num_more_link)._t(" More like this")." &rsaquo;</a></div>";
 // 				}
 // 				print "</div><!-- end unit -->";
 // 			}
 # --- output related object images as links
 $va_related_artworks = $t_occurrence->get("ca_objects", array("restrict_to_relationship_types" => array("part"), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
 if (sizeof($va_related_artworks)) {
     print "<div class='unit' style='clear:right;'><H3>" . _t("Checklist of Artworks") . "</H3>";
     $t_rel_object = new ca_objects();
     $i = 0;
     foreach ($va_related_artworks as $vn_rel_id => $va_info) {
         if ($i == $vn_num_more_link) {
             print "<div id='artworkMore' class='relatedMoreItems'>";
         }
         $vn_rel_object_id = $va_info['object_id'];
         $t_rel_object->load($vn_rel_object_id);
         print "<div id='relArtwork" . $vn_rel_object_id . "'  class='relArtwork' " . ($i / 2 - floor($i / 2) == 0 ? "style='clear:left;'" : "") . ">";
         $va_rep = array();
         $vs_rep = "";
         if ($t_rel_object->getPrimaryRepresentation(array('tiny'), null, array('return_with_access' => $va_access_values))) {
             $va_rep = $t_rel_object->getPrimaryRepresentation(array('tiny'), null, array('return_with_access' => $va_access_values));
             $vs_rep = $va_rep["tags"]["tiny"];
             print "<div class='relArtworkImage' id='relArtworkImage" . $vn_rel_object_id . "'>" . caNavLink($this->request, $vs_rep, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_rel_object_id)) . "</div>";
         } else {
             print "<div class='relArtworkImagePlaceHolder'><!-- empty --></div>";
         }
         print "<div>";
         if ($t_rel_object->get("ca_objects.idno")) {
             print "<span class='resultidno'>" . trim($t_rel_object->get("ca_objects.idno")) . "</span><br/>";
         }
         if ($this->request->config->get('allow_detail_for_ca_objects')) {
 /**
  * Returns content for overlay containing details for object representation linked to occurrence
  */
 public function getSetsOverlay()
 {
     $this->view->setVar('display_type', 'media_overlay');
     $pn_set_id = $this->request->getParameter('set_id', pInteger);
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $this->view->setVar('object_id', $pn_object_id);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/simpleGallery/conf/simpleGallery.conf');
     $this->view->setVar('set_id', $pn_set_id);
     $t_set = new ca_sets($pn_set_id);
     $pn_set_item_id = $this->request->getParameter('set_item_id', pInteger);
     $this->view->setVar('set_item_id', $pn_set_item_id);
     $ps_set_item_description_code = $this->opo_plugin_config->get('set_item_description_element_code');
     $this->view->setVar('set_item_description', $ps_set_item_description_code);
     $this->view->setVar('object_id', $pn_object_id);
     $t_object = new ca_objects($pn_object_id);
     $this->view->setVar('t_object', $t_object);
     $t_rep = new ca_object_representations($pn_representation_id);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('t_object_representation', $t_rep);
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     if (!$t_set->getPrimaryKey()) {
         die("Invalid set_id");
     }
     if (!$t_object->getPrimaryKey()) {
         die("Invalid object_id");
     }
     if (!$t_rep->getPrimaryKey()) {
         die("Invalid representation_id");
     }
     if (sizeof($va_access_values) && !in_array($t_set->get('access'), $va_access_values)) {
         die("Invalid set_id");
     }
     if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) {
         die("Invalid object_id");
     }
     if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) {
         die("Invalid rep_id");
     }
     // Get media for display using configured rules
     $va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     // set version
     $this->view->setVar('version', $va_rep_display_info['display_version']);
     unset($va_display_info['display_version']);
     // set other options
     $this->view->setVar('display_options', $va_rep_display_info);
     if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) {
         $ps_containerID = 'caMediaPanelContentArea';
     }
     $this->view->setVar("containerID", $ps_containerID);
     // Get all objects asscoiated with this set and show primary reps as icons for navigation
     $va_set_items = $t_set->getItems(array("checkAccess" => $va_access_values));
     #print "<pre>";
     #print_r($va_set_items);
     #print "</pre>";
     if (sizeof($va_set_items) > 0) {
         $t_image_objects = new ca_objects();
         $i = 1;
         foreach ($va_set_items as $vn_rel_id => $va_inter) {
             foreach ($va_inter as $id => $va_info) {
                 $t_image_objects->load($va_info["row_id"]);
                 if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) {
                     $va_temp = array();
                     if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                         $va_temp["representation_id"] = $t_primary_rep->get("representation_id");
                         $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon');
                         $va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                         $va_temp["object_id"] = $va_info["object_id"];
                         $va_temp["set_item_id"] = $va_info['item_id'];
                         $va_thumbnails[$va_info["object_id"]] = $va_temp;
                         if ($vn_getNext == 1) {
                             $this->view->setVar("next_object_id", $va_info["object_id"]);
                             $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
                             $vn_getNext = 0;
                         }
                         if ($va_info["object_id"] == $pn_object_id) {
                             $this->view->setVar("representation_index", $i);
                             $this->view->setVar("previous_object_id", $vn_prev_obj_id);
                             $this->view->setVar("previous_representation_id", $vn_prev_rep_id);
                             $this->view->setVar("set_item_id", $va_info['item_id']);
                             $vn_getNext = 1;
                         }
                         $vn_prev_obj_id = $va_info["object_id"];
                         $vn_prev_rep_id = $t_primary_rep->get("representation_id");
                         $i++;
                     }
                 }
             }
         }
     }
     $this->view->setVar('reps', $va_thumbnails);
     return $this->render($this->ops_theme . "/ajax_ca_sets_media_overlay_html.php");
 }
Example #12
0
JavascriptLoadManager::register('tabUI');
# --- get the access values for checking permissions
if ($this->request->config->get("dont_enforce_access_settings")) {
    $va_access_values = array();
} else {
    $va_access_values = caGetUserAccessValues($this->request);
}
$t_object = new ca_objects();
# --- most viewed
$va_most_viewed_ids = $t_object->getMostViewedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if (is_array($va_most_viewed_ids) && sizeof($va_most_viewed_ids) > 0) {
    $va_most_viewed = array();
    foreach ($va_most_viewed_ids as $va_item_info) {
        $va_temp = array();
        $vn_r_object_id = $va_item_info['object_id'];
        $t_object->load($vn_r_object_id);
        $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'widepreview'), null, array('return_with_access' => $va_access_values));
        $va_temp["widepreview"] = $va_reps["tags"]["widepreview"];
        $va_temp["label"] = $t_object->get("ca_objects.preferred_labels");
        $va_most_viewed[$vn_r_object_id] = $va_temp;
    }
}
# --- recently added
# -- get object type of fond and subfonds
$o_lists = new ca_lists();
$vn_fond_id = $o_lists->getItemIDFromList('object_types', 'fonds');
$vn_sub_fond_id = $o_lists->getItemIDFromList('object_types', 'sub_fonds');
$va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1, 'restrictToTypes' => array($vn_fond_id, $vn_sub_fond_id)));
if (is_array($va_recently_added_ids) && sizeof($va_recently_added_ids) > 0) {
    $va_recently_added = array();
    foreach ($va_recently_added_ids as $va_item_info) {
Example #13
0
            $va_chrono_display_info = caGetMediaDisplayInfo('chronology', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
            $vs_chrono_version = $va_chrono_display_info['display_version'];
            $vn_object_id = $va_object_info['object_id'];
            $va_opts = array('display' => 'detail', 'object_id' => $vn_object_id, 'containerID' => 'cont');
            print "<div style='text-align:center;'>" . caNavLink($this->request, $t_rel_object->getLabelForDisplay() . ", ID:" . $t_rel_object->get('idno'), '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)) . "</div>";
            print "<div id='contchrono'>" . $t_rep->getRepresentationViewerHTMLBundle($this->request, $va_opts) . "</div>";
        }
    } else {
        ?>
			<table border="0" cellpadding="0px" cellspacing="0px" width="100%">
<?php 
        $t_rel_object = new ca_objects();
        $vn_itemc = 0;
        # --- only show the first 12 images then a link that says how many more there are
        foreach ($va_action["objects"] as $vn_i => $va_object_info) {
            $t_rel_object->load($va_object_info['object_id']);
            $va_reps = $t_rel_object->getPrimaryRepresentation(array('widethumbnail', 'small'), null, array('return_with_access' => $va_access_values));
            if ($vn_c == 0) {
                print "<tr>\n";
            }
            $vn_object_id = $va_object_info['object_id'];
            $vs_caption = $t_rel_object->getLabelForDisplay();
            # --- get the height of the image so can calculate padding needed to center vertically
            $vn_padding_top = 0;
            $vs_display = "";
            if (!($vs_display = $va_reps["tags"]["widethumbnail"])) {
                $vs_display = "<div class='textResult'>ID: " . $t_rel_object->get('idno') . "</div>";
            }
            print "<td align='left' valign='top' class='searchResultTd' style='width:110px;'><div class='relatedThumbBg searchThumbnail" . $vn_object_id . "'>";
            print caNavLink($this->request, $vs_display, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id));
            // Get thumbnail caption
    print '<img src="' . $this->request->getThemeDirectoryPath() . '/graphics/metabolic_logo.png"/>';
}
print "<span class='headerText'>" . caGetLocalizedDate(null, array('dateFormat' => 'delimited')) . "</span>";
print "<span class='headerText'>" . ($vn_num_items == 1 ? _t('%1 item', $vn_num_items) : _t('%1 items', $vn_num_items)) . "</span>";
print "<span class='headerText'>" . mb_substr($vs_title, 0, 15) . (mb_strlen($vs_title) > 15 ? '...' : '') . "</span>";
#print "<span class='pagingText'>"._t("page [%1]/[%2]", "[page_cu]", "[page_nb]")."</span>";
?>
		</div>

	<table width="100%" cellpadding="0" cellspacing="0">
<?php 
$i = 1;
$t_object = new ca_objects();
foreach ($va_items as $va_item) {
    $vn_object_id = $va_item['object_id'];
    $t_object->load($vn_object_id);
    $t_rep = $t_object->getPrimaryRepresentationInstance();
    if ($i == 1) {
        print "<tr>";
    }
    print "<td><table class='imageTable' cellpadding='0' cellspacing='0'><tr><td>";
    if ($t_rep) {
        print "<img src='" . $t_rep->getMediaUrl("media", "medium") . "' width='" . $va_item["representation_width_thumbnail"] . "' height='" . $va_item["representation_height_thumbnail"] . "' border='0'>";
    }
    print "</td></tr></table>";
    #print "<td><table class='imageTable' cellpadding='0' cellspacing='0'><tr><td>".((file_exists(str_replace($this->request->config->get("site_host"), $this->request->config->get("ca_base_dir"), $va_item["representation_url_thumbnail"]))) ? $va_item["representation_tag_thumbnail"] : "")."</td></tr></table>";
    print "<div class='imageCaption'>" . $va_item["idno"] . "<br/>" . $t_object->get("ca_objects.altID") . "<br/>" . $t_object->get("ca_collections.preferred_labels", array("delimiter" => "; ")) . "</div></td>";
    if ($i == 4) {
        print "</tr>";
        $i = 0;
    }
Example #15
0
 function Index()
 {
     // Remove any browse criteria previously set
     $this->opo_browse->removeAllCriteria();
     parent::Index(true);
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('browsable');
     JavascriptLoadManager::register('tabUI');
     $t_object = new ca_objects();
     $t_featured = new ca_sets();
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     # --- featured items set - set name assigned in app.conf
     $featured_sets = $this->request->config->get('featured_sets');
     $len = count($featured_sets);
     if ($len > 3) {
         $len = 3;
     }
     for ($i = 0; $i < $len; $i++) {
         $t_featured->load(array('set_code' => $featured_sets[$i]));
         $set_id = $t_featured->getPrimaryKey();
         $set_title = $t_featured->getLabelForDisplay();
         $set_desc = $t_featured->getAttributeFromSets('description', array(0 => $set_id));
         $va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());
         // These are the object ids in the set
         if (is_array($va_featured_ids) && sizeof($va_featured_ids) > 0) {
             $t_object = new ca_objects($va_featured_ids[0]);
             $va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'medium', 'mediumlarge', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
             $featured_set_id_array[$i] = array('featured_set_code' => $featured_sets[$i], 'featured_content_id' => $va_featured_ids[0], 'featured_content_small' => $va_rep["tags"]["small"], 'featured_content_label' => $set_title, 'featured_content_description' => $set_desc[$set_id][0], 'featured_set_id' => $set_id);
         }
     }
     $this->view->setVar('featured_set_id_array', $featured_set_id_array);
     # --- user favorites get the highest ranked objects to display
     $va_user_favorites_items = $t_object->getHighestRated(true, 12, $va_access_values);
     if (sizeof($va_user_favorites_items) > 0) {
         if (is_array($va_user_favorites_items) && sizeof($va_user_favorites_items) > 0) {
             $t_object = new ca_objects($va_user_favorites_items[0]);
             $va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
             $this->view->setVar('user_favorites_id', $va_user_favorites_items[0]);
             $this->view->setVar('user_favorites_thumb', $va_rep["tags"]["thumbnail"]);
             $this->view->setVar('user_favorites_small', $va_rep["tags"]["small"]);
             $this->view->setVar('user_favorites_preview', $va_rep["tags"]["preview"]);
             $this->view->setVar('user_favorites_widepreview', $va_rep["tags"]["widepreview"]);
         }
     } else {
         $this->view->setVar('user_favorites_is_random', 1);
         # if no ranks set, choose a random object
         $va_random_items = $t_object->getRandomItems(1, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
         $va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_random_items));
         $va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_random_items), array('small', 'thumbnail', 'preview', 'medium', 'widepreview'), array("checkAccess" => $va_access_values));
         foreach ($va_random_items as $vn_object_id => $va_object_info) {
             $va_object_info['title'] = $va_labels[$vn_object_id];
             $va_object_info['media'] = $va_media[$vn_object_id];
             $va_random_items[$vn_object_id] = $va_object_info;
         }
         $this->view->setVar('random_objects', $va_random_items);
         if (is_array($va_random_items) && sizeof($va_random_items) > 0) {
             $va_object_info = array_shift($va_random_items);
             $this->view->setVar('user_favorites_id', $va_object_info['object_id']);
             $this->view->setVar('user_favorites_thumb', $va_media[$va_object_info['object_id']]["tags"]["thumbnail"]);
             $this->view->setVar('user_favorites_small', $va_media[$va_object_info['object_id']]["tags"]["small"]);
             $this->view->setVar('user_favorites_preview', $va_media[$va_object_info['object_id']]["tags"]["preview"]);
             $this->view->setVar('user_favorites_widepreview', $va_media[$va_object_info['object_id']]["tags"]["widepreview"]);
             $this->view->setVar('user_favorites_medium', $va_media[$va_object_info['object_id']]["tags"]["medium"]);
         }
     }
     #---- new 'recently added'
     $t_set = new ca_sets();
     $ra_set_code = $this->request->config->get('recently_added_set_id');
     $t_set->load(array('set_code' => $ra_set_code));
     $set_id = $t_set->getPrimaryKey();
     $ra_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('thumbnail', 'preview'), "checkAccess" => 1)));
     $va_recently_added = array();
     foreach ($ra_items as $va_item_info) {
         $vn_r_object_id = $va_item_info['object_id'];
         $t_object->load($vn_r_object_id);
         $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
         $va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
     }
     # --- get the 12 most recently added objects to display
     /*$va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
     			if(is_array($va_recently_added_ids) && sizeof($va_recently_added_ids) > 0){
     			$va_recently_added = array();
     			foreach($va_recently_added_ids as $va_item_info){
     				$vn_r_object_id = $va_item_info['object_id'];
     				$t_object->load($vn_r_object_id);
     				$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
     				$va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
     			}
     		}*/
     $this->view->setVar('recently_added', $va_recently_added);
     $this->render('Splash/splash_html.php');
 }
Example #16
0
 /**
  * Override insert() to add child records to the same lot as parent
  */
 public function insert($pa_options = null)
 {
     if ($vn_parent_id = $this->get('parent_id')) {
         $t_parent = new ca_objects();
         if ($this->inTransaction()) {
             $t_parent->setTransaction($this->getTransaction());
         }
         if ($t_parent->load($vn_parent_id) && ($vn_lot_id = $t_parent->get('lot_id'))) {
             $this->set('lot_id', $vn_lot_id);
         }
     }
     return parent::insert($pa_options);
 }
    $va_featured_ids = array_keys($va_row_ids);
    // These are the object ids in the set
    foreach ($va_featured_ids as $vn_f_object_id) {
        $t_object = new ca_objects($vn_f_object_id);
        $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
        $va_featured[$vn_f_object_id] = $va_reps["tags"]["preview"];
        $vs_featured_content_label = $t_object->getLabelForDisplay();
    }
} else {
    # --- get random objects
    $va_random_ids = $t_object->getRandomItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
    if (is_array($va_random_ids) && sizeof($va_random_ids) > 0) {
        $va_random = array();
        foreach ($va_random_ids as $va_item_info) {
            $vn_rand_object_id = $va_item_info['object_id'];
            $t_object->load($vn_rand_object_id);
            $va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
            $va_random[$vn_rand_object_id] = $va_reps["tags"]["preview"];
            $vs_featured_content_label = $t_object->getLabelForDisplay();
        }
        $va_featured = $va_random;
    }
}
?>
	<div id="featuredHeader">Featured Objects</div>
	<div class="textContent">
<?php 
print $this->render('Favorites/favorites_intro_text_html.php');
?>
	</div><!-- end textContent -->
	<div class="favoritesColumn" id="featuredCol">
Example #18
0
 /**
  *
  */
 public static function reload_object_current_locations($po_opts = null)
 {
     require_once __CA_LIB_DIR__ . "/core/Db.php";
     require_once __CA_MODELS_DIR__ . "/ca_objects.php";
     $o_db = new Db();
     $t_object = new ca_objects();
     $qr_res = $o_db->query("SELECT * FROM ca_objects");
     print CLIProgressBar::start($qr_res->numRows(), _t('Starting...'));
     $vn_c = 0;
     while ($qr_res->nextRow()) {
         $vn_object_id = $qr_res->get('object_id');
         if ($t_object->load($vn_object_id)) {
             print CLIProgressBar::next(1, _t('Processing %1', $t_object->getWithTemplate("^ca_objects.preferred_labels.name (^ca_objects.idno)")));
             $t_object->deriveCurrentLocationForBrowse();
         } else {
             print CLIProgressBar::next(1, _t('Cannot load object %1', $vn_object_id));
         }
         $vn_c++;
     }
     print CLIProgressBar::finish();
     CLIUtils::addMessage(_t('Processed %1 objects', $vn_c));
     return true;
 }
Example #19
0
 /**
  * 
  *
  * @return boolean 
  */
 public function renumberObjects($po_application_plugin_manager = null)
 {
     if (!$this->getPrimaryKey()) {
         return false;
     }
     if ($va_non_conforming_objects = $this->getObjectsWithNonConformingIdnos()) {
         $va_objects = $this->getObjects();
         $vs_lot_num = $this->get('idno_stub');
         $t_object = new ca_objects();
         $vb_web_set_transaction = false;
         if (!$this->inTransaction()) {
             $o_trans = new Transaction($this->getDb());
             $vb_web_set_transaction = true;
         } else {
             $o_trans = $this->getTransaction();
         }
         $t_object->setTransaction($o_trans);
         $t_idno = $t_object->getIDNoPlugInInstance();
         $vs_separator = $t_idno->getSeparator();
         $vn_i = 1;
         foreach ($va_objects as $vn_object_id => $va_object_info) {
             if ($t_object->load($vn_object_id)) {
                 if ($po_application_plugin_manager) {
                     $po_application_plugin_manager->hookBeforeSaveItem(array('id' => $vn_object_id, 'table_num' => $t_object->tableNum(), 'table_name' => $t_object->tableName(), 'instance' => $t_object));
                 }
                 $t_object->setMode(ACCESS_WRITE);
                 $t_object->set('idno', $vs_lot_num . $vs_separator . $vn_i);
                 $t_object->update();
                 if ($t_object->numErrors()) {
                     $t->rollback();
                     $this->errors = $t_object->errors;
                     return false;
                 }
                 if ($po_application_plugin_manager) {
                     $po_application_plugin_manager->hookSaveItem(array('id' => $vn_object_id, 'table_num' => $t_object->tableNum(), 'table_name' => $t_object->tableName(), 'instance' => $t_object));
                 }
                 $vn_i++;
             }
         }
         if ($vb_web_set_transaction) {
             $o_trans->commit();
         }
     }
     return true;
 }
 public function getFeaturedArtistSlideshow()
 {
     $va_featured_ids = array();
     $t_featured = new ca_sets();
     # --- featured artists set - set name assigned in eastend.conf - plugin conf file
     $t_featured->load(array('set_code' => $this->opo_plugin_config->get('featured_artists_set_name')));
     # Enforce access control on set
     if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_featured->get("access"), $this->opa_access_values)) {
         $this->view->setVar('featured_set_id', $t_featured->get("set_id"));
         $va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
         // These are the entity ids in the set
     }
     if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) {
         # put random entities in the features variable
         $o_db = new Db();
         $q_entities = $o_db->query("SELECT e.entity_id from ca_entities e WHERE e.access IN (" . implode($this->opa_access_values, ", ") . ") ORDER BY RAND() LIMIT 10");
         if ($q_entities->numRows() > 0) {
             while ($q_entities->nextRow()) {
                 $va_featured_ids[] = $q_entities->get("entity_id");
             }
         }
     }
     # --- loop through featured ids and grab the entity's name, portrait, lifespan -lifespans_date, indexing_notes (brief description abouthow they relate to the east end)
     $t_entity = new ca_entities();
     $t_object = new ca_objects();
     $va_featured_artists = array();
     foreach ($va_featured_ids as $vn_featured_entity_id) {
         $va_tmp = array();
         $t_entity->load($vn_featured_entity_id);
         $va_tmp["entity_id"] = $vn_featured_entity_id;
         $va_tmp["lifespan"] = $t_entity->get("lifespans_date");
         $va_tmp["indexing_notes"] = $t_entity->get("indexing_notes");
         $va_tmp["name"] = $t_entity->getLabelForDisplay();
         $va_objects = $t_entity->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $this->opa_access_values, 'restrict_to_relationship_types' => array('portrait')));
         $va_object = array_shift($va_objects);
         $t_object->load($va_object["object_id"]);
         $va_portrait = $t_object->getPrimaryRepresentation(array("abSlideShow"));
         # --- don't show records with status ars/vaga don't show image
         if ($t_object->get("ca_objects.object_status") != 348) {
             if ($t_object->get("ca_objects.object_status") == 349) {
                 $va_tmp["vaga_class"] = "vagaDisclaimer";
             }
             $va_tmp["image"] = $va_portrait["tags"]["abSlideShow"];
             $va_tmp["caption"] = $t_object->get("ca_objects.caption");
         }
         $va_featured_artists[$vn_featured_entity_id] = $va_tmp;
     }
     $this->view->setVar("featured_artists", $va_featured_artists);
     $this->render('featured_artists_html.php');
 }
Example #21
0
            print caNavLink($this->request, $va_item['representation_tag_thumbnail'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id']));
        }
        ?>
						</div>
<?php 
        if ($va_item['idno']) {
            $va_title[] = '<span class="resultidno">' . $va_item['idno'] . "</span>";
        }
        if ($va_item['name']) {
            if (unicode_strlen($va_item['name']) > 70) {
                $va_title[] = '<em>' . unicode_substr($va_item['name'], 0, 67) . '...</em>';
            } else {
                $va_title[] = '<em>' . $va_item['name'] . '</em>';
            }
        }
        $t_set_item->load($va_item['row_id']);
        if ($t_set_item->get("ca_objects.date.display_date")) {
            $va_title[] = $t_set_item->get("ca_objects.date.display_date");
        }
        if ($t_set_item->get("ca_objects.technique")) {
            $va_title[] = $t_set_item->get("ca_objects.technique");
        }
        $vs_caption = join('<br/>', $va_title);
        ?>
						
						<div id='caption<?php 
        print $vn_item_id;
        ?>
' class='setItemCaption'><?php 
        print caNavLink($this->request, $vs_caption, '', 'Detail', 'Object', 'Show', array('object_id' => $va_item['row_id']));
        ?>
Example #22
0
 public function testChildrenGet()
 {
     $t_object = new ca_objects();
     $this->assertTrue($t_object->load(array('idno' => $this->ops_object_idno)), "Could not load test record");
     //
     // Get intrinsic field from children
     //
     $vs_value = 'CIHP.TEST.1; CIHP.TEST.2';
     $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => false, 'returnAllLocales' => false, 'delimiter' => '; '));
     $this->assertInternalType("string", $va_val, "Returned value should be string");
     $this->assertEquals($vs_value, $va_val, "Returned value is incorrect");
     $vs_value = 'CIHP.TEST.1';
     $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => true, 'returnAllLocales' => false));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0");
     $this->assertContains($vs_value, $va_val, "Value in array is incorrect");
     $va_val = $t_object->get('ca_objects.children.idno', array('returnAsArray' => true, 'returnAllLocales' => true));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Second level of returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Third level of returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertContains($vs_value, $va_val, "Value in array is incorrect");
     //
     // Get preferred labels from children
     //
     $vs_value = 'Canonical test sub-record No. 1; Canonical test sub-record No. 2';
     $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => false, 'returnAllLocales' => false, 'delimiter' => '; '));
     $this->assertInternalType("string", $va_val, "Returned value should be string");
     $this->assertEquals($vs_value, $va_val, "Returned value is incorrect");
     $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => true, 'returnAllLocales' => false));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0");
     $vs_value = 'Canonical test sub-record No. 1';
     $this->assertContains($vs_value, $va_val, "Value in array is incorrect");
     $va_val = $t_object->get('ca_objects.children.preferred_labels.name', array('returnAsArray' => true, 'returnAllLocales' => true));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Second level of returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Third level of returned value should be array");
     $this->assertContains($vs_value, $va_val, "Value in array is incorrect");
     //
     // Get attributes from children
     //
     $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => false, 'returnAllLocales' => false));
     $this->assertInternalType("string", $va_val, "Returned value should be string");
     $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => true, 'returnAllLocales' => false));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should greater than 0");
     $this->assertArrayHasKey('description', $va_tmp = array_shift($va_val), "Returned array should have key 'description'");
     $va_val = $t_object->get('ca_objects.children.description', array('returnAsArray' => true, 'returnAllLocales' => true));
     $this->assertInternalType("array", $va_val, "Returned value should be array");
     $this->assertGreaterThan(0, sizeof($va_val), "Size of returned array should be greater than 0");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Second level of returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Third level of returned value should be array");
     $va_val = array_shift($va_val);
     $this->assertInternalType("array", $va_val, "Fourth level of returned value should be array");
     $this->assertArrayHasKey('description', $va_val, "Returned array should have key 'description'");
 }
 /**
  * Returns content for overlay containing details for object representation
  */
 private function _renderMediaView($ps_view_name, $ps_media_context)
 {
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $pn_year = $this->request->getParameter('year', pInteger);
     $this->view->setVar("year", $pn_year);
     $va_periods = $this->ops_periods;
     $this->view->setVar('object_id', $pn_object_id);
     $t_object = new ca_objects($pn_object_id);
     # --- get caption and photocredit
     $this->view->setVar("caption", $t_object->get("description"));
     $this->view->setVar("photographer", $t_object->get("provenance"));
     $t_rep = new ca_object_representations($pn_representation_id);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('t_object_representation', $t_rep);
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     if (!$t_object->getPrimaryKey()) {
         die("Invalid object_id");
     }
     if (!$t_rep->getPrimaryKey()) {
         die("Invalid representation_id");
     }
     if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) {
         die("Invalid object_id");
     }
     if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) {
         die("Invalid rep_id");
     }
     $this->view->setVar('t_display_rep', $t_rep);
     // Get media for display using configured rules
     $va_rep_display_info = caGetMediaDisplayInfo($ps_media_context, $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     // set version
     $this->view->setVar('display_version', $va_rep_display_info['display_version']);
     // set other options
     $this->view->setVar('display_options', $va_rep_display_info);
     // Get all representation as icons for navigation
     # --- do a search for all chronology image objects
     # --- determine the period from the year
     foreach ($va_periods as $i => $va_per_info) {
         if ($pn_year >= $va_per_info["start"] && $pn_year <= $va_per_info["end"]) {
             $vn_period = $i;
             break;
         }
     }
     # --- what is year to search by?
     $vn_y = "";
     if ($va_periods[$vn_period]["displayAllYears"] == 1) {
         $vn_y = $va_periods[$vn_period]["start"] . "-" . $va_periods[$vn_period]["end"];
     } else {
         $vn_y = $pn_year;
     }
     # --- get type is for chron images
     $t_list = new ca_lists();
     $vn_chron_images_type_id = $t_list->getItemIDFromList('object_types', 'chronology_image');
     $o_obj_search = new ObjectSearch();
     $qr_chron_images = $o_obj_search->search("ca_objects.access:1 AND ca_objects.date.parsed_date:\"" . $vn_y . "\" AND ca_objects.type_id:{$vn_chron_images_type_id}", array("sort" => "ca_objects.date.parsed_date", "no_cache" => !$this->opb_cache_searches));
     $va_thumbnails = array();
     if ($qr_chron_images->numHits() > 0) {
         $t_image_objects = new ca_objects();
         $i = 1;
         while ($qr_chron_images->nextHit()) {
             $t_image_objects->load($qr_chron_images->get("ca_objects.object_id"));
             if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) {
                 $va_temp = array();
                 if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                     $va_temp["representation_id"] = $t_primary_rep->get("representation_id");
                     $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon');
                     $va_temp["rep_tiny"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                     $va_temp["object_id"] = $qr_chron_images->get("ca_objects.object_id");
                     $va_thumbnails[$qr_chron_images->get("ca_objects.object_id")] = $va_temp;
                     if ($vn_getNext == 1) {
                         $this->view->setVar("next_object_id", $qr_chron_images->get("object_id"));
                         $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
                         $vn_getNext = 0;
                     }
                     if ($qr_chron_images->get("object_id") == $pn_object_id) {
                         $this->view->setVar("representation_index", $i);
                         $this->view->setVar("previous_object_id", $vn_prev_obj_id);
                         $this->view->setVar("previous_representation_id", $vn_prev_rep_id);
                         $vn_getNext = 1;
                     }
                     $vn_prev_obj_id = $qr_chron_images->get("object_id");
                     $vn_prev_rep_id = $t_primary_rep->get("representation_id");
                     $i++;
                 }
             }
         }
     }
     $this->view->setVar('reps', $va_thumbnails);
     return $this->render("Chronology/{$ps_view_name}.php");
 }
Example #24
0
            jQuery('#bristolboxContent').load('<?php 
print caNavUrl($this->request, 'bristol', 'Show', 'setItemInfo', array('set_id' => $t_set->get("set_id")));
?>
/set_item_id/' + item_id);
        },
        onClose: function() {
        	  jQuery('#bristolboxContent').html('');	
        }
    });
}
</script>

<?php 
$t_object = new ca_objects();
foreach ($va_items as $va_item) {
    $t_object->load($va_item['row_id']);
    ?>
		
			<a href="#" onclick="showOverlayForItem(<?php 
    print $va_item['item_id'];
    ?>
); return false;">
			<div class="setItemContainer">
				<div class="setItem" id="item<?php 
    print $va_item['item_id'];
    ?>
"><?php 
    print $va_item['representation_tag_widepreview'];
    ?>
<br/></div>
				<div class="setItemCaption">
</h2>
<?php 
            foreach ($va_occurrence_list as $vn_rel_occurrence_id => $va_info) {
                print "<div>" . ($this->request->config->get('allow_detail_for_ca_occurrences') ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"]) . " (" . $va_info['relationship_typename'] . ")</div>";
            }
            print "</div><!-- end unit -->";
        }
    }
    # --- objects
    $va_objects = $t_occurrence->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
    $va_sorted_objects = array();
    if (sizeof($va_objects) > 0) {
        $t_obj = new ca_objects();
        $va_item_types = $t_obj->getTypeList();
        foreach ($va_objects as $va_object) {
            $t_obj->load($va_object['object_id']);
            $va_sorted_objects[$va_object['item_type_id']][$va_object['object_id']] = $va_object;
        }
        foreach ($va_sorted_objects as $vn_object_type_id => $va_object_list) {
            ?>
						<div class="unit"><h2><?php 
            print _t("Related") . " " . $va_item_types[$vn_object_type_id]['name_singular'] . (sizeof($va_object_list) > 1 ? "s" : "");
            ?>
</h2>
<?php 
            foreach ($va_object_list as $vn_rel_object_id => $va_info) {
                print "<div>" . ($this->request->config->get('allow_detail_for_ca_objects') ? caNavLink($this->request, $va_info["idno"], '', 'Detail', 'Object', 'Show', array('object_id' => $vn_rel_object_id)) : $va_info["label"]) . " (" . $va_info['relationship_typename'] . ")</div>";
            }
            print "</div><!-- end unit -->";
        }
    }
 /**
  * Return info via ajax on selected object
  */
 public function SaveTransaction()
 {
     $pn_user_id = $this->request->getParameter('user_id', pInteger);
     $ps_item_list = $this->request->getParameter('item_list', pString);
     $pa_item_list = json_decode($ps_item_list, true);
     $t_checkout = ca_object_checkouts::newCheckoutTransaction();
     $va_ret = array('status' => 'OK', 'total' => sizeof($pa_item_list), 'errors' => array(), 'checkouts' => array());
     $t_object = new ca_objects();
     foreach ($pa_item_list as $vn_i => $va_item) {
         if (!$t_object->load(array('object_id' => $va_item['object_id'], 'deleted' => 0))) {
             continue;
         }
         $vs_name = $t_object->getWithTemplate("^ca_objects.preferred_labels.name (^ca_objects.idno)");
         if ($va_checkout_info = $t_checkout->objectIsOut($va_item['object_id'])) {
             if ($va_checkout_info['user_id'] == $pn_user_id) {
                 // user already has item so skip it
                 $va_ret['errors'][$va_item['object_id']] = _t('User already has <em>%1</em>', $vs_name);
                 continue;
             }
             try {
                 $vb_res = $t_checkout->reserve($va_item['object_id'], $pn_user_id, $va_item['note'], array('request' => $this->request));
                 if ($vb_res) {
                     $va_ret['checkouts'][$va_item['object_id']] = _t('Reserved <em>%1</em>', $vs_name);
                 } else {
                     $va_ret['errors'][$va_item['object_id']] = _t('Could not reserve <em>%1</em>: %2', $vs_name, join('; ', $t_checkout->getErrors()));
                 }
             } catch (Exception $e) {
                 $va_ret['errors'][$va_item['object_id']] = _t('Could not reserve <em>%1</em>: %2', $vs_name, $e->getMessage());
             }
         } else {
             try {
                 $vb_res = $t_checkout->checkout($va_item['object_id'], $pn_user_id, $va_item['note'], $va_item['due_date'], array('request' => $this->request));
                 if ($vb_res) {
                     $va_ret['checkouts'][$va_item['object_id']] = _t('Checked out <em>%1</em>; due date is %2', $vs_name, $va_item['due_date']);
                 } else {
                     $va_ret['errors'][$va_item['object_id']] = _t('Could not check out <em>%1</em>: %2', $vs_name, join('; ', $t_checkout->getErrors()));
                 }
             } catch (Exception $e) {
                 $va_ret['errors'][$va_item['object_id']] = _t('Could not check out <em>%1</em>: %2', $vs_name, $e->getMessage());
             }
         }
     }
     $this->view->setVar('data', $va_ret);
     $this->render('checkout/ajax_data_json.php');
 }
 /**
  * Returns content for overlay containing details for object representation linked to occurrence
  */
 public function getOccurrenceMediaOverlay()
 {
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pInteger);
     $pn_object_id = $this->request->getParameter('object_id', pInteger);
     $this->view->setVar('object_id', $pn_object_id);
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $this->view->setVar('occurrence_id', $pn_occurrence_id);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $this->view->setVar('object_id', $pn_object_id);
     $t_object = new ca_objects($pn_object_id);
     $this->view->setVar('t_object', $t_object);
     $t_rep = new ca_object_representations($pn_representation_id);
     $this->view->setVar('representation_id', $pn_representation_id);
     $this->view->setVar('t_object_representation', $t_rep);
     if ($this->request->config->get("dont_enforce_access_settings")) {
         $va_access_values = array();
     } else {
         $va_access_values = caGetUserAccessValues($this->request);
     }
     if (!$t_occurrence->getPrimaryKey()) {
         die("Invalid occurrence_id");
     }
     if (!$t_object->getPrimaryKey()) {
         die("Invalid object_id");
     }
     if (!$t_rep->getPrimaryKey()) {
         die("Invalid representation_id");
     }
     if (sizeof($va_access_values) && !in_array($t_occurrence->get('access'), $va_access_values)) {
         die("Invalid occurrence_id");
     }
     if (sizeof($va_access_values) && !in_array($t_object->get('access'), $va_access_values)) {
         die("Invalid object_id");
     }
     if (sizeof($va_access_values) && !in_array($t_rep->get('access'), $va_access_values)) {
         die("Invalid rep_id");
     }
     // Get media for display using configured rules
     $va_rep_display_info = caGetMediaDisplayInfo("media_overlay", $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
     // set version
     $this->view->setVar('version', $va_rep_display_info['display_version']);
     unset($va_display_info['display_version']);
     // set poster frame URL
     //$va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
     //unset($va_display_info['poster_frame_version']);
     //$va_rep_display_info['viewer_base_url'] = $t_rep->getAppConfig()->get('ca_url_root');
     // set other options
     $this->view->setVar('display_options', $va_rep_display_info);
     if (!($ps_display_type = trim($this->request->getParameter('display_type', pString)))) {
         $ps_display_type = 'media_overlay';
     }
     if (!($ps_containerID = trim($this->request->getParameter('containerID', pString)))) {
         $ps_containerID = 'caMediaPanelContentArea';
     }
     $this->view->setVar("display_type", $ps_display_type);
     $this->view->setVar("containerID", $ps_containerID);
     // Get all objects asscoiated with this occurrence and show primary reps as icons for navigation
     $va_exhibition_images = $t_occurrence->get("ca_objects", array('restrict_to_relationship_types' => array('describes'), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
     if (sizeof($va_exhibition_images) > 0) {
         $t_image_objects = new ca_objects();
         $i = 1;
         foreach ($va_exhibition_images as $vn_rel_id => $va_info) {
             $t_image_objects->load($va_info["object_id"]);
             if ($t_primary_rep = $t_image_objects->getPrimaryRepresentationInstance()) {
                 $va_temp = array();
                 if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                     $va_temp["representation_id"] = $t_primary_rep->get("representation_id");
                     $va_temp["rep_icon"] = $t_primary_rep->getMediaTag('media', 'icon');
                     $va_temp["rep_tinyicon"] = $t_primary_rep->getMediaTag('media', 'tinyicon');
                     $va_temp["object_id"] = $va_info["object_id"];
                     $va_thumbnails[$va_info["object_id"]] = $va_temp;
                     if ($vn_getNext == 1) {
                         $this->view->setVar("next_object_id", $va_info["object_id"]);
                         $this->view->setVar("next_representation_id", $t_primary_rep->get("representation_id"));
                         $vn_getNext = 0;
                     }
                     if ($va_info["object_id"] == $pn_object_id) {
                         $this->view->setVar("representation_index", $i);
                         $this->view->setVar("previous_object_id", $vn_prev_obj_id);
                         $this->view->setVar("previous_representation_id", $vn_prev_rep_id);
                         $vn_getNext = 1;
                     }
                     $vn_prev_obj_id = $va_info["object_id"];
                     $vn_prev_rep_id = $t_primary_rep->get("representation_id");
                     $i++;
                 }
             }
         }
     }
     $this->view->setVar('reps', $va_thumbnails);
     return $this->render("Detail/ajax_ca_occurrences_media_overlay_html.php");
 }
 /**
  * oldest date
  */
 private function oldestDate()
 {
     $t_object = new ca_objects();
     $vn_object_tablenum = $this->opn_objectTableNum;
     $o_db = new db();
     # --- get the element_id for date attribute
     $q_date_element_id = $o_db->query("select element_id from ca_metadata_elements where element_code = 'date'");
     $q_date_element_id->nextRow();
     $vn_date_element_id = $q_date_element_id->get("element_id");
     if ($vn_date_element_id && $vn_object_tablenum) {
         // Bracket search to dates between 1000 and 2012 since ANSM date data is very f****d up
         $q_oldest_date = $o_db->query("select v.value_decimal1, v.value_decimal2, a.row_id from ca_attribute_values v\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attributes a ON v.attribute_id = a.attribute_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects o ON a.row_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\twhere v.element_id = " . $vn_date_element_id . " AND a.table_num = " . $vn_object_tablenum . " AND o.access = 1 AND (value_decimal1 BETWEEN 1100 AND 2012)\n \t\t\t\t\t\t\t\t\t\t\t\tORDER BY value_decimal1 LIMIT 1");
         if ($q_oldest_date->numRows() > 0) {
             $q_oldest_date->nextRow();
             $t_object->load($q_oldest_date->get("row_id"));
             #print $q_oldest_date->get("value_decimal1")." - ".$q_oldest_date->get("value_decimal2")." - ".$q_oldest_date->get("row_id");
             return $t_object->get("date") . ", " . caNavLink($this->request, $t_object->getLabelForDisplay(), "", "Detail", "Object", "Show", array("object_id" => $q_oldest_date->get("row_id")));
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 /**
  * Import oral histories from specified directory into CollectiveAccess database
  */
 public function commandImportOralHistories()
 {
     $o_conf = $this->getToolConfig();
     // Get locale from config and translate to numeric code
     $t_locale = new ca_locales();
     $pn_locale_id = $t_locale->localeCodeToID($o_conf->get('locale'));
     $o_log = $this->getLogger();
     $o_progress = $this->getProgressBar(0);
     $vs_transcript_dir = $this->getSetting("transcript_directory");
     if (!is_readable($vs_transcript_dir)) {
         if ($o_log) {
             $o_log->logError($vs_err_msg = _t("Transcript directory %1 is not readable", $vs_transcript_dir));
         }
         if ($o_progress) {
             $o_progress->setError($vs_err_msg);
             $o_progress->finish();
         }
         return false;
     }
     $vs_audio_dir = $this->getSetting("audio_directory");
     if (!is_readable($vs_audio_dir)) {
         if ($o_log) {
             $o_log->logError($vs_err_msg = _t("Audio directory %1 is not readable", $vs_audio_dir));
         }
         if ($o_progress) {
             $o_progress->setError($vs_err_msg);
             $o_progress->finish();
         }
         return false;
     }
     if ($o_progress) {
         $o_progress->start("Starting oral history import");
     }
     // ----------------------------------------------------------------------
     // process main data
     $r_dir = opendir($vs_transcript_dir);
     while (($vs_file = readdir($r_dir)) !== false) {
         if ($vs_file[0] == '.') {
             continue;
         }
         // Get markup and fix it up to be valid XML
         $vs_markup = file_get_contents($vs_transcript_dir . $vs_file);
         $vs_markup = preg_replace('!&!', '&amp;', $vs_markup);
         $vs_xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><transcript>{$vs_markup}</transcript>";
         try {
             $o_xml = new SimpleXMLElement($vs_xml);
         } catch (Exception $e) {
             $o_log->logError("Could not parse XML transcript for {$vs_transcript_dir}{$vs_file}: " . $e->getMessage());
             continue;
         }
         $vs_idno = (string) $o_xml->identifier;
         if (!file_exists($vs_media_path = "{$vs_audio_dir}{$vs_idno}.mp3")) {
             $o_log->logError("No audio file found for {$vs_idno}. File path was {$vs_media_path}");
             continue;
         }
         $vs_title = (string) $o_xml->title;
         $vs_date_created = (string) $o_xml->datecreated;
         $vs_format = (string) $o_xml->format;
         $vs_medium = (string) $o_xml->medium;
         $vs_place_recorded = (string) $o_xml->placeRecorded;
         $vs_rights = (string) $o_xml->rights;
         $vs_extent = (string) $o_xml->extent;
         $vs_country = (string) $o_xml->countryOfOrigin;
         $va_interviewers = array();
         foreach ($o_xml->interviewer as $o_interviewer) {
             $va_interviewers[(string) $o_interviewer->attributes()->abbreviation] = (string) $o_interviewer;
         }
         $va_participants = array();
         foreach ($o_xml->participant as $o_participant) {
             $va_participants[(string) $o_participant->attributes()->abbreviation] = (string) $o_participant;
         }
         $va_observers = array();
         if ($o_xml->observer) {
             foreach ($o_xml->observer as $o_observer) {
                 $va_observers[] = (string) $o_observer;
             }
         }
         // Create object
         $t_object = new ca_objects();
         $t_object->setMode(ACCESS_WRITE);
         if (!$t_object->load(array('idno' => $vs_idno, 'deleted' => 0))) {
             $t_object->set('type_id', 'oral_history');
             $t_object->set('idno', $vs_idno);
             $t_object->set('status', 0);
             $t_object->set('access', 1);
         }
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'dc_format' => $vs_format), 'dc_format');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'dates_value' => $vs_date_created, 'dc_dates_types' => 'created'), 'date');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'medium' => $vs_medium), 'medium');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'interview_location' => $vs_place_recorded), 'interview_location');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'rights' => $vs_rights), 'rights');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'extent' => $vs_extent), 'extent');
         $t_object->addAttribute(array('locale_id' => $pn_locale_id, 'countryOfOrigin' => $vs_country), 'countryOfOrigin');
         if (!$t_object->getPrimaryKey()) {
             $t_object->insert();
             DataMigrationUtils::postError($t_object, 'While inserting object');
             if ($t_object->numErrors()) {
                 $o_log->logError("While adding object for {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
             $t_object->addLabel(array('name' => $vs_title), $pn_locale_id, null, true);
             DataMigrationUtils::postError($t_object, 'While adding object label');
             if ($t_object->numErrors()) {
                 $o_log->logError("While adding object label for {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
         } else {
             $t_object->update();
             DataMigrationUtils::postError($t_object, 'While updating object');
             if ($t_object->numErrors()) {
                 $o_log->logError("While updating object for {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
         }
         // add entities
         foreach ($va_interviewers as $vs_abbr => $vs_name) {
             $vn_entity_id = DataMigrationUtils::getEntityID(DataMigrationUtils::splitEntityName($vs_name), 'ind', $pn_locale_id);
             $t_object->addRelationship('ca_entities', $vn_entity_id, 'interviewer');
             DataMigrationUtils::postError($t_object, "While adding interviewer {$vs_name} to object");
             if ($t_object->numErrors()) {
                 $o_log->logError("While adding interview {$vs_name} to {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
         }
         foreach ($va_participants as $vs_abbr => $vs_name) {
             $vn_entity_id = DataMigrationUtils::getEntityID(DataMigrationUtils::splitEntityName($vs_name), 'ind', $pn_locale_id);
             $t_object->addRelationship('ca_entities', $vn_entity_id, 'interviewee');
             DataMigrationUtils::postError($t_object, "While adding interviewee {$vs_name} to object");
             if ($t_object->numErrors()) {
                 $o_log->logError("While adding interviee {$vs_name} to {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
         }
         foreach ($va_observers as $vn_i => $vs_name) {
             $vn_entity_id = DataMigrationUtils::getEntityID(DataMigrationUtils::splitEntityName($vs_name), 'ind', $pn_locale_id);
             $t_object->addRelationship('ca_entities', $vn_entity_id, 'observer');
             DataMigrationUtils::postError($t_object, "While adding observer {$vs_name} to object");
             if ($t_object->numErrors()) {
                 $o_log->logError("While adding observer {$vs_name} to {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
             }
         }
         // Add media
         $t_rep = $t_object->addRepresentation($vs_media_path, "front", $pn_locale_id, 0, 1, true, array(), array('returnRepresentation' => true));
         DataMigrationUtils::postError($t_object, "While adding representation {$vs_media_path} to object");
         if ($t_object->numErrors()) {
             $o_log->logError("While adding representation {$vs_media_path} to {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_object->getErrors()));
         }
         if ($t_object->numErrors()) {
             continue;
         }
         $va_clips = array();
         foreach ($o_xml->clip as $o_clip) {
             $vs_content = nl2br(preg_replace('!^[\\n\\r\\t]+!', '', trim((string) $o_clip->asXML())));
             $vs_start = (string) $o_clip->attributes()->start;
             $va_themes = $va_places = array();
             foreach ($o_clip->children() as $o_node) {
                 $vs_tag = (string) $o_node->getName();
                 switch ($vs_tag) {
                     case 'place':
                         $va_places[] = (string) $o_node;
                         break;
                     default:
                         $va_themes[] = $vs_tag;
                         break;
                 }
             }
             $va_clips[] = array('start' => $vs_start, 'content' => $vs_content, 'themes' => $va_themes, 'places' => $va_places);
         }
         foreach ($va_clips as $vn_i => $va_clip) {
             $vs_start = $va_clip['start'];
             if (!($vs_end = $va_clips[$vn_i + 1]['start'])) {
                 $va_info = $t_rep->getMediaInfo('media', 'original');
                 $vs_end = $va_info['PROPERTIES']['duration'];
             }
             //print "[$vs_start/$vs_end] (".join('/', $va_clip['themes'])."); (".join('/', $va_clip['places']).") ".substr($va_clip['content'], 0, 30)."\n\n\n";
             $t_annotation = $t_rep->addAnnotation("{$vs_start} ... {$vs_end}", $pn_locale_id, 1, array('startTimecode' => $vs_start, 'endTimecode' => $vs_end), 0, 1, array('transcription' => $va_clip['content']), array('returnAnnotation' => true));
             DataMigrationUtils::postError($t_rep, "While adding annotation to representation");
             if ($t_rep->numErrors()) {
                 $o_log->logError("While adding annotation {$vs_start}/{$vs_end} to {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_rep->getErrors()));
             }
             if ($t_annotation) {
                 foreach ($va_clip['themes'] as $vs_theme) {
                     $t_annotation->addRelationship('ca_list_items', $vs_theme, 'describes');
                     DataMigrationUtils::postError($t_annotation, "While adding theme {$vs_theme} to annotation");
                     if ($t_annotation->numErrors()) {
                         $o_log->logError("While adding theme {$vs_theme} to annotation {$vs_start}/{$vs_end} for {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_annotation->getErrors()));
                     }
                 }
                 foreach ($va_clip['places'] as $vs_place) {
                     if ($vn_place_id = ca_places::find(array('preferred_labels' => array('name' => $vs_place)), array('returnAs' => 'firstId'))) {
                         $t_annotation->addRelationship('ca_places', $vn_place_id, 'describes');
                         DataMigrationUtils::postError($t_annotation, "While adding place {$vs_place} to annotation");
                         if ($t_annotation->numErrors()) {
                             $o_log->logError("While adding place {$vs_place} to annotation {$vs_start}/{$vs_end} for {$vs_transcript_dir}{$vs_file}: " . join("; ", $t_annotation->getErrors()));
                         }
                     }
                 }
             }
         }
         $o_log->logInfo("Imported {$vs_file}");
     }
     $o_progress->finish("Completed processing");
     if ($o_log) {
         $o_log->logDebug(_t("Ended oral history import"));
     }
     return true;
 }
					<div id='featuresSlidehowScrollingViewerItemText'><!-- empty --></div>
				</div>
			</td>
			<td class='featuresSlideshowScrollControl'><a href="#" onclick="featuresSlideshowScroller.scrollToNextImage(); return false;" class="featuresSlideshowScrollControlLink"><img src='<?php 
print $this->request->getThemeUrlPath();
?>
/graphics/browse_arrow_large_gr_rt.gif' width='20' height='31' border='0'></a></td>
		</tr>
	</table>

<script type="text/javascript">
<?php 
$va_imgs = array();
$t_object = new ca_objects();
foreach ($va_items as $va_item) {
    $t_object->load($va_item["row_id"]);
    $va_artwork_info = array();
    if ($t_object->get('ca_entities.preferred_labels.displayname')) {
        $va_artwork_info[] = $t_object->get('ca_entities.preferred_labels.displayname', array('delimiter' => ', '));
    }
    if ($va_item["name"]) {
        $va_artwork_info[] = "<i>" . $va_item["name"] . "</i>";
    }
    if ($t_object->get("ca_objects.object_type")) {
        $va_artwork_info[] = $t_object->get("ca_objects.object_type");
    }
    if ($va_item["idno"]) {
        $va_artwork_info[] = $va_item["idno"];
    }
    $vs_artwork_info = "";
    if (sizeof($va_artwork_info) > 0) {