- Timestamp:
- 01/28/16 16:34:17 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Root.pm
r1682 r1687 6 6 no utf8; 7 7 use POSIX; 8 use DateTime; 9 use Date::Calc; 10 use Date::Parse; 8 11 9 12 # … … 65 68 66 69 $c->res->status(404); 70 } 71 72 sub index : Private { 73 my ( $self, $c ) = @_; 74 75 my $ouser = $c->model('Accounts')->db->get_object( 76 'user', 77 $c->user->{username}, 78 ); 79 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( 96 epoch => str2time( 97 $expire 98 ) 99 )->ymd('-')); 100 101 my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@now, @ed); 102 $c->stash->{accountExpire} = join(', ', 103 ($Dy ? $c->loc('[_1] years', $Dy) : ()), 104 ($Dm ? $c->loc('[_1] months', $Dm) : ()), 105 ($Dd ? $c->loc('[_1] days', $Dd) : ()), 106 ); 107 } 108 109 67 110 } 68 111
Note: See TracChangeset
for help on using the changeset viewer.