Revision 466

Date:
2014/12/18 10:27:31
Author:
ahitrov
Revision Log:
username methods
Files:

Legend:

 
Added
 
Removed
 
Modified
  • koi8/plugins/users/lib/users/UserProfile.pm

     
    38 38 )
    39 39 }
    40 40
    41 sub name_full
    42 {
    43 my $self = shift;
    44 my $name = $self->name;
    45 if ( $name =~ /^(.*?),[\ \t]+(.*)$/ ) {
    46 $name = $2.' '.$1;
    47 }
    48 return $name;
    49 }
    50
    51 sub name_part
    52 {
    53 my $self = shift;
    54 my $name = $self->name;
    55 if ( $name =~ /^(.*?),[\ \t]+(.*)$/ ) {
    56 $name = $2;
    57 } else {
    58 my @parts = split /\s+/, $name;
    59 if ( @parts > 1 ) {
    60 pop @parts;
    61 }
    62 $name = join ' ', @parts;
    63 }
    64 return $name;
    65 }
    66
    67 sub name_family
    68 {
    69 my $self = shift;
    70 my $name = $self->name;
    71 if ( $name =~ /^(.*?),[\ \t]+(.*)$/ ) {
    72 $name = $1;
    73 } else {
    74 my @parts = split /\s+/, $name;
    75 if ( @parts > 1 ) {
    76 $name = pop @parts;
    77 }
    78 }
    79 return $name;
    80 }
    81
    82 sub name_first
    83 {
    84 my $self = shift;
    85 my @name = split /\s+/, $self->name_part;
    86
    87 return $name[0];
    88 }
    89
    90 sub name_middle
    91 {
    92 my $self = shift;
    93 my @name = split /\s+/, $self->name_part;
    94 shift @name if @name;
    95 my $name = @name ? join (' ', @name) : '';
    96
    97 return $name;
    98 }
    99
    41 100 sub class_name
    42 101 {
    43 102 return '������� ������������';