/[Frey]/trunk/lib/App/RoomReservation/Room.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/App/RoomReservation/Room.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1095 - (show annotations)
Sun Jun 28 18:51:49 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 988 byte(s)
insert attributes into database and fixed tests
1 package App::RoomReservation::Room;
2 use Moose;
3
4 use Frey;
5 with 'Frey::Web';
6
7 has room => (
8 is => 'rw',
9 isa => 'Str',
10 required => 1,
11 default => 'zimbardo',
12 );
13
14 has description => (
15 is => 'rw',
16 isa => 'Str',
17 required => 1,
18 default => q|
19 <h2>Prijava za predavanje profesora Phillipa Zimbarda "The Lucifer Effect"</h2>
20 <h3>28. 9. 2009. u 12 sati </h3>
21 |,
22 );
23
24 has seats => (
25 is => 'rw',
26 isa => 'Int',
27 required => 1,
28 default => 600,
29 );
30
31 sub seats_full { 42 }
32
33 sub seats_left {
34 my ($self) = @_;
35 $self->seats - $self->seats_full;
36 }
37
38 sub room_markup {
39 my ($self) = @_;
40
41 my $size = 50; # %
42
43 my $full = int( $size * ( $self->seats_full / $self->seats ) );
44 my $left = int( $size * ( $self->seats_left / $self->seats ) );
45
46 $self->description
47 . qq|
48 <table width=$size%>
49 <tr><th colspan=2>seats</th></tr>
50 <tr><th>full</th><th>left</th>
51 <tr><td width=$full%>
52 | . $self->seats_full . qq|
53 </td><td width=$left%>
54 | . $self->seats_left . qq|
55 </td></tr>
56 </table>
57 |
58 }
59
60 1;

  ViewVC Help
Powered by ViewVC 1.1.26