本文整理汇总了PHP中ca_objects::getPrimaryRepresentation方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getPrimaryRepresentation方法的具体用法?PHP ca_objects::getPrimaryRepresentation怎么用?PHP ca_objects::getPrimaryRepresentation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getPrimaryRepresentation方法的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: 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;
}
示例3: 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;
}
示例4: 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');
}
示例5: array
</div><!-- end col -->
</div>
<div class="row">
<div class='col-md-12 col-lg-12'>
<H4>Loan</H4>
<H6></H6>
</div><!-- end col 12-->
</div><!-- end row -->
<div class="row">
<div class='col-xs-12 col-sm-7 col-md-6 col-lg-6'>
<div class="row">
<?php
$va_related_artworks = $t_item->get('ca_objects.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'returnAsArray' => true));
foreach ($va_related_artworks as $vn_id => $va_related_artwork) {
$t_object = new ca_objects($va_related_artwork);
$va_reps = $t_object->getPrimaryRepresentation(array('versions' => 'medium'), null, array("checkAccess" => $va_access_values, 'scaleCSSHeightTo' => '260px', 'scaleCSSWidthTo' => '220px'));
print "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6 relatedLoan'>";
print "<div class='loanImg'>" . caNavLink($this->request, $va_reps['tags']['medium'], '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</div>";
print "<div class='lotCaption'>";
print "<p>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>";
print "<p>" . caNavLink($this->request, "<i>" . $t_object->get('ca_objects.preferred_labels') . "</i>, " . $t_object->get('ca_objects.creation_date'), '', '', 'Detail', 'artworks/' . $va_related_artwork) . "</p>";
print "<p>" . $t_object->get('ca_objects.medium') . "</p>";
print "<p>" . $t_object->get('ca_objects.dimensions.display_dimensions') . "</p>";
if ($this->request->user->hasUserRole("founders_new") || $this->request->user->hasUserRole("admin") || $this->request->user->hasUserRole("curatorial_all_new") || $this->request->user->hasUserRole("curatorial_basic_new") || $this->request->user->hasUserRole("archives_new") || $this->request->user->hasUserRole("library_new")) {
print "<p>" . $t_object->get('ca_objects.idno') . "</p>";
}
print "</div><!-- end lotCaption -->";
print "</div>";
}
?>
示例6: Db
?>
<div class="dontmiss noh2 yellowbar">
<h1><a href="local-studies.html">My Favourites</a></h1>
<?php
if ($this->request->isLoggedIn()) {
# --- get the last item added to the users sets
$o_db = new Db();
$qr_set_item = $o_db->query("\n\t\t\t\t\t\t\t\tSELECT csi.row_id\n\t\t\t\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\t\t\t\tINNER JOIN ca_set_items AS csi ON cs.set_id = csi.set_id\n\t\t\t\t\t\t\t\tWHERE cs.user_id = ?\n\t\t\t\t\t\t\t\tORDER BY csi.item_id DESC\n\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t", $this->request->getUserID());
if ($qr_set_item->numRows() > 0) {
while ($qr_set_item->nextRow()) {
$t_lastSetObject = new ca_objects($qr_set_item->get("row_id"));
if (in_array($t_lastSetObject->get("access"), $va_access_values)) {
$vn_lastSetObjectId = $qr_set_item->get("row_id");
$vs_lastSetObjectLabel = $t_lastSetObject->get("preferred_labels");
$va_reps = $t_lastSetObject->getPrimaryRepresentation(array('icon'), null, array('return_with_access' => $va_access_values));
$vs_lastSetObjectIcon = $va_reps["tags"]["icon"];
$vs_lastSetObjectIconLink = caNavLink($this->request, $vs_lastSetObjectIcon, '', 'Detail', 'Object', 'Show', array('object_id' => $vn_lastSetObjectId));
}
}
}
if ($vs_lastSetObjectIconLink) {
print $vs_lastSetObjectIconLink;
} else {
print '<a href="local-studies.html"><img src="' . $this->request->getThemeUrlPath() . '/graphics/bookicon.jpg" alt="" title="" /></a>';
}
?>
<p>Click <?php
print caNavLink($this->request, _t("here"), "", "", "Sets", "index");
?>
to view your saved items. Or <?php
示例7: array
<?php
$t_object = new ca_objects();
$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"];
$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();
}
示例8: 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');
}
示例9: Index
/**
* Displays site stats
*/
public function Index()
{
$this->view->setVar("num_objects", $this->numObjects());
$this->view->setVar("num_members", $this->numEntities(array($this->opn_member_institution_id)));
$this->view->setVar("num_entities", $this->numEntities(array($this->opn_individual_id, $this->opn_family_id, $this->opn_organization_id)));
$this->view->setVar("num_reps", $this->numReps());
$this->view->setVar("oldest_date", $this->oldestDate());
$this->view->setVar("median_date", $this->medianDate());
$vs_version = "preview";
$t_object = new ca_objects();
// $va_user_favorites_items = array_reverse($t_object->getHighestRated(null, 3, $this->opa_access_values));
// $va_user_favorites = array();
// if(is_array($va_user_favorites_items) && (sizeof($va_user_favorites_items) > 0)){
// foreach($va_user_favorites_items as $vn_user_favorite_id){
// $t_object->load($vn_user_favorite_id);
// $va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
// $va_user_favorites[$vn_user_favorite_id] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
// }
// }
// $this->view->setVar("most_popular", $va_user_favorites);
$o_db = new Db();
$q_most_liked = $o_db->query("SELECT ic.row_id, count(*) c\n \t\t\t\t\t\t\t\t\t\t\t\tFROM ca_item_comments ic\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects o ON ic.row_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects_x_object_representations oxr ON oxr.object_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_object_representations r ON oxr.representation_id = r.representation_id\n \t\t\t\t\t\t\t\t\t\t\t\tWHERE o.access = 1 AND o.deleted = 0 AND r.access = 1 AND r.deleted = 0\n \t\t\t\t\t\t\t\t\t\t\t\tGROUP BY ic.row_id order by c DESC limit 3;");
$va_user_favorites = array();
if ($q_most_liked->numRows()) {
while ($q_most_liked->nextRow()) {
#print $q_most_liked->get("row_id")." - ";
$t_object->load($q_most_liked->get("row_id"));
$va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
$va_user_favorites[$q_most_liked->get("row_id")] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
}
}
$this->view->setVar("most_popular", $va_user_favorites);
$va_recently_added_items = $t_object->getRecentlyAddedItems(3, array('checkAccess' => $this->opa_access_values, 'hasRepresentations' => 1));
#print_r($va_recently_added_items);
$va_recently_added = array();
if (is_array($va_recently_added_items) && sizeof($va_recently_added_items) > 0) {
$i = 0;
foreach ($va_recently_added_items as $vn_recently_added_info) {
if ($i == 3) {
break;
}
$t_object->load($vn_recently_added_info["object_id"]);
$va_rep = $t_object->getPrimaryRepresentation(array($vs_version), null, array('return_with_access' => $this->opa_access_values));
if ($va_rep['tags'][$vs_version]) {
$va_recently_added[$vn_recently_added_info["object_id"]] = array("image" => $va_rep['tags'][$vs_version], "label" => $t_object->getLabelForDisplay());
$i++;
}
}
}
$this->view->setVar("recently_added", $va_recently_added);
# --- timestamp for 60 days ago
$vn_timestamp = time() - 24 * 60 * 60 * 60;
$this->view->setVar("createdLast60Days", $this->recentlyAdded($vn_timestamp));
$this->view->setVar("topThemes", $this->topThemes());
$this->render('dashboard_html.php');
}
示例10: getFeaturedArtistSlideshow
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');
}
示例11: array
}
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', 'icon', 'tiny'), null, array('return_with_access' => $va_access_values));
$vn_featured_content_id = $va_featured_ids[0];
$vs_featured_content_thumb = $va_rep["tags"]["thumbnail"];
$vs_featured_content_tiny = $va_rep["tags"]["tiny"];
$vs_featured_content_icon = $va_rep["tags"]["icon"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
} else {
# if there are no items in the featured set, put a random object in the features variable
$va_random_item = $t_object->getRandomItems(1, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if (sizeof($va_random_item) > 0) {
foreach ($va_random_item as $vn_object_id => $va_object_info) {
$t_object = new ca_objects($vn_object_id);
$va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'icon', 'tiny'), null, array('return_with_access' => $va_access_values));
$vn_featured_content_id = $vn_object_id;
$vs_featured_content_thumb = $va_rep["tags"]["thumbnail"];
$vs_featured_content_tiny = $va_rep["tags"]["tiny"];
$vs_featured_content_icon = $va_rep["tags"]["icon"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php
print $this->request->config->get('html_page_title');
示例12: array
# --- 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')) {
print caNavLink($this->request, "<i>" . $va_info['label'] . "</i>", '', 'Detail', 'Object', 'Show', array('object_id' => $vn_rel_object_id)) . "<br/>";
} else {
print "<i>" . $va_info['label'] . "</i><br/>";
}
示例13: foreach
<?php
if ($va_artwork_ids = $t_occurrence->get('ca_objects.object_id', array('checkAccess' => caGetUserAccessValues($this->request), 'restrictToTypes' => array('artwork'), 'returnAsArray' => true))) {
?>
<div id="detailRelatedObjects">
<H6>Related Artworks </H6>
<div class="jcarousel-wrapper">
<div id="detailScrollButtonNext"><i class="fa fa-angle-right"></i></div>
<div id="detailScrollButtonPrevious"><i class="fa fa-angle-left"></i></div>
<!-- Carousel -->
<div class="jcarousel">
<ul>
<?php
foreach ($va_artwork_ids as $va_object_id => $va_artwork_id) {
$t_object = new ca_objects($va_artwork_id);
$va_rep = $t_object->getPrimaryRepresentation(array('library'), null, array('return_with_access' => $va_access_values));
if (strlen($t_object->get('ca_objects.preferred_labels')) > 200) {
$va_artwork_title = substr($t_object->get('ca_objects.preferred_labels'), 0, 197) . "...";
} else {
$va_artwork_title = $t_object->get('ca_objects.preferred_labels');
}
print "<li>";
print "<div class='detailObjectsResult'>" . caNavLink($this->request, $va_rep['tags']['library'], '', '', 'Detail', 'artworks/' . $va_artwork_id) . "</div>";
print "<div class='caption'>" . caNavLink($this->request, $t_object->get('ca_entities.preferred_labels', array('restrictToRelationshipTypes' => array('artist'))) . "<br/><i>" . $va_artwork_title . "</i>, " . $t_object->get('ca_objects.creation_date'), '', '', 'Detail', 'artworks/' . $va_artwork_id) . "</div>";
if ($t_object->hasField('is_deaccessioned') && $t_object->get('is_deaccessioned') && $t_object->get('deaccession_date', array('getDirectDate' => true)) <= caDateToHistoricTimestamp(_t('now'))) {
// If currently deaccessioned then display deaccession message
print "<div class='searchDeaccessioned'>" . _t('Deaccessioned %1', $t_object->get('deaccession_date')) . "</div>\n";
#if ($vs_deaccession_notes = $t_object->get('deaccession_notes')) { TooltipManager::add(".inspectorDeaccessioned", $vs_deaccession_notes); }
}
print "</li>";
}
示例14: while
<?php
if ($vo_result) {
$t_entity = new ca_entities();
while ($vo_result->nextHit()) {
$vn_entity_id = $vo_result->get('ca_entities.entity_id');
$va_labels = $vo_result->getDisplayLabels($this->request);
$vs_surname = $vo_result->get("ca_entity_labels.surname");
$vs_letter = mb_strtoupper(mb_substr($vs_surname, 0, 1));
$va_entity_results[$vs_letter]["entities"][] = caNavLink($this->request, join($va_labels, "; "), '', 'Detail', 'Entity', 'Show', array('entity_id' => $vn_entity_id));
if (!$va_entity_results[$vs_letter]["image"]) {
$t_entity->load($vn_entity_id);
$va_portraits = $t_entity->get("ca_objects", array("restrictToRelationshipTypes" => array("portrait"), "returnAsArray" => 1, 'checkAccess' => $va_access_values));
foreach ($va_portraits as $va_portrait) {
$t_object = new ca_objects($va_portrait["object_id"]);
if ($t_object->get("object_status") != 348) {
if ($va_portrait = $t_object->getPrimaryRepresentation(array('abHeadShot'), null, array('return_with_access' => $va_access_values))) {
$vs_vaga_class = "";
if ($t_object->get("object_status") == 349) {
$vs_vaga_class = "vagaDisclaimer";
}
$va_entity_results[$vs_letter]["image"] = caNavLink($this->request, $va_portrait['tags']['abHeadShot'], $vs_vaga_class, 'Detail', 'Entity', 'Show', array('entity_id' => $vn_entity_id), array("title" => $t_entity->get("ca_entity_labels.displayname")));
break;
}
}
}
}
}
# --- how many to put in each column?
$vn_num_results = $vo_result->numHits();
$vn_num_per_col = ceil($vn_num_results / 5);
$vn_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');
}