コード例 #1
0
ファイル: p2p.php プロジェクト: banumelody/slims7_cendana
            if ($subjects) {
                foreach ($subjects as $subject) {
                    if ($subject['term_type'] == 'Temporal') {
                        $subject_type = 'tm';
                    } else {
                        if ($subject['term_type'] == 'Genre') {
                            $subject_type = 'gr';
                        } else {
                            if ($subject['term_type'] == 'Occupation') {
                                $subject_type = 'oc';
                            } else {
                                $subject_type = strtolower(substr($subject['term_type'], 0, 1));
                            }
                        }
                    }
                    $subject_id = getSubjectID($subject['term'], $subject_type, $subject_cache);
                    @$dbs->query("INSERT IGNORE INTO biblio_topic (biblio_id, topic_id, level) VALUES ({$biblio_id}, {$subject_id}, 1)");
                }
            }
            if ($biblio_id) {
                // write to logs
                utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'bibliography', $_SESSION['realname'] . ' insert bibliographic data from P2P service (server:' . $p2pserver . ') with (' . $biblio['title'] . ') and biblio_id (' . $biblio_id . ')');
                $r++;
            }
        }
    }
    utility::jsAlert($r . ' records inserted to database.');
    echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
    exit;
}
/* RECORD OPERATION END */
コード例 #2
0
ファイル: marcimport.php プロジェクト: robeee/slims7_cendana
 $biblio_id = $sql_op->insert_id;
 if ($biblio_id < 1) {
     continue;
 }
 $updated_row++;
 // Subject
 $subject_flds = $record->getFields('650|651|648|655|656|657', true);
 if ($subject_flds) {
     // echo 'Subject: ';
     foreach ($subject_flds as $subj_fld) {
         if ($subj_fld) {
             $subject = $subj_fld->getSubfields('a');
             if (isset($subject[0])) {
                 // echo $subject[0]->getData();
                 $subject_type = 't';
                 $subject_id = getSubjectID($dbs->escape_string(trim($subject[0]->getData())), $subject_type, $subject_cache);
                 @$dbs->query("INSERT IGNORE INTO biblio_topic (biblio_id, topic_id, level) VALUES ({$biblio_id}, {$subject_id}, 1)");
             }
         }
     }
 }
 // Main entry
 $me_fld = $record->getField('100');
 if ($me_fld) {
     $mes = $me_fld->getSubfields('a');
     if (isset($me[0])) {
         // echo 'Main entry: '.$me[0]->getData();
         $author_id = utility::getID($dbs, 'mst_author', 'author_id', 'author_name', $dbs->escape_string(trim($me[0]->getData())), $author_cache);
         @$dbs->query("INSERT IGNORE INTO biblio_author (biblio_id, author_id, level) VALUES ({$biblio_id}, {$author_id}, 1)");
     }
 }
コード例 #3
0
ファイル: z3950.php プロジェクト: indonesia/slims5_meranti
            }
        }
        // insert conference/meeting authors
        if ($authors_conf) {
            $author_id = 0;
            $author_type = 'c';
            foreach ($authors_conf as $author_conf) {
                $author_id = getAuthorID($author_conf, $author_type, $author_cache);
                @$dbs->query("INSERT IGNORE INTO biblio_author (biblio_id, author_id, level) VALUES ({$biblio_id}, {$author_id}, 1)");
            }
        }
        // insert subject/topical terms
        if ($subjects) {
            foreach ($subjects as $subject) {
                $subject_type = 't';
                $subject_id = getSubjectID($subject, $subject_type, $subject_cache);
                @$dbs->query("INSERT IGNORE INTO biblio_topic (biblio_id, topic_id, level) VALUES ({$biblio_id}, {$subject_id}, 1)");
            }
        }
        if ($biblio_id) {
            $r++;
        }
    }
    // destroy result Z3950 session
    unset($_SESSION['z3950result']);
    utility::jsAlert($r . ' records inserted to database.');
    echo '<script type="text/javascript">parent.$(\'#mainContent\').simbioAJAX(\'' . $_SERVER['PHP_SELF'] . '\');</script>';
    exit;
}
/* RECORD OPERATION END */
/* SEARCH OPERATION */
コード例 #4
0
 $biblio_id = $sql_op->insert_id;
 if ($biblio_id < 1) {
     continue;
 }
 $updated_row++;
 // Subject
 $subject_flds = $record->getFields('650|651|648|655|656|657', true);
 if ($subject_flds) {
     // echo 'Subject: ';
     foreach ($subject_flds as $subj_fld) {
         if ($subj_fld) {
             $subject = $subj_fld->getSubfields('a');
             if (isset($subject[0])) {
                 // echo $subject[0]->getData();
                 $subject_type = 't';
                 $subject_id = getSubjectID($subject[0]->getData(), $subject_type, $subject_cache);
                 @$dbs->query("INSERT IGNORE INTO biblio_topic (biblio_id, topic_id, level) VALUES ({$biblio_id}, {$subject_id}, 1)");
             }
         }
     }
 }
 // Main entry
 $me_fld = $record->getField('100');
 if ($me_fld) {
     $mes = $me_fld->getSubfields('a');
     if (isset($me[0])) {
         // echo 'Main entry: '.$me[0]->getData();
         $author_id = utility::getID($dbs, 'mst_author', 'author_id', 'author_name', $me[0]->getData(), $author_cache);
         @$dbs->query("INSERT IGNORE INTO biblio_author (biblio_id, author_id, level) VALUES ({$biblio_id}, {$author_id}, 1)");
     }
 }