Common functions for importing resources into wikindx

version 1
package wikindx4\core\importexport
author Mark Grimshaw

 Methods

IMPORT

__construct() 

Selext box for selecting user bibliographies to import into

bibliographySelect() : string

Returns

string

Check for duplicate title/resourceType

checkDuplicates(string $noSort, string $title, string $subtitle, string $type) : boolean

If the session variable 'import_ImportDuplicates' is TRUE, the function quits immediately. NoSort, Title, Subtitle and resource type must match.

Parameters

$noSort

string

(A word like 'the', 'a' or translated equivalents that is at the start of the raw title)

$title

string

$subtitle

string

$type

string

Returns

booleanTRUE if resource already exists, FALSE if not.

getUnrecognised fields

getUnrecognisedFields() : array

Follows from prompting for field mapping

author Mark Grimshaw

Returns

array1st element is error message or FALSE, 2nd element is array of custom fields, 3rd element is array of unrecognized fields

Select box for specifying keyword separation character in source bibliography

keywordSeparator() : string

Returns

string

Print a list of discarded resources.

printDuplicates(int $numDiscarded, array $titlesDiscarded) : \string.
author Mark Grimshaw

Parameters

$numDiscarded

int

Num. resources discarded

$titlesDiscarded

array

Titles of discarded resources

Returns

\string.

promptFieldNames - print field name mapping to browser as an intermediate stage when invalid field names are found in the input.

promptFieldNames(array $entries, array $inputTypes, array $map, array $invalidFieldNames, mixed $strings) : array

This allows users to map them to any existing custom fields.

author Mark Grimshaw

Parameters

$entries

array

$inputTypes

array

$map

array

$invalidFieldNames

array

$strings

mixed

array|FALSE. Default is FALSE

Returns

array1st element is error message or FALSE, 2nd element is string for display

split title into WIKINDX component parts (noSort, title : subtitle)

splitTitle($title) : array

title / subtitle split is calculated on the session variable 'import_TitleSubtitleSeparator'.

author Mark Grimshaw

Parameters

$title

Returns

array(noSort, title, subtitle)

Tidy up the database by checking for creators etc.

tidyTables() 

that do not have resources.

This should be called just once at the end of multiple inserts.

Select box for specifying title/subtitle separation character in source bibliography

titleSubtitleSeparator() : string

Returns

string

Write the bibtexKey field for a new resource

writeBibtexKey() 

Write collection table

writeCollectionTable(string $title, string $titleShort, string $wkType) : int

Parameters

$title

string

Collection title

$titleShort

string

Collection short title

$wkType

string

wikindx resource type

Returns

intCollection ID

Write creator and resource_creator tables

writeCreatorTables(array $creators) 

Parameters

$creators

array

ordered array of creators

writeImportRawTable - write import_raw table

writeImportrawTable(array $rejectedArray, int $bibtexStringId, string $importType) 
author Mark Grimshaw

Parameters

$rejectedArray

array

Rejected input values for this resource

$bibtexStringId

int

ID of the BibTeX string in the bibtex_string table. Default is FALSE

$importType

string

Default is FALSE

Write keyword tables

writeKeywordTables(array $keywords) 

Parameters

$keywords

array

Wite resource_page table

writePageTable(array $fields, array $values) 
author Mark Grimshaw

Parameters

$fields

array

$values

array

Write the publisher table

writePublisherTable(string $name, string $location, string $wkType) : int

Parameters

$name

string

Publisher name

$location

string

Publisher location

$wkType

string

wikindx resource type

Returns

intPublisher ID

Write the resource table

writeResourceTable(array $fields, array $values) : int

Parameters

$fields

array

$values

array

Returns

intNew resource Id

writeResourceTimestampTable - write timestamp to resource_timestamp table an add blank statistics row

writeResourceTimestampTable() 
author Mark Grimshaw

Write resource_category table

writeResourcecategoryTable(string $categories) 

Parameters

$categories

string

Comma-delimited list of category IDs. At the very least, this must comprise '1' (the 'General' category)

Write resource_custom tables

writeResourcecustomTable(string $string, int $customId) 

Parameters

$string

string

$customId

int

Write the resource_misc table

writeResourcemiscTable(array $fields, array $values) 

Parameters

$fields

array

$values

array

Write resource_text table

writeResourcetextTable(string $notes, string $abstract, string $url) 

Parameters

$notes

string

$abstract

string

$url

string

Default is FALSE

writeTagTable - write import tag to tag table

writeTagTable() : int
author Mark Grimshaw

Returns

intlastAutoId

Write user_bibliography_resource table

writeUserbibliographyresourceTable(string $bibId) 

Parameters

$bibId

string

Comma-delimited string of user_bibliography ids

Wite resource_year table

writeYearTable(array $fields, array $values) 
author Mark Grimshaw

Parameters

$fields

array

$values

array

 Properties

 

$bibConfig 
 

$bibtexKeys 
 

$collection 
 

$collectionMap 
 

$config 
 

$creator 
 

$db 
 

$errors 
 

$form 
 

$html 
 

$keyword 
 

$messages 
 

$publisher 
 

$publisherMap 
 

$resourceId 
 

$session 
 

$table 
 

$vars