本文整理汇总了PHP中ca_objects::load方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::load方法的具体用法?PHP ca_objects::load怎么用?PHP ca_objects::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Index
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');
}
示例2: testInsertLoadAndDeleteCycleWithCaObjectsModel
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()));
}
示例3: renderWidget
/**
*
*/
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');
}
示例4: Index
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');
}
示例5: _setCurrent
/**
*
*/
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;
}
}
示例6: caNavLink
<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/>";
示例7: join
$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 {
示例8: DownloadMedia
/**
* 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();
//.........这里部分代码省略.........
示例9: array
?>
</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;'>";
}
示例10: array
// 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")." ›</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')) {
示例11: getSetsOverlay
/**
* 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");
}
示例12: array
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) {
示例13: caGetMediaDisplayInfo
$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
示例14: caGetLocalizedDate
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;
}
示例15: Index
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');
}