- Timestamp:
- 01/28/16 16:47:36 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Root.pm
r1687 r1688 73 73 my ( $self, $c ) = @_; 74 74 75 my $ouser = $c->model('Accounts')->db->get_object( 76 'user', 77 $c->user->{username}, 78 ); 75 if ($c->user->{username}) { 76 my $ouser = $c->model('Accounts')->db->get_object( 77 'user', 78 $c->user->{username}, 79 ); 79 80 80 my @cd = split('-', DateTime->from_epoch( 81 epoch => str2time( 82 $ouser->get_attributes('create'), 83 ) 84 )->ymd('-')); 85 my @now = split('-', DateTime->now()->ymd('-')); 86 87 my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@cd, @now); 88 $c->stash->{accountExists} = join(', ', 89 ($Dy ? $c->loc('[_1] years', $Dy) : ()), 90 ($Dm ? $c->loc('[_1] months', $Dm) : ()), 91 ($Dd ? $c->loc('[_1] days', $Dd) : ()), 92 ); 93 94 if (my $expire = $ouser->get_attributes('expire')) { 95 my @ed = split('-', DateTime->from_epoch( 81 my @cd = split('-', DateTime->from_epoch( 96 82 epoch => str2time( 97 $ expire83 $ouser->get_attributes('create'), 98 84 ) 99 85 )->ymd('-')); 86 my @now = split('-', DateTime->now()->ymd('-')); 100 87 101 my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@ now, @ed);102 $c->stash->{accountEx pire} = join(', ',88 my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@cd, @now); 89 $c->stash->{accountExists} = join(', ', 103 90 ($Dy ? $c->loc('[_1] years', $Dy) : ()), 104 91 ($Dm ? $c->loc('[_1] months', $Dm) : ()), 105 92 ($Dd ? $c->loc('[_1] days', $Dd) : ()), 106 93 ); 94 95 if (my $expire = $ouser->get_attributes('expire')) { 96 my @ed = split('-', DateTime->from_epoch( 97 epoch => str2time( 98 $expire 99 ) 100 )->ymd('-')); 101 102 my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@now, @ed); 103 $c->stash->{accountExpire} = join(', ', 104 ($Dy ? $c->loc('[_1] years', $Dy) : ()), 105 ($Dm ? $c->loc('[_1] months', $Dm) : ()), 106 ($Dd ? $c->loc('[_1] days', $Dd) : ()), 107 ); 108 } 107 109 } 108 109 110 110 } 111 111
Note: See TracChangeset
for help on using the changeset viewer.