本文整理汇总了PHP中ca_lists::getItemFromListForDisplayByItemID方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::getItemFromListForDisplayByItemID方法的具体用法?PHP ca_lists::getItemFromListForDisplayByItemID怎么用?PHP ca_lists::getItemFromListForDisplayByItemID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::getItemFromListForDisplayByItemID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
//.........这里部分代码省略.........
}
// can't pull fields from other tables!
return $vb_return_as_array ? array() : null;
}
}
if (isset($pa_options["BINARY"]) && $pa_options["BINARY"]) {
return $this->_FIELD_VALUES[$ps_field];
}
if (array_key_exists($ps_field, $this->FIELDS)) {
$ps_field_type = $this->getFieldInfo($ps_field, "FIELD_TYPE");
if ($this->getFieldInfo($ps_field, 'IS_LIFESPAN')) {
$pa_options['isLifespan'] = true;
}
switch ($ps_field_type) {
case FT_BIT:
$vs_prop = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : "";
if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText']) {
$vs_prop = (bool) $vs_prop ? _t('yes') : _t('no');
}
return $vs_prop;
break;
case FT_TEXT:
case FT_NUMBER:
case FT_PASSWORD:
$vs_prop = isset($this->_FIELD_VALUES[$ps_field]) ? $this->_FIELD_VALUES[$ps_field] : null;
if (isset($pa_options["FILTER_HTML_SPECIAL_CHARS"]) && $pa_options["FILTER_HTML_SPECIAL_CHARS"]) {
$vs_prop = htmlentities(html_entity_decode($vs_prop));
}
//
// Convert foreign keys and choice list values to display text is needed
//
if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && ($vs_list_code = $this->getFieldInfo($ps_field, "LIST_CODE"))) {
$t_list = new ca_lists();
$vs_prop = $t_list->getItemFromListForDisplayByItemID($vs_list_code, $vs_prop);
} else {
if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && ($vs_list_code = $this->getFieldInfo($ps_field, "LIST"))) {
$t_list = new ca_lists();
if (!($vs_tmp = $t_list->getItemFromListForDisplayByItemValue($vs_list_code, $vs_prop))) {
if ($vs_tmp = $this->getChoiceListValue($ps_field, $vs_prop)) {
$vs_prop = $vs_tmp;
}
} else {
$vs_prop = $vs_tmp;
}
} else {
if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && $ps_field === 'locale_id' && (int) $vs_prop > 0) {
$t_locale = new ca_locales($vs_prop);
$vs_prop = $t_locale->getName();
} else {
if (isset($pa_options['convertCodesToDisplayText']) && $pa_options['convertCodesToDisplayText'] && is_array($va_list = $this->getFieldInfo($ps_field, "BOUNDS_CHOICE_LIST"))) {
foreach ($va_list as $vs_option => $vs_value) {
if ($vs_value == $vs_prop) {
$vs_prop = $vs_option;
break;
}
}
}
}
}
}
if (isset($pa_options["CONVERT_HTML_BREAKS"]) && $pa_options["CONVERT_HTML_BREAKS"] || isset($pa_options["convertLineBreaks"]) && $pa_options["convertLineBreaks"]) {
$vs_prop = caConvertLineBreaks($vs_prop);
}
break;
case FT_DATETIME:
case FT_TIMESTAMP:
示例2: _getChangeLogFromRawData
//.........这里部分代码省略.........
}
if (!$vs_proc_val) {
$vs_proc_val = '???';
}
} else {
$vs_proc_val = _t("Not set");
}
} else {
$vs_proc_val = _t('Non-existent');
}
} else {
// Adjust display of value for different field types
switch ($va_field_info['FIELD_TYPE']) {
case FT_BIT:
$vs_proc_val = $vs_value ? 'Yes' : 'No';
break;
default:
$vs_proc_val = $vs_value;
break;
}
// Adjust display of value for lists
if ($va_field_info['LIST']) {
$t_list = new ca_lists();
if ($t_list->load(array('list_code' => $va_field_info['LIST']))) {
$vn_list_id = $t_list->getPrimaryKey();
$t_list_item = new ca_list_items();
if ($t_list_item->load(array('list_id' => $vn_list_id, 'item_value' => $vs_value))) {
$vs_proc_val = $t_list_item->getLabelForDisplay();
}
}
} else {
if ($va_field_info['BOUNDS_CHOICE_LIST']) {
// TODO
}
}
}
}
$va_changes[] = array('label' => $va_field_info['LABEL'], 'description' => strlen((string) $vs_proc_val) ? $vs_proc_val : $vs_blank_placeholder, 'value' => $vs_value);
}
}
// ---------------------------------------------------------------
// is this a label row?
if ($va_log_entry['logged_table_num'] == $vn_label_table_num) {
foreach ($va_log_entry['snapshot'] as $vs_field => $vs_value) {
$va_changes[] = array('label' => $t_item_label->getFieldInfo($vs_field, 'LABEL'), 'description' => $vs_value);
}
}
// ---------------------------------------------------------------
// is this an attribute?
if ($va_log_entry['logged_table_num'] == 3) {
// attribute_values
if ($t_element = ca_attributes::getElementInstance($va_log_entry['snapshot']['element_id'])) {
if ($o_attr_val = Attribute::getValueInstance($t_element->get('datatype'))) {
$o_attr_val->loadValueFromRow($va_log_entry['snapshot']);
$vs_attr_val = $o_attr_val->getDisplayValue();
} else {
$vs_attr_val = '?';
}
// Convert list-based attributes to text
if ($vn_list_id = $t_element->get('list_id')) {
$t_list = new ca_lists();
$vs_attr_val = $t_list->getItemFromListForDisplayByItemID($vn_list_id, $vs_attr_val, true);
}
if (!$vs_attr_val) {
$vs_attr_val = $vs_blank_placeholder;
}
$vs_label = $t_element->getLabelForDisplay();
$va_attributes[$va_log_entry['snapshot']['attribute_id']]['values'][] = array('label' => $vs_label, 'value' => $vs_attr_val);
$va_changes[] = array('label' => $vs_label, 'description' => $vs_attr_val);
}
}
// ---------------------------------------------------------------
// is this a related (many-many) row?
$va_keys = $o_datamodel->getOneToManyRelations($t_item->tableName(), $t_obj->tableName());
if (sizeof($va_keys) > 0) {
if (method_exists($t_obj, 'getLeftTableNum')) {
if ($t_obj->getLeftTableNum() == $t_item->tableNum()) {
// other side of rel is on right
$t_related_table = $o_datamodel->getInstanceByTableNum($t_obj->getRightTableNum(), true);
$t_related_table->load($va_log_entry['snapshot'][$t_obj->getRightTableFieldName()]);
} else {
// other side of rel is on left
$t_related_table = $o_datamodel->getInstanceByTableNum($t_obj->getLeftTableNum(), true);
$t_related_table->load($va_log_entry['snapshot'][$t_obj->getLeftTableFieldName()]);
}
$t_rel = $o_datamodel->getInstanceByTableNum($t_obj->tableNum(), true);
$va_changes[] = array('label' => caUcFirstUTF8Safe($t_related_table->getProperty('NAME_SINGULAR')), 'idno' => ($vs_idno_field = $t_related_table->getProperty('ID_NUMBERING_ID_FIELD')) ? $t_related_table->get($vs_idno_field) : null, 'description' => $t_related_table->getLabelForDisplay(), 'table_name' => $t_related_table->tableName(), 'table_num' => $t_related_table->tableNum(), 'row_id' => $t_related_table->getPrimaryKey(), 'rel_type_id' => $va_log_entry['snapshot']['type_id'], 'rel_typename' => $t_rel->getRelationshipTypename('ltor', $va_log_entry['snapshot']['type_id']));
}
}
// ---------------------------------------------------------------
// record log line
if (sizeof($va_changes)) {
$va_log_output[$vn_unit_id][] = array('datetime' => $vs_datetime, 'user_fullname' => $vs_user, 'user_email' => $vs_email, 'user' => $vs_user . ' (' . $vs_email . ')', 'changetype_display' => $va_change_types[$va_log_entry['changetype']], 'changetype' => $va_log_entry['changetype'], 'changes' => $va_changes, 'subject' => $vs_subject_display_name, 'subject_id' => $vn_subject_row_id, 'subject_table_num' => $vn_subject_table_num, 'logged_table_num' => $va_log_entry['logged_table_num'], 'logged_table' => $t_obj->tableName(), 'logged_row_id' => $va_log_entry['logged_row_id']);
}
}
}
}
}
return $va_log_output;
}
示例3: lookup
public function lookup()
{
$vs_search = $this->request->getParameter('q', pString);
$t_list = new ca_lists();
$va_data = array();
$va_access_values = caGetUserAccessValues($this->request);
#
# Do "quicksearches" on so-configured tables
#
if ($this->request->config->get('quicksearch_return_ca_objects')) {
$va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_objects', 57, array('limit' => 3, 'checkAccess' => $va_access_values)));
// break found objects out by type
foreach ($va_results as $vn_id => $va_match_info) {
$vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('object_types', $va_match_info['type_id'], true));
$va_data['ca_objects'][$vs_type][$vn_id] = $va_match_info;
}
}
if ($this->request->config->get('quicksearch_return_ca_entities')) {
$va_data['ca_entities'][_t('Entities')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_entities', 20, array('limit' => 10, 'checkAccess' => $va_access_values)));
}
if ($this->request->config->get('quicksearch_return_ca_places')) {
$va_data['ca_places'][_t('Places')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_places', 72, array('limit' => 10, 'checkAccess' => $va_access_values)));
}
if ($this->request->config->get('quicksearch_return_ca_occurrences')) {
$va_results = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_occurrences', 67, array('limit' => 10, 'checkAccess' => $va_access_values)));
// break found occurrences out by type
foreach ($va_results as $vn_id => $va_match_info) {
$vs_type = unicode_ucfirst($t_list->getItemFromListForDisplayByItemID('occurrence_types', $va_match_info['type_id'], true));
$va_data['ca_occurrences'][$vs_type][$vn_id] = $va_match_info;
}
}
if ($this->request->config->get('quicksearch_return_ca_collections')) {
$va_data['ca_collections'][_t('Collections')] = caExtractValuesByUserLocale(SearchEngine::quickSearch($vs_search, 'ca_collections', 13, array('limit' => 10, 'checkAccess' => $va_access_values)));
}
$this->view->setVar('matches', $va_data);
$this->render('Search/ajax_search_lookup_json.php');
}
示例4: caReturnDefaultIfBlank
print "<div class='unit'><b>" . _t('Type Status') . ":</b> " . caReturnDefaultIfBlank($vs_track_type_status) . "</div>";
$vs_cast = $t_object->get("ca_objects.cast_model", array("convertCodesToDisplayText" => true));
print "<div class='unit'><b>" . _t('Cast') . ":</b> " . ($vs_cast ? $vs_cast : "No") . "</div>";
#if($va_taxonomy = $t_object->get('ca_objects.taxonomic_rank' , array('convertCodesToDisplayText' => true))){
# print "<div class='unit'><b>"._t('Taxonomy').":</b> ".$va_taxonomy."</div>";
#}
if ($vn_taxonomy = $t_object->get('ca_objects.taxonomic_rank', array('idsOnly' => true))) {
?>
<br><div class="unit"><h2>Taxonomy</h2></div>
<?php
$t_list_item = new ca_list_items();
$va_hierarchy = caExtractValuesByUserLocale($t_list_item->getHierarchyAncestors($vn_taxonomy, array("includeSelf" => true, "additionalTableToJoin" => "ca_list_item_labels", "additionalTableSelectFields" => array("name_singular"))));
$va_hierarchy = array_reverse($va_hierarchy);
foreach ($va_hierarchy as $va_hier_taxonomy) {
if ($va_hier_taxonomy["parent_id"]) {
print "<div class='unit'><b>" . $t_lists->getItemFromListForDisplayByItemID("list_item_types", $va_hier_taxonomy["type_id"]) . ": </b>" . $va_hier_taxonomy["name_singular"] . "</div>";
}
}
}
if ($vs_description = $t_object->get("ca_objects.description")) {
print "<div class='unit'><b>" . _t('Description') . ":</b> {$vs_description}</div><!-- end unit -->";
}
$vs_era = $t_object->get('ca_places.era', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_period = $t_object->get('ca_places.period', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_epoch = $t_object->get('ca_places.epoch', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_ageNALMA = $t_object->get('ca_places.ageNALMA', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_unit = $t_object->get('ca_places.unit', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_group = $t_object->get('ca_places.group', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_formation = $t_object->get('ca_places.formation', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
$vs_member = $t_object->get('ca_places.member', array("convertCodesToDisplayText" => true, "delimiter" => ", "));
?>
示例5: getCriterionLabel
/**
* Returns a display label for a given criterion and facet.
*
* @param string $ps_facet_name Name of facet
* @param mixed $pm_criterion
* @return string
*/
public function getCriterionLabel($ps_facet_name, $pn_row_id)
{
if (!($va_facet_info = $this->getInfoForFacet($ps_facet_name))) {
return null;
}
switch ($va_facet_info['type']) {
# -----------------------------------------------------
case 'has':
$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');
return (bool) $pn_row_id ? $vs_yes_text : $vs_no_text;
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'label':
if (!($t_table = $this->opo_datamodel->getInstanceByTableName(isset($va_facet_info['relative_to']) && $va_facet_info['relative_to'] ? $va_facet_info['relative_to'] : $this->ops_browse_table_name, true))) {
break;
}
if (!$t_table->load($pn_row_id)) {
return '???';
}
return $t_table->getLabelForDisplay();
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'authority':
if (!($t_table = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table'], true))) {
break;
}
if (!$t_table->load($pn_row_id)) {
return '???';
}
return $t_table->getLabelForDisplay();
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'attribute':
$t_element = new ca_metadata_elements();
if (!$t_element->load(array('element_code' => $va_facet_info['element_code']))) {
return urldecode($pn_row_id);
}
$vn_element_id = $t_element->getPrimaryKey();
switch ($vn_element_type = $t_element->get('datatype')) {
case __CA_ATTRIBUTE_VALUE_LIST__:
$t_list = new ca_lists();
return $t_list->getItemFromListForDisplayByItemID($t_element->get('list_id'), $pn_row_id, true);
break;
case __CA_ATTRIBUTE_VALUE_OBJECTS__:
case __CA_ATTRIBUTE_VALUE_ENTITIES__:
case __CA_ATTRIBUTE_VALUE_PLACES__:
case __CA_ATTRIBUTE_VALUE_OCCURRENCES__:
case __CA_ATTRIBUTE_VALUE_COLLECTIONS__:
case __CA_ATTRIBUTE_VALUE_LOANS__:
case __CA_ATTRIBUTE_VALUE_MOVEMENTS__:
case __CA_ATTRIBUTE_VALUE_STORAGELOCATIONS__:
case __CA_ATTRIBUTE_VALUE_OBJECTLOTS__:
if ($t_rel_item = AuthorityAttributeValue::elementTypeToInstance($vn_element_type)) {
return $t_rel_item->load($pn_row_id) ? $t_rel_item->getLabelForDisplay() : "???";
}
break;
default:
return urldecode($pn_row_id);
break;
}
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'field':
if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_browse_table_name, true))) {
break;
}
if ($vb_is_bit = $t_item->getFieldInfo($va_facet_info['field'], 'FIELD_TYPE') == FT_BIT) {
return (bool) $pn_row_id ? caGetOption('label_yes', $va_facet_info, _t('Yes')) : caGetOption('label_no', $va_facet_info, _t('No'));
}
return urldecode($pn_row_id);
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'violations':
if (!($t_rule = $this->opo_datamodel->getInstanceByTableName('ca_metadata_dictionary_rules', true))) {
break;
}
if ($t_rule->load(array('rule_code' => $pn_row_id))) {
return $t_rule->getSetting('label');
}
return urldecode($pn_row_id);
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'checkouts':
$vs_status_text = null;
$vs_status_code = isset($va_facet_info['status']) && $va_facet_info['status'] ? $va_facet_info['status'] : $pn_row_id;
switch ($vs_status_code) {
//.........这里部分代码省略.........
示例6: getSetsForUser
public function getSetsForUser($pa_options)
{
if (!is_array($pa_options)) {
$pa_options = array();
}
$pn_user_id = isset($pa_options['user_id']) ? (int) $pa_options['user_id'] : null;
$pm_table_name_or_num = isset($pa_options['table']) ? $pa_options['table'] : null;
if ($pm_table_name_or_num && !($vn_table_num = $this->_getTableNum($pm_table_name_or_num))) {
return null;
}
$pm_type = isset($pa_options['setType']) ? $pa_options['setType'] : null;
$pn_access = isset($pa_options['access']) ? $pa_options['access'] : null;
$pa_public_access = isset($pa_options['checkAccess']) ? $pa_options['checkAccess'] : null;
if ($pa_public_access && is_numeric($pa_public_access) && !is_array($pa_public_access)) {
$pa_public_access = array($pa_public_access);
}
for ($vn_i = 0; $vn_i < sizeof($pa_public_access); $vn_i++) {
$pa_public_access[$vn_i] = intval($pa_public_access[$vn_i]);
}
if ($pn_user_id) {
$va_extra_joins = array();
$va_sql_wheres = array("(cs.deleted = 0)");
$va_sql_params = array();
$o_db = $this->getDb();
if ($vn_table_num) {
$va_sql_wheres[] = "(cs.table_num = ?)";
$va_sql_params[] = (int) $vn_table_num;
}
if (!is_null($pa_public_access) && is_array($pa_public_access) && sizeof($pa_public_access)) {
$va_sql_wheres[] = "(cs.access IN (?))";
$va_sql_params[] = $pa_public_access;
}
if (isset($pm_type) && $pm_type) {
if (is_numeric($pm_type)) {
$va_sql_wheres[] = "(cs.type_id = ?)";
$va_sql_params[] = (int) $pm_type;
} else {
# --- look up code of set type
$t_list = new ca_lists();
$vn_type_id = $t_list->getItemIDFromList("set_types", $pm_type);
if ($vn_type_id) {
$va_sql_wheres[] = "(cs.type_id = ?)";
$va_sql_params[] = (int) $vn_type_id;
}
}
}
if ($pa_options["owner"]) {
$va_sql_wheres[] = "(cs.user_id = " . $pn_user_id . ")";
} else {
# --- if owner is not set to true, we're finding all sets the user has access to or is owner of
# --- we also check the users' access to the set if set
$t_user = new ca_users();
$t_user->load($pn_user_id);
if ($t_user->getPrimaryKey()) {
$vs_access_sql = $pn_access > 0 ? " AND (access >= " . intval($pn_access) . ")" : "";
if (is_array($va_groups = $t_user->getUserGroups()) && sizeof($va_groups)) {
$vs_sql = "(\n\t\t\t\t\t\t\t(cs.user_id = " . intval($pn_user_id) . ") OR \n\t\t\t\t\t\t\t(cs.set_id IN (\n\t\t\t\t\t\t\t\t\tSELECT set_id \n\t\t\t\t\t\t\t\t\tFROM ca_sets_x_user_groups \n\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\tgroup_id IN (" . join(',', array_keys($va_groups)) . ") {$vs_access_sql}\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t (sdatetime IS NULL AND edatetime IS NULL)\n\t\t\t\t\t\t\t\t\t\t\t OR \n\t\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t\t\tsdatetime <= " . time() . " AND edatetime >= " . time() . "\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)";
} else {
$vs_sql = "(cs.user_id = {$pn_user_id})";
}
$vs_sql .= " OR (cs.set_id IN (\n\t\t\t\t\t\t\t\t\t\t\tSELECT set_id \n\t\t\t\t\t\t\t\t\t\t\tFROM ca_sets_x_users \n\t\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\t\tuser_id = {$pn_user_id} {$vs_access_sql}\n\t\t\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t (sdatetime IS NULL AND edatetime IS NULL)\n\t\t\t\t\t\t\t\t\t\t\t\t\t OR \n\t\t\t\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsdatetime <= " . time() . " AND edatetime >= " . time() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)";
$va_sql_wheres[] = "({$vs_sql})";
}
}
$qr_res = $o_db->query("SELECT cs.set_id, cs.user_id, type_id, cu.fname, cu.lname\n\t\t\t\t\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\t\t\t\t\tINNER JOIN ca_users AS cu ON cs.user_id = cu.user_id\n\t\t\t\t\t\t\t\t\t" . join("\n", $va_extra_joins) . "\n\t\t\t\t\t\t\t\t\t" . (sizeof($va_sql_wheres) ? "WHERE " : "") . " " . join(" AND ", $va_sql_wheres) . "\n\t\t\t\t\t\t\t\t\t", $va_sql_params);
$va_sets = array();
$t_list = new ca_lists();
while ($qr_res->nextRow()) {
$vn_table_num = $qr_res->get('table_num');
if (!isset($va_type_name_cache[$vn_table_num]) || !($vs_set_type = $va_type_name_cache[$vn_table_num])) {
$vs_set_type = $va_type_name_cache[$vn_table_num] = $this->getSetContentTypeName($vn_table_num, array('number' => 'plural'));
}
$vs_type = $t_list->getItemFromListForDisplayByItemID('set_types', $qr_res->get('type_id'));
$va_sets[$qr_res->get('set_id')] = array_merge($qr_res->getRow(), array('set_content_type' => $vs_set_type, 'set_type' => $vs_type));
}
return $va_sets;
} else {
return false;
}
}
示例7: getDisplayValue
/**
* Will return plural value of list item unless useSingular option is set to true, in which case singular version of list item label will be used.
*
* @param array Optional array of options. Support options are:
* list_id = if set then the numeric item_id value is translated into label text in the current locale. If not set then the numeric item_id is returned.
* useSingular = If list_id is set then by default the returned text is the plural label. Setting this option to true will force use of the singular label.
* showHierarchy = If true then hierarchical parents of list item will be returned and hierarchical options described below will be used to control the output
* returnIdno = If true list item idno is returned rather than preferred label
* HIERARCHICAL OPTIONS:
* direction - For hierarchy specifications (eg. ca_objects.hierarchy) this determines the order in which the hierarchy is returned. ASC will return the hierarchy root first while DESC will return it with the lowest node first. Default is ASC.
* top - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the root down. Default is to not limit.
* bottom - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the lowest node up. Default is to not limit.
* hierarchicalDelimiter - Text to place between items in a hierarchy for a hierarchical specification (eg. ca_objects.hierarchy) when returning as a string
* removeFirstItems - If set to a non-zero value, the specified number of items at the top of the hierarchy will be omitted. For example, if set to 2, the root and first child of the hierarchy will be omitted. Default is zero (don't delete anything).
* @return string The value
*/
public function getDisplayValue($pa_options = null)
{
$vn_list_id = is_array($pa_options) && isset($pa_options['list_id']) ? (int) $pa_options['list_id'] : null;
if ($vn_list_id > 0) {
$t_list = new ca_lists();
$vb_return_idno = isset($pa_options['returnIdno']) && (bool) $pa_options['returnIdno'];
if ($vb_return_idno) {
$vs_get_spec = 'idno';
} else {
$vs_get_spec = isset($pa_options['useSingular']) && $pa_options['useSingular'] ? 'name_singular' : 'name_plural';
}
// do we need to get the hierarchy?
if ($pa_options['showHierarchy']) {
$t_item = new ca_list_items($this->ops_text_value);
return $t_item->get('ca_list_items.hierarchy.' . $vs_get_spec, $pa_options);
} elseif ($vb_return_idno) {
$t_item = new ca_list_items($this->ops_text_value);
return $t_item->get('ca_list_items.' . $vs_get_spec, $pa_options);
}
return $t_list->getItemFromListForDisplayByItemID($vn_list_id, $this->ops_text_value, isset($pa_options['useSingular']) && $pa_options['useSingular'] ? false : true);
}
return $this->ops_text_value;
}
示例8: getDisplayValue
/**
* Will return plural value of list item unless useSingular option is set to true, in which case singular version of list item label will be used.
*
* @param array Optional array of options. Support options are:
* list_id = if set then the numeric item_id value is translated into label text in the current locale. If not set then the numeric item_id is returned.
* useSingular = If list_id is set then by default the returned text is the plural label. Setting this option to true will force use of the singular label. [Default is false]
* showHierarchy = If true then hierarchical parents of list item will be returned and hierarchical options described below will be used to control the output [Default is false]
* returnIdno = If true list item idno is returned rather than preferred label [Default is false]
* idsOnly = Return numeric item_id only [Default is false]
* HIERARCHICAL OPTIONS:
* direction - For hierarchy specifications (eg. ca_objects.hierarchy) this determines the order in which the hierarchy is returned. ASC will return the hierarchy root first while DESC will return it with the lowest node first. Default is ASC.
* top - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the root down. Default is to not limit.
* bottom - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the lowest node up. Default is to not limit.
* hierarchicalDelimiter - Text to place between items in a hierarchy for a hierarchical specification (eg. ca_objects.hierarchy) when returning as a string
* removeFirstItems - If set to a non-zero value, the specified number of items at the top of the hierarchy will be omitted. For example, if set to 2, the root and first child of the hierarchy will be omitted. Default is zero (don't delete anything).
* transaction = the transaction to execute database actions within. [Default is null]
* @return string The value
*/
public function getDisplayValue($pa_options = null)
{
if ($vb_return_idno = isset($pa_options['returnIdno']) && (bool) $pa_options['returnIdno']) {
return caGetListItemIdno($this->ops_text_value);
}
$vb_ids_only = (bool) caGetOption('idsOnly', $pa_options, false);
if ($vb_ids_only) {
return (int) $this->ops_text_value;
}
$vn_list_id = is_array($pa_options) && isset($pa_options['list_id']) ? (int) $pa_options['list_id'] : null;
if ($vn_list_id > 0) {
$t_list = new ca_lists();
if ($o_trans = caGetOption('transaction', $pa_options, null)) {
$t_list->setTransaction($o_trans);
}
$t_item = new ca_list_items();
if ($pa_options['showHierarchy'] || $vb_return_idno) {
if ($o_trans) {
$t_item->setTransaction($o_trans);
}
}
$vs_get_spec = isset($pa_options['useSingular']) && $pa_options['useSingular'] ? 'name_singular' : 'name_plural';
// do we need to get the hierarchy?
if ($pa_options['showHierarchy']) {
$t_item->load($this->ops_text_value);
return $t_item->get('ca_list_items.hierarchy.' . $vs_get_spec, $pa_options);
}
return $t_list->getItemFromListForDisplayByItemID($vn_list_id, $this->ops_text_value, isset($pa_options['useSingular']) && $pa_options['useSingular'] ? false : true);
}
return $this->ops_text_value;
}
示例9: getSets
//.........这里部分代码省略.........
if ($pn_user_id && !$this->getAppConfig()->get('dont_enforce_access_control_for_ca_sets')) {
$o_dm = $this->getAppDatamodel();
$t_user = $o_dm->getInstanceByTableName('ca_users', true);
$t_user->load($pn_user_id);
if ($t_user->getPrimaryKey()) {
$vs_access_sql = $pn_access > 0 ? " AND (access >= " . intval($pn_access) . ")" : "";
if (is_array($va_groups = $t_user->getUserGroups()) && sizeof($va_groups)) {
$vs_sql = "(\n\t\t\t\t\t\t\t(cs.user_id = " . intval($pn_user_id) . ") OR \n\t\t\t\t\t\t\t(cs.set_id IN (\n\t\t\t\t\t\t\t\t\tSELECT set_id \n\t\t\t\t\t\t\t\t\tFROM ca_sets_x_user_groups \n\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\tgroup_id IN (" . join(',', array_keys($va_groups)) . ") {$vs_access_sql}\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t (sdatetime IS NULL AND edatetime IS NULL)\n\t\t\t\t\t\t\t\t\t\t\t OR \n\t\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t\t\tsdatetime <= " . time() . " AND edatetime >= " . time() . "\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)";
} else {
$vs_sql = "(cs.user_id = {$pn_user_id})";
}
$vs_sql .= " OR (cs.set_id IN (\n\t\t\t\t\t\t\t\t\t\t\tSELECT set_id \n\t\t\t\t\t\t\t\t\t\t\tFROM ca_sets_x_users \n\t\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\t\tuser_id = {$pn_user_id} {$vs_access_sql}\n\t\t\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t (sdatetime IS NULL AND edatetime IS NULL)\n\t\t\t\t\t\t\t\t\t\t\t\t\t OR \n\t\t\t\t\t\t\t\t\t\t\t\t\t (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsdatetime <= " . time() . " AND edatetime >= " . time() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)";
$va_sql_wheres[] = "({$vs_sql})";
}
}
}
if (!is_null($pa_public_access) && is_array($pa_public_access) && sizeof($pa_public_access)) {
$va_sql_wheres[] = "(cs.access IN (?))";
$va_sql_params[] = $pa_public_access;
}
if (isset($pm_type) && $pm_type) {
if (is_numeric($pm_type)) {
$va_sql_wheres[] = "(cs.type_id = ?)";
$va_sql_params[] = (int) $pm_type;
} else {
# --- look up code of set type
$t_list = new ca_lists();
$vn_type_id = $t_list->getItemIDFromList("set_types", $pm_type);
if ($vn_type_id) {
$va_sql_wheres[] = "(cs.type_id = ?)";
$va_sql_params[] = (int) $vn_type_id;
}
}
}
if ($pn_row_id > 0) {
$va_sql_wheres[] = "((csi.row_id = ?) AND (csi.table_num = ?))";
$va_extra_joins[] = "INNER JOIN ca_set_items AS csi ON cs.set_id = csi.set_id";
$va_sql_selects[] = 'csi.item_id';
$va_sql_params[] = (int) $pn_row_id;
$va_sql_params[] = (int) $vn_table_num;
}
if ($ps_set_name) {
$va_sql_wheres[] = "(csl.name = ?)";
$va_sql_params[] = (string) $ps_set_name;
}
if (!$pb_set_ids_only && !$pb_omit_counts) {
// get set item counts
$qr_table_nums = $o_db->query("\n\t\t\t\tSELECT DISTINCT cs.table_num \n\t\t\t\tFROM ca_sets cs\n\t\t\t\tINNER JOIN ca_set_items AS csi ON cs.set_id = csi.set_id\n\t\t\t\t" . (sizeof($va_sql_wheres) ? 'WHERE ' : '') . "\n\t\t\t\t" . join(' AND ', $va_sql_wheres) . "\n\t\t\t", $va_sql_params);
$va_item_counts = array();
while ($qr_table_nums->nextRow()) {
$o_dm = $this->getAppDatamodel();
$t_instance = $o_dm->getInstanceByTableNum($vn_table_num = (int) $qr_table_nums->get('table_num'), true);
if (!$t_instance) {
continue;
}
$va_item_wheres = $va_sql_wheres;
$va_item_wheres[] = "(cs.table_num = {$vn_table_num})";
if ($t_instance->hasField('deleted')) {
$va_item_wheres[] = "(t.deleted = 0)";
}
$qr_res = $o_db->query("\n\t\t\t\t\tSELECT cs.set_id, count(distinct row_id) item_count\n\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\tINNER JOIN ca_set_items AS csi ON cs.set_id = csi.set_id\n\t\t\t\t\tINNER JOIN " . $t_instance->tableName() . " AS t ON t." . $t_instance->primaryKey() . " = csi.row_id\n\t\t\t\t\t" . (sizeof($va_item_wheres) ? 'WHERE ' : '') . "\n\t\t\t\t\t" . join(' AND ', $va_item_wheres) . "\n\t\t\t\t\tGROUP BY cs.set_id\n\t\t\t\t", $va_sql_params);
while ($qr_res->nextRow()) {
$va_item_counts[(int) $qr_res->get('set_id')] = (int) $qr_res->get('item_count');
}
}
// get sets
$qr_res = $o_db->query("\n\t\t\t\tSELECT " . join(', ', $va_sql_selects) . "\n\t\t\t\tFROM ca_sets cs\n\t\t\t\tLEFT JOIN ca_set_labels AS csl ON cs.set_id = csl.set_id\n\t\t\t\tLEFT JOIN ca_locales AS l ON csl.locale_id = l.locale_id\n\t\t\t\tINNER JOIN ca_users AS u ON cs.user_id = u.user_id\n\t\t\t\t" . join("\n", $va_extra_joins) . "\n\t\t\t\t" . (sizeof($va_sql_wheres) ? 'WHERE ' : '') . "\n\t\t\t\t" . join(' AND ', $va_sql_wheres) . "\n\t\t\t\tORDER BY csl.name\n\t\t\t", $va_sql_params);
$va_sets = array();
$o_dm = $this->getAppDatamodel();
$va_type_name_cache = array();
$t_list = new ca_lists();
while ($qr_res->nextRow()) {
$vn_table_num = $qr_res->get('table_num');
if (!isset($va_type_name_cache[$vn_table_num]) || !($vs_set_type = $va_type_name_cache[$vn_table_num])) {
$vs_set_type = $va_type_name_cache[$vn_table_num] = $this->getSetContentTypeName($vn_table_num, array('number' => 'plural'));
}
$vs_type = $t_list->getItemFromListForDisplayByItemID('set_types', $qr_res->get('type_id'));
$va_sets[$qr_res->get('set_id')][$qr_res->get('locale_id')] = array_merge($qr_res->getRow(), array('item_count' => intval($va_item_counts[$qr_res->get('set_id')]), 'set_content_type' => $vs_set_type, 'set_type' => $vs_type));
}
return $va_sets;
} else {
if ($pb_set_ids_only) {
// get sets
$qr_res = $o_db->query("\n\t\t\t\t\tSELECT " . join(', ', $va_sql_selects) . "\n\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\tINNER JOIN ca_users AS u ON cs.user_id = u.user_id\n\t\t\t\t\tLEFT JOIN ca_set_labels AS csl ON cs.set_id = csl.set_id\n\t\t\t\t\t" . join("\n", $va_extra_joins) . "\n\t\t\t\t\t" . (sizeof($va_sql_wheres) ? 'WHERE ' : '') . "\n\t\t\t\t\t" . join(' AND ', $va_sql_wheres) . "\n\t\t\t\t", $va_sql_params);
return $qr_res->getAllFieldValues("set_id");
} else {
$qr_res = $o_db->query("\n\t\t\t\t\tSELECT " . join(', ', $va_sql_selects) . "\n\t\t\t\t\tFROM ca_sets cs\n\t\t\t\t\tINNER JOIN ca_users AS u ON cs.user_id = u.user_id\n\t\t\t\t\tLEFT JOIN ca_set_labels AS csl ON cs.set_id = csl.set_id\n\t\t\t\t\tLEFT JOIN ca_locales AS l ON csl.locale_id = l.locale_id\n\t\t\t\t\t" . join("\n", $va_extra_joins) . "\n\t\t\t\t\t" . (sizeof($va_sql_wheres) ? 'WHERE ' : '') . "\n\t\t\t\t\t" . join(' AND ', $va_sql_wheres) . "\n\t\t\t\t", $va_sql_params);
$t_list = new ca_lists();
while ($qr_res->nextRow()) {
$vn_table_num = $qr_res->get('table_num');
if (!isset($va_type_name_cache[$vn_table_num]) || !($vs_set_type = $va_type_name_cache[$vn_table_num])) {
$vs_set_type = $va_type_name_cache[$vn_table_num] = $this->getSetContentTypeName($vn_table_num, array('number' => 'plural'));
}
$vs_type = $t_list->getItemFromListForDisplayByItemID('set_types', $qr_res->get('type_id'));
$va_sets[$qr_res->get('set_id')][$qr_res->get('locale_id')] = array_merge($qr_res->getRow(), array('item_count' => intval($va_item_counts[$qr_res->get('set_id')]), 'set_content_type' => $vs_set_type, 'set_type' => $vs_type));
}
return $va_sets;
}
}
}
示例10: caDetailLink
// Vertebrates
//
print "<div class='searchFullTitle'>" . caDetailLink($this->request, "UCM " . ($vs_idno ? $vs_idno : 'not available'), '', 'ca_objects', $vn_id, array("subsite" => $this->request->session->getVar("coloradoSubSite")), array(), array('action' => $this->request->getAction())) . "</div>";
print "<div class='searchFullText" . ($vs_image ? "Small" : "") . "'>";
$vs_other = $qr_res->get("ca_objects.other_catalog_number");
print "<div><b>" . _t('Alternate Catalog Number') . ":</b> " . caReturnDefaultIfBlank($vs_other) . "</div>";
if ($vn_taxonomy = $qr_res->get('ca_objects.taxonomic_rank', array('idsOnly' => true))) {
if (isset($va_taxonomy_cache[$vn_taxonomy])) {
print $va_taxonomy_cache[$vn_taxonomy];
} else {
$va_hierarchy = caExtractValuesByUserLocale($t_list_item->getHierarchyAncestors($vn_taxonomy, array("includeSelf" => true, "additionalTableToJoin" => "ca_list_item_labels", "additionalTableSelectFields" => array("name_singular"))));
$va_hierarchy = array_reverse($va_hierarchy);
$vs_buf = '';
foreach ($va_hierarchy as $va_hier_taxonomy) {
if ($va_hier_taxonomy["parent_id"]) {
$vs_buf .= "<div><b>" . $t_lists->getItemFromListForDisplayByItemID("list_item_types", $va_hier_taxonomy["type_id"]) . ": </b>" . $va_hier_taxonomy["name_singular"] . "</div>";
}
}
print $va_taxonomy_cache[$vn_taxonomy] = $vs_buf;
}
} else {
print "<div><b>" . _t('Taxonomy') . ":</b> " . caReturnDefaultIfBlank($qr_res->get('ca_objects.taxonomic_rank')) . "</div>";
}
if ($vs_description = $qr_res->get("ca_objects.description")) {
print "<div><b>" . _t('Description') . ":</b> {$vs_description}</div>";
}
print "<div><b>" . _t('Photo') . ":</b> " . ($vs_image ? "Yes" : "No") . "</div>";
$vs_cast = $qr_res->get("ca_objects.cast_model", array("convertCodesToDisplayText" => true));
print "<div><b>" . _t('Cast') . ":</b> " . ($vs_cast ? $vs_cast : "No") . "</div>";
$vs_track_type_status = $qr_res->get('ca_objects.track_type_status', array('convertCodesToDisplayText' => true));
if (substr($vs_track_type_status, -1) == 's') {
示例11: getListAsHTMLFormElement
//.........这里部分代码省略.........
$vn_c = 0;
$vs_buf = "<table>\n";
foreach ($va_options as $vm_value => $vs_label) {
if ($vn_c == 0) {
$vs_buf .= "<tr>";
}
$va_attributes = array('value' => $vm_value);
if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
$va_attributes['disabled'] = 1;
}
if (isset($pa_options['readonly']) && $pa_options['readonly']) {
$va_attributes['disabled'] = 1;
}
if (is_array($pa_options['value']) && in_array($vm_value, $pa_options['value'])) {
$va_attributes['checked'] = '1';
}
$vs_buf .= "<td>" . caHTMLCheckboxInput($ps_name . '_' . $vm_value, $va_attributes, $pa_options) . " {$vs_label}</td>";
$vn_c++;
if ($vn_c >= $pa_options['maxColumns']) {
$vn_c = 0;
$vs_buf .= "</tr>\n";
}
}
if ($vn_c != 0) {
$vs_buf .= "</tr>\n";
}
$vs_buf .= "</table>";
return $vs_buf;
break;
case 'lookup':
$vs_value = $vs_hidden_value = "";
if (caGetOption('forSearch', $pa_options)) {
if ($vs_val_id = caGetOption('value', $pa_options)) {
$vs_value = $t_list->getItemFromListForDisplayByItemID($pm_list_name_or_id, $vs_val_id);
$vs_hidden_value = $vs_val_id;
}
} else {
$vs_value = "{" . $pa_options['element_id'] . "_label}";
$vs_hidden_value = "{" . $pa_options['element_id'] . "}";
}
$vs_buf = caHTMLTextInput($ps_name . '_autocomplete', array('width' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : 300, 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => $vs_value, 'maxlength' => 512, 'id' => $ps_name . "_autocomplete", 'class' => 'lookupBg')) . caHTMLHiddenInput($ps_name, array('value' => $vs_hidden_value, 'id' => $ps_name));
if ($pa_options['request']) {
$vs_url = caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noInline' => 1, 'noSymbols' => 1, 'max' => 100));
} else {
// hardcoded default for testing.
$vs_url = '/index.php/lookup/ListItem/Get';
}
$vs_buf .= '</div>';
$vs_buf .= "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').autocomplete({\n\t\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (parseInt(ui.item.id) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').val('');\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val('');\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
return $vs_buf;
break;
case 'horiz_hierbrowser':
case 'horiz_hierbrowser_with_search':
case 'vert_hierbrowser':
$va_width = caParseFormElementDimension($pa_options['width'] ? $pa_options['width'] : $pa_options['width']);
if ($va_width['type'] != 'pixels' && $va_width['dimension'] < 250) {
$va_width['dimension'] = 500;
}
$vn_width = $va_width['dimension'] . 'px';
$va_height = caParseFormElementDimension($pa_options['height']);
if ($va_height['type'] != 'pixels' && $va_height['dimension'] < 100) {
$va_height['dimension'] = 200;
}
$vn_height = $va_height['dimension'] . 'px';
$t_root_item = new ca_list_items();
$t_root_item->load(array('list_id' => $vn_list_id, 'parent_id' => null));
示例12: getDisplayValue
/**
* When returning text will return plural value of list item unless useSingular option is set to true, in which case singular version of list item label will be used.
*
* @param array Optional array of options. Support options are:
* list_id = if set then the numeric item_id value is translated into label text in the current locale. If not set then the numeric item_id is returned.
* useSingular = If list_id is set then by default the returned text is the plural label. Setting this option to true will force use of the singular label. [Default is false]
* showHierarchy = If true then hierarchical parents of list item will be returned and hierarchical options described below will be used to control the output [Default is false]
* returnIdno = If true list item idno is returned rather than preferred label [Default is false]
* idsOnly = Return numeric item_id only [Default is false]
* alwaysReturnItemID = Synonym for idsOnly [Default is false]
* output = what value for the list to return. Valid values are text [display text], idno [identifier; same as returnIdno option], value [numeric item_id; same as idsOnly option]. [Default is value]
*
* HIERARCHICAL OPTIONS:
* direction - For hierarchy specifications (eg. ca_objects.hierarchy) this determines the order in which the hierarchy is returned. ASC will return the hierarchy root first while DESC will return it with the lowest node first. Default is ASC.
* top - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the root down. Default is to not limit.
* bottom - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the lowest node up. Default is to not limit.
* hierarchicalDelimiter - Text to place between items in a hierarchy for a hierarchical specification (eg. ca_objects.hierarchy) when returning as a string
* removeFirstItems - If set to a non-zero value, the specified number of items at the top of the hierarchy will be omitted. For example, if set to 2, the root and first child of the hierarchy will be omitted. Default is zero (don't delete anything).
* transaction = the transaction to execute database actions within. [Default is null]
* @return string The value
*/
public function getDisplayValue($pa_options = null)
{
if (isset($pa_options['output'])) {
switch (strtolower($pa_options['output'])) {
case 'idno':
$pa_options['returnIdno'] = true;
break;
case 'text':
$pa_options['returnIdno'] = false;
$pa_options['idsOnly'] = false;
break;
default:
$pa_options['idsOnly'] = true;
break;
}
}
if ($vb_return_idno = isset($pa_options['returnIdno']) && (bool) $pa_options['returnIdno']) {
return caGetListItemIdno($this->opn_item_id);
}
if (is_null($vb_ids_only = isset($pa_options['idsOnly']) ? (bool) $pa_options['idsOnly'] : null)) {
$vb_ids_only = isset($pa_options['alwaysReturnItemID']) ? (bool) $pa_options['alwaysReturnItemID'] : false;
}
if ($vb_ids_only) {
return (int) $this->opn_item_id;
}
$vn_list_id = is_array($pa_options) && isset($pa_options['list_id']) ? (int) $pa_options['list_id'] : null;
if ($vn_list_id > 0) {
$t_list = new ca_lists();
if ($o_trans = isset($pa_options['transaction']) ? $pa_options['transaction'] : null) {
$t_list->setTransaction($o_trans);
}
$t_item = new ca_list_items();
if ($pa_options['showHierarchy'] || $vb_return_idno) {
if ($o_trans) {
$t_item->setTransaction($o_trans);
}
}
$vs_get_spec = isset($pa_options['useSingular']) && $pa_options['useSingular'] ? 'preferred_labels.name_singular' : 'preferred_labels.name_plural';
// do we need to get the hierarchy?
if ($pa_options['showHierarchy']) {
$t_item->load((int) $this->opn_item_id);
return $t_item->get('ca_list_items.hierarchy.' . $vs_get_spec, array_merge(array('removeFirstItems' => 1, 'delimiter' => ' ➔ ', $pa_options)));
}
return $t_list->getItemFromListForDisplayByItemID($vn_list_id, $this->opn_item_id, isset($pa_options['useSingular']) && $pa_options['useSingular'] ? false : true);
}
return $this->ops_text_value;
}
示例13: join
}
if ($t_object->get("ca_objects.dimensions.dimensions_length")) {
$va_dimension_pieces[] = $t_object->get("ca_objects.dimensions.dimensions_length");
}
if (sizeof($va_dimension_pieces)) {
print join(" x ", $va_dimension_pieces);
}
if ($t_object->get("ca_objects.dimensions.dimensions_weight")) {
print " " . $t_object->get("ca_objects.dimensions.dimensions_weight");
}
}
if ($va_materials = $t_object->get("ca_objects.material", array("returnAsArray" => true, "convertCodesToDisplayText" => false))) {
$i = 0;
$va_materials_display = array();
foreach ($va_materials as $vn_material_id => $va_material) {
$vs_material = $t_lists->getItemFromListForDisplayByItemID("material", $va_material["material"]);
if (trim($vs_material)) {
$va_materials_display[] = caNavLink($this->request, $vs_material, "", "", "Browse", "Objects", array("facet" => "material_facet", "id" => $va_material["material"]));
}
}
if (sizeof($va_materials_display)) {
print "<H6>" . _t("Material") . "</H6>";
print join(", ", $va_materials_display);
}
}
?>
{{{<ifdef code="ca_objects.description"><H6>Description</H6>^ca_objects.description</ifdef>}}}
<?php
if (trim($t_object->get("ca_objects.dimensions_frame.display_dimensions_frame")) || $t_object->get("ca_objects.dimensions_frame.dimensions_frame_height") || $t_object->get("ca_objects.dimensions.dimensions_height") || trim($t_object->get("ca_objects.dimensions.display_dimensions")) || trim($t_object->get("ca_objects.material")) || trim($t_object->get("description"))) {
print "<HR/>";
}
示例14: array
$vs_dob = "";
}
if ($vs_nationality || $vs_dob) {
print "<H5>(" . $vs_nationality;
if ($vs_nationality && $vs_dob) {
print ", ";
}
print $vs_dob . ")</H5>";
}
?>
<HR/>
<?php
if ($va_styles = $t_item->get("ca_entities.styles_movement", array("returnAsArray" => true, "convertCodesToDisplayText" => false))) {
$va_style_display = array();
foreach ($va_styles as $vn_style_id => $va_style) {
$vs_style_movement = $t_lists->getItemFromListForDisplayByItemID("styles_movement", $va_style["styles_movement"]);
if (trim($vs_style_movement)) {
$va_style_display[] = caNavLink($this->request, $vs_style_movement, "", "", "Browse", "Objects", array("facet" => "styles_movement_facet", "id" => $va_style["styles_movement"]));
}
}
if (sizeof($va_style_display)) {
print "<H6>" . _t("Style/Movement") . "</H6>";
print join(", ", $va_style_display);
}
}
?>
{{{<ifdef code="ca_entities.birthplace"><H6>Birthplace</H6>^ca_entities.birthplace</ifdef>}}}
{{{<ifdef code="ca_entities.entity_bio"><HR/><H6>Biography</H6>^ca_entities.entity_bio</ifdef>}}}
<HR/>
<div id="detailTools">
示例15: getCriterionLabel
/**
*
*/
public function getCriterionLabel($ps_facet_name, $pn_row_id)
{
if (!($va_facet_info = $this->getInfoForFacet($ps_facet_name))) {
return null;
}
switch ($va_facet_info['type']) {
# -----------------------------------------------------
case 'has':
$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');
return (bool) $pn_row_id ? $vs_yes_text : $vs_no_text;
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'label':
if (!($t_table = $this->opo_datamodel->getInstanceByTableName(isset($va_facet_info['relative_to']) && $va_facet_info['relative_to'] ? $va_facet_info['relative_to'] : $this->ops_browse_table_name, true))) {
break;
}
if (!$t_table->load($pn_row_id)) {
return '???';
}
return $t_table->getLabelForDisplay();
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'authority':
if (!($t_table = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table'], true))) {
break;
}
if (!$t_table->load($pn_row_id)) {
return '???';
}
return $t_table->getLabelForDisplay();
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'attribute':
$t_element = new ca_metadata_elements();
if (!$t_element->load(array('element_code' => $va_facet_info['element_code']))) {
return urldecode($pn_row_id);
}
$vn_element_id = $t_element->getPrimaryKey();
switch ($t_element->get('datatype')) {
case 3:
// list
$t_list = new ca_lists();
return $t_list->getItemFromListForDisplayByItemID($t_element->get('list_id'), $pn_row_id, true);
break;
default:
return urldecode($pn_row_id);
break;
}
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'field':
return urldecode($pn_row_id);
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'normalizedDates':
return urldecode($pn_row_id);
break;
# -----------------------------------------------------
# -----------------------------------------------------
case 'fieldList':
if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_browse_table_name, true))) {
break;
}
$vs_field_name = $va_facet_info['field'];
$va_field_info = $t_item->getFieldInfo($vs_field_name);
$t_list = new ca_lists();
if ($vs_list_name = $va_field_info['LIST_CODE']) {
$t_list_item = new ca_list_items($pn_row_id);
if ($vs_tmp = $t_list_item->getLabelForDisplay()) {
return $vs_tmp;
}
return '???';
} else {
if ($vs_list_name = $va_field_info['LIST']) {
if (is_array($va_list_items = $t_list->getItemsForList($vs_list_name))) {
$va_list_items = caExtractValuesByUserLocale($va_list_items);
foreach ($va_list_items as $vn_id => $va_list_item) {
if ($va_list_item['item_value'] == $pn_row_id) {
return $va_list_item['name_plural'];
}
}
}
}
}
if (isset($va_field_info['BOUNDS_CHOICE_LIST'])) {
$va_choice_list = $va_field_info['BOUNDS_CHOICE_LIST'];
if (is_array($va_choice_list)) {
foreach ($va_choice_list as $vs_val => $vn_id) {
if ($vn_id == $pn_row_id) {
return $vs_val;
}
//.........这里部分代码省略.........