本文整理汇总了PHP中ca_objects::hasField方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::hasField方法的具体用法?PHP ca_objects::hasField怎么用?PHP ca_objects::hasField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::hasField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<!-- 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>";
}
?>
</ul>
</div><!-- end jcarousel -->
</div><!-- end jcarousel-wrapper -->
</div><!-- end detailRelatedObjects -->
<script type='text/javascript'>
jQuery(document).ready(function() {
示例2: getFacetContent
//.........这里部分代码省略.........
# -----------------------------------------------------
case 'has':
$vn_state = null;
if (isset($va_all_criteria[$ps_facet_name])) {
break;
}
// only one instance of this facet allowed per browse
if (!($t_item = $this->opo_datamodel->getInstanceByTableName($vs_browse_table_name, true))) {
break;
}
$vs_yes_text = isset($va_facet_info['label_yes']) && $va_facet_info['label_yes'] ? $va_facet_info['label_yes'] : _t('Yes');
$vs_no_text = isset($va_facet_info['label_no']) && $va_facet_info['label_no'] ? $va_facet_info['label_no'] : _t('No');
$va_facet_values = array('yes' => array('id' => 1, 'label' => $vs_yes_text), 'no' => array('id' => 0, 'label' => $vs_no_text));
// Actually check that both yes and no values will result in something
if ($va_facet_info['element_code']) {
$t_element = new ca_metadata_elements();
if (!$t_element->load(array('element_code' => $va_facet_info['element_code']))) {
break;
}
$vs_element_code = $va_facet_info['element_code'];
$va_facet = array();
$va_counts = array();
foreach ($va_facet_values as $vs_state_name => $va_state_info) {
$va_wheres = array();
$va_joins = array();
if (!(bool) $va_state_info['id']) {
// no option
$va_wheres[] = $this->ops_browse_table_name . '.' . $t_item->primaryKey() . " NOT IN (select row_id from ca_attributes where table_num = " . $t_item->tableNum() . " AND element_id = " . $t_element->getPrimaryKey() . ")";
} else {
// yes option
$va_joins[] = "LEFT JOIN ca_attributes AS caa ON " . $this->ops_browse_table_name . '.' . $t_item->primaryKey() . " = caa.row_id AND " . $t_item->tableNum() . " = caa.table_num";
$va_wheres[] = "caa.element_id = " . $t_element->getPrimaryKey();
}
if ($t_item->hasField('deleted')) {
$va_wheres[] = "(" . $t_item->tableName() . ".deleted = 0)";
}
if (isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && $t_item->hasField('access')) {
$va_wheres[] = "(" . $vs_browse_table_name . ".access IN (" . join(',', $pa_options['checkAccess']) . "))";
}
if (sizeof($va_results)) {
$va_wheres[] = $vs_browse_table_name . "." . $t_item->primaryKey() . " IN (" . join(",", $va_results) . ")";
}
if ($va_facet_info['relative_to']) {
if ($t_subject->hasField('deleted')) {
$va_wheres[] = "(" . $t_subject->tableName() . ".deleted = 0)";
}
if ($va_relative_sql_data = $this->_getRelativeFacetSQLData($va_facet_info['relative_to'], $pa_options)) {
$va_joins = array_merge($va_joins, $va_relative_sql_data['joins']);
$va_wheres = array_merge($va_wheres, $va_relative_sql_data['wheres']);
}
}
if ($this->opo_config->get('perform_item_level_access_checking')) {
if ($t_item = $this->opo_datamodel->getInstanceByTableName($vs_browse_table_name, true)) {
// Join to limit what browse table items are used to generate facet
$va_joins[] = 'LEFT JOIN ca_acl ON ' . $vs_browse_table_name . '.' . $t_item->primaryKey() . ' = ca_acl.row_id AND ca_acl.table_num = ' . $t_item->tableNum() . "\n";
$va_wheres[] = "(\n\t\t\t\t\t\t\t\t\t\t((\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.user_id = " . (int) $vn_user_id . ")\n\t\t\t\t\t\t\t\t\t\t\t" . (sizeof($va_group_ids) > 0 ? "OR\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.group_id IN (" . join(",", $va_group_ids) . "))" : "") . "\n\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t(ca_acl.user_id IS NULL and ca_acl.group_id IS NULL)\n\t\t\t\t\t\t\t\t\t\t) AND ca_acl.access >= " . __CA_ACL_READONLY_ACCESS__ . ")\n\t\t\t\t\t\t\t\t\t\t" . ($vb_show_if_no_acl ? "OR ca_acl.acl_id IS NULL" : "") . "\n\t\t\t\t\t\t\t\t\t)";
}
}
$vs_join_sql = join("\n", $va_joins);
$vs_where_sql = '';
if (sizeof($va_wheres) > 0) {
$vs_where_sql = ' WHERE ' . join(' AND ', $va_wheres);
}
if ($vb_check_availability_only) {
$vs_sql = "\n\t\t\t\t\t\t\t\t\tSELECT 1\n\t\t\t\t\t\t\t\t\tFROM " . $vs_browse_table_name . "\n\t\t\t\t\t\t\t\t\t{$vs_join_sql}\n\t\t\t\t\t\t\t\t\t{$vs_where_sql}\n\t\t\t\t\t\t\t\t\tLIMIT 2\n\t\t\t\t\t\t\t\t";
//print "$vs_sql<hr>";
示例3: reserve
/**
*
*/
public function reserve($pn_object_id, $pn_user_id, $ps_note, $pa_options = null)
{
global $g_ui_locale_id;
$vb_we_set_transaction = false;
if ($this->inTransaction()) {
$o_trans = $this->getTransaction();
} else {
$vb_we_set_transaction = true;
$this->setTransaction($o_trans = new Transaction());
}
$o_request = caGetOption('request', $pa_options, null);
$t_object = new ca_objects($pn_object_id);
$t_object->setTransaction($o_trans);
if (!$t_object->getPrimaryKey()) {
return null;
}
if ($o_request && !$t_object->isReadable($o_request)) {
return null;
}
// is object out?
if ($t_object->getCheckoutStatus() === __CA_OBJECTS_CHECKOUT_STATUS_AVAILABLE__) {
throw new Exception(_t('Item is not out'));
}
$va_reservations = $this->objectHasReservations($pn_object_id);
// is object already reserved by this user?
if (is_array($va_reservations)) {
foreach ($va_reservations as $va_reservation) {
if ($va_reservation['user_id'] == $pn_user_id) {
throw new Exception(_t('Item is already reserved by this user'));
}
}
}
$vs_uuid = $this->getTransactionUUID();
$va_checkout_config = ca_object_checkouts::getObjectCheckoutConfigForType($t_object->getTypeCode());
$this->setMode(ACCESS_WRITE);
$this->set(array('group_uuid' => $vs_uuid, 'object_id' => $pn_object_id, 'user_id' => $pn_user_id, 'checkout_notes' => $ps_notes));
// Do we need to set values?
if (is_array($va_checkout_config['set_values']) && sizeof($va_checkout_config['set_values'])) {
$t_object->setMode(ACCESS_WRITE);
foreach ($va_checkout_config['set_values'] as $vs_attr => $va_attr_values_by_event) {
if (!is_array($va_attr_values_by_event['reserve'])) {
if ($t_object->hasField($vs_attr)) {
// Intrinsic
$t_object->set($vs_attr, $va_attr_values_by_event['reserve']);
}
} else {
$va_attr_values['locale_id'] = $g_ui_locale_id;
$t_object->replaceAttribute($va_attr_values_by_event['reserve'], $vs_attr);
}
$t_object->update();
if ($t_object->numErrors()) {
$this->errors = $t_object->errors;
if ($vb_we_set_transaction) {
$o_trans->rollback();
}
return false;
}
}
}
$vn_rc = $this->insert();
if ($vb_we_set_transaction) {
$vn_rc ? $o_trans->commit() : $o_trans->rollback();
}
return $vn_rc;
}