本文整理汇总了PHP中ca_occurrences::getTypeList方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_occurrences::getTypeList方法的具体用法?PHP ca_occurrences::getTypeList怎么用?PHP ca_occurrences::getTypeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_occurrences
的用法示例。
在下文中一共展示了ca_occurrences::getTypeList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: caGetTableDisplayName
/**
*
*/
function caGetTableDisplayName($pm_table_name_or_num, $pb_use_plural = true)
{
require_once __CA_MODELS_DIR__ . '/ca_occurrences.php';
$o_dm = Datamodel::load();
$vs_table = $o_dm->getTableName($pm_table_name_or_num);
switch ($vs_table) {
case 'ca_occurrences':
$t_occ = new ca_occurrences();
$va_types = $t_occ->getTypeList();
$va_type_labels = array();
foreach ($va_types as $vn_item_id => $va_type_info) {
$va_type_labels[] = $va_type_info[$pb_use_plural ? 'name_plural' : 'name_singular'];
}
return join('/', $va_type_labels);
break;
default:
if ($t_instance = $o_dm->getInstanceByTableName($vs_table, true)) {
return $t_instance->getProperty($pb_use_plural ? 'NAME_PLURAL' : 'NAME_SINGULAR');
}
break;
}
return null;
}
示例2: getObjectHistory
/**
* Return array with list of significant events in object life cycle as configured for
* a ca_objects_history editor bundle.
*
* @param array $pa_bundle_settings The settings for a ca_objects_history editing BUNDLES
* @param array $pa_options Array of options. Options include:
* noCache = Don't use any cached history data. [Default is false]
* currentOnly = Only return history entries dates before or on the current date. [Default is false]
* limit = Only return a maximum number of history entries. [Default is null; no limit]
*
* @return array A list of life cycle events, indexed by historic timestamp for date of occurrrence. Each list value is an array of history entries.
*
* @used-by ca_objects::getObjectHistoryHTMLFormBundle
*/
public function getObjectHistory($pa_bundle_settings = null, $pa_options = null)
{
global $g_ui_locale;
if (!is_array($pa_options)) {
$pa_options = array();
}
if (!is_array($pa_bundle_settings)) {
$pa_bundle_settings = array();
}
$vs_cache_key = caMakeCacheKeyFromOptions(array_merge($pa_bundle_settings, $pa_options, array('object_id' => $this->getPrimaryKey())));
$pb_no_cache = caGetOption('noCache', $pa_options, false);
if (!$pb_no_cache && isset(ca_objects::$s_object_use_cache[$vs_cache_key])) {
return ca_objects::$s_object_use_cache[$vs_cache_key];
}
$pb_display_label_only = caGetOption('displayLabelOnly', $pa_options, false);
$pb_get_current_only = caGetOption('currentOnly', $pa_options, false);
$pn_limit = caGetOption('limit', $pa_options, null);
$vs_display_template = caGetOption('display_template', $pa_bundle_settings, _t('No template defined'));
$vs_history_template = caGetOption('history_template', $pa_bundle_settings, $vs_display_template);
$vn_current_date = caDateToHistoricTimestamp(_t('now'));
$o_media_coder = new MediaInfoCoder();
//
// Get history
//
$va_history = array();
// Lots
if (is_array($va_lot_types = caGetOption('ca_object_lots_showTypes', $pa_bundle_settings, null)) && ($vn_lot_id = $this->get('lot_id'))) {
$t_lot = new ca_object_lots($vn_lot_id);
if (!$t_lot->get('deleted')) {
$va_lot_type_info = $t_lot->getTypeList();
$vn_type_id = $t_lot->get('type_id');
$vs_color = $va_lot_type_info[$vn_type_id]['color'];
if (!$vs_color || $vs_color == '000000') {
$vs_color = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
}
$va_dates = array();
$va_date_elements = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null);
if (!is_array($va_date_elements) && $va_date_elements) {
$va_date_elements = array($va_date_elements);
}
if (is_array($va_date_elements) && sizeof($va_date_elements)) {
foreach ($va_date_elements as $vs_date_element) {
$va_dates[] = array('sortable' => $t_lot->get($vs_date_element, array('getDirectDate' => true)), 'display' => $t_lot->get($vs_date_element));
}
}
if (!sizeof($va_dates)) {
$va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($t_lot->getCreationTimestamp(null, array('timestampOnly' => true))), 'display' => caGetLocalizedDate($vn_date));
}
foreach ($va_dates as $va_date) {
if (!$va_date['sortable']) {
continue;
}
if (!in_array($vn_type_id, $va_lot_types)) {
continue;
}
if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
continue;
}
$vs_default_display_template = '^ca_object_lots.preferred_labels.name (^ca_object_lots.idno_stub)';
$vs_display_template = $pb_display_label_only ? "" : caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
$va_history[$va_date['sortable']][] = array('type' => 'ca_object_lots', 'id' => $vn_lot_id, 'display' => $t_lot->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_lot_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_lot_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_lot_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
}
}
}
// Loans
$va_loans = $this->get('ca_loans.loan_id', array('returnAsArray' => true));
if (is_array($va_loan_types = caGetOption('ca_loans_showTypes', $pa_bundle_settings, null)) && is_array($va_loans) && sizeof($va_loans)) {
$qr_loans = caMakeSearchResult('ca_loans', $va_loans);
$t_loan = new ca_loans();
$va_loan_type_info = $t_loan->getTypeList();
$va_date_elements_by_type = array();
foreach ($va_loan_types as $vn_type_id) {
if (!is_array($va_date_elements = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) {
$va_date_elements = array($va_date_elements);
}
if (!$va_date_elements) {
continue;
}
$va_date_elements_by_type[$vn_type_id] = $va_date_elements;
}
while ($qr_loans->nextHit()) {
$vn_loan_id = $qr_loans->get('loan_id');
if ((string) $qr_loans->get('ca_loans.deleted') !== '0') {
continue;
}
// filter out deleted
//.........这里部分代码省略.........
示例3: foreach
?>
</h2>
<?php
foreach ($va_entities as $va_entity) {
print "<div>" . ($this->request->config->get('allow_detail_for_ca_entities') ? caNavLink($this->request, $va_entity["label"], '', 'Detail', 'Entity', 'Show', array('entity_id' => $va_entity["entity_id"])) : $va_entity["label"]) . " (" . $va_entity['relationship_typename'] . ")</div>";
}
?>
</div><!-- end unit -->
<?php
}
# --- occurrences
$va_occurrences = $t_place->get("ca_occurrences", array("returnAsArray" => 1, 'checkAccess' => $va_access_values));
$va_sorted_occurrences = array();
if (sizeof($va_occurrences) > 0) {
$t_occ = new ca_occurrences();
$va_item_types = $t_occ->getTypeList();
foreach ($va_occurrences as $va_occurrence) {
$t_occ->load($va_occurrence['occurrence_id']);
$va_sorted_occurrences[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = $va_occurrence;
}
foreach ($va_sorted_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
?>
<div class="unit"><h2><?php
print _t("Related") . " " . $va_item_types[$vn_occurrence_type_id]['name_singular'] . (sizeof($va_occurrence_list) > 1 ? "s" : "");
?>
</h2>
<?php
foreach ($va_occurrence_list as $vn_rel_occurrence_id => $va_info) {
print "<div>" . ($this->request->config->get('allow_detail_for_ca_occurrences') ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"]) . " (" . $va_info['relationship_typename'] . ")</div>";
}
print "</div><!-- end unit -->";
示例4: foreach
foreach ($va_production_list as $vn_rel_production_id => $va_info) {
#print "<div class='relatedItem'>".(($this->request->config->get('allow_detail_for_ca_occurrences')) ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"])."</div>";
# --- no links to works detail?????
print "<div class='relatedItem'>" . caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $va_info['occurrence_id'])) . "<br/><span class='capsText'>" . $va_info['relationship_typename'] . "</span></div>";
}
print "</td><!-- end relatedWorks -->";
}
} else {
$vn_showRelatedFiller = 1;
}
# --- occurrences
$va_occurrences = $t_entity->get("ca_occurrences", array("returnAsArray" => 1, 'checkAccess' => $va_access_values, 'restrictToTypes' => array("work")));
$va_sorted_occurrences = array();
if (sizeof($va_occurrences) > 0) {
$t_occurrence = new ca_occurrences();
$va_item_types = $t_occurrence->getTypeList();
foreach ($va_occurrences as $va_occurrence) {
$t_occurrence->load($va_occurrence['occurrence_id']);
$va_sorted_occurrences[$va_occurrence['item_type_id']][$va_occurrence['occurrence_id']] = $va_occurrence;
}
foreach ($va_sorted_occurrences as $vn_occurrence_type_id => $va_occurrence_list) {
?>
<td id="relatedWorks"><h2><?php
print _t("Related Work") . "" . (sizeof($va_occurrence_list) > 1 ? "s" : "");
?>
</h2>
<?php
foreach ($va_occurrence_list as $vn_rel_occurrence_id => $va_info) {
#print "<div class='relatedItem'>".(($this->request->config->get('allow_detail_for_ca_occurrences')) ? caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $vn_rel_occurrence_id)) : $va_info["label"])."</div>";
# --- no links to works detail?????
print "<div class='relatedItem'>" . caNavLink($this->request, $va_info["label"], '', 'Detail', 'Occurrence', 'Show', array('occurrence_id' => $va_info['occurrence_id'])) . "<br/><span class='capsText'>" . $va_info['relationship_typename'] . "</span></div>";