package EPrints::Plugin::Export::REPOSITORYID::Activity; use EPrints::Plugin::Export; @ISA = ( "EPrints::Plugin::Export" ); use strict; sub new { my( $class, %opts ) = @_; my $self = $class->SUPER::new( %opts ); # Register $self->{name} = "Deposit Activity (REPOSITORYID)"; $self->{accept} = [ 'dataobj/eprint', 'list/eprint' ]; $self->{visible} = "all"; $self->{suffix} = ".txt"; $self->{mimetype} = "text/plain; charset=utf-8"; return $self; } # Override output_list function to print a header at the top of the export sub output_list { my( $plugin, %opts ) = @_; my $heading = "Deposited by\tDeposit date\n"; if( defined $opts{fh} ) { # Write header to filehandle print {$opts{fh}} $heading; return $plugin->SUPER::output_list( %opts ); } else { return $heading . $plugin->SUPER::output_list( %opts ); } } sub output_dataobj { my( $plugin, $dataobj ) = @_; # Convert - print username and date deposited my $user = $dataobj->get_user; my $username = $user->get_value( "username" ); my $date_deposited = $dataobj->get_value( "datestamp" ); return "$username\t$date_deposited\n"; } 1;