Ejemplo n.º 1
0
 */
// file to import
$input_file = '../workspace/tmp/ddc_dnb.txt';
// visibility status of imported collections
$visible = true;
$fieldSeparator = '	';
if (!file_exists($input_file)) {
    echo "Error: input file {$input_file} does not exist\n";
    exit;
}
if (!is_readable($input_file)) {
    echo "Error: input file {$input_file} is not readable\n";
    exit;
}
// find next valid position for collection role
$table = Opus_Db_TableGateway::getInstance(Opus_CollectionRole::getTableGatewayClass());
$select = $table->select()->from($table, array('MAX(position) AS max_position'));
$row = $table->fetchRow($select);
$position = $row->max_position + 1;
// create root collection
$collectionRole = new Opus_CollectionRole();
$collectionRole->setPosition($position);
$collectionRole->setName('ddc_dnb');
$collectionRole->setOaiName('ddc_dnb');
$collectionRole->setVisible(true);
$collectionRole->setVisibleBrowsingStart(true);
$collectionRole->setDisplayBrowsing('Number,Name');
$collectionRole->setDisplayFrontdoor('Number,Name');
$collectionRole->setVisibleFrontdoor(true);
$collectionRole->setVisibleOai(true);
$collectionRoleId = $collectionRole->store();