Difference between revisions of "API:EPrints/DataObj"
Line 58: | Line 58: | ||
<!-- Pod2Wiki=head_description --> | <!-- Pod2Wiki=head_description --> | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
− | This module is a base class which is inherited by [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]], [[API:EPrints/User|EPrints::User]], [[API:EPrints/DataObj/Subject|EPrints::DataObj::Subject]] and [[API:EPrints/DataObj/Document|EPrints::DataObj::Document]] and several other classes. | + | This module is a base class which is inherited by [[API:EPrints/DataObj/EPrint|EPrints::DataObj::EPrint]], [[API:EPrints/DataObj/User|EPrints::DataObj::User]], [[API:EPrints/DataObj/Subject|EPrints::DataObj::Subject]] and [[API:EPrints/DataObj/Document|EPrints::DataObj::Document]] and several other classes. |
It is ABSTRACT - its methods should not be called directly. | It is ABSTRACT - its methods should not be called directly. | ||
Line 75: | Line 75: | ||
Return true if successful. | Return true if successful. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_empty --> | ||
+ | ===$dataobj->empty()=== | ||
+ | |||
+ | Remove all of this object's values that may be imported. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 207: | Line 219: | ||
Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint. | Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_render_export_bar --> | ||
+ | ===$xhtml = $dataobj->render_export_bar( [ $staff ] )=== | ||
+ | |||
+ | Render a drop-down list of exports. | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
Line 246: | Line 270: | ||
Apply an output plugin to this items. Return the results. | Apply an output plugin to this items. Return the results. | ||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_copyright --> | ||
+ | ==COPYRIGHT== | ||
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
<span style='display:none'>User Comments</span> | <span style='display:none'>User Comments</span> |
Revision as of 10:46, 25 August 2011
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 SYNOPSIS
- 3 DESCRIPTION
- 3.1 $success = $dataobj->delete
- 3.2 $dataobj->empty()
- 3.3 $success = $dataobj->commit( [$force] )
- 3.4 $value = $dataobj->value( $fieldname )
- 3.5 $dataobj->set_value( $fieldname, $value )
- 3.6 @values = $dataobj->get_values( $fieldnames )
- 3.7 $bool = $dataobj->is_set( $fieldname )
- 3.8 $bool = $dataobj->exists_and_set( $fieldname )
- 3.9 $id = $dataobj->id
- 3.10 $xhtml = $dataobj->render_value( $fieldname, [$showall] )
- 3.11 $xhtml = $dataobj->render_citation( [$style], [%params] )
- 3.12 $xhtml = $dataobj->render_citation_link( [$style], %params )
- 3.13 $xhtml = $dataobj->render_export_bar( [ $staff ] )
- 3.14 $url = $dataobj->uri
- 3.15 $url = $dataobj->url
- 3.16 $plugin_output = $dataobj->export( $plugin_id, %params )
- 4 COPYRIGHT
NAME
EPrints::DataObj - Base class for records in EPrints.
SYNOPSIS
$dataobj = $dataset->dataobj( $id );
$dataobj->delete;
$dataobj->commit( $force );
$dataset = $dataobj->dataset;
$repo = $dataobj->repository;
$id = $dataobj->id;
$dataobj->set_value( $fieldname, $value );
$value = $dataobj->value( $fieldname );
\@value = $dataobj->value( $fieldname ); # multiple
$boolean = $dataobj->is_set( $fieldname );
$xhtml = $dataobj->render_value( $fieldname );
$xhtml = $dataobj->render_citation( $style, %opts );
$uri = $dataobj->uri;
$url = $dataobj->url;
$string = $dataobj->export( $plugin_id, %opts );
$dataobj = $dataobj->create_subobject( $fieldname, $epdata );
DESCRIPTION
This module is a base class which is inherited by EPrints::DataObj::EPrint, EPrints::DataObj::User, EPrints::DataObj::Subject and EPrints::DataObj::Document and several other classes.
It is ABSTRACT - its methods should not be called directly.
$success = $dataobj->delete
Delete this data object from the database and any sub-objects or related files.
Return true if successful.
$dataobj->empty()
Remove all of this object's values that may be imported.
$success = $dataobj->commit( [$force] )
Write this object to the database and reset the changed fields.
If $force isn't true then it only actually modifies the database if one or more fields have been changed.
Commit may also queue indexer jobs or log changes, depending on the object.
$value = $dataobj->value( $fieldname )
Get a the value of a metadata field. If the field is not set then it returns undef unless the field has the property multiple set, in which case it returns [] (a reference to an empty array).
$dataobj->set_value( $fieldname, $value )
Set the value of the named metadata field in this record.
@values = $dataobj->get_values( $fieldnames )
Returns a list of all the values in this record of all the fields specified by $fieldnames. $fieldnames should be in the format used by browse views - slash seperated fieldnames with an optional .id suffix to indicate the id part rather than the main part.
For example "author.id/editor.id" would return a list of all author and editor ids from this record.
$bool = $dataobj->is_set( $fieldname )
Returns true if the named field is set in this record, otherwise false.
Warns if the field does not exist.
$bool = $dataobj->exists_and_set( $fieldname )
Returns true if the named field is set in this record, otherwise false.
If the field does not exist, just return false.
This method is useful for plugins which may operate on multiple repositories, and the fact a field does not exist is not an issue.
$id = $dataobj->id
Returns the value of the primary key of this record.
$xhtml = $dataobj->render_value( $fieldname, [$showall] )
Returns the rendered version of the value of the given field, as appropriate for the current session. If $showall is true then all values are rendered - this is usually used for staff viewing data.
$xhtml = $dataobj->render_citation( [$style], [%params] )
Renders the record as a citation. If $style is set then it uses that citation style from the citations config file. Otherwise $style defaults to the type of this record. If $params{url} is set then the citiation will link to the specified URL.
$xhtml = $dataobj->render_citation_link( [$style], %params )
Renders a citation (as above) but as a link to the URL for this item. For example - the abstract page of an eprint.
$xhtml = $dataobj->render_export_bar( [ $staff ] )
Render a drop-down list of exports.
$url = $dataobj->uri
Returns a unique URI for this object. Not certain to resolve as a URL.
If $c->{dataobj_uri}->{eprint} is a function, call that to work it out.
$url = $dataobj->url
Returns the URL for this record, for example the URL of the abstract page of an eprint.
$plugin_output = $dataobj->export( $plugin_id, %params )
Apply an output plugin to this items. Return the results.
COPYRIGHT