1 package SL::Presenter::Project;
5 use parent qw(Exporter);
7 use Exporter qw(import);
8 our @EXPORT = qw(project);
13 my ($self, $project, %params) = @_;
15 return '' unless $project;
17 $params{display} ||= 'inline';
19 croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
21 my $description = $project->full_description(style => $params{style});
22 my $callback = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
25 $params{no_link} ? '' : '<a href="controller.pl?action=Project/edit&id=' . $self->escape($project->id) . $callback . '">',
26 $self->escape($description),
27 $params{no_link} ? '' : '</a>',
29 return $self->escaped_text($text);
42 SL::Presenter::Project - Presenter module for project Rose::DB objects
46 my $project = SL::DB::Manager::Project->get_first;
47 my $html = SL::Presenter->get->project($project, display => 'inline');
53 =item C<project $object, %params>
55 Returns a rendered version (actually an instance of
56 L<SL::Presenter::EscapedText>) of the project object C<$customer>.
58 C<%params> can include:
64 Either C<inline> (the default) or C<table-cell>. At the moment both
65 representations are identical and produce the project's description
66 (controlled by the C<style> parameter) linked to the corresponding
71 Determines what exactly will be output. Can be one of the values with
72 C<both> being the default if it is missing:
76 =item C<projectnumber> (or simply C<number>)
78 Outputs only the project's number.
80 =item C<projectdescription> (or simply C<description>)
82 Outputs only the project's description.
86 Outputs the project's number followed by its description in
87 parenthesis (e.g. "12345 (Secret Combinations)"). If the project's
88 description is already part of the project's number then it will not
95 If falsish (the default) then the project's description will be linked to
96 the "edit project" dialog from the master data menu.
108 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>