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
63 @years = reverse( 2002 .. ($lt[5]+1900) );
64 @months=qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
67 1 => 29, # February, allow for leap year
80 # Set to one to prevent users without the ShowConfigTab right from seeing Statistics
83 # Variables to control debugging
84 my $debugging=0; # set to 1 to enable debugging
89 Returns a string representing the specified date formatted by the specified string
95 return POSIX::strftime($fmt, localtime($self->Unix));
99 =head2 RTDateSetToLocalMidnight
101 Sets the date to midnight (at the beginning of the day) local time
102 Returns the unixtime at midnight.
105 sub RTDateSetToLocalMidnight {
108 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
109 $self->Unix(timelocal (0,0,0,$mday,$mon,$year,$wday,$yday));
111 return ($self->Unix);
114 =head2 RTDateIsWeekend
116 Returns 1 if the date is on saturday or sunday
119 sub RTDateIsWeekend {
122 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
123 return 1 if (($wday==6) || ($wday==0));
127 =head2 RTDateGetDateWeekday
129 Returns the localized name of the day specified by date
132 sub RTDateGetDateWeekday {
135 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($self->Unix);
136 return $self->GetWeekday($wday);
141 Subtracts 24 hours from the current time
147 $self->AddSeconds(0 - $DAY);
150 =head2 RTDateSubDays $DAYS
152 Subtracts 24 hours * $DAYS from the current time
159 $self->AddSeconds(0 - ($days * $DAY));
164 Creates a text area on the page if debugging is on.
171 $m->print("<TEXTAREA NAME=debugarea COLS=120 ROWS=50>$debugtext</TEXTAREA>\n");
175 =head2 DebugLog $logmsg
177 Adds a message to the debug area
185 $RT::Logger->debug($line);
191 Clears the current debug string, otherwise it builds from page to page
201 =head2 DurationAsString
203 Returns a string representing the specified duration
207 sub DurationAsString {
208 my $Duration = shift;
210 my $HOUR = $MINUTE*60;
211 my $DAY = $HOUR * 24;
213 my $days = int($Duration / $DAY);
214 $Duration = $Duration % $DAY;
215 my $hours = int($Duration / $HOUR);
216 $hours = sprintf("%02d", $hours);
217 $Duration = $Duration % $HOUR;
218 my $minutes = int($Duration/$MINUTE);
219 $minutes = sprintf("%02d", $minutes);
220 $Duration = $Duration % $MINUTE;
221 my $secs = sprintf("%02d", $Duration);
235 return "$days days $hours:$minutes:$secs";