本文整理汇总了PHP中caUcFirstUTF8Safe函数的典型用法代码示例。如果您正苦于以下问题:PHP caUcFirstUTF8Safe函数的具体用法?PHP caUcFirstUTF8Safe怎么用?PHP caUcFirstUTF8Safe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了caUcFirstUTF8Safe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
?>
</a>
<ul class="dropdown-menu" id="browse-menu">
<li class="browseNavFacet">
<div class="browseMenuContent container">
<?php
if (sizeof($va_browse_types) > 1) {
# --- only show browse targets if there are more than one
?>
<div class="mainfacet">
<ul class="nav nav-pills">
<?php
foreach ($va_browse_types as $vs_browse_name => $va_browse_type) {
#print "<div class='browseHeadernav'><a href='#'>".$vs_browse_name."</a></div>";
print "<div class='browseHeadernav caps'><li " . (!$vs_first_browse_name ? "class='active'" : "") . "><a href='#' onclick='jQuery(\"#browseMenuTypeFacet\").load(\"" . caNavUrl($this->request, '*', 'Browse', 'getBrowseNavBarByTarget', array('target' => $vs_browse_name)) . "\"); jQuery(this).parent().siblings().removeClass(\"active\"); jQuery(this).parent().addClass(\"active\"); return false;'>" . caUcFirstUTF8Safe($va_browse_type['displayName']) . "</a></li></div>";
if (!$vs_first_browse_name) {
$vs_first_browse_name = $va_browse_type['displayName'];
}
}
?>
</ul>
</div><!--end main facet-->
<?php
}
?>
<div id="browseMenuTypeFacet"> </div>
</div><!-- end browseMenuContent container -->
</li><!-- end browseNavFacet -->
</ul> <!--end dropdown-browse-menu -->
</li><!-- end dropdown -->
示例2: _t
print "<a href='#{$vs_block}'>" . $va_results[$vs_block]['displayName'] . " (" . $va_results[$vs_block]['count'] . ")</a>";
}
?>
</small>
<h1><?php
print _t("Search results for %1", caUcFirstUTF8Safe($this->getVar('search')));
?>
</h1>
<?php
//
// Print out block content (results for each type of search)
//
foreach ($this->getVar('blockNames') as $vs_block) {
?>
<a name='<?php
print $vs_block;
?>
'></a>
<div id="<?php
print $vs_block;
?>
Block" >
<?php
print $va_results[$vs_block]['html'];
?>
</div>
<?php
}
} else {
print "<H1>" . _t("Your search for %1 returned no results", caUcFirstUTF8Safe($this->getVar('search'))) . "</H1>";
}
示例3: getCriteriaForDisplay
/**
* Returns summary of current browse parameters suitable for display.
*
* @return string Summary of current browse criteria ready for display
*/
public function getCriteriaForDisplay()
{
$va_criteria = $this->opo_browse->getCriteriaWithLabels();
if (!sizeof($va_criteria)) {
return '';
}
$va_criteria_info = $this->opo_browse->getInfoForFacets();
$va_buf = array();
foreach ($va_criteria as $vs_facet => $va_vals) {
$va_buf[] = caUcFirstUTF8Safe($va_criteria_info[$vs_facet]['label_singular']) . ': ' . join(", ", $va_vals);
}
return join("; ", $va_buf);
}
示例4: caGetBrowseTypes
*
* ----------------------------------------------------------------------
*/
$va_browse_types = caGetBrowseTypes();
if (sizeof($va_browse_types)) {
?>
<li class="dropdown yamm-fw"> <!-- add class yamm-fw for full width-->
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php
print _t("Browse");
?>
</a>
<ul class="dropdown-menu" id="browse-menu">
<li class="browseNavFacet">
<div class="browseMenuContent container text-center">
<?php
if (sizeof($va_browse_types) > 1) {
?>
Find:
<?php
foreach ($va_browse_types as $vs_browse_name => $va_browse_type) {
print caNavLink($this->request, caUcFirstUTF8Safe($vs_browse_name) . ' ' . $va_browse_type["icon_class"] . '', 'browseMenuBrowseAll btn btn-default btn-lg', '', 'Browse', $vs_browse_name, '');
}
}
?>
</div><!-- end browseMenuContent container -->
</li><!-- end browseNavFacet -->
</ul> <!--end dropdown-browse-menu -->
</li><!-- end dropdown -->
<?php
}
示例5: getPlacementsInScreen
/**
* Returns list of placements in the currently loaded screen
*
* @param array $pa_options Optional array of options. Supported options are:
* noCache = if set to true, no caching of placement values is performed.
* user_id = if specified then placements are only returned if the user has at least read access to the screen
* @return array List of placements. Each element in the list is an array with the following keys:
* display = A display label for the bundle
* bundle = The bundle name
*/
public function getPlacementsInScreen($pa_options = null)
{
if (!is_array($pa_options)) {
$pa_options = array();
}
$pb_no_cache = isset($pa_options['noCache']) ? (bool) $pa_options['noCache'] : false;
$pn_user_id = isset($pa_options['user_id']) ? $pa_options['user_id'] : null;
//if ($pn_user_id && !$this->haveAccessToDisplay($pn_user_id, __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
// return array();
//}
if (!($pn_table_num = $this->getTableNum())) {
return null;
}
if (!($t_instance = $this->_DATAMODEL->getInstanceByTableNum($pn_table_num, true))) {
return null;
}
if (!is_array($va_placements = $this->getPlacements($pa_options))) {
$va_placements = array();
}
$va_placements_in_screen = array();
foreach ($va_placements as $vn_placement_id => $va_placement) {
$vs_bundle_proc = preg_replace('!^ca_attribute_!', '', $va_placement['bundle_name']);
$vs_label = ($vs_label = $t_instance->getDisplayLabel($t_instance->tableName() . '.' . $vs_bundle_proc)) ? $vs_label : $va_placement['bundle_name'];
if (is_array($va_placement['settings']['label'])) {
$va_tmp = caExtractValuesByUserLocale(array($va_placement['settings']['label']));
if ($vs_user_set_label = array_shift($va_tmp)) {
$vs_label = "{$vs_label} (<em>{$vs_user_set_label}</em>)";
}
}
$vs_display = "<div id='uiEditor_{$vn_placement_id}'><span class='bundleDisplayEditorPlacementListItemTitle'>" . caUcFirstUTF8Safe($t_instance->getProperty('NAME_SINGULAR')) . "</span> {$vs_label}</div>";
$va_placement['display'] = $vs_display;
$va_placement['bundle'] = $va_placement['bundle_name'];
// we used 'bundle' in the arrays, but the database field is called 'bundle_name' and getPlacements() returns data directly from the database
unset($va_placement['bundle_name']);
$va_placements_in_screen[$vn_placement_id] = $va_placement;
$vs_description = $t_instance->getDisplayDescription($t_instance->tableName() . '.' . $vs_bundle_proc);
TooltipManager::add("#uiEditor_{$vn_placement_id}", "<h2>{$vs_label}</h2>" . _t("Bundle name") . ": {$vs_bundle_proc}<br />" . (strlen($vs_description) > 0 ? _t("Description") . ": {$vs_description}<br />" : ""));
}
return $va_placements_in_screen;
}
示例6: _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;
}
示例7: caEditorInspector
//.........这里部分代码省略.........
$vs_label .= join(" / ", $va_collection_links) . ' > ';
}
if (method_exists($t_item, 'getLabelForDisplay')) {
$vn_parent_index = sizeof($va_ancestors) - 1;
if ($vn_parent_id && ($vs_table_name != 'ca_places' || $vn_parent_index > 0)) {
$va_parent = $va_ancestors[$vn_parent_index];
$vs_disp_fld = $t_item->getLabelDisplayField();
if ($va_parent['NODE'][$vs_disp_fld] && ($vs_editor_link = caEditorLink($po_view->request, $va_parent['NODE'][$vs_disp_fld], '', $vs_table_name, $va_parent['NODE'][$t_item->primaryKey()]))) {
$vs_label .= $vs_editor_link . ' > ' . $t_item->getLabelForDisplay();
} else {
$vs_label .= ($va_parent['NODE'][$vs_disp_fld] ? $va_parent['NODE'][$vs_disp_fld] . ' > ' : '') . $t_item->getLabelForDisplay();
}
} else {
$vs_label .= $t_item->getLabelForDisplay();
if ($vs_table_name === 'ca_editor_uis' && in_array($po_view->request->getAction(), array('EditScreen', 'DeleteScreen', 'SaveScreen'))) {
$t_screen = new ca_editor_ui_screens($po_view->request->getParameter('screen_id', pInteger));
if (!($vs_screen_name = $t_screen->getLabelForDisplay())) {
$vs_screen_name = _t('new screen');
}
$vs_label .= " > " . $vs_screen_name;
}
}
} else {
$vs_label .= $t_item->get('name');
}
}
}
$vb_show_idno = (bool) ($vs_idno = $t_item->get($t_item->getProperty('ID_NUMBERING_ID_FIELD')));
if (!$vs_label) {
switch ($vs_table_name) {
case 'ca_commerce_orders':
if ($t_item->get('order_type') == 'L') {
if ($vs_org = $t_item->get('billing_organization')) {
$vs_label = _t('%5 #%4 on %1 to %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
} else {
$vs_label = _t('%4 #%3 on %1 to %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
}
} else {
if ($vs_org = $t_item->get('billing_organization')) {
$vs_label = _t('%5 #%4 on %1 from %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
} else {
$vs_label = _t('%4 #%3 on %1 from %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
}
}
break;
default:
if ($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects) {
$vs_label = $vs_idno;
$vb_show_idno = false;
} else {
$vs_label = '[' . _t('BLANK') . ']';
}
break;
}
}
$vs_buf .= "<div class='recordTitle {$vs_table_name}' style='width:190px; overflow:hidden;'>{$vs_label}" . ($vb_show_idno ? "<a title='{$vs_idno}'>" . ($vs_idno ? " ({$vs_idno})" : '') : "") . "</a></div>";
if ($vs_table_name === 'ca_object_lots' && $t_item->getPrimaryKey()) {
$vs_buf .= "<div id='inspectorLotMediaDownload'><strong>" . (($vn_num_objects = $t_item->numObjects()) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n";
}
if ($po_view->request->config->get("include_custom_inspector")) {
if (file_exists($po_view->request->getViewsDirectoryPath() . "/bundles/inspector_info.php")) {
$vo_inspector_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
$vo_inspector_view->setVar('t_item', $t_item);
$vs_buf .= $vo_inspector_view->render('inspector_info.php');
}
}
示例8: count
<?php
if ($this->request->isLoggedIn() && $this->request->user->getPreference('ui_show_breadcrumbs') == 1) {
if (trim($vs_trail = join('<img src="' . $this->request->getThemeUrlPath() . '/graphics/arrows/breadcrumb.jpg">', $va_breadcrumb = $this->getVar('nav')->getDestinationAsBreadCrumbTrail()))) {
?>
<div class='navBreadCrumbContainer'>
<div class='navBreadCrumbs'>
<?php
$count = count($va_breadcrumb);
$i = 1;
print '<div class="crumb"><div class="crumbtext navBreadCrumbLabel">' . _t('Current location') . '</div><img src="' . $this->request->getThemeUrlPath() . '/graphics/arrows/breadcrumbloc.png" width="16" height="19" border="0"></div>';
foreach ($va_breadcrumb as $crumb) {
if ($i == $count) {
print '<div class="lastcrumb"><nobr><div class="crumbtext">' . caUcFirstUTF8Safe($crumb) . '</div><img src="' . $this->request->getThemeUrlPath() . '/graphics/arrows/breadcrumb.png" width="16" height="19" border="0"></nobr></div>';
} else {
print '<div class="crumb"><nobr><div class="crumbtext">' . caUcFirstUTF8Safe($crumb) . '</div><img src="' . $this->request->getThemeUrlPath() . '/graphics/arrows/breadcrumb.png" width="16" height="19" border="0"></nobr></div>';
$i++;
}
}
if (substr($this->request->getModulePath(), 0, 7) == 'editor/') {
print "<div class='expandCollapse'>";
print "<div style='padding: 5px; text-align: center;'><a href='#' id='expandAll' onclick='caBundleVisibilityManager.open(); return false;' style='margin-right: 5px;'><img src='" . $this->request->getThemeUrlPath() . "/graphics/arrows/collapsedown.png' width='16' height='12' border='0'></a> ";
print "<a href='#' id='collapseAll' onclick='caBundleVisibilityManager.close(); return false;'><img src='" . $this->request->getThemeUrlPath() . "/graphics/arrows/collapseup.png' width='16' height='12' border='0'></a></div>";
print "</div><!-- end expandCollapse-->";
TooltipManager::add('#expandAll', _t("Expand all metadata elements"));
TooltipManager::add('#collapseAll', _t("Collapse all metadata elements"));
}
?>
</div><!-- end navBreadCrumbs-->
</div><!-- end navBreadCrumbContainer -->
示例9: caGetFacetForMenuBar
/**
*
*
* @return (string)
*/
function caGetFacetForMenuBar($po_request, $vs_browse_type)
{
$vs_key = '';
//$po_request->session->getVar('objects_last_browse_id');
if (!($va_browse_info = caGetInfoForBrowseType($vs_browse_type))) {
// invalid browse type – throw error
return null;
}
$o_browse = caGetBrowseInstance($va_browse_info["table"]);
if ($vs_key) {
$o_browse->reload($vs_key);
}
$o_browse->execute(array('checkAccess' => caGetUserAccessValues($po_request), 'showAllForNoCriteriaBrowse' => true));
$va_facets = $o_browse->getInfoForAvailableFacets();
$vs_buf = '';
$vs_default_facet = null;
foreach ($va_facets as $vs_facet_name => $va_facet_info) {
if (!$vs_default_facet) {
$vs_default_facet = $vs_facet_name;
}
$vs_buf .= "<li " . (!$vs_buf ? "class='active'" : "") . "><a href='#' onclick='jQuery(\".browseMenuFacet\").load(\"" . caNavUrl($po_request, '*', 'Browse', $vs_browse_type, array('facet' => $vs_facet_name, 'getFacet' => 1, 'key' => $vs_key, 'isNav' => 1)) . "\", function() { jQuery(this).parent().scrollTop(0); }); jQuery(this).parent().siblings().removeClass(\"active\"); jQuery(this).parent().addClass(\"active\"); return false;'>" . caUcFirstUTF8Safe($va_facet_info['label_plural']) . "</a></li>\n";
}
if ($vs_default_facet) {
$vs_buf .= "<script type='text/javascript'>jQuery(document).ready(function() { jQuery(\".browseMenuFacet\").load(\"" . caNavUrl($po_request, '*', 'Browse', $vs_browse_type, array('facet' => $vs_default_facet, 'getFacet' => 1, 'key' => $vs_key, 'isNav' => 1)) . "\"); });</script>\n";
}
return $vs_buf;
}
示例10: Delete
/**
* Performs two-step delete of an existing record. The first step is a confirmation dialog, followed by actual deletion upon user confirmation
*
* @param array $pa_options Array of options passed through to _initView
*/
public function Delete($pa_options = null)
{
list($vn_subject_id, $t_subject, $t_ui) = $this->_initView($pa_options);
if (!$vn_subject_id) {
return;
}
if (!$this->_checkAccess($t_subject)) {
return false;
}
if (!($vs_type_name = $t_subject->getTypeName())) {
$vs_type_name = $t_subject->getProperty('NAME_SINGULAR');
}
//
// Does user have access to row?
//
if ($t_subject->getAppConfig()->get('perform_item_level_access_checking')) {
if ($t_subject->checkACLAccessForUser($this->request->user) < __CA_ACL_EDIT_DELETE_ACCESS__) {
$this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
return;
}
}
// get parent_id, if it exists, prior to deleting so we can
// set the browse_last_id parameter to something sensible
$vn_parent_id = null;
if ($vs_parent_fld = $t_subject->getProperty('HIERARCHY_PARENT_ID_FLD')) {
$vn_parent_id = $t_subject->get($vs_parent_fld);
}
if ($vn_subject_id && !$t_subject->getPrimaryKey()) {
$this->notification->addNotification(_t("%1 does not exist", $vs_type_name), __NOTIFICATION_TYPE_ERROR__);
return;
}
// Don't allow deletion of roots in simple mono-hierarchies... that's bad.
if (!$vn_parent_id && in_array($t_subject->getProperty('HIERARCHY_TYPE'), array(__CA_HIER_TYPE_SIMPLE_MONO__, __CA_HIER_TYPE_MULTI_MONO__))) {
$this->notification->addNotification(_t("Cannot delete root of hierarchy"), __NOTIFICATION_TYPE_ERROR__);
return;
}
if ($vb_confirm = $this->request->getParameter('confirm', pInteger) == 1 ? true : false) {
$vb_we_set_transaction = false;
if (!$t_subject->inTransaction()) {
$o_t = new Transaction();
$t_subject->setTransaction($o_t);
$vb_we_set_transaction = true;
}
// Do we need to move relationships?
if (($vn_remap_id = $this->request->getParameter('remapToID', pInteger)) && $this->request->getParameter('referenceHandling', pString) == 'remap') {
switch ($t_subject->tableName()) {
case 'ca_relationship_types':
if ($vn_c = $t_subject->moveRelationshipsToType($vn_remap_id)) {
$t_target = new ca_relationship_types($vn_remap_id);
$this->notification->addNotification($vn_c == 1 ? _t("Transferred %1 relationship to type <em>%2</em>", $vn_c, $t_target->getLabelForDisplay()) : _t("Transferred %1 relationships to type <em>%2</em>", $vn_c, $t_target->getLabelForDisplay()), __NOTIFICATION_TYPE_INFO__);
}
break;
default:
// update relationships
$va_tables = array('ca_objects', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations', 'ca_list_items', 'ca_loans', 'ca_movements', 'ca_tours', 'ca_tour_stops', 'ca_object_representations', 'ca_list_items');
$vn_c = 0;
foreach ($va_tables as $vs_table) {
$vn_c += $t_subject->moveRelationships($vs_table, $vn_remap_id);
}
// update existing metadata attributes to use remapped value
$t_subject->moveAuthorityElementReferences($vn_remap_id);
if ($vn_c > 0) {
$t_target = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
$t_target->load($vn_remap_id);
$this->notification->addNotification($vn_c == 1 ? _t("Transferred %1 relationship to <em>%2</em> (%3)", $vn_c, $t_target->getLabelForDisplay(), $t_target->get($t_target->getProperty('ID_NUMBERING_ID_FIELD'))) : _t("Transferred %1 relationships to <em>%2</em> (%3)", $vn_c, $t_target->getLabelForDisplay(), $t_target->get($t_target->getProperty('ID_NUMBERING_ID_FIELD'))), __NOTIFICATION_TYPE_INFO__);
}
break;
}
} else {
$t_subject->deleteAuthorityElementReferences();
}
$t_subject->setMode(ACCESS_WRITE);
$vb_rc = false;
if ($this->_beforeDelete($t_subject)) {
if ($vb_rc = $t_subject->delete(true)) {
$this->_afterDelete($t_subject);
}
}
if ($vb_we_set_transaction) {
if (!$vb_rc) {
$o_t->rollbackTransaction();
} else {
$o_t->commitTransaction();
}
}
}
$this->view->setVar('confirmed', $vb_confirm);
if ($t_subject->numErrors()) {
foreach ($t_subject->errors() as $o_e) {
$this->notification->addNotification($o_e->getErrorDescription(), __NOTIFICATION_TYPE_ERROR__);
}
} else {
if ($vb_confirm) {
$this->notification->addNotification(_t("%1 was deleted", caUcFirstUTF8Safe($vs_type_name)), __NOTIFICATION_TYPE_INFO__);
// update result list since it has changed
//.........这里部分代码省略.........
示例11: refine
/**
*
*/
public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null)
{
global $g_ui_locale_id;
$vs_delimiter = caGetOption('delimiter', $pa_options, null);
if (!($pn_locale_id = ca_locales::getDefaultCataloguingLocaleID())) {
$pn_locale_id = $g_ui_locale_id;
}
$o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null;
$t_mapping = caGetOption('mapping', $pa_options, null);
if ($t_mapping) {
$o_dm = Datamodel::load();
if ($t_mapping->get('table_num') != $o_dm->getTableNum('ca_list_items')) {
if ($o_log) {
$o_log->logError(_t("listItemIndentedHierarchyBuilder refinery may only be used in imports to ca_list_items"));
}
return null;
}
}
$va_group_dest = explode(".", $pa_group['destination']);
$vs_terminal = array_pop($va_group_dest);
$pm_value = $pa_source_data[$pa_item['source']];
// Get list of fields to insert
if (!is_array($va_levels = $pa_item['settings']['listItemIndentedHierarchyBuilder_levels'])) {
if ($o_log) {
$o_log->logError(_t("listItemIndentedHierarchyBuilder requires levels option be set to a list of data source placeholders"));
}
return null;
} else {
$va_level_types = $pa_item['settings']['listItemIndentedHierarchyBuilder_levelTypes'];
}
// Get list, or create if it doesn't already exist
if (!($vs_list_code = $pa_item['settings']['listItemIndentedHierarchyBuilder_list'])) {
if ($o_log) {
$o_log->logError(_t("listItemIndentedHierarchyBuilder requires list option be set"));
}
return null;
}
$t_list = new ca_lists();
if (!$t_list->load(array('list_code' => $vs_list_code))) {
// create list
$t_list->set('list_code', $vs_list_code);
$t_list->setMode(ACCESS_WRITE);
$t_list->insert();
if ($t_list->numErrors()) {
if ($o_log) {
$o_log->logError(_t("listItemIndentedHierarchyBuilder could not create list %1: %2", $vs_list_code, join("; ", $t_list->getErrors())));
}
return null;
}
$t_list->addLabel(array('name' => caUcFirstUTF8Safe($vs_list_code)), $pn_locale_id, null, true);
if ($t_list->numErrors()) {
if ($o_log) {
$o_log->logError(_t("listItemIndentedHierarchyBuilder could not create list label %1: %2", $vs_list_code, join("; ", $t_list->getErrors())));
}
return null;
}
}
// Handle each level
if (!is_array($va_level_values = listItemIndentedHierarchyBuilderRefinery::$opa_level_values)) {
$va_level_values = $va_level_value_ids = array();
}
$va_level_value_ids = listItemIndentedHierarchyBuilderRefinery::$opa_level_value_ids;
$vn_max_level = 0;
$vn_parent_id = null;
foreach ($va_levels as $vn_i => $vs_level_placeholder) {
$vs_level_value = null;
if (strlen($vs_level_placeholder)) {
if ($vs_level_value = BaseRefinery::parsePlaceholder($vs_level_placeholder, $pa_source_data, $pa_item, 0, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true))) {
if (!$vn_parent_id && isset(listItemIndentedHierarchyBuilderRefinery::$opa_level_value_ids[$vn_i - 1])) {
$vn_parent_id = listItemIndentedHierarchyBuilderRefinery::$opa_level_value_ids[$vn_i - 1];
}
$vs_type = isset($va_level_types[$vn_i]) ? $va_level_types[$vn_i] : null;
if ($vn_item_id = DataMigrationUtils::getListItemID($vs_list_code, preg_replace("![^A-Za-z0-9_]+!", "_", $vs_level_value), $vs_type, $pn_locale_id, array('is_enabled' => 1, 'parent_id' => $vn_parent_id, 'preferred_labels' => array('name_singular' => $vs_level_value, 'name_plural' => $vs_level_value)), array('matchOnIdno' => true, 'log' => $o_log, 'transaction' => caGetOption('transaction', $pa_options, null), 'importEvent' => caGetOption('event', $pa_options, null), 'importEventSource' => 'listItemIndentedHierarchyBuilder'))) {
$vn_parent_id = $vn_item_id;
$va_level_values[$vn_i] = $vs_level_value;
$va_level_value_ids[$vn_i] = $vn_item_id;
$vn_max_level = $vn_i;
}
}
}
}
listItemIndentedHierarchyBuilderRefinery::$opa_level_values = array_slice($va_level_values, 0, $vn_max_level + 1);
listItemIndentedHierarchyBuilderRefinery::$opa_level_value_ids = array_slice($va_level_value_ids, 0, $vn_max_level + 1);
if ($pa_item['settings']['listItemIndentedHierarchyBuilder_list'] == 'returnData') {
return $vn_parent_id;
}
return null;
}
示例12: getCriteriaForDisplay
/**
* Returns summary of current browse parameters suitable for display.
*
* @return string Summary of current browse criteria ready for display
*/
public function getCriteriaForDisplay($po_browse)
{
$va_criteria = $po_browse->getCriteriaWithLabels();
if (!sizeof($va_criteria)) {
return '';
}
$va_criteria_info = $po_browse->getInfoForFacets();
$va_buf = array();
foreach ($va_criteria as $vs_facet => $va_vals) {
foreach ($va_vals as $vn_i => $vs_val) {
$va_vals[$vn_i] = preg_replace("![A-Za-z_\\./]+[:]{1}!", "", $vs_val);
$va_vals[$vn_i] = trim(preg_replace("![\\*].!", "", $va_vals[$vn_i]));
$va_vals[$vn_i] = trim(preg_replace("![\\(\\)]+!", " ", $va_vals[$vn_i]));
}
$va_buf[] = caUcFirstUTF8Safe($va_criteria_info[$vs_facet]['label_singular']) . ': ' . join(", ", $va_vals);
}
return join(" / ", $va_buf);
}
示例13: caGetBundlesAvailableForSearch
//.........这里部分代码省略.........
}
} else {
if (isset($va_field_info['DONT_USE_AS_BUNDLE']) && $va_field_info['DONT_USE_AS_BUNDLE']) {
continue;
}
if (in_array($va_field_info['FIELD_TYPE'], array(FT_MEDIA, FT_FILE))) {
continue;
}
$vs_bundle = $vs_table . '.' . $vs_field;
$vs_label = $t_instance->getDisplayLabel($vs_bundle);
$va_available_bundles[$vs_label][$vs_bundle] = array('bundle' => $vs_bundle, 'label' => $vs_label, 'description' => $vs_description = $t_instance->getDisplayDescription($vs_bundle));
}
}
} else {
// related table
if ($o_config->get($vs_table . '_disable')) {
continue;
}
$t_table = $o_dm->getInstanceByTableName($vs_table, true);
if (method_exists($t_table, "getSubjectTableName") && ($vs_subject_table = $t_table->getSubjectTableName())) {
if ($o_config->get($vs_subject_table . '_disable')) {
continue;
}
}
if (caGetBundleAccessLevel($vs_primary_table, $vs_subject_table) == __CA_BUNDLE_ACCESS_NONE__) {
continue;
}
foreach ($va_fields['fields'] as $vs_field => $va_field_indexing_info) {
if (in_array('DONT_INCLUDE_IN_SEARCH_FORM', $va_field_indexing_info)) {
continue;
}
if (is_array($pa_filter) && sizeof($pa_filter) && !in_array($vs_table . '.' . $vs_field, $pa_filter)) {
continue;
}
if ($va_field_info = $t_table->getFieldInfo($vs_field)) {
if (isset($va_field_info['DONT_USE_AS_BUNDLE']) && $va_field_info['DONT_USE_AS_BUNDLE']) {
continue;
}
$vs_bundle = $vs_table . '.' . $vs_field;
$vs_related_table = caUcFirstUTF8Safe($t_table->getProperty('NAME_SINGULAR'));
if (method_exists($t_table, 'getSubjectTableInstance')) {
$t_subject = $t_table->getSubjectTableInstance();
$vs_related_table = caUcFirstUTF8Safe($t_subject->getProperty('NAME_SINGULAR'));
}
$vs_label = $t_instance->getDisplayLabel($vs_bundle);
$va_available_bundles[$vs_label][$vs_bundle] = array('bundle' => $vs_bundle, 'label' => $vs_label, 'description' => $vs_description = $t_instance->getDisplayDescription($vs_bundle));
}
}
}
}
//
// access points
//
$va_access_points = isset($va_search_settings['_access_points']) && is_array($va_search_settings['_access_points']) ? $va_search_settings['_access_points'] : array();
foreach ($va_access_points as $vs_access_point => $va_access_point_info) {
if (isset($va_access_point_info['options']) && is_array($va_access_point_info['options'])) {
if (in_array('DONT_INCLUDE_IN_SEARCH_FORM', $va_access_point_info['options'])) {
continue;
}
}
if (is_array($pa_filter) && sizeof($pa_filter) && !in_array($vs_access_point, $pa_filter)) {
continue;
}
$vs_label = isset($va_access_point_info['name']) && $va_access_point_info['name'] ? $va_access_point_info['name'] : $vs_access_point;
$va_available_bundles[$vs_label][$vs_access_point] = array('bundle' => $vs_access_point, 'label' => $vs_label, 'description' => $vs_description = isset($va_access_point_info['description']) && $va_access_point_info['description'] ? $va_access_point_info['description'] : '');
}
//
// created and modified
//
foreach (array('created', 'modified') as $vs_bundle) {
if (is_array($pa_filter) && sizeof($pa_filter) && !in_array($vs_bundle, $pa_filter)) {
continue;
}
$vs_label = $t_instance->getDisplayLabel($vs_bundle);
$va_available_bundles[$vs_label][$vs_bundle] = array('bundle' => $vs_bundle, 'label' => $vs_label, 'description' => $vs_description = $t_instance->getDisplayDescription($vs_bundle));
}
ksort($va_available_bundles);
$va_sorted_bundles = array();
foreach ($va_available_bundles as $vs_k => $va_val) {
foreach ($va_val as $vs_real_key => $va_info) {
if ($pb_for_select) {
$va_sorted_bundles[$va_info['label']] = $vs_real_key;
} else {
$va_sorted_bundles[$vs_real_key] = $va_info;
}
}
}
// rewrite bundles to used preferred_labels notation
if ($pb_for_select) {
foreach ($va_sorted_bundles as $vs_label => $vs_key) {
$va_tmp = explode('.', $vs_key);
if (preg_match('!_labels$!', $va_tmp[0])) {
if (($t_label_instance = $o_dm->getInstanceByTableName($va_tmp[0], true)) && is_a($t_label_instance, 'BaseLabel')) {
$va_sorted_bundles[$vs_label] = $t_label_instance->getSubjectTableName() . '.preferred_labels' . ($va_tmp[1] ? '.' . $va_tmp[1] : '');
}
}
}
}
return $va_sorted_bundles;
}
示例14: hookRenderMenuBar
/**
* Insert activity menu
*/
public function hookRenderMenuBar($pa_menu_bar)
{
if ($o_req = $this->getRequest()) {
$o_dm = Datamodel::load();
$va_activity_lists = array();
foreach (array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations', 'ca_loans', 'ca_movements', 'ca_list_items', 'ca_sets', 'ca_tours', 'ca_tour_stops') as $vs_table_name) {
$va_activity_menu_list = array();
if (!is_array($va_activity_list = $o_req->session->getVar($vs_table_name . '_duplicate_id_list'))) {
$va_activity_list = array();
}
if (sizeof($va_activity_list) == 0) {
continue;
}
$t_instance = $o_dm->getInstanceByTableName($vs_table_name, true);
$va_labels = $t_instance->getPreferredDisplayLabelsForIDs(array_keys($va_activity_list));
if ($vs_table_name === 'ca_occurrences') {
$vs_priv_name = 'can_duplicate_ca_occurrences';
// Output occurrences grouped by type with types as top-level menu items
$va_types = $t_instance->getTypeList();
$va_editor_url_info = caEditorUrl($o_req, $vs_table_name, null, true);
// sort occurrences by type
$va_sorted_by_type_id = array();
$va_keys = array_reverse(array_keys($va_activity_list));
foreach ($va_keys as $vn_id) {
$va_info = $va_activity_list[$vn_id];
$va_sorted_by_type_id[$va_info['type_id']][$vn_id] = $va_info;
}
foreach ($va_types as $vn_type_id => $va_type_info) {
$va_activity_menu_list = array();
if (isset($va_sorted_by_type_id[$vn_type_id]) && is_array($va_sorted_by_type_id[$vn_type_id])) {
foreach ($va_sorted_by_type_id[$vn_type_id] as $vn_id => $va_info) {
$va_activity_menu_list[$vs_table_name . '_' . $vn_type_id . '_' . $vn_id] = array('default' => $va_editor_url_info, 'displayName' => htmlspecialchars($va_labels[$vn_id], ENT_QUOTES, 'UTF-8') . (trim($va_info['idno']) ? ' [' . $va_info['idno'] . ']' : ''), 'is_enabled' => 1, 'requires' => array('action:' . $vs_priv_name => 'OR'), 'parameters' => array($va_editor_url_info['_pk'] => $vn_id, 'mode' => 'dupe'));
}
}
if (sizeof($va_activity_menu_list) > 0) {
$va_activity_lists[$vs_table_name . '_' . $vn_type_id] = array('displayName' => mb_strtolower(caUcFirstUTF8Safe($va_type_info['name_singular']), 'UTF-8'), 'submenu' => array("type" => 'static', 'navigation' => $va_activity_menu_list));
}
}
} else {
// Non-occurrences get grouped by their table
switch ($vs_table_name) {
case 'ca_list_items':
$vs_priv_name = 'can_duplicate_ca_lists';
break;
case 'ca_object_representations':
$vs_priv_name = 'can_duplicate_ca_objects';
break;
default:
$vs_priv_name = 'can_duplicate_' . $vs_table_name;
break;
}
$va_keys = array_reverse(array_keys($va_activity_list));
foreach ($va_keys as $vn_id) {
$va_info = $va_activity_list[$vn_id];
$va_editor_url_info = caEditorUrl($o_req, $vs_table_name, null, true);
$va_activity_menu_list[$vs_table_name . '_' . $vn_id] = array('default' => $va_editor_url_info, 'displayName' => htmlspecialchars($va_labels[$vn_id], ENT_QUOTES, 'UTF-8') . (trim($va_info['idno']) ? ' [' . $va_info['idno'] . ']' : ''), 'is_enabled' => 1, 'requires' => array('action:' . $vs_priv_name => 'OR'), 'parameters' => array($va_editor_url_info['_pk'] => $vn_id, 'mode' => 'dupe'));
}
$va_activity_lists[$vs_table_name] = array('displayName' => mb_strtolower(caUcFirstUTF8Safe($t_instance->getProperty('NAME_SINGULAR')), 'UTF-8'), 'navigation' => $va_activity_menu_list);
}
}
if (sizeof($va_activity_lists)) {
// only show duplicate menu if there are records used to create duplicates
$pa_menu_bar['New']['navigation']['spacer'] = array('is_enabled' => 0, 'displayName' => "<div class='sf-spacer'/><!-- empty --></div>", 'default' => null);
// Add duplicate menu to bottom of "New" menu
$pa_menu_bar['New']['navigation']['duplicate'] = array('default' => $va_editor_url_info, 'is_enabled' => 1, 'displayName' => _t('Duplicate from...'), 'submenu' => array("type" => 'static', 'navigation' => $va_activity_lists));
}
}
return $pa_menu_bar;
}
示例15: getPlacementsInDisplay
/**
* Returns list of placements in the currently loaded display
*
* @param array $pa_options Optional array of options. Supported options are:
* noCache = if set to true, no caching of placement values is performed.
* no_tooltips = if set no tooltips for available bundles will be emitted. Default is false - tooltips will be emitted.
* format = specifies label format for bundles. Valid values are "simple" (just the name of the element) or "full" (name of element, name of type of item element pertains to and alternate label, if defined). Default is "full"
* user_id = if specified then placements are only returned if the user has at least read access to the display
* @return array List of placements. Each element in the list is an array with the following keys:
* display = A display label for the bundle
* bundle = The bundle name
*/
public function getPlacementsInDisplay($pa_options = null)
{
if (!is_array($pa_options)) {
$pa_options = array();
}
$pb_no_cache = caGetOption('noCache', $pa_options, false);
$pn_user_id = caGetOption('user_id', $pa_options, null);
if ($pn_user_id && !$this->haveAccessToDisplay($pn_user_id, __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
return array();
}
$vb_show_tooltips = !caGetOption('no_tooltips', $pa_options, false);
$vs_format = caGetOption('format', $pa_options, 'full', array('validValues' => array('simple', 'full')));
if (!($pn_table_num = $this->getAppDatamodel()->getTableNum($this->get('table_num')))) {
return null;
}
if (!($t_instance = $this->getAppDatamodel()->getInstanceByTableNum($pn_table_num, true))) {
return null;
}
if (!is_array($va_placements = $this->getPlacements($pa_options))) {
$va_placements = array();
}
$va_placements_in_display = array();
foreach ($va_placements as $vn_placement_id => $va_placement) {
$vs_label = ($vs_label = $t_instance->getDisplayLabel($va_placement['bundle_name'])) ? $vs_label : $va_placement['bundle_name'];
if (is_array($va_placement['settings']) && is_array($va_placement['settings']['label'])) {
$va_tmp = caExtractValuesByUserLocale(array($va_placement['settings']['label']));
if ($vs_user_set_label = array_shift($va_tmp)) {
$vs_label = "{$vs_label} (<em>{$vs_user_set_label}</em>)";
}
}
$vs_display = "<div id='bundleDisplayEditor_{$vn_placement_id}'><span class='bundleDisplayEditorPlacementListItemTitle'>" . caUcFirstUTF8Safe($t_instance->getProperty('NAME_SINGULAR')) . "</span> {$vs_label}</div>";
$va_placement['display'] = $vs_format == 'simple' ? $vs_label : $vs_display;
$va_placement['bundle'] = $va_placement['bundle_name'];
// we used 'bundle' in the arrays, but the database field is called 'bundle_name' and getPlacements() returns data directly from the database
unset($va_placement['bundle_name']);
$va_placements_in_display[$vn_placement_id] = $va_placement;
$vs_description = $t_instance->getDisplayDescription($va_placement['bundle']);
if ($vb_show_tooltips) {
TooltipManager::add("#bundleDisplayEditor_{$vn_placement_id}", $this->_formatBundleTooltip($vs_label, $va_placement['bundle'], $vs_description));
}
}
return $va_placements_in_display;
}