Class File_MARC_Data_Field

Description

The File_MARC_Data_Field class represents a single field in a MARC record.

A MARC data field consists of a tag name, two indicators which may be null, and zero or more subfields represented by File_MARC_Subfield objects. Subfields are held within a linked list structure.

Located in /MARC/Data_Field.php (line 53)

Structures_LinkedList_DoubleNode
   |
   --File_MARC_Field
      |
      --File_MARC_Data_Field
Variable Summary
Method Summary
File_MARC_Data_Field __construct (string $tag, [ $subfields = null], [string $ind1 = null], [string $ind2 = null])
void __destruct ()
int addSubfields ( $subfields)
void delete ()
string getIndicator (int $ind)
File_MARC_Subfield getSubfield ([string $code = null])
File_MARC_List|array getSubfields ([string $code = null])
File_MARC_Subfield insertSubfield (File_MARC_Subfield $new_field, File_MARC_Subfield $existing_field, [bool $before = false])
bool isEmpty ()
string setIndicator (int $ind, string $value)
string toRaw ()
string __toString ()
Variables
string $ind1 (line 60)

Value of the first indicator

  • access: protected
string $ind2 (line 66)

Value of the second indicator

  • access: protected
File_MARC_List $subfields (line 72)

Linked list of subfields

  • access: protected

Inherited Variables

Inherited from File_MARC_Field

File_MARC_Field::$tag
Methods
Constructor __construct (line 99)

File_MARC_Data_Field constructor

Create a new File_MARC_Data_Field object. The only required parameter is a tag. This enables programs to build up new fields programmatically.

  1.  // Example: Create a new data field
  2.  
  3.  // We can optionally create an array of subfields first
  4.   $subfields[new File_MARC_Data_Subfield('a''Scott, Daniel.');
  5.  
  6.  // Create the new 100 field complete with a _a subfield and an indicator
  7.   $new_field new File_MARC_Data_Field('100'$subfields0null);

File_MARC_Data_Field __construct (string $tag, [ $subfields = null], [string $ind1 = null], [string $ind2 = null])
  • string $tag: tag
  • array $subfields: array of File_MARC_Subfield objects
  • string $ind1: first indicator
  • string $ind2: second indicator

Redefinition of:
File_MARC_Field::__construct()
File_MARC_Field constructor
Destructor __destruct (line 119)

Destroys the data field

void __destruct ()

Redefinition of:
File_MARC_Field::__destruct()
Destroys the data field
addSubfields (line 246)

Adds an array of subfields to a File_MARC_Data_Field object

Appends subfields to existing subfields in the order in which they appear in the array. For finer grained control of the subfield order, use appendSubfield(), prependSubfield(), or insertSubfield() to add each subfield individually.

  • return: returns the number of subfields that were added
int addSubfields ( $subfields)
appendSubfield (line 174)

Appends subfield to subfield list

Adds a File_MARC_Subfield object to the end of the existing list of subfields.

  • return: the new File_MARC_Subfield object
File_MARC_Subfield appendSubfield (File_MARC_Subfield $new_subfield)
delete (line 132)

Destroys the data field

void delete ()
deleteSubfield (line 274)

Delete a subfield from the field.

  • return: Success or failure
bool deleteSubfield (File_MARC_Subfield $subfield)
getIndicator (line 290)

Get the value of an indicator

  • return: returns indicator value if it exists, otherwise false
string getIndicator (int $ind)
  • int $ind: number of the indicator (1 or 2)
getSubfield (line 343)

Returns the first subfield that matches a requested code.

  • return: returns the first subfield that matches $code, or false if no codes match $code
File_MARC_Subfield getSubfield ([string $code = null])
getSubfields (line 369)

Returns an array of subfields that match a requested code, or a File_MARC_List that contains all of the subfields if the requested code is null.

  • return: returns a linked list of all subfields if $code is null, an array of File_MARC_Subfield objects if one or more subfields match, or false if no codes match $code
File_MARC_List|array getSubfields ([string $code = null])
insertSubfield (line 212)

Inserts a field in the MARC record relative to an existing field

Inserts a File_MARC_Subfield object before or after an existing subfield.

  • return: The new subfield
File_MARC_Subfield insertSubfield (File_MARC_Subfield $new_field, File_MARC_Subfield $existing_field, [bool $before = false])
  • File_MARC_Subfield $new_field: The subfield to add
  • File_MARC_Subfield $existing_field: The target subfield
  • bool $before: Insert the subfield before the existing subfield if true, after the existing subfield if false
isEmpty (line 398)

Checks if the field is empty.

Checks if the field is empty. If the field has at least one subfield with data, it is not empty.

  • return: Returns true if the field is empty, otherwise false
bool isEmpty ()

Redefinition of:
File_MARC_Field::isEmpty()
Is empty
prependSubfield (line 192)

Prepends subfield to subfield liss

Adds a File_MARC_Subfield object to the start of the existing list of subfields.

  • return: the new File_MARC_Subfield object
File_MARC_Subfield prependSubfield (File_MARC_Subfield $new_subfield)
setIndicator (line 312)

Set the value of an indicator

  • return: returns indicator value if it exists, otherwise false
string setIndicator (int $ind, string $value)
  • int $ind: number of the indicator (1 or 2)
  • string $value: value of the indicator
toRaw (line 454)

Return Field in Raw MARC

Return the Field formatted in Raw MARC for saving into MARC files

  • return: Raw MARC
string toRaw ()

Redefinition of:
File_MARC_Field::toRaw()
Return field in raw MARC format (stub)
__toString (line 429)

Return Field formatted

Return Field as a formatted string.

  • return: Formatted output of Field
string __toString ()

Redefinition of:
File_MARC_Field::__toString()
Return Field formatted

Inherited Methods

Inherited From File_MARC_Field

File_MARC_Field::__construct()
File_MARC_Field::getTag()
File_MARC_Field::isEmpty()
File_MARC_Field::setTag()
File_MARC_Field::toRaw()
File_MARC_Field::__destruct()
File_MARC_Field::__toString()

Documentation generated on Mon, 01 Jan 2007 23:44:40 -0500 by phpDocumentor 1.3.1