WTF::Data - Container for data generation functions
This document describes WTF::Data version 1.02
use WTF::Data; my ( $work_data, $week_of ) = WTF::Data::myweekly_data( $user_id, $date ); my $team_data = WTF::Data::team_data( @input_parameters ); my $employee_ids = WTF::Data::get_team_employee_ids($id);
This module is a container for data generation functions for pages that are large, called from multiple places, or both.
There are two functions in this module, each provides data generation functionality.
myweekly_data()
This function generates the data used on the ``My Weekly Time'' page. It requires a user ID number and a MySQL date string (i. e. 2006-10-25).
my ( $user_id, $date ) = ( 77, '2006-10-25' ); my ( $work_data, $week_of ) = WTF::Data::myweekly_data( $user_id, $date );
The function returns a reference to an array and a scalar. The scalar is a MySQL date string representing the date of the Sunday of the week of the date string passed in. For example, if $date is ``2006-10-25'', then $week_of will be ``2006-10-22''.
The the array reference contains a complex data structure suitable for page display. The data structure inside the array might look similar to this:
{ 'work_day' => 'Friday, October 6, 2006', 'notes' => '1-on-1 with manager', 'date' => '2006-10-06', }, { 'work_day' => 'Thursday, October 5, 2006', 'notes' => 'Interviewed candidate for new position', 'date' => '2006-10-05', }, { 'work_day' => 'Monday, October 2, 2006', 'notes' => 'Weekly status meeting', 'days' => [ { 'codeline' => 'Management Systems', 'hours' => '1.00', 'date' => '2006-10-02', 'project' => 'New Project X (Func. Spec. Review, Sign-off)', 'bug' => '1138', }, ], },
team_data()
This function generates the data used on the ``Team View'' page. It requires three and accepts five inputs.
# reference to an array containing team ID numbers my $team_ids = [ 42, 1138 ];
# MySQL date strings for start and end of data range my ( $date_start, $date_end ) = ( '2006-10-01', '2006-10-07' );
# booleans to display notes and extended team data # (optional; defaults to 0) my ( $notes_view, $extended_team ) = ( 1, 0 );
my $team_data = WTF::Data::team_data( $team_ids, $date_start, $date_end, $notes_view, $extended_team, );
The function returns a reference to a complex data structure containing data suitable for page display. The data structure inside the array might look similar to this:
{ 'team' => 'Nakatomi' 'employees' => [ { 'employee_id' => 77, 'employee' => 'Hans Gruebber', 'last_login' => '2006-10-10 09:01:22', 'work_days' => [ { 'codeline' => 'Management Systems', 'hours' => '1.00', 'date' => '2006-10-02', 'project' => 'New Project X (Func. Spec.)', 'bug' => '1138', }, ], 'note_content' => [ { 'work_day' => 'Friday, October 6, 2006', 'notes' => '1-on-1 with manager', 'date' => '2006-10-06', }, { 'work_day' => 'Thursday, October 5, 2006', 'notes' => 'Interviewed candidate for new position', 'date' => '2006-10-05', }, ], }, ], }
get_team_employee_ids()
This simple function accepts a user ID (typically the user ID of the current user) and returns an array reference containing a list of all the user IDs of all the users in the extended team of the initial user referenced by the incoming user ID.
my $employee_ids = WTF::Data::get_team_employee_ids($id); # $id might be 1138 # $employee_ids might be [ 42, 1138, 433 ]
WTF::Data depends on the following modules:
Use of this module implies the reading and agreement with the license under which this software is release. That license can be found in the ``license.txt'' file included with this distribution.