本文整理汇总了PHP中ca_lists::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::addItem方法的具体用法?PHP ca_lists::addItem怎么用?PHP ca_lists::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::addItem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strlen
break;
default:
$vn_type_id = null;
$pb_is_enabled = true;
break;
}
//print_r($va_subject);
print str_repeat(chr(8), $vn_last_message_length);
$vs_message = "\tIMPORTING #" . ($vn_term_count + 1) . " [" . $va_subject['term_number'] . "] " . $vs_preferred_term_dutch . '/' . $vs_preferred_term_english;
if (($vn_l = 200 - strlen($vs_message)) < 1) {
$vn_l = 1;
}
$vs_message .= str_repeat(' ', $vn_l);
$vn_last_message_length = strlen($vs_message);
print $vs_message;
if ($t_item = $t_list->addItem($va_subject['term_number'], $pb_is_enabled, false, null, $vn_type_id, $va_subject['term_number'], '', 4, 1)) {
// add preferred labels
if ($vs_preferred_term_dutch) {
if (!$t_item->addLabel(array('name_singular' => $vs_preferred_term_dutch, 'name_plural' => $vs_preferred_term_dutch, 'description' => $va_subject['description_dutch']), $pn_nl_locale_id, null, true)) {
print "ERROR: Could not add Dutch preferred label to AAT term [" . $va_subject['term_number'] . "] " . $vs_preferred_term_dutch . ": " . join("; ", $t_item->getErrors()) . "\n";
}
}
if ($vs_preferred_term_english) {
if (!$t_item->addLabel(array('name_singular' => $vs_preferred_term_english, 'name_plural' => $vs_preferred_term_english, 'description' => $va_subject['description_english']), $pn_nl_locale_id, null, true)) {
print "ERROR: Could not add English preferred label to AAT term [" . $va_subject['term_number'] . "] " . $vs_preferred_term_english . ": " . join("; ", $t_item->getErrors()) . "\n";
}
}
$va_aat_id_to_item_id[$vs_preferred_term_dutch] = $va_aat_id_to_item_id[$vs_preferred_term_english] = $t_item->getPrimaryKey();
if (!($va_parent_child_links[$vs_pref_key] = $va_subject['parent_dutch'])) {
$va_parent_child_links[$vs_pref_key] = $va_subject['parent_english'];
}
示例2: getListItemID
//.........这里部分代码省略.........
break 2;
}
break;
}
}
if ($vn_item_id) {
DataMigrationUtils::$s_cached_list_item_ids[$vs_cache_key] = $vn_item_id;
if ($o_event) {
$o_event->beginItem($ps_event_source, 'ca_list_items', 'U');
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
if (($vb_force_update = caGetOption('forceUpdate', $pa_options, false)) || ($vb_return_instance = caGetOption('returnInstance', $pa_options, false))) {
$vb_has_attr = false;
if ($vb_force_update) {
foreach ($pa_values as $vs_element => $va_values) {
if ($t_item->hasElement($vs_element)) {
$vb_has_attr = true;
break;
}
}
}
if ($vb_return_instance || $vb_force_update && $vb_has_attr) {
$t_item = new ca_list_items($vn_item_id);
if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
$t_item->setTransaction($pa_options['transaction']);
}
}
$vb_attr_errors = false;
if ($vb_force_update && $vb_has_attr) {
$vb_attr_errors = !DataMigrationUtils::_setAttributes($t_item, $pn_locale_id, $pa_values, $pa_options);
}
if ($o_event) {
if ($vb_attr_errors) {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_item->getErrors())));
} else {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
}
if ($vb_return_instance) {
return $t_item;
}
}
return $vn_item_id;
}
if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
return false;
}
//
// Need to create list item
//
if (!$t_list->load($vn_list_id)) {
if ($o_log) {
$o_log->logError(_t("Could not find list with list id %1", $vn_list_id));
}
return null;
}
if ($o_event) {
$o_event->beginItem($ps_event_source, 'ca_list_items', 'I');
}
if ($t_item = $t_list->addItem($ps_item_idno, $pa_values['is_enabled'], $pa_values['is_default'], $vn_parent_id, $pn_type_id, $ps_item_idno, '', (int) $pa_values['status'], (int) $pa_values['access'], $pa_values['rank'])) {
$vb_label_errors = false;
$t_item->addLabel(array('name_singular' => $vs_singular_label, 'name_plural' => $vs_plural_label), $pn_locale_id, null, true);
if ($t_item->numErrors()) {
if ($pb_output_errors) {
print "[Error] " . _t("Could not set preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())) . "\n";
}
if ($o_log) {
$o_log->logError(_t("Could not set preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())));
}
$vb_label_errors = true;
}
unset($pa_values['access']);
unset($pa_values['status']);
unset($pa_values['idno']);
unset($pa_values['source_id']);
$vb_attr_errors = !DataMigrationUtils::_setAttributes($t_item, $pn_locale_id, $pa_values, $pa_options);
DataMigrationUtils::_setNonPreferredLabels($t_item, $pn_locale_id, $pa_options);
DataMigrationUtils::_setIdno($t_item, $ps_item_idno, $pa_options);
$vn_item_id = DataMigrationUtils::$s_cached_list_item_ids[$vs_cache_key] = $t_item->getPrimaryKey();
if ($o_event) {
if ($vb_attr_errors || $vb_label_errors) {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting field values: %1", join('; ', $t_item->getErrors())));
} else {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
}
if ($o_log) {
$o_log->logInfo(_t("Created new list item %1 in list %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", $pm_list_code_or_id));
}
if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
return $t_item;
}
return $vn_item_id;
} else {
if ($o_log) {
$o_log->logError(_t("Could not find add item to list: %1", join("; ", $t_list->getErrors())));
}
}
return null;
}
示例3: join
$t_list->setMode(ACCESS_WRITE);
$t_list->set('list_code', 'place_hierarchies');
$t_list->set('is_system_list', 1);
$t_list->set('is_hierarchical', 1);
$t_list->set('use_as_vocabulary', 0);
$t_list->insert();
if ($t_list->numErrors()) {
print "[Error] couldn't create ca_list row for place hierarchies: " . join('; ', $t_list->getErrors()) . "\n";
die;
}
$t_list->addLabel(array('name' => 'Place hierarchies'), $pn_en_locale_id, null, true);
}
$vn_list_id = $t_list->getPrimaryKey();
// create place hierarchy
if (!($vn_tgn_id = caGetListItemID('place_hierarchies', 'tgn'))) {
$t_tgn = $t_list->addItem('tgn', true, false, null, null, 'tgn');
$t_tgn->addLabel(array('name_singular' => 'Thesaurus of Geographic Names', 'name_plural' => 'Thesaurus of Geographic Names'), $pn_en_locale_id, null, true);
$vn_tgn_id = $t_tgn->getPrimaryKey();
} else {
$t_tgn = new ca_list_items($vn_tgn_id);
}
// Create list for place types (if it doesn't exist already)
$t_place_types = new ca_lists();
if (!$t_place_types->load(array('list_code' => 'tgn_place_types'))) {
$t_place_types->setMode(ACCESS_WRITE);
$t_place_types->set('list_code', 'tgn_place_types');
$t_place_types->set('is_system_list', 1);
$t_place_types->set('is_hierarchical', 1);
$t_place_types->set('use_as_vocabulary', 1);
$t_place_types->insert();
if ($t_place_types->numErrors()) {
示例4: getListItemID
//.........这里部分代码省略.........
if ($o_log) {
$o_log->logError(_t("Could not find list with list code %1", $pm_list_code_or_id));
}
return DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id] = null;
}
$t_list = new ca_lists();
$t_item = new ca_list_items();
if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
$t_list->setTransaction($pa_options['transaction']);
$t_item->setTransaction($pa_options['transaction']);
}
$va_find_arr = array('list_id' => $vn_list_id);
if ($vn_parent_id) {
$va_find_arr['parent_id'] = $vn_parent_id;
}
$vn_item_id = null;
if ($pb_match_on_label) {
if (!($vn_item_id = ca_list_items::find(array_merge(array('preferred_labels' => array('name_singular' => $ps_item_idno)), $va_find_arr), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction'])))) {
$vn_item_id = ca_list_items::find(array_merge(array('preferred_labels' => array('name_plural' => $ps_item_idno)), $va_find_arr), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']));
}
if ($vn_item_id) {
DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id] = $vn_item_id;
if ($o_event) {
$o_event->beginItem($vs_event_source, 'ca_list_items', 'U');
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
return new ca_list_items($vn_item_id);
}
if ($o_log) {
$o_log->logDebug(_t("Found existing list item %1 (member of list %2) in DataMigrationUtils::getListItemID() using label %3 and %4", $ps_item_idno, $pm_list_code_or_id, $vs_label, print_R($va_find_arr, true)));
}
return DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id];
}
}
if (!$pb_match_on_label || $pb_match_on_idno) {
if ($vn_item_id = ca_list_items::find(array_merge(array('idno' => $vs_idno), $va_find_arr), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']))) {
DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id] = $vn_item_id;
if ($o_event) {
$o_event->beginItem($vs_event_source, 'ca_list_items', 'U');
$o_event->endItem(DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id], __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
if ($o_log) {
$o_log->logDebug(_t("Found existing list item %1 (member of list %2) in DataMigrationUtils::getListItemID() using idno with %3", $ps_item_idno, $pm_list_code_or_id, print_R($va_find_arr, true)));
}
if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
return $t_item;
}
return DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id];
}
}
if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
return false;
}
//
// Need to create list item
//
if (!$t_list->load($vn_list_id)) {
if ($o_log) {
$o_log->logError(_t("Could not find list with list id %1", $vn_list_id));
}
return null;
}
if ($o_event) {
$o_event->beginItem($vs_event_source, 'ca_list_items', 'I');
}
if ($t_item = $t_list->addItem($ps_item_idno, $pa_values['is_enabled'], $pa_values['is_default'], $vn_parent_id, $pn_type_id, $ps_item_idno, '', (int) $pa_values['status'], (int) $pa_values['access'], $pa_values['rank'])) {
$vb_label_errors = false;
$t_item->addLabel(array('name_singular' => $pa_values['name_singular'] ? $pa_values['name_singular'] : $ps_item_idno, 'name_plural' => $pa_values['name_plural'] ? $pa_values['name_plural'] : $ps_item_idno), $pn_locale_id, null, true);
if ($t_item->numErrors()) {
if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
print "[Error] " . _t("Could not set preferred label for list item %1: %2", $pa_values['name_singular'] . "/" . $pa_values['name_plural'] . "/{$ps_item_idno}", join('; ', $t_item->getErrors())) . "\n";
}
if ($o_log) {
$o_log->logError(_t("Could not set preferred label for list item %1: %2", $pa_values['name_singular'] . "/" . $pa_values['name_plural'] . "/{$ps_item_idno}", join('; ', $t_item->getErrors())));
}
$vb_label_errors = true;
}
$vn_item_id = DataMigrationUtils::$s_cached_list_item_ids[$pm_list_code_or_id . '/' . $ps_item_idno . '/' . $vn_parent_id] = $t_item->getPrimaryKey();
if ($o_event) {
if ($vb_label_errors) {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_PARTIAL_SUCCESS__, _t("Errors setting preferred labels: %1", join('; ', $t_item->getErrors())));
} else {
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
}
if ($o_log) {
$o_log->logInfo(_t("Created new list item %1 in list %2", $pa_values['name_singular'] . "/" . $pa_values['name_plural'] . "/{$ps_item_idno}", $pm_list_code_or_id));
}
if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
return $t_item;
}
return $vn_item_id;
} else {
if ($o_log) {
$o_log->logError(_t("Could not find add litem to list: %1", join("; ", $t_list->getErrors())));
}
}
return null;
}
示例5: getListItemID
//.........这里部分代码省略.........
break;
}
}
if ($vn_item_id) {
DataMigrationUtils::$s_cached_list_item_ids[$vs_cache_key] = $vn_item_id;
if ($o_event) {
$o_event->beginItem($vs_event_source, 'ca_list_items', 'U');
$o_event->endItem($vn_item_id, __CA_DATA_IMPORT_ITEM_SUCCESS__, '');
}
if (isset($pa_options['returnInstance']) && $pa_options['returnInstance']) {
$t_item = new ca_list_items($vn_item_id);
if (isset($pa_options['transaction']) && $pa_options['transaction'] instanceof Transaction) {
$t_item->setTransaction($pa_options['transaction']);
}
return $t_item;
}
return $vn_item_id;
}
if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
return false;
}
//
// Need to create list item
//
if (!$t_list->load($vn_list_id)) {
if ($o_log) {
$o_log->logError(_t("Could not find list with list id %1", $vn_list_id));
}
return null;
}
if ($o_event) {
$o_event->beginItem($vs_event_source, 'ca_list_items', 'I');
}
if ($t_item = $t_list->addItem($ps_item_idno, $pa_values['is_enabled'], $pa_values['is_default'], $vn_parent_id, $pn_type_id, $ps_item_idno, '', (int) $pa_values['status'], (int) $pa_values['access'], $pa_values['rank'])) {
$vb_label_errors = false;
$t_item->addLabel(array('name_singular' => $vs_singular_label, 'name_plural' => $vs_plural_label), $pn_locale_id, null, true);
if ($t_item->numErrors()) {
if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
print "[Error] " . _t("Could not set preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())) . "\n";
}
if ($o_log) {
$o_log->logError(_t("Could not set preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())));
}
$vb_label_errors = true;
}
if (is_array($va_nonpreferred_labels = caGetOption("nonPreferredLabels", $pa_options, null))) {
if (caIsAssociativeArray($va_nonpreferred_labels)) {
// single non-preferred label
$va_labels = array($va_nonpreferred_labels);
} else {
// list of non-preferred labels
$va_labels = $va_nonpreferred_labels;
}
foreach ($va_labels as $va_label) {
$t_item->addLabel($va_label, $pn_locale_id, null, false);
if ($t_item->numErrors()) {
if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
print "[Error] " . _t("Could not set non-preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())) . "\n";
}
if ($o_log) {
$o_log->logError(_t("Could not set non-preferred label for list item %1: %2", "{$vs_singular_label}/{$vs_plural_label}/{$ps_item_idno}", join('; ', $t_item->getErrors())));
}
}
}
}
/** @var IIDNumbering $o_idno */
示例6: caLoadULAN
//.........这里部分代码省略.........
case 'Person':
default:
$vn_type_id = $va_ulan_types['Person'];
$pb_is_enabled = true;
break;
case 'Corporate Body':
$vn_type_id = $va_ulan_types['Corporate Body'];
$pb_is_enabled = true;
break;
}
print str_repeat(chr(8), $vn_last_message_length);
$vs_message = "\tIMPORTING #" . ($vn_term_count + 1) . " [" . $va_subject['subject_id'] . "] " . $vs_preferred_term;
if (($vn_l = 100 - strlen($vs_message)) < 1) {
$vn_l = 1;
}
$vs_message .= str_repeat(' ', $vn_l);
$vn_last_message_length = strlen($vs_message);
print $vs_message;
if ($vs_ulan_import_mode == 'ca_entities') {
$va_np_labels = array();
if (is_array($va_subject['non_preferred_terms'])) {
for ($vn_i = 0; $vn_i < sizeof($va_subject['non_preferred_terms']); $vn_i++) {
$va_np_labels[] = DataMigrationUtils::splitEntityName(trim(htmlentities($va_subject['non_preferred_terms'][$vn_i])));
}
}
$t_item = DataMigrationUtils::getEntityID(DataMigrationUtils::splitEntityName(trim(htmlentities($vs_preferred_term, ENT_NOQUOTES))), $vn_type_id, $pn_en_locale_id, array('idno' => $va_subject['subject_id']), array('nonPreferredLabels' => $va_np_labels, 'returnInstance' => true));
if (!$t_item) {
$o_log->logError("Failed to create entity for ULAN artist {$vs_preferred_term}");
break;
}
$t_item->setMode(ACCESS_WRITE);
$va_ulan_id_to_item_id[$va_subject['subject_id']] = $t_item->getPrimaryKey();
} else {
if ($t_item = $t_list->addItem($va_subject['subject_id'], $pb_is_enabled, false, null, $vn_type_id, $va_subject['subject_id'], '', 4, 1)) {
$va_ulan_id_to_item_id[$va_subject['subject_id']] = $t_item->getPrimaryKey();
if ($va_subject['preferred_parent_subject_id'] != 500000000) {
$va_parent_child_links[$va_subject['subject_id']] = $va_subject['preferred_parent_subject_id'];
}
// add preferred labels
if (!$t_item->addLabel(array('name_singular' => trim(htmlentities($vs_preferred_term, ENT_NOQUOTES)), 'name_plural' => trim(htmlentities($vs_preferred_term, ENT_NOQUOTES)), 'description' => $va_subject['description']), $pn_en_locale_id, null, true)) {
$o_log->logError("Could not add preferred label to ULAN term [" . $va_subject['subject_id'] . "] " . $vs_preferred_term . ": " . join("; ", $t_item->getErrors()));
}
// add alternate labels
if (is_array($va_subject['non_preferred_terms'])) {
for ($vn_i = 0; $vn_i < sizeof($va_subject['non_preferred_terms']); $vn_i++) {
$vs_np_label = $va_subject['non_preferred_terms'][$vn_i];
$vs_np_term_type = $va_subject['non_preferred_term_types'][$vn_i];
switch ($vs_np_term_type) {
case 'Used For Term':
$vn_np_term_type_id = $vn_list_item_label_type_uf;
break;
case 'Alternate Descriptor':
$vn_np_term_type_id = $vn_list_item_label_type_alt;
break;
default:
$vn_np_term_type_id = null;
break;
}
if (!$t_item->addLabel(array('name_singular' => trim(htmlentities($vs_np_label, ENT_NOQUOTES)), 'name_plural' => trim(htmlentities($vs_np_label, ENT_NOQUOTES)), 'description' => ''), $pn_en_locale_id, $vn_np_term_type_id, false)) {
$o_log->logError("Could not add non-preferred label to ULAN term [" . $va_subject['subject_id'] . "] " . $vs_np_label);
}
}
}
} else {
$o_log->logError("Could not import ULAN term [" . $va_subject['subject_id'] . "] " . $vs_preferred_term . ": " . join("; ", $t_list->getErrors()));
break;
示例7: caLoadAAT
//.........这里部分代码省略.........
$vs_preferred_term = $va_subject['preferred_term'];
switch ($va_subject['record_type']) {
case 'Concept':
$vn_type_id = $vn_list_item_type_hierarchy_name;
$pb_is_enabled = true;
break;
case 'Facet':
$vn_type_id = $vn_list_item_type_facet;
$vs_preferred_term = '<' . $vs_preferred_term . '>';
$pb_is_enabled = false;
break;
case 'Guide Term':
$vn_type_id = $vn_list_item_type_guide_term;
$vs_preferred_term = '<' . $vs_preferred_term . '>';
$pb_is_enabled = false;
break;
case 'Hierarchy Name':
$vn_type_id = $vn_list_item_type_hierarchy_name;
$pb_is_enabled = false;
break;
default:
$vn_type_id = null;
$pb_is_enabled = true;
break;
}
print str_repeat(chr(8), $vn_last_message_length);
$vs_message = "\tIMPORTING #" . ($vn_term_count + 1) . " [" . $va_subject['subject_id'] . "] " . $vs_preferred_term;
if (($vn_l = 100 - strlen($vs_message)) < 1) {
$vn_l = 1;
}
$vs_message .= str_repeat(' ', $vn_l);
$vn_last_message_length = strlen($vs_message);
print $vs_message;
if ($t_item = $t_list->addItem($va_subject['subject_id'], $pb_is_enabled, false, null, $vn_type_id, $va_subject['subject_id'], '', 4, 1)) {
$va_aat_id_to_item_id[$va_subject['subject_id']] = $t_item->getPrimaryKey();
if ($va_subject['preferred_parent_subject_id'] != 300000000) {
$va_parent_child_links[$va_subject['subject_id']] = $va_subject['preferred_parent_subject_id'];
}
// add preferred labels
if (!$t_item->addLabel(array('name_singular' => trim(htmlentities($vs_preferred_term, ENT_NOQUOTES)), 'name_plural' => trim(htmlentities($vs_preferred_term, ENT_NOQUOTES)), 'description' => $va_subject['description']), $pn_en_locale_id, null, true)) {
print "ERROR: Could not add preferred label to AAT term [" . $va_subject['subject_id'] . "] " . $vs_preferred_term . ": " . join("; ", $t_item->getErrors()) . "\n";
}
// add alternate labels
if (is_array($va_subject['non_preferred_terms'])) {
for ($vn_i = 0; $vn_i < sizeof($va_subject['non_preferred_terms']); $vn_i++) {
$vs_np_label = $va_subject['non_preferred_terms'][$vn_i];
$vs_np_term_type = $va_subject['non_preferred_term_types'][$vn_i];
switch ($vs_np_term_type) {
case 'Used For Term':
$vn_np_term_type_id = $vn_list_item_label_type_uf;
break;
case 'Alternate Descriptor':
$vn_np_term_type_id = $vn_list_item_label_type_alt;
break;
default:
$vn_np_term_type_id = null;
break;
}
if (!$t_item->addLabel(array('name_singular' => trim(htmlentities($vs_np_label, ENT_NOQUOTES)), 'name_plural' => trim(htmlentities($vs_np_label, ENT_NOQUOTES)), 'description' => ''), $pn_en_locale_id, $vn_np_term_type_id, false)) {
print "ERROR: Could not add non-preferred label to AAT term [" . $va_subject['subject_id'] . "] " . $vs_np_label . "\n";
//: ".join("; ", $t_item->getErrors())."\n";
}
}
}
// record item-item relations
if (is_array($va_subject['related_subjects'])) {