本文整理汇总了PHP中ca_sets::getLabelForDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_sets::getLabelForDisplay方法的具体用法?PHP ca_sets::getLabelForDisplay怎么用?PHP ca_sets::getLabelForDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_sets
的用法示例。
在下文中一共展示了ca_sets::getLabelForDisplay方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParametersForDisplay
public function getParametersForDisplay($pa_rec)
{
$va_parameters = caUnserializeForDatabase($pa_rec["parameters"]);
$va_params = array();
$t_set = new ca_sets($va_parameters['set_id']);
$va_params['importing_from'] = array('label' => _t("Applying batch edits to set"), 'value' => $t_set->getLabelForDisplay());
$va_params['number_of_records'] = array('label' => _t("Records to edit"), 'value' => (int) $t_set->getItemCount(array('user_id' => $va_parameters['user_id'])));
$t_ui = new ca_editor_uis($va_parameters['ui_id']);
$t_screen = new ca_editor_ui_screens();
if ($t_screen->load(array('ui_id' => $t_ui->getPrimaryKey(), 'screen_id' => str_ireplace("screen", "", $va_parameters['screen'])))) {
$va_params['ui'] = array('label' => _t("Using interface"), 'value' => $t_ui->getLabelForDisplay() . " ➜ " . $t_screen->getLabelForDisplay());
}
return $va_params;
}
示例2: caEditorInspector
//.........这里部分代码省略.........
}
//
// Display flags; expressions for these are defined in app.conf in the <table_name>_inspector_display_flags directive
//
if (is_array($va_display_flags = $po_view->request->config->getAssoc("{$vs_table_name}_inspector_display_flags"))) {
$va_display_flag_buf = array();
foreach ($va_display_flags as $vs_exp => $vs_display_flag) {
$va_exp_vars = array();
foreach (ExpressionParser::getVariableList($vs_exp) as $vs_var_name) {
$va_exp_vars[$vs_var_name] = $t_item->get($vs_var_name, array('returnIdno' => true));
}
if (ExpressionParser::evaluate($vs_exp, $va_exp_vars)) {
$va_display_flag_buf[] = $t_item->getWithTemplate("{$vs_display_flag}");
}
}
if (sizeof($va_display_flag_buf) > 0) {
$vs_buf .= join("; ", $va_display_flag_buf);
}
}
$vs_label = '';
$vb_dont_use_labels_for_ca_objects = (bool) $t_item->getAppConfig()->get('ca_objects_dont_use_labels');
if (!($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects)) {
if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_title")) {
$vs_label = caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey()));
} else {
$va_object_collection_collection_ancestors = $po_view->getVar('object_collection_collection_ancestors');
if ($t_item->tableName() == 'ca_objects' && $t_item->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && is_array($va_object_collection_collection_ancestors) && sizeof($va_object_collection_collection_ancestors)) {
$va_collection_links = array();
foreach ($va_object_collection_collection_ancestors as $va_collection_ancestor) {
$va_collection_links[] = caEditorLink($po_view->request, $va_collection_ancestor['label'], '', 'ca_collections', $va_collection_ancestor['collection_id']);
}
$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 {
示例3: addToSet
/**
* Add items to specified set
*/
public function addToSet()
{
$vn_added_items_count = $vn_dupe_item_count = 0;
$ps_rows = $this->request->getParameter('item_ids', pString);
$pa_row_ids = explode(';', $ps_rows);
if (!$ps_rows || !sizeof($pa_row_ids)) {
$this->view->setVar('error', _t('Nothing was selected'));
} else {
$t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
$pn_set_id = $this->request->getParameter('set_id', pInteger);
$t_set = new ca_sets($pn_set_id);
$this->view->setVar('set_id', $pn_set_id);
$this->view->setVar('set_name', $t_set->getLabelForDisplay());
$this->view->setVar('error', '');
if ($t_set->getPrimaryKey() && $t_set->get('table_num') == $t_model->tableNum()) {
$va_item_ids = $t_set->getItemRowIDs(array('user_id' => $this->request->getUserID()));
foreach ($pa_row_ids as $vn_row_id) {
if (!$vn_row_id) {
continue;
}
if (isset($va_item_ids[$vn_row_id])) {
$vn_dupe_item_count++;
continue;
}
if ($t_set->addItem($vn_row_id, array(), $this->request->getUserID())) {
$va_item_ids[$vn_row_id] = 1;
$vn_added_items_count++;
} else {
$this->view->setVar('error', join('; ', $t_set->getErrors()));
}
}
} else {
$this->view->setVar('error', _t('Invalid set'));
}
}
$this->view->setVar('num_items_added', $vn_added_items_count);
$this->view->setVar('num_items_already_in_set', $vn_dupe_item_count);
$this->render('Results/ajax_add_to_set_json.php');
}
示例4: displaySet
public function displaySet()
{
# --- set info
$pn_set_id = $this->request->getParameter('set_id', pInteger);
$t_set = new ca_sets($pn_set_id);
$va_access_values = caGetUserAccessValues($this->request);
# Enforce access control
if (sizeof($va_access_values) && !in_array($t_set->get("access"), $va_access_values)) {
$this->notification->addNotification(_t("This set is not available for view"), "message");
$this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
return;
}
$this->view->setVar('t_set', $t_set);
$va_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('widepreview', 'medium', 'setimage'), "checkAccess" => $va_access_values)));
$this->view->setVar('items', $va_items);
$va_row_ids = array();
foreach ($va_items as $vn_item_id => $va_item_info) {
$va_row_ids[] = $va_item_info['row_id'];
}
# --- all featured sets - for display in right hand column
// get sets for public display
$t_list = new ca_lists();
$vn_public_set_type_id = $t_list->getItemIDFromList('set_types', $t_list->getAppConfig()->get('simpleGallery_set_type'));
$t_set = new ca_sets($pn_set_id);
$va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'checkAccess' => $va_access_values, 'setType' => $vn_public_set_type_id)));
$va_set_first_items = array();
$va_set_first_items = $t_set->getFirstItemsFromSets(array_keys($va_sets), array("version" => "icon", "checkAccess" => $va_access_values));
$this->view->setVar('sets', $va_sets);
$this->view->setVar('first_items_from_sets', $va_set_first_items);
$this->view->setVar('set_title', $t_set->getLabelForDisplay());
$this->view->setVar('set_description', $t_set->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLinkBreaks' => true)));
// Needed to figure out what result context to use on details
$this->opo_result_context->setParameter('set_id', $pn_set_id);
$this->opo_result_context->setResultList($va_row_ids);
$this->opo_result_context->setAsLastFind();
$this->opo_result_context->saveContext();
$this->render($this->ops_theme . '/set_info_html.php');
}
示例5: foreach
?>
</H1>
<?php
if ($va_errors["general"]) {
print "<div class='alert alert-danger'>" . $va_errors["general"] . "</div>";
}
?>
<form id="AddItemForm" action="#" class="form-horizontal" role="form">
<?php
if (is_array($va_write_sets) && sizeof($va_write_sets)) {
$t_write_set = new ca_sets();
print "<div class='form-group'><div class='col-sm-offset-4 col-sm-7'><select name='set_id' class='form-control'>";
print "<option value=''>" . _t("Select a lightbox") . "</option>\n";
foreach ($va_write_sets as $va_write_set) {
$t_write_set->load($va_write_set["set_id"]);
print "<option value='" . $va_write_set["set_id"] . "'>" . $t_write_set->getLabelForDisplay() . "</option>\n";
}
print "</select>\n";
print "</div><!-- end col-sm-7 --></div><!-- end form-group -->\n";
print "<div class='form-group'><div class='col-sm-offset-4 col-sm-7'><H3>" . _t("OR Create a New Lightbox") . "</H3></div></div><!-- end form-group -->\n";
}
print "<div class='form-group'><label for='name' class='col-sm-4 control-label'>" . _t("Name") . "</label><div class='col-sm-7'><input type='text' name='name' placeholder='Your lightbox' class='form-control'></div><!-- end col-sm-7 --></div><!-- end form-group -->\n";
#print $t_set->htmlFormElement("access","<div class='form-group'><label for='access' class='col-sm-4 control-label'>"._t("Display Option")."</label><div class='col-sm-7' class='form-control'>^ELEMENT</div><!-- end col-sm-7 --></div><!-- end form-group -->\n", array("classname" => "form-control"));
print "<div class='form-group'><label for='description' class='col-sm-4 control-label'>" . _t("Description") . "</label><div class='col-sm-7'><textarea name='description' class='form-control' rows='3'></textarea></div><!-- end col-sm-7 --></div><!-- end form-group -->\n";
?>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-7">
<button type="submit" class="btn btn-default">Save</button>
</div><!-- end col-sm-7 -->
</div><!-- end form-group -->
<input type="hidden" name="object_id" value="<?php
示例6: floor
?>
px; margin-left: <?php
print floor((160 - $vn_item_width) / 2);
?>
px'><a href='#' onclick='loadSet(<?php
print $va_set['set_id'];
?>
); return false;'><?php
print $va_item['representation_tag'];
?>
</a></div>
</div>
</div>
<?php
if ($t_set->getLabelForDisplay()) {
// set view vars for tooltip
$this->setVar('tooltip_text', preg_replace('![\\n\\r]+!', '<br/><br/>', $t_set->getLabelForDisplay()));
TooltipManager::add(".set{$va_set['set_id']}", $this->render('features_tooltip_html.php'));
}
}
$vn_i++;
if ($vn_i == 3) {
print "</div>";
$vn_i = 0;
}
}
if ($vn_i) {
print "</div>";
}
?>
示例7: Index
function Index()
{
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(true);
JavascriptLoadManager::register('imageScroller');
JavascriptLoadManager::register('browsable');
JavascriptLoadManager::register('tabUI');
$t_object = new ca_objects();
$t_featured = new ca_sets();
if ($this->request->config->get("dont_enforce_access_settings")) {
$va_access_values = array();
} else {
$va_access_values = caGetUserAccessValues($this->request);
}
# --- featured items set - set name assigned in app.conf
$featured_sets = $this->request->config->get('featured_sets');
$len = count($featured_sets);
if ($len > 3) {
$len = 3;
}
for ($i = 0; $i < $len; $i++) {
$t_featured->load(array('set_code' => $featured_sets[$i]));
$set_id = $t_featured->getPrimaryKey();
$set_title = $t_featured->getLabelForDisplay();
$set_desc = $t_featured->getAttributeFromSets('description', array(0 => $set_id));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());
// These are the object ids in the set
if (is_array($va_featured_ids) && sizeof($va_featured_ids) > 0) {
$t_object = new ca_objects($va_featured_ids[0]);
$va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'medium', 'mediumlarge', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
$featured_set_id_array[$i] = array('featured_set_code' => $featured_sets[$i], 'featured_content_id' => $va_featured_ids[0], 'featured_content_small' => $va_rep["tags"]["small"], 'featured_content_label' => $set_title, 'featured_content_description' => $set_desc[$set_id][0], 'featured_set_id' => $set_id);
}
}
$this->view->setVar('featured_set_id_array', $featured_set_id_array);
# --- user favorites get the highest ranked objects to display
$va_user_favorites_items = $t_object->getHighestRated(true, 12, $va_access_values);
if (sizeof($va_user_favorites_items) > 0) {
if (is_array($va_user_favorites_items) && sizeof($va_user_favorites_items) > 0) {
$t_object = new ca_objects($va_user_favorites_items[0]);
$va_rep = $t_object->getPrimaryRepresentation(array('thumbnail', 'small', 'preview', 'widepreview'), null, array('return_with_access' => $va_access_values));
$this->view->setVar('user_favorites_id', $va_user_favorites_items[0]);
$this->view->setVar('user_favorites_thumb', $va_rep["tags"]["thumbnail"]);
$this->view->setVar('user_favorites_small', $va_rep["tags"]["small"]);
$this->view->setVar('user_favorites_preview', $va_rep["tags"]["preview"]);
$this->view->setVar('user_favorites_widepreview', $va_rep["tags"]["widepreview"]);
}
} else {
$this->view->setVar('user_favorites_is_random', 1);
# if no ranks set, choose a random object
$va_random_items = $t_object->getRandomItems(1, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_random_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_random_items), array('small', 'thumbnail', 'preview', 'medium', 'widepreview'), array("checkAccess" => $va_access_values));
foreach ($va_random_items as $vn_object_id => $va_object_info) {
$va_object_info['title'] = $va_labels[$vn_object_id];
$va_object_info['media'] = $va_media[$vn_object_id];
$va_random_items[$vn_object_id] = $va_object_info;
}
$this->view->setVar('random_objects', $va_random_items);
if (is_array($va_random_items) && sizeof($va_random_items) > 0) {
$va_object_info = array_shift($va_random_items);
$this->view->setVar('user_favorites_id', $va_object_info['object_id']);
$this->view->setVar('user_favorites_thumb', $va_media[$va_object_info['object_id']]["tags"]["thumbnail"]);
$this->view->setVar('user_favorites_small', $va_media[$va_object_info['object_id']]["tags"]["small"]);
$this->view->setVar('user_favorites_preview', $va_media[$va_object_info['object_id']]["tags"]["preview"]);
$this->view->setVar('user_favorites_widepreview', $va_media[$va_object_info['object_id']]["tags"]["widepreview"]);
$this->view->setVar('user_favorites_medium', $va_media[$va_object_info['object_id']]["tags"]["medium"]);
}
}
#---- new 'recently added'
$t_set = new ca_sets();
$ra_set_code = $this->request->config->get('recently_added_set_id');
$t_set->load(array('set_code' => $ra_set_code));
$set_id = $t_set->getPrimaryKey();
$ra_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('thumbnail', 'preview'), "checkAccess" => 1)));
$va_recently_added = array();
foreach ($ra_items as $va_item_info) {
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
}
# --- get the 12 most recently added objects to display
/*$va_recently_added_ids = $t_object->getRecentlyAddedItems(15, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
if(is_array($va_recently_added_ids) && sizeof($va_recently_added_ids) > 0){
$va_recently_added = array();
foreach($va_recently_added_ids as $va_item_info){
$vn_r_object_id = $va_item_info['object_id'];
$t_object->load($vn_r_object_id);
$va_reps = $t_object->getPrimaryRepresentation(array('thumbnail', 'preview'), null, array('return_with_access' => $va_access_values));
$va_recently_added[$vn_r_object_id] = $va_reps["tags"]["preview"];
}
}*/
$this->view->setVar('recently_added', $va_recently_added);
$this->render('Splash/splash_html.php');
}
示例8: importMediaFromDirectory
//.........这里部分代码省略.........
}
}
$o_log->logDebug("Names to match: " . print_r($va_names_to_match, true));
foreach ($va_names_to_match as $vs_match_name) {
if (preg_match('!' . $vs_regex . '!', $vs_match_name, $va_matches)) {
$o_log->logDebug(_t("Matched name %1 on regex %2", $vs_match_name, $vs_regex));
if (!$vs_idno || strlen($va_matches[1]) < strlen($vs_idno)) {
$vs_idno = $va_matches[1];
}
if (!$vs_modified_filename || strlen($vs_modified_filename) > strlen($va_matches[1])) {
$vs_modified_filename = $va_matches[1];
}
$va_extracted_idnos_from_filename[] = $va_matches[1];
if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'ALWAYS_MATCH'))) {
if (!is_array($va_fields_to_match_on = $po_request->config->getList('batch_media_import_match_on')) || !sizeof($va_fields_to_match_on)) {
$batch_media_import_match_on = array('idno');
}
$vs_bool = 'OR';
$va_values = array();
foreach ($va_fields_to_match_on as $vs_fld) {
if (in_array($vs_fld, array('preferred_labels', 'nonpreferred_labels'))) {
$va_values[$vs_fld] = array($vs_fld => array('name' => $va_matches[1]));
} else {
$va_values[$vs_fld] = $va_matches[1];
}
}
if (is_array($va_limit_matching_to_type_ids) && sizeof($va_limit_matching_to_type_ids) > 0) {
$va_values['type_id'] = $va_limit_matching_to_type_ids;
$vs_bool = 'AND';
}
$o_log->logDebug("Trying to find records using boolean {$vs_bool} and values " . print_r($va_values, true));
if (class_exists($vs_import_target) && ($vn_id = $vs_import_target::find($va_values, array('returnAs' => 'firstId', 'boolean' => $vs_bool)))) {
if ($t_instance->load($vn_id)) {
$va_notices[$vs_relative_directory . '/' . $vs_match_name . '_match'] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Matched media %1 from %2 to %3 using expression "%4"', $f, $vs_relative_directory, caGetTableDisplayName($vs_import_target, false), $va_regex_info['displayName']), 'status' => 'MATCHED');
$o_log->logInfo($vs_msg);
}
break 3;
}
}
} else {
$o_log->logDebug(_t("Couldn't match name %1 on regex %2", $vs_match_name, $vs_regex));
}
}
}
}
}
if (!$t_instance->getPrimaryKey()) {
// Use filename as idno if all else fails
if ($t_instance->load(array('idno' => $f, 'deleted' => 0))) {
$va_notices[$vs_relative_directory . '/' . $f . '_match'] = array('idno' => $t_instance->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_instance->getLabelForDisplay(), 'message' => $vs_msg = _t('Matched media %1 from %2 to %3 using filename', $f, $vs_relative_directory, caGetTableDisplayName($vs_import_target, false)), 'status' => 'MATCHED');
$o_log->logInfo($vs_msg);
}
}
switch ($vs_representation_idno_mode) {
case 'filename':
// use the filename as identifier
$vs_rep_idno = $f;
break;
case 'filename_no_ext':
// use filename without extension as identifier
$vs_rep_idno = preg_replace('/\\.[^.\\s]{3,4}$/', '', $f);
break;
case 'directory_and_filename':
// use the directory + filename as identifier
$vs_rep_idno = $d . '/' . $f;
break;
示例9: count
-->
<!--
<h2>Highlights from the Collection</h2>
<?php
$t_featured = new ca_sets();
$featured_sets = $this->request->config->get('featured_sets');
$len = count($featured_sets);
if ($len > 3) {
$len = 3;
}
for ($i = 0; $i < $len; $i++) {
$t_featured->load(array('set_code' => $featured_sets[$i]));
$set_id = $t_featured->getPrimaryKey();
$set_title = $t_featured->getLabelForDisplay();
$set_desc = $t_featured->getAttributeFromSets('description', array(0 => $set_id));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 0))) ? $va_tmp : array());
// These are the object ids in the set
if (is_array($va_featured_ids) && sizeof($va_featured_ids) > 0) {
$t_object = new ca_objects($va_featured_ids[0]);
$va_rep = $t_object->getPrimaryRepresentation(array('preview', 'preview170'), null, array('return_with_access' => $va_access_values));
$featured_set_id_array[$i] = array('featured_set_code' => $featured_sets[$i], 'featured_content_id' => $va_featured_ids[0], 'featured_content_small' => $va_rep["tags"]["preview"], 'featured_content_label' => $set_title, 'featured_content_description' => $set_desc[$set_id][0], 'featured_set_id' => $set_id);
}
}
?>
<?php
if (isset($featured_set_id_array)) {
?>
<table class="featured-list" cell-padding="0" cell-spacing="0">
示例10: importMediaFromDirectory
//.........这里部分代码省略.........
continue;
}
$t_object = new ca_objects();
$t_object->setTransaction($o_trans);
$vs_modified_filename = $f;
$va_extracted_idnos_from_filename = array();
if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'ALWAYS_MATCH')) || is_array($va_create_relationship_for) && sizeof($va_create_relationship_for)) {
foreach ($va_regex_list as $vs_regex_name => $va_regex_info) {
foreach ($va_regex_info['regexes'] as $vs_regex) {
$va_names_to_match = array();
switch ($vs_match_mode) {
case 'DIRECTORY_NAME':
$va_names_to_match = array($d);
break;
case 'FILE_AND_DIRECTORY_NAMES':
$va_names_to_match = array($f, $d);
break;
default:
case 'FILE_NAME':
$va_names_to_match = array($f);
break;
}
foreach ($va_names_to_match as $vs_match_name) {
if (preg_match('!' . $vs_regex . '!', $vs_match_name, $va_matches)) {
if (!$vs_idno || strlen($va_matches[1]) < strlen($vs_idno)) {
$vs_idno = $va_matches[1];
}
if (!$vs_modified_filename || strlen($vs_modified_filename) > strlen($va_matches[1])) {
$vs_modified_filename = $va_matches[1];
}
$va_extracted_idnos_from_filename[] = $va_matches[1];
if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'ALWAYS_MATCH'))) {
if ($t_object->load(array('idno' => $va_matches[1], 'deleted' => 0))) {
$va_notices[$vs_relative_directory . '/' . $vs_match_name . '_match'] = array('idno' => $t_object->get($t_object->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_object->getLabelForDisplay(), 'message' => _t('Matched media %1 from %2 to object using %2', $f, $vs_relative_directory, $vs_regex_name), 'status' => 'MATCHED');
break 3;
}
}
}
}
}
}
}
if (!$t_object->getPrimaryKey()) {
// Use filename as idno if all else fails
if ($t_object->load(array('idno' => $f, 'deleted' => 0))) {
$va_notices[$vs_relative_directory . '/' . $f . '_match'] = array('idno' => $t_object->get($t_object->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_object->getLabelForDisplay(), 'message' => _t('Matched media %1 from %2 to object using filename', $f, $vs_relative_directory), 'status' => 'MATCHED');
}
}
$t_new_rep = null;
if ($t_object->getPrimaryKey()) {
// found existing object
$t_object->setMode(ACCESS_WRITE);
$t_new_rep = $t_object->addRepresentation($vs_directory . '/' . $f, $vn_rep_type_id, $vn_locale_id, $vn_object_representation_status, $vn_object_representation_access, false, array(), array('original_filename' => $f, 'returnRepresentation' => true));
if ($t_object->numErrors()) {
$o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => "Error importing {$f} from {$vs_directory}: " . join('; ', $t_object->getErrors())));
$va_errors[$vs_relative_directory . '/' . $f] = array('idno' => $t_object->get($t_object->getProperty('ID_NUMBERING_ID_FIELD')), 'label' => $t_object->getLabelForDisplay(), 'errors' => $t_object->errors(), 'message' => _t("Error importing %1 from %2: %3", $f, $vs_relative_directory, join('; ', $t_object->getErrors())), 'status' => 'ERROR');
$o_trans->rollback();
continue;
} else {
if ($vb_delete_media_on_import) {
@unlink($vs_directory . '/' . $f);
}
}
} else {
// should we create new object?
if (in_array($vs_import_mode, array('TRY_TO_MATCH', 'DONT_MATCH'))) {
示例11: caGetGalleryConfig
<div>
<H1><?php
print $this->getVar("section_name");
?>
</H1>
<?php
$o_config = caGetGalleryConfig();
$va_access_values = caGetUserAccessValues($this->request);
$va_sets = $this->getVar("sets");
$va_first_items_from_set = $this->getVar("first_items_from_sets");
print "<div class='container'>";
if (is_array($va_sets) && sizeof($va_sets)) {
$t_set = new ca_sets();
foreach ($va_sets as $vn_set_id => $va_set) {
$t_set->load($vn_set_id);
print "<div class='row'>";
print "<div class='col-sm-12 col-sm-offset-0 col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3'><div class='galleryListItem'>";
$va_first_item = array_shift(array_shift($t_set->getFirstItemsFromSets(array($vn_set_id), array("version" => "small", "checkAccess" => $va_access_values))));
print "<div class='galleryListItemImg'>" . $va_first_item["representation_tag"] . "</div>";
print "<H3>" . $t_set->getLabelForDisplay() . "</H3>";
print "<p class='count'>" . $t_set->getItemCount(array("checkAccess" => $va_access_values)) . " items</p>";
if ($vs_description = $t_set->get($o_config->get('gallery_set_description_element_code'))) {
print "<p><strong>" . $vs_description . "</strong></p>";
}
print caNavLink($this->request, "<span class='glyphicon glyphicon-th-large'></span>", "", "", "Gallery", $t_set->get("set_id")) . " " . caNavLink($this->request, "<strong>" . _t("VIEW GALLERY") . "</strong>", "", "", "Gallery", $t_set->get("set_id"));
print "<div style='clear:both;'></div></div></div></div>\n";
}
}
print "</div>";
?>
</div>