本文整理汇总了PHP中ca_objects::getLabelForDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::getLabelForDisplay方法的具体用法?PHP ca_objects::getLabelForDisplay怎么用?PHP ca_objects::getLabelForDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::getLabelForDisplay方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInsertLoadAndDeleteCycleWithCaObjectsModel
public function testInsertLoadAndDeleteCycleWithCaObjectsModel()
{
$t_list = new ca_lists();
$va_object_types = $t_list->getItemsForList('object_types');
$this->assertGreaterThan(0, sizeof($va_object_types), "No object types available");
$va_object_types = caExtractValuesByUserLocale($va_object_types);
$this->assertGreaterThan(0, sizeof($va_object_types), "No locale-filtered object types available");
$vn_locale_id = 1;
$t_object = new ca_objects();
$t_object->setMode(ACCESS_WRITE);
$vn_item_id = 0;
foreach ($va_object_types as $va_object_type) {
if (intval($va_object_type['is_enabled']) === 1) {
$vn_item_id = $va_object_type['item_id'];
}
}
$this->assertGreaterThan(0, $vn_item_id, 'No enabled object type found');
$t_object->set('type_id', $vn_item_id);
$t_object->set('locale_id', $vn_locale_id);
$t_object->set('idno', time());
$t_object->addAttribute(array('description' => 'Test description', 'locale_id' => $vn_locale_id), 'description');
$vb_res = $t_object->insert();
$this->assertTrue($vb_res !== false, 'Insert returned non-true value');
// insert() returns false OR the primary key, therefore simply asserting $vb_res being true doesn't cut it
$this->assertEquals($t_object->numErrors(), 0, "Errors on insert: " . join('; ', $t_object->getErrors()));
$this->opa_test_record_ids['ca_objects'][] = $t_object->getPrimaryKey();
$vb_res = $t_object->addLabel(array('name' => 'Unit test object'), $vn_locale_id, null, true);
$this->assertGreaterThan(0, $vb_res, 'AddLabel returned zero value but should return non-zero label_id: ' . join('; ', $t_object->getErrors()));
$t_object2 = new ca_objects();
$vb_res = $t_object2->load($t_object->getPrimaryKey());
$this->assertTrue($vb_res, 'Load of newly created record failed [record does not seem to exist or return row id was invalid?]');
$this->assertEquals($t_object2->getLabelForDisplay(), 'Unit test object', 'Retrieved row label does not match');
$this->assertEquals($t_object2->getAttributesForDisplay('description'), 'Test description', 'Retrieved value for attribute "description" does not match expected value');
// try to search for it
$o_search = new ObjectSearch();
$qr_hits = $o_search->search("Unit test object");
$this->assertGreaterThan(0, $qr_hits->numHits(), 'Search for ca_object by label found no results');
$vb_found_object = false;
while ($qr_hits->nextHit()) {
if ($qr_hits->get('object_id') == $t_object->getPrimaryKey()) {
$vb_found_object = true;
break;
}
}
$this->assertTrue($vb_found_object, 'ca_object was not in returned search results for ca_object by label');
// try delete
$t_object->delete(true, array('hard' => true));
$this->assertEquals($t_object->numErrors(), 0, "Errors on delete: " . join('; ', $t_object->getErrors()));
}
示例2: renderWidget
/**
*
*/
public function renderWidget($ps_widget_id, &$pa_settings)
{
parent::renderWidget($ps_widget_id, $pa_settings);
$t_object = new ca_objects();
# get a random object for display
$va_random_item = $t_object->getRandomItems(1, array('hasRepresentations' => 1));
if (sizeof($va_random_item) > 0) {
foreach ($va_random_item as $vn_object_id => $va_object_info) {
$t_object->load($vn_object_id);
$va_rep = $t_object->getPrimaryRepresentation(array('medium'));
$this->opo_view->setVar('object_id', $vn_object_id);
$this->opo_view->setVar('image', $va_rep["tags"]["medium"]);
$this->opo_view->setVar('label', $t_object->getLabelForDisplay());
}
}
$this->opo_view->setVar('request', $this->getRequest());
return $this->opo_view->render('main_html.php');
}
示例3: array
$t_object = new ca_objects();
$t_featured_obj = new ca_sets();
# --- load the featured items set - set name assigned in app.conf
$t_featured_obj->load(array('set_code' => 'featured_object'));
# --- Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_obj->get("access"), $va_access_values)) {
$vn_featured_set_id = $t_featured_obj->get("set_id");
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured_obj->getItemRowIDs(array('checkAccess' => $va_access_values, 'limit' => 1))) ? $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('widepreview'), null, array('return_with_access' => $va_access_values));
$feat_obj_content_id = $va_featured_ids[0];
$feat_obj_content_widepreview = $va_rep["tags"]["widepreview"];
$vs_featured_content_label = $t_object->getLabelForDisplay();
}
# --- Recently Added
# --- get the 12 most recently added objects to display
$va_recently_added_items = $t_object->getRecentlyAddedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_recently_added_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_recently_added_items), array('small', 'thumbnail', 'preview', 'widepreview'), array("checkAccess" => $va_access_values));
foreach ($va_recently_added_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_recently_added_objects[$vn_object_id] = $va_object_info;
}
#$this->view->setVar('recently_added_objects', $va_recently_added_objects);
if (is_array($va_recently_added_objects) && sizeof($va_recently_added_objects) > 0) {
$va_object_info = array_shift($va_recently_added_objects);
$recently_added_id = $va_object_info['object_id'];
示例4: Index
public function Index()
{
$va_participate_ids = array();
$t_participate = new ca_sets();
# --- participate set - set name assigned in eastend.conf - plugin conf file
$t_participate->load(array('set_code' => $this->opo_plugin_config->get('participate_set_name')));
# Enforce access control on set
if (sizeof($this->opa_access_values) == 0 || sizeof($this->opa_access_values) && in_array($t_participate->get("access"), $this->opa_access_values)) {
$this->view->setVar('participate_set_id', $t_participate->get("set_id"));
$va_participate_ids = array_keys(is_array($va_tmp = $t_participate->getItemRowIDs(array('checkAccess' => $this->opa_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the entity ids in the set
}
# --- loop through featured ids and grab the object's image
$t_object = new ca_objects();
$va_participate_images = array();
foreach ($va_participate_ids as $vn_participate_object_id) {
$va_tmp = array();
$t_object->load($vn_participate_object_id);
$va_tmp["object_id"] = $vn_participate_object_id;
$va_image = $t_object->getPrimaryRepresentation(array("mediumlarge"));
# --- don't show records with status ars/vaga don't show image
if ($t_object->get("ca_objects.object_status") != 348) {
if ($t_object->get("ca_objects.object_status") == 349) {
$va_tmp["vaga_class"] = "vagaDisclaimer";
}
$va_tmp["image"] = $va_image["tags"]["mediumlarge"];
$va_tmp["caption"] = $t_object->get("ca_objects.caption");
$va_tmp["title"] = $t_object->getLabelForDisplay();
}
$va_participate_images[$vn_participate_object_id] = $va_tmp;
}
$this->view->setVar("participate_images", $va_participate_images);
$this->render('participate_html.php');
}
示例5: setItemInfo
public function setItemInfo()
{
$va_access_values = caGetUserAccessValues($this->request);
$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);
$pn_set_item_id = $this->request->getParameter('set_item_id', pInteger);
$t_set_item = new ca_set_items($pn_set_item_id);
$va_set_item_info = array();
$va_items = $t_set->getItemIDs(array("checkAccess" => $va_access_values));
$pn_previous_id = "";
foreach ($va_items as $vn_item_id => $va_item_info) {
if ($va_set_item_info["item_id"]) {
$va_set_item_info["next_id"] = $vn_item_id;
break;
}
if ($pn_set_item_id == $vn_item_id) {
$va_set_item_info["previous_id"] = $pn_previous_id;
$va_set_item_info["item_id"] = $vn_item_id;
}
$pn_previous_id = $vn_item_id;
}
$va_set_item_info["item_id"] = $t_set_item->get("item_id");
$va_reps = $t_set_item->getRepresentations(array("mediumlarge", "small"), null, array("return_with_access" => $va_access_values));
$va_rep = array_shift($va_rep);
$this->view->setVar('t_object_representation', $t_rep = new ca_object_representations($va_rep['representation_id']));
$va_rep_display_info = caGetMediaDisplayInfo('cropped_gallery_media_overlay', $t_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
$this->view->setVar('rep_display_version', $va_rep_display_info['display_version']);
unset($va_display_info['display_version']);
$va_rep_display_info['poster_frame_url'] = $t_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
unset($va_display_info['poster_frame_version']);
$this->view->setVar('rep_display_options', $va_rep_display_info);
$va_set_item_info["info"] = $va_rep['info'];
$va_set_item_info["label"] = $t_set_item->getLabelForDisplay();
$va_set_item_info["description"] = $t_set_item->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLineBreaks' => true));
$va_set_item_info["item_description"] = $t_set_item->get($this->opo_plugin_config->get('set_item_description_element_code'), array('convertLineBreaks' => true));
$va_set_item_info["row_id"] = $t_set_item->get("row_id");
$va_set_item_info["lesson"] = $t_set_item->get('set_item_description');
$t_object = new ca_objects($t_set_item->get("row_id"));
$va_set_item_info["object_label"] = $t_object->getLabelForDisplay();
$this->view->setVar('item_info', $va_set_item_info);
$this->render($this->ops_theme . '/ajax_item_info_html.php');
}
示例6: getHierarchyName
/**
* Returns name of hierarchy for currently loaded row or, if specified, row identified by optional $pn_id parameter
*
* @param int $pn_id Optional object_id to return hierarchy name for. If not specified, the currently loaded row is used.
* @return string The name of the hierarchy
*/
public function getHierarchyName($pn_id = null)
{
if (!$pn_id) {
$pn_id = $this->getPrimaryKey();
}
$va_ancestors = $this->getHierarchyAncestors($pn_id, array('idsOnly' => true));
if (is_array($va_ancestors) && sizeof($va_ancestors)) {
$vn_parent_id = array_pop($va_ancestors);
$t_object = new ca_objects($vn_parent_id);
return $t_object->getLabelForDisplay(false);
} else {
if ($pn_id == $this->getPrimaryKey()) {
return $this->getLabelForDisplay(true);
} else {
$t_object = new ca_objects($pn_id);
return $t_object->getLabelForDisplay(true);
}
}
}
示例7: array
</h3>
<div class="searchboxitemtext">
<?php
# --- identifier
if ($t_object->get('idno')) {
print "<div class='unit'><b>" . _t("Reference Code") . ":</b> " . $t_object->get('idno') . "</div><!-- end unit -->";
}
# --- hirearchy breadcrumb trail
$va_ancestors = array();
$va_ancestors = $t_object->getHierarchyAncestors();
if (sizeof($va_ancestors) > 0) {
$va_hier_path = array();
$t_hier_object = new ca_objects();
foreach ($va_ancestors as $va_ancestor) {
$t_hier_object->load($va_ancestor['NODE']['object_id']);
$va_hier_path[] = caNavLink($this->request, $t_hier_object->getLabelForDisplay(), '', 'Detail', 'Object', 'Show', array('object_id' => $va_ancestor['NODE']['object_id']));
}
print "<div class='unit'><b>" . _t("Part Of") . ":</b> " . join(" > ", array_reverse($va_hier_path)) . "</div>";
}
# --- child hierarchy info
$va_children = $t_object->get("ca_objects.children.preferred_labels", array('returnAsArray' => 1, 'checkAccess' => $va_access_values));
if (sizeof($va_children) > 0) {
print "<div class='unit'><b>" . _t("Part%1", sizeof($va_children) > 1 ? "s" : "") . ":</b><br/>";
$i = 0;
foreach ($va_children as $va_child) {
# only show the first 5 and have a more link
if ($i == 5) {
print "<div id='moreChildrenLink'><a href='#' onclick='\$(\"#moreChildren\").slideDown(250); \$(\"#moreChildrenLink\").hide(1); return false;'>[" . _t("More") . "]</a></div><!-- end moreChildrenLink -->";
print "<div id='moreChildren' style='display:none;'>";
}
print "<div>" . caNavLink($this->request, $va_child['name'], '', 'Detail', 'Object', 'Show', array('object_id' => $va_child['object_id'])) . "</div>";
示例8: foreach
if (sizeof($va_featured_object)) {
foreach ($va_featured_object as $va_featured_object_info) {
$vn_featured_object_id = $va_featured_object_info["object_id"];
break;
}
$t_object = new ca_objects($vn_featured_object_id);
$vs_media = $t_object->getMediaTag('ca_object_representations.media', 'medium', array('checkAccess' => $va_access_values));
$ca_lists = new ca_lists();
?>
<div id="leftCol">
<?php
print "<div id='featuredMedia'>" . $vs_media . "</div>";
# --- get caption for object
$vs_caption = $t_object->get("ca_objects.image_caption.image_caption_text");
if (!$vs_caption) {
$vs_caption = $t_object->getLabelForDisplay();
}
print "<br/>" . $vs_caption;
?>
</div><!-- end leftCol -->
<?php
}
?>
<div style="clear:both;"><!-- empty --></div>
</div><!-- end productionTopArea -->
<?php
}
if ($qr_hits->numHits()) {
if (!$this->request->isAjax()) {
?>
<div id="relatedObjectsArea">
示例9: array
$t_featured_share->load(array('set_code' => $this->request->config->get('featured_share_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_share->get("access"), $va_access_values)) {
$vn_featured_share_set_id = $t_featured_share->get("set_id");
$va_featured_share_ids = array_keys(is_array($va_tmp = $t_featured_share->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the object ids in the set
}
if (!is_array($va_featured_share_ids) || sizeof($va_featured_share_ids) == 0) {
# put a random object in the features variable
$va_featured_share_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
}
$t_object_share = new ca_objects($va_featured_share_ids[0]);
$va_rep = $t_object_share->getPrimaryRepresentation(array('frontpage'), null, array('return_with_access' => $va_access_values));
$vn_featured_share_id = $va_featured_share_ids[0];
$vs_featured_share_image = $va_rep["tags"]["frontpage"];
$vs_featured_share_label = $t_object->getLabelForDisplay();
# --- set for featured member - set name assigned in app.conf - featured_member_set_name - this is an ENTITY set
$t_featured_member = new ca_sets();
$t_featured_member->load(array('set_code' => $this->request->config->get('featured_member_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_member->get("access"), $va_access_values)) {
$vn_featured_member_set_id = $t_featured_member->get("set_id");
$va_featured_member_ids = array_keys(is_array($va_tmp = $t_featured_member->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the entity ids in the set
}
$t_entity = new ca_entities($va_featured_member_ids[0]);
$vn_featured_member_id = $va_featured_member_ids[0];
$vs_featured_member_image = $t_entity->get("mem_inst_image", array("version" => "frontpage", "return" => "tag"));
$vs_featured_member_name = $t_entity->getLabelForDisplay();
# --- canned browses
$va_browse_codes = $this->request->config->get('hp_category_browse_codes');
示例10: Index
function Index($pa_options = null)
{
// Remove any browse criteria previously set
$this->opo_browse->removeAllCriteria();
parent::Index(array('dontRenderView' => true));
JavascriptLoadManager::register('imageScroller');
JavascriptLoadManager::register('browsable');
JavascriptLoadManager::register('tabUI');
JavascriptLoadManager::register('cycle');
$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);
}
$va_default_versions = array('thumbnail', 'icon', 'small', 'preview', 'medium', 'preview', 'widepreview');
# --- featured items set - set name assigned in app.conf
$t_featured->load(array('set_code' => $this->request->config->get('featured_set_name')));
# Enforce access control on set
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured->get("access"), $va_access_values)) {
$this->view->setVar('featured_set_id', $t_featured->get("set_id"));
$va_featured_ids = array_keys(is_array($va_tmp = $t_featured->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
// These are the object ids in the set
}
if (!is_array($va_featured_ids) || sizeof($va_featured_ids) == 0) {
# put a random object in the features variable
$va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
}
$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));
$this->view->setVar('featured_content_id', $va_featured_ids[0]);
$this->view->setVar('featured_content_thumb', $va_rep["tags"]["thumbnail"]);
$this->view->setVar('featured_content_small', $va_rep["tags"]["small"]);
$this->view->setVar('featured_content_mediumlarge', $va_rep["tags"]["mediumlarge"]);
$this->view->setVar('featured_content_medium', $va_rep["tags"]["medium"]);
$this->view->setVar('featured_content_preview', $va_rep["tags"]["preview"]);
$this->view->setVar('featured_content_widepreview', $va_rep["tags"]["widepreview"]);
$this->view->setVar('featured_content_label', $t_object->getLabelForDisplay());
$this->view->setVar('featured_content_slideshow_id_list', $va_featured_ids);
if (!(bool) $this->request->config->get("splash_disable_highest_rated_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_highest_rated_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- 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($va_versions, null, array('return_with_access' => $va_access_values));
$this->view->setVar('user_favorites_id', $va_user_favorites_items[0]);
foreach ($va_versions as $vs_version) {
$this->view->setVar('user_favorites_' . $vs_version, $va_rep['tags'][$vs_version]);
}
}
} 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), $va_versions, 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 = reset($va_random_items);
$this->view->setVar('user_favorites_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('user_favorites_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
}
}
if (!(bool) $this->request->config->get("splash_disable_recently_added_objects")) {
if (!is_array($va_versions = $this->request->config->getList("splash_recently_added_display_versions"))) {
$va_versions = $va_default_versions;
}
# --- get the 12 most recently added objects to display
$va_recently_added_items = $t_object->getRecentlyAddedItems(12, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1));
$va_labels = $t_object->getPreferredDisplayLabelsForIDs(array_keys($va_recently_added_items));
$va_media = $t_object->getPrimaryMediaForIDs(array_keys($va_recently_added_items), $va_versions, array("checkAccess" => $va_access_values));
foreach ($va_recently_added_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_recently_added_objects[$vn_object_id] = $va_object_info;
}
$this->view->setVar('recently_added_objects', $va_recently_added_objects);
if (is_array($va_recently_added_objects) && sizeof($va_recently_added_objects) > 0) {
$va_object_info = reset($va_recently_added_objects);
$this->view->setVar('recently_added_id', $va_object_info['object_id']);
foreach ($va_versions as $vs_version) {
$this->view->setVar('recently_added_' . $vs_version, $va_media[$va_object_info['object_id']]['tags'][$vs_version]);
}
}
} else {
$this->view->setVar('recently_added_objects', array());
}
//.........这里部分代码省略.........
示例11: oldestDate
/**
* oldest date
*/
private function oldestDate()
{
$t_object = new ca_objects();
$vn_object_tablenum = $this->opn_objectTableNum;
$o_db = new db();
# --- get the element_id for date attribute
$q_date_element_id = $o_db->query("select element_id from ca_metadata_elements where element_code = 'date'");
$q_date_element_id->nextRow();
$vn_date_element_id = $q_date_element_id->get("element_id");
if ($vn_date_element_id && $vn_object_tablenum) {
// Bracket search to dates between 1000 and 2012 since ANSM date data is very fucked up
$q_oldest_date = $o_db->query("select v.value_decimal1, v.value_decimal2, a.row_id from ca_attribute_values v\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_attributes a ON v.attribute_id = a.attribute_id\n \t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN ca_objects o ON a.row_id = o.object_id\n \t\t\t\t\t\t\t\t\t\t\t\twhere v.element_id = " . $vn_date_element_id . " AND a.table_num = " . $vn_object_tablenum . " AND o.access = 1 AND (value_decimal1 BETWEEN 1100 AND 2012)\n \t\t\t\t\t\t\t\t\t\t\t\tORDER BY value_decimal1 LIMIT 1");
if ($q_oldest_date->numRows() > 0) {
$q_oldest_date->nextRow();
$t_object->load($q_oldest_date->get("row_id"));
#print $q_oldest_date->get("value_decimal1")." - ".$q_oldest_date->get("value_decimal2")." - ".$q_oldest_date->get("row_id");
return $t_object->get("date") . ", " . caNavLink($this->request, $t_object->getLabelForDisplay(), "", "Detail", "Object", "Show", array("object_id" => $q_oldest_date->get("row_id")));
} else {
return false;
}
} else {
return false;
}
}
示例12: 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'))) {