本文整理汇总了PHP中ca_objects类的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects类的具体用法?PHP ca_objects怎么用?PHP ca_objects使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ca_objects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllItemInfo
protected function getAllItemInfo()
{
$va_info = parent::getAllItemInfo();
if ($this->getTableName() == 'ca_objects' && is_array($va_info) && sizeof($va_info) > 0) {
$t_object = new ca_objects($va_info['object_id']['value']);
if (!$t_object->getPrimaryKey()) {
return $va_info;
}
// include number of 'likes' (comments)
$va_info['likes'] = (int) $t_object->getNumComments(null);
// include copyright holder
$vs_copyright_holder = $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => 'copyright'));
if ($vs_copyright_holder) {
$va_info['copyright_holder'] = $vs_copyright_holder;
}
// include urls for reference img
$va_objects = $t_object->getRelatedItems('ca_objects', array('restrictToRelationshipTypes' => 'reference'));
if (!is_array($va_objects) || sizeof($va_objects) != 1) {
return $va_info;
}
$va_object = array_shift($va_objects);
$t_rel_object = new ca_objects($va_object['object_id']);
$va_rep = $t_rel_object->getPrimaryRepresentation(array('preview170', 'medium', 'alhalqa1000', 'alhalqa2000'));
if (!is_array($va_rep) || !is_array($va_rep['urls'])) {
return $va_info;
}
$va_info['reference_image_urls'] = $va_rep['urls'];
}
return $va_info;
}
示例2: 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');
}
示例3: recentlyAdded
function recentlyAdded()
{
// 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"));
}
$t_object = new ca_objects();
$va_recently_added_objects = $t_object->getRecentlyAddedItems(25, array('checkAccess' => caGetUserAccessValues($this->request)));
$va_entries = array();
$va_object_ids = array();
foreach ($va_recently_added_objects as $va_object) {
$va_object_ids[] = $va_object['object_id'];
}
$va_labels = $t_object->getPreferredDisplayLabelsForIDs($va_object_ids);
// TODO: Need to get object descriptions and last update times properly
foreach ($va_labels as $vn_object_id => $vs_label) {
$va_entries[] = array('title' => $vs_label, 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => time(), 'description' => '', 'pubDate' => time());
}
$va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
$o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
$this->view->setVar('feed', $o_feed);
$this->render('Feed/feed_recently_added_xml.php');
}
示例4: recentlyAdded
function recentlyAdded()
{
// 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"));
}
$t_object = new ca_objects();
if (($vn_num_items = (int) $this->request->config->get('rss_number_of_items')) <= 0) {
$vn_num_items = 10;
}
$va_recently_added_objects = $t_object->getRecentlyAddedItems($vn_num_items, array('checkAccess' => caGetUserAccessValues($this->request)));
$va_entries = array();
$va_object_ids = array();
foreach ($va_recently_added_objects as $va_object) {
$va_object_ids[] = $va_object['object_id'];
}
$qr_res = $t_object->makeSearchResult('ca_objects', $va_object_ids);
$vs_description_bundle = $this->request->config->get('rss_description');
while ($qr_res->nextHit()) {
$vn_object_id = $qr_res->get('ca_objects.object_id');
if (!($vn_creation_time = $t_object->getCreationTimestamp($vn_object_id, array('timestampOnly' => true)))) {
$vn_creation_time = time();
}
if (!($vn_update_time = $t_object->getLastChangeTimestamp($vn_object_id, array('timestampOnly' => true)))) {
$vn_update_time = time();
}
$va_entries[] = array('title' => $qr_res->get('ca_objects.preferred_labels.name'), 'link' => $vs_link = $this->request->config->get('site_host') . caNavUrl($this->request, '', 'Detail/Object', 'Index', array('object_id' => $vn_object_id)), 'guid' => $vs_link, 'lastUpdate' => $vn_update_time, 'description' => $vs_description_bundle ? $qr_res->getMediaTag("ca_object_representations.media", "preview") . "\n" . $qr_res->get($vs_description_bundle) : '', 'pubDate' => $vn_creation_time);
}
$va_feed_data = array('title' => _t('Recently added'), 'link' => $this->request->getRequestUrl(true), 'charset' => 'UTF-8', 'entries' => $va_entries);
$o_feed = Zend_Feed::importArray($va_feed_data, 'rss');
$this->view->setVar('feed', $o_feed);
$this->render('Feed/feed_recently_added_xml.php');
}
示例5: search
protected function search($pa_bundles = null)
{
$va_return = parent::search($pa_bundles);
if ($this->getTableName() == 'ca_objects' && is_array($va_return['results']) && sizeof($va_return['results']) > 0) {
$pb_only_with_likes = (bool) $this->opo_request->getParameter('likesOnly', pInteger);
foreach ($va_return['results'] as $vn_k => &$va_result) {
$t_object = new ca_objects($va_result['object_id']);
if (!$t_object->getPrimaryKey()) {
continue;
}
// include number of 'likes' (comments)
$va_result['likes'] = (int) $t_object->getNumComments(null);
if ($pb_only_with_likes && !$va_result['likes']) {
unset($va_return['results'][$vn_k]);
continue;
}
// include copyright holder
$vs_copyright_holder = $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => 'copyright'));
if ($vs_copyright_holder) {
$va_result['copyright_holder'] = $vs_copyright_holder;
}
// include urls for reference img
$va_objects = $t_object->getRelatedItems('ca_objects', array('restrictToRelationshipTypes' => 'reference'));
if (!is_array($va_objects) || sizeof($va_objects) != 1) {
continue;
}
$va_object = array_shift($va_objects);
$t_rel_object = new ca_objects($va_object['object_id']);
$va_rep = $t_rel_object->getPrimaryRepresentation(array('preview170', 'medium', 'alhalqa1000', 'alhalqa2000'));
if (!is_array($va_rep) || !is_array($va_rep['urls'])) {
continue;
}
$va_result['reference_image_urls'] = $va_rep['urls'];
}
if ($this->opo_request->getParameter('sort', pString) == 'likes') {
if (strtolower($this->opo_request->getParameter('sortDirection', pString)) == 'asc') {
usort($va_return['results'], function ($a, $b) {
return $a['likes'] - $b['likes'];
});
} else {
// default is desc
usort($va_return['results'], function ($a, $b) {
return $b['likes'] - $a['likes'];
});
}
}
}
return $va_return;
}
示例6: testFindByPreferredLabelWithPurify
public function testFindByPreferredLabelWithPurify()
{
$vm_ret = ca_objects::find(['preferred_labels' => ['name' => 'Sound & Motion']], ['purifyWithFallback' => false, 'purify' => true, 'returnAs' => 'ids']);
$this->assertInternalType('array', $vm_ret);
$this->assertCount(1, $vm_ret);
$this->assertEquals($this->opn_object_id, $vm_ret[0]);
}
示例7: testDelete
public function testDelete()
{
$va_objects = array();
$this->assertGreaterThan(0, $va_objects[] = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'dataset'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test dataset")))));
$this->assertGreaterThan(0, $va_objects[] = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'physical_object'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Test physical object")))));
foreach ($va_objects as $vn_object_id) {
$t_object = new ca_objects($vn_object_id);
$t_object->setMode(ACCESS_WRITE);
$t_object->delete(true, array('hard' => true));
}
$o_search = caGetSearchInstance('ca_objects');
$o_result = $o_search->search('dataset');
$this->assertEquals(0, $o_result->numHits(), 'dataset should not be indexed anymore');
$o_result = $o_search->search('physical');
$this->assertEquals(0, $o_result->numHits(), 'physical object should not be indexed anymore');
}
示例8: __call
/**
*
*/
public function __call($ps_function, $pa_args)
{
AssetLoadManager::register("carousel");
$va_access_values = caGetUserAccessValues($this->request);
$this->view->setVar('access_values', $va_access_values);
#
# --- if there is a set configured to show on the front page, load it now
#
$va_featured_ids = array();
if ($vs_set_code = $this->config->get("front_page_set_code")) {
$t_set = new ca_sets();
$t_set->load(array('set_code' => $vs_set_code));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$this->view->setVar('featured_set_id', $t_set->get("set_id"));
$this->view->setVar('featured_set', $t_set);
$va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
$this->view->setVar('featured_set_item_ids', $va_featured_ids);
$this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
}
}
#
# --- no configured set/items in set so grab random objects with media
#
if (sizeof($va_featured_ids) == 0) {
$t_object = new ca_objects();
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
$this->view->setVar('featured_set_item_ids', $va_featured_ids);
$this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
}
$this->view->setVar('config', $this->config);
$o_result_context = new ResultContext($this->request, 'ca_objects', 'front');
$this->view->setVar('result_context', $o_result_context);
$o_result_context->setAsLastFind();
//
// Try to load selected page if it exists in Front/, otherwise load default Front/front_page_html.php
//
$ps_function = preg_replace("![^A-Za-z0-9_\\-]+!", "", $ps_function);
$vs_path = "Front/{$ps_function}_html.php";
if (file_exists(__CA_THEME_DIR__ . "/views/{$vs_path}")) {
$this->render($vs_path);
} else {
$this->render("Front/front_page_html.php");
}
}
示例9: 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');
}
示例10: _t
{{{<ifdef code="ca_objects.topic"><div class='unit'><h6>Topic</h6><span class='metaFloat'>^ca_objects.topic</span></div></ifdef>}}}
{{{<ifdef code="ca_objects.description"><h6>Description</h6>^ca_objects.description<br/></ifdef>}}}
{{{<ifdef code="ca_objects.courtesy"><div class='unit'><h6>Courtesy<h6><span class='metaFloat'>^ca_objects.courtesy</span></div></ifdef>}}}
{{{<ifdef code="ca_objects.rights.rightsText"><div class='unit'><h6>Rights</h6><span class='metaFloat'>^ca_objects.rights.rightsText</span></div></ifdef>}}}
<?php
if ($vs_entities = $t_object->get("ca_entities", array('delimiter' => '<br/>', 'template' => '^preferred_labels (^relationship_typename)', "returnAsLink" => true))) {
print "<div class='unit'><H6>" . _t('Related Entities') . "</H6> <span class='metaData'>{$vs_entities}</span></div><!-- end unit -->";
}
if ($t_object->get('type_id') == 21) {
$va_children = $t_object->getHierarchyChildren(null, array('idsOnly' => true));
print "<div class='unit rings'><h6><b>" . _t("Rings") . "</b></h6>";
foreach ($va_children as $va_child_key => $va_child_id) {
$t_ring = new ca_objects($va_child_id);
print caNavLink($this->request, $t_ring->get("ca_objects.preferred_labels.name"), '', '', 'Detail', 'objects/' . $va_child_id) . "<br/>";
}
print "</div>";
}
?>
</div><!-- end col -->
</div><!-- end row --></div><!-- end container -->
</div><!-- end col -->
<div class='navLeftRight col-xs-1 col-sm-1 col-md-1 col-lg-1'>
<div class="detailNavBgRight">
{{{nextLink}}}
</div><!-- end detailNavBgLeft -->
</div><!-- end col -->
示例11: caRepresentationViewerHTMLBundleForSearchResult
/**
*
*
* @param RequestHTTP $po_request
* @param array $pa_options
* @param array $pa_additional_display_options
* @return string HTML output
*/
function caRepresentationViewerHTMLBundleForSearchResult($po_data, $po_request, $pa_options = null, $pa_additional_display_options = null)
{
$ps_version = $po_request->getParameter('version', pString);
$va_access_values = isset($pa_options['access']) && is_array($pa_options['access']) ? $pa_options['access'] : array();
$vs_display_type = isset($pa_options['display']) && $pa_options['display'] ? $pa_options['display'] : 'media_overlay';
$vs_container_dom_id = isset($pa_options['containerID']) && $pa_options['containerID'] ? $pa_options['containerID'] : null;
$vn_object_id = isset($pa_options['object_id']) && $pa_options['object_id'] ? $pa_options['object_id'] : null;
$vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
$vn_order_item_id = isset($pa_options['order_item_id']) && $pa_options['order_item_id'] ? $pa_options['order_item_id'] : null;
$vb_media_editor = isset($pa_options['mediaEditor']) && $pa_options['mediaEditor'] ? true : false;
$vb_no_controls = isset($pa_options['noControls']) && $pa_options['noControls'] ? true : false;
$vn_item_id = isset($pa_options['item_id']) && $pa_options['item_id'] ? $pa_options['item_id'] : null;
$t_object = new ca_objects($vn_object_id);
//if (!$t_object->getPrimaryKey()) { return false; }
if (!$po_data->getPrimaryKey() && $t_object->getPrimaryKey() && method_exists($po_data, 'load')) {
$po_data->load($t_object->getPrimaryRepresentationID(array('checkAccess' => $va_access_values)));
}
$t_set_item = new ca_set_items();
if ($vn_item_id) {
$t_set_item->load($vn_item_id);
}
$t_order_item = new ca_commerce_order_items();
if ($vn_order_item_id) {
$t_order_item->load($vn_order_item_id);
}
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('t_object', $t_object);
$o_view->setVar('t_set_item', $t_set_item);
$o_view->setVar('t_order_item', $t_order_item);
$o_view->setVar('use_media_editor', $vb_media_editor);
$o_view->setVar('noControls', $vb_no_controls);
$va_rep_display_info = array();
if (isset($pa_options['use_book_viewer'])) {
$va_rep_display_info['use_book_viewer'] = (bool) $pa_options['use_book_viewer'];
}
if ($t_object->getPrimaryKey()) {
$o_view->setVar('reps', $va_reps = $t_object->getRepresentations(array('icon'), null, array("return_with_access" => $va_access_values)));
}
$t_media = new Media();
$va_buf = array();
while ($po_data->nextHit()) {
if (method_exists($po_data, 'numFiles')) {
$o_view->setVar('num_multifiles', $po_data->numFiles());
}
$o_view->setVar('t_object_representation', $po_data);
if (($vn_representation_id = $po_data->getPrimaryKey()) && (!sizeof($va_access_values) || in_array($po_data->get('access'), $va_access_values))) {
// check rep access
$va_rep_display_info = caGetMediaDisplayInfo($vs_display_type, $vs_mimetype = $po_data->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$va_rep_display_info['poster_frame_url'] = $po_data->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
$va_additional_display_options = array();
if (is_array($pa_additional_display_options) && isset($pa_additional_display_options[$vs_mimetype]) && is_array($pa_additional_display_options[$vs_mimetype])) {
$va_additional_display_options = $pa_additional_display_options[$vs_mimetype];
}
$o_view->setVar('display_options', caGetMediaDisplayInfo('detail', $vs_mimetype));
$o_view->setVar('display_type', $vs_display_type);
$o_view->setVar('representation_id', $vn_representation_id);
$o_view->setVar('t_object_representation', $po_data);
$o_view->setVar('versions', $va_versions = $po_data->getMediaVersions('media'));
$o_view->setVar('containerID', $vs_container_dom_id . $vn_representation_id);
$o_view->setVar('version_type', $t_media->getMimetypeTypename($po_data->getMediaInfo('media', 'original', 'MIMETYPE')));
if ($t_object->getPrimaryKey()) {
$vn_next_rep = $vn_prev_rep = null;
$va_rep_list = array_values($va_reps);
foreach ($va_rep_list as $vn_i => $va_rep) {
if ($va_rep['representation_id'] == $vn_representation_id) {
if (isset($va_rep_list[$vn_i - 1])) {
$vn_prev_rep = $va_rep_list[$vn_i - 1]['representation_id'];
}
if (isset($va_rep_list[$vn_i + 1])) {
$vn_next_rep = $va_rep_list[$vn_i + 1]['representation_id'];
}
$o_view->setVar('representation_index', $vn_i + 1);
}
}
$o_view->setVar('previous_representation_id', $vn_prev_rep);
$o_view->setVar('next_representation_id', $vn_next_rep);
}
if (!in_array($ps_version, $va_versions)) {
if (!($ps_version = $va_rep_display_info['display_version'])) {
$ps_version = null;
}
}
$o_view->setVar('version_info', $po_data->getMediaInfo('media', $ps_version));
$o_view->setVar('version', $ps_version);
}
$va_buf[$vn_representation_id] = $o_view->render('representation_viewer_html.php');
}
return $va_buf;
}
示例12: caGetUserAccessValues
}
?>
<div id="frontPage" class="subhomeslide">
<?php
$va_access_values = caGetUserAccessValues($this->request);
$this->config = caGetFrontConfig();
if ($vs_set_code = $this->config->get("front_page_set_code_CJF")) {
$t_set = new ca_sets();
$t_set->load(array('set_code' => $vs_set_code));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
$va_item_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
}
}
if (is_array($va_item_ids) && sizeof($va_item_ids)) {
$t_object = new ca_objects();
$va_item_media = $t_object->getPrimaryMediaForIDs($va_item_ids, array("mediumlarge"), array('checkAccess' => $va_access_values));
$va_item_labels = $t_object->getPreferredDisplayLabelsForIDs($va_item_ids);
}
if (is_array($va_item_media) && sizeof($va_item_media)) {
?>
<div class="jcarousel-wrapper slidecontainer">
<!-- Carousel -->
<div class="jcarousel">
<ul>
<?php
foreach ($va_item_media as $vn_object_id => $va_media) {
print "<li>" . caDetailLink($this->request, $va_media["tags"]["mediumlarge"], '', 'ca_objects', $vn_object_id) . "</li>";
}
?>
示例13: get
//.........这里部分代码省略.........
$va_data = $va_sorted_data;
}
if ($vb_return_as_array) {
return $va_data;
} else {
return join($vs_delimiter, $va_data);
}
}
break;
case 'hierarchy':
$vs_direction = isset($pa_options['direction']) ? strtoupper($pa_options['direction']) : null;
if (!in_array($vs_direction, array('ASC', 'DESC'))) {
$vs_direction = 'ASC';
}
$vn_top = (int) isset($pa_options['top']) ? strtoupper($pa_options['top']) : 0;
if ($vn_top < 0) {
$vn_top = 0;
}
$vn_bottom = (int) isset($pa_options['bottom']) ? strtoupper($pa_options['bottom']) : 0;
if ($vn_bottom < 0) {
$vn_bottom = 0;
}
$vs_pk = $this->primaryKey();
$vs_label_table_name = $this->getLabelTableName();
$t_label_instance = $this->getLabelTableInstance();
if (!$vs_template && ($vs_display_field = $t_label_instance->hasField($va_tmp[2]) ? $t_label_instance->tableName() . "." . $va_tmp[2] : ($this->hasField($va_tmp[2]) ? $this->tableName() . "." . $va_tmp[2] : null))) {
$vs_template = "^{$vs_display_field}";
}
$vn_top_id = null;
if (!($va_ancestor_list = $this->getHierarchyAncestors(null, array('idsOnly' => true, 'includeSelf' => true)))) {
$va_ancestor_list = array();
}
// TODO: this should really be in a model subclass
if ($this->tableName() == 'ca_objects' && $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && ($vs_coll_rel_type = $this->getAppConfig()->get('ca_objects_x_collections_hierarchy_relationship_type'))) {
require_once __CA_MODELS_DIR__ . '/ca_objects.php';
if ($this->getPrimaryKey() == $vn_top_id) {
$t_object = $this;
} else {
$t_object = new ca_objects($vn_top_id);
}
if (is_array($va_collections = $t_object->getRelatedItems('ca_collections', array('restrictToRelationshipTypes' => $vs_coll_rel_type)))) {
require_once __CA_MODELS_DIR__ . '/ca_collections.php';
$t_collection = new ca_collections();
foreach ($va_collections as $vn_i => $va_collection) {
if ($va_collections_ancestor_list = $t_collection->getHierarchyAncestors($va_collection['collection_id'], array('idsOnly' => true, 'includeSelf' => true))) {
$va_ancestor_list = array_merge($va_ancestor_list, $va_collections_ancestor_list);
}
break;
// for now only process first collection (no polyhierarchies)
}
}
}
// remove root and children if so desired
if (isset($pa_options['removeFirstItems']) && (int) $pa_options['removeFirstItems'] > 0) {
for ($vn_i = 0; $vn_i < (int) $pa_options['removeFirstItems']; $vn_i++) {
array_pop($va_ancestor_list);
}
}
if ($vs_display_field != $va_tmp[2]) {
if ($this->hasField($va_tmp[2])) {
$vs_display_field = $va_tmp[2];
}
}
$vb_check_access = is_array($pa_options['checkAccess']) && $this->hasField('access');
if ($vb_check_access) {
$va_access_values = $this->getFieldValuesForIDs($va_ancestor_list, array('access'));
示例14: Db
<hr>
<h1>Artists by Last Name</h1>
<?php
//$o_artist_search = new ObjectSearch();
//$qr_artists = $o_artist_search->search("ca_entities.preferred_labels.displayname/artist:*");
$o_db = new Db();
$qr_res = $o_db->query("\n\t\t\tSELECT DISTINCT e.entity_id FROM ca_entities e\n\t\t\tINNER JOIN ca_entity_labels AS el ON el.entity_id = e.entity_id\n\t\t\tINNER JOIN ca_objects_x_entities AS oxe ON e.entity_id = oxe.entity_id\n\t\t\tWHERE\n\t\t\t\toxe.type_id = 103 AND e.deleted = 0 AND el.is_preferred = 1\n\t\t\tORDER BY\n\t\t\t\tel.surname, el.forename\n\t\t");
$qr_artists = caMakeSearchResult('ca_entities', $qr_res->getAllFieldValues('entity_id'));
$va_artists = array();
while ($qr_artists->nextHit()) {
$va_has_artwork = false;
if ($qr_artists->get('ca_objects', array('restrictToRelationshipTypes' => 'artist', 'checkAccess' => $va_access_values))) {
$va_artworks = $qr_artists->get('ca_objects', array('restrictToRelationshipTypes' => 'artist', 'checkAccess' => $va_access_values, 'returnAsArray' => true));
foreach ($va_artworks as $vn_artwork_key => $va_artwork) {
$vn_artwork_id = $va_artwork['object_id'];
$t_object = new ca_objects($vn_artwork_id);
if ($t_object->get('ca_objects.type_id') == 28) {
$va_has_artwork = true;
}
}
if ($va_has_artwork == true) {
$va_first_letter = substr($qr_artists->get('ca_entities.preferred_labels.surname'), 0, 1);
$va_artists[$va_first_letter][] = $qr_artists->get('ca_entities.preferred_labels.displayname', array('returnAsLink' => true));
}
}
}
#print "<pre>";
#print_r($va_artists);
#print "<pre>";
foreach ($va_artists as $va_letter_key => $va_artist_name) {
print "<div class='letterMenu'><a href='#" . $va_letter_key . "'>" . $va_letter_key . "</a></div>";
示例15: GeographicMap
}
# --- map
if ($this->request->config->get('ca_objects_map_attribute') && $t_object->get($this->request->config->get('ca_objects_map_attribute'))) {
$o_map = new GeographicMap(300, 200, 'map');
$o_map->mapFrom($t_object, $this->request->config->get('ca_objects_map_attribute'));
print "<div class='unit'>" . $o_map->render('HTML') . "</div>";
}
# --- output related object images as links
$va_related_objects = $t_object->get("ca_objects", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
if (sizeof($va_related_objects)) {
print "<div class='unit'><div class='unitHeader'>" . _t("Related Objects") . "</div>";
print "<table border='0' cellspacing='0' cellpadding='0' width='100%' id='objDetailRelObjects'>";
$col = 0;
$vn_numCols = 4;
foreach ($va_related_objects as $vn_rel_id => $va_info) {
$t_rel_object = new ca_objects($va_info["object_id"]);
$va_reps = $t_rel_object->getPrimaryRepresentation(array('icon', 'small'), null, array('return_with_access' => $va_access_values));
if ($col == 0) {
print "<tr>";
}
print "<td align='center' valign='middle' class='imageIcon icon" . $va_info["object_id"] . "'>";
print caNavLink($this->request, $va_reps['tags']['icon'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_info["object_id"]));
// set view vars for tooltip
$this->setVar('tooltip_representation', $va_reps['tags']['small']);
$this->setVar('tooltip_title', $va_info['label']);
$this->setVar('tooltip_idno', $va_info["idno"]);
TooltipManager::add(".icon" . $va_info["object_id"], $this->render('../Results/ca_objects_result_tooltip_html.php'));
print "</td>";
$col++;
if ($col < $vn_numCols) {
print "<td align='center'><!-- empty --></td>";