当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_list_items::update方法代码示例

本文整理汇总了PHP中ca_list_items::update方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_list_items::update方法的具体用法?PHP ca_list_items::update怎么用?PHP ca_list_items::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_list_items的用法示例。


在下文中一共展示了ca_list_items::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: caLoadULAN


//.........这里部分代码省略.........
                                        break;
                                    }
                                    foreach ($va_subject['nationalities'] as $va_nationality) {
                                        $va_values[] = $va_nationality['code'];
                                    }
                                    break;
                                case 'role_name':
                                    if (!is_array($va_subject['roles'])) {
                                        break;
                                    }
                                    foreach ($va_subject['roles'] as $va_role) {
                                        $va_values[] = $va_role['name'];
                                    }
                                    break;
                                case 'role_code':
                                    if (!is_array($va_subject['roles'])) {
                                        break;
                                    }
                                    foreach ($va_subject['roles'] as $va_role) {
                                        $va_values[] = $va_role['code'];
                                    }
                                    break;
                            }
                            if (sizeof($va_values)) {
                                $va_dest = explode('.', $vs_dest);
                                $vs_fld = array_pop($va_dest);
                                if ($t_item->hasField($vs_fld)) {
                                    $t_item->set($vs_fld, join("\n", $va_values));
                                } else {
                                    foreach ($va_values as $vs_value) {
                                        $t_item->addAttribute(array('locale_id' => $pn_en_locale_id, $vs_fld => $vs_value), $vs_fld);
                                    }
                                }
                                $t_item->update(array('dontCheckCircularReferences' => true, 'dontSetHierarchicalIndexing' => true));
                                if ($t_item->numErrors()) {
                                    $o_log->logError("Could not update ULAN list item with content values: " . join("; ", $t_item->getErrors()));
                                }
                            }
                        }
                        // record item-item relations
                        if (is_array($va_subject['related_subjects'])) {
                            foreach ($va_subject['related_subjects'] as $vs_rel_subject_id) {
                                $va_item_item_links[$va_subject['subject_id']] = $vs_rel_subject_id;
                            }
                        }
                        $vn_term_count++;
                    } else {
                        $va_subject = array('subject_id' => $o_xml->getAttribute('Subject_ID'));
                    }
                    break;
                    # ---------------------------
                # ---------------------------
                case 'Biographies':
                    while ($o_xml->read()) {
                        switch ($o_xml->name) {
                            case 'Preferred_Biography':
                                $va_bio = array();
                                while ($o_xml->read()) {
                                    switch ($o_xml->name) {
                                        case 'Biography_Text':
                                            switch ($o_xml->nodeType) {
                                                case XMLReader::ELEMENT:
                                                    $o_xml->read();
                                                    $va_bio['text'] = $o_xml->value;
                                                    break;
                                            }
开发者ID:idiscussforum,项目名称:providence,代码行数:67,代码来源:supportHelpers.php

示例2: strlen

    $vn_last_message_length = strlen($vs_message);
    print $vs_message;
    if (!($vn_child_item_id = $va_aat_id_to_item_id[$vs_child_id])) {
        print "ERROR: no list item id for child_id {$vs_child_id} (were there previous errors?)\n";
        continue;
    }
    if (!($vn_parent_item_id = $va_aat_id_to_item_id[$vs_parent_id])) {
        print "ERROR: no list item id for parent_id {$vs_child_id} (were there previous errors?)\n";
        continue;
    }
    if (!$t_item->load($vn_child_item_id)) {
        print "ERROR: could not load item for {$vs_child_id} (was translated to item_id={$vn_child_item_id})\n";
        continue;
    }
    $t_item->set('parent_id', $vn_parent_item_id);
    $t_item->update();
    if ($t_item->numErrors()) {
        print "ERROR: could not set parent_id for {$vs_child_id} (was translated to item_id={$vn_child_item_id}): " . join('; ', $t_item->getErrors()) . "\n";
    }
}
if ($vn_list_item_relation_type_id_related > 0) {
    print "\n\nADDING RELATED TERM LINKS...\n";
    $vn_last_message_length = 0;
    $t_item = new ca_list_items();
    $t_link = new ca_list_items_x_list_items();
    $t_link->setMode(ACCESS_WRITE);
    foreach ($va_item_item_links as $vs_left_id => $vs_right_id) {
        print str_repeat(chr(8), $vn_last_message_length);
        $vs_message = "\tLINKING {$vs_left_id} to {$vs_right_id}";
        if (($vn_l = 200 - strlen($vs_message)) < 1) {
            $vn_l = 1;
开发者ID:idiscussforum,项目名称:providence,代码行数:31,代码来源:import_aat.php

示例3: caLoadAAT


//.........这里部分代码省略.........
                                case XMLReader::ELEMENT:
                                    $o_xml->read();
                                    $va_subject['non_preferred_terms'][] = $o_xml->value;
                                    break;
                            }
                            break;
                        case 'Term_ID':
                            switch ($o_xml->nodeType) {
                                case XMLReader::ELEMENT:
                                    $o_xml->read();
                                    $va_subject['non_preferred_term_ids'][] = $o_xml->value;
                                    break;
                            }
                            break;
                        case 'Non-Preferred_Term':
                            break 2;
                    }
                }
                break;
                # ---------------------------
            # ---------------------------
            case 'VP_Subject_ID':
                switch ($o_xml->nodeType) {
                    case XMLReader::ELEMENT:
                        $o_xml->read();
                        $va_subject['related_subjects'][] = $o_xml->value;
                        break;
                }
                break;
                # ---------------------------
        }
    }
    $o_xml->close();
    print "\n\nLINKING TERMS IN HIERARCHY...\n";
    $vn_last_message_length = 0;
    $t_item = new ca_list_items();
    $t_item->setMode(ACCESS_WRITE);
    foreach ($va_parent_child_links as $vs_child_id => $vs_parent_id) {
        print str_repeat(chr(8), $vn_last_message_length);
        $vs_message = "\tLINKING {$vs_child_id} to parent {$vs_parent_id}";
        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 (!($vn_child_item_id = $va_aat_id_to_item_id[$vs_child_id])) {
            print "ERROR: no list item id for child_id {$vs_child_id} (were there previous errors?)\n";
            continue;
        }
        if (!($vn_parent_item_id = $va_aat_id_to_item_id[$vs_parent_id])) {
            print "ERROR: no list item id for parent_id {$vs_child_id} (were there previous errors?)\n";
            continue;
        }
        if (!$t_item->load($vn_child_item_id)) {
            print "ERROR: could not load item for {$vs_child_id} (was translated to item_id={$vn_child_item_id})\n";
            continue;
        }
        $t_item->set('parent_id', $vn_parent_item_id);
        $t_item->update();
        if ($t_item->numErrors()) {
            print "ERROR: could not set parent_id for {$vs_child_id} (was translated to item_id={$vn_child_item_id}): " . join('; ', $t_item->getErrors()) . "\n";
        }
    }
    if ($vn_list_item_relation_type_id_related > 0) {
        print "\n\nADDING RELATED TERM LINKS...\n";
        $vn_last_message_length = 0;
        $t_item = new ca_list_items();
        $t_link = new ca_list_items_x_list_items();
        $t_link->setMode(ACCESS_WRITE);
        foreach ($va_item_item_links as $vs_left_id => $vs_right_id) {
            print str_repeat(chr(8), $vn_last_message_length);
            $vs_message = "\tLINKING {$vs_left_id} to {$vs_right_id}";
            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 (!($vn_left_item_id = $va_aat_id_to_item_id[$vs_left_id])) {
                print "ERROR: no list item id for left_id {$vs_left_id} (were there previous errors?)\n";
                continue;
            }
            if (!($vn_right_item_id = $va_aat_id_to_item_id[$vs_right_id])) {
                print "ERROR: no list item id for right_id {$vs_right_id} (were there previous errors?)\n";
                continue;
            }
            $t_link->set('term_left_id', $vn_left_item_id);
            $t_link->set('term_right_id', $vn_right_item_id);
            $t_link->set('type_id', $vn_list_item_relation_type_id_related);
            $t_link->insert();
            if ($t_link->numErrors()) {
                print "ERROR: could not set link between {$vs_left_id} (was translated to item_id={$vn_left_item_id}) and {$vs_right_id} (was translated to item_id={$vn_right_item_id}): " . join('; ', $t_link->getErrors()) . "\n";
            }
        }
    } else {
        print "WARNING: Skipped import of term-term relationships because the ca_list_items_x_list_items 'related' relationship type is not defined for your installation\n";
    }
    print "\n\nIMPORT COMPLETE.\n";
}
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:supportHelpers.php


注:本文中的ca_list_items::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。