4 $MultiQueueStatus $MultiQueueDateFormat @MultiQueueQueueList $MultiQueueMaxRows $MultiQueueWeekends $MultiQueueLabelDateFormat
5 $PerDayStatus $PerDayDateFormat $PerDayQueue $PerDayMaxRows $PerDayWeekends $PerDayLabelDateFormat $PerDayPeriod
7 @OpenStalledQueueList $OpenStalledWeekends
8 $TimeToResolveDateFormat $TimeToResolveQueue $TimeToResolveMaxRows $TimeToResolveWeekends $TimeToResolveLabelDateFormat
9 $TimeToResolveGraphQueue
10 @years @months %monthsMaxDay
13 $GraphWidth $GraphHeight
18 # I couldn't figure out a way to override these in RT_SiteConfig, which would be
21 # Width and Height of all graphics
25 # Initial settings for the CallsMultiQueue stat page
26 $MultiQueueStatus = "resolved";
27 $MultiQueueDateFormat = "%a %b %d %Y"; # format for dates on Multi Queue report, see "man strftime" for options
28 @MultiQueueQueueList = ("General"); # list of queues to start Multi Queue per day reports
29 $MultiQueueMaxRows = 10;
30 $MultiQueueWeekends = 1;
31 $MultiQueueLabelDateFormat = "%a";
33 # Initial settings for the CallsQueueDay stat page
34 $PerDayStatus = "resolved";
35 $PerDayDateFormat = "%a %b %d %Y";
36 $PerDayQueue = "General";
39 $PerDayLabelDateFormat = "%a";
42 # Initial settings for the DayOfWeek stat page
43 $DayOfWeekQueue = "General";
45 # Initial settings for the OpenStalled stat page
46 @OpenStalledQueueList = ("General");
47 $OpenStalledWeekends = 1;
49 # Initial settings for the TimeToResolve stat page
50 $TimeToResolveDateFormat = "%a %b %d";
51 $TimeToResolveQueue = "General";
52 $TimeToResolveMaxRows = 10;
53 $TimeToResolveWeekends = 1;
54 $TimeToResolveLabelDateFormat = "%a";
56 # Initial settings for the TimeToResolve Graph page
57 $TimeToResolveGraphQueue = "General";
61 # List of years and months to populate drop down lists
62 @years =('2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003' ,'2003' ,'2002');
63 @months=qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
66 1 => 29, # February, allow for leap year
79 # Set to one to prevent users without the ShowConfigTab right from seeing Statistics
82 # Variables to control debugging
83 my $debugging=0; # set to 1 to enable debugging
88 Returns a string representing the specified date formatted by the specified string
94 return POSIX::strftime($fmt, localtime($self->Unix));
98 =head2 RTDateSetToLocalMidnight
100 Sets the date to midnight (at the beginning of the day) local time
101 Returns the unixtime at midnight.
104 sub RTDateSetToLocalMidnight {
107 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
108 $self->Unix(timelocal (0,0,0,$mday,$mon,$year,$wday,$yday));
110 return ($self->Unix);
113 =head2 RTDateIsWeekend
115 Returns 1 if the date is on saturday or sunday
118 sub RTDateIsWeekend {
121 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
122 return 1 if (($wday==6) || ($wday==0));
126 =head2 RTDateGetDateWeekday
128 Returns the localized name of the day specified by date
131 sub RTDateGetDateWeekday {
134 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
135 return $self->GetWeekday($wday);
140 Subtracts 24 hours from the current time
146 $self->AddSeconds(0 - $DAY);
149 =head2 RTDateSubDays $DAYS
151 Subtracts 24 hours * $DAYS from the current time
158 $self->AddSeconds(0 - ($days * $DAY));
163 Creates a text area on the page if debugging is on.
170 $m->print("<TEXTAREA NAME=debugarea COLS=120 ROWS=50>$debugtext</TEXTAREA>\n");
174 =head2 DebugLog $logmsg
176 Adds a message to the debug area
184 $RT::Logger->debug($line);
190 Clears the current debug string, otherwise it builds from page to page
200 =head2 DurationAsString
202 Returns a string representing the specified duration
206 sub DurationAsString {
207 my $Duration = shift;
209 my $HOUR = $MINUTE*60;
210 my $DAY = $HOUR * 24;
212 my $days = int($Duration / $DAY);
213 $Duration = $Duration % $DAY;
214 my $hours = int($Duration / $HOUR);
215 $hours = sprintf("%02d", $hours);
216 $Duration = $Duration % $HOUR;
217 my $minutes = int($Duration/$MINUTE);
218 $minutes = sprintf("%02d", $minutes);
219 $Duration = $Duration % $MINUTE;
220 my $secs = sprintf("%02d", $Duration);
234 return "$days days $hours:$minutes:$secs";