From: Alan J. Pippin <ajp@server.pippins.net>
Date: Sat, 16 Feb 2008 02:56:23 +0000 (-0700)
Subject: Changed monthly_hometeaching_interview_stats config variable to mean every X months.
X-Git-Tag: release_0_3_0~16
X-Git-Url: http://git.pippins.net/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/images/%7Blink_activity%7D?a=commitdiff_plain;h=b74dbe53448ab77b7ff14bae31ea9a2b2e56ab38;p=eq%2F.git

Changed monthly_hometeaching_interview_stats config variable to mean every X months.

It now represents the frequency of hometeaching interview stats in months.
Example Values: Monthly=1 Quarterly=3 Yearly=12
---

diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php
index 4574d4b..68bc93d 100644
--- a/inc/class.eq.inc.php
+++ b/inc/class.eq.inc.php
@@ -2722,26 +2722,19 @@ class eq
 	  $table_data .= "<tr><td colspan=20><hr></td></tr>";
 	}
 	$total_companionships += $num_companionships;
-	$stat_data = "<tr><td><b><font size=-2>$num_companionships Companionships<br>Interview Quarterly Totals:</font></b></td>";
+	$stat_data = "<tr><td><b><font size=-2>$num_companionships Companionships<br>Interview Totals:</font></b></td>";
 
 	// Print the hometeaching interview stats
-	if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly
-	  for($m=$num_months; $m >=0; $m--) {
-	    $month = $current_month - $m;
-	    if(($month % 3) == 1) { $quarter_total = $ints[$m]; }
-	    else { $quarter_total += $ints[$m]; }
-	    $percent = ceil(($quarter_total / $num_companionships)*100);
-	    $stat_data .= "<td align=center><font size=-2><b>$quarter_total<br>$percent%</font></b></td>";
-	  }
-	  $stat_data .= "</tr>";
-	}
-	else { // Monthly
-	  for($m=$num_months; $m >=0; $m--) {
-	    $percent = ceil(($ints[$m] / $num_companionships)*100);
-	    $stat_data .= "<td align=center><font size=-2><b>$ints[$m]<br>$percent%</font></b></td>";
-	  }
-	  $stat_data .= "</tr>";
+	for($m=$num_months; $m >=0; $m--) {
+	  $month = $current_month - $m;
+	  $month_begins = $month % $this->monthly_hometeaching_interview_stats;
+	  if($this->monthly_hometeaching_interview_stats == 1) { $month_begins = 1; }
+	  if(($month_begins) == 1) { $total = $ints[$m]; }
+	  else { $total += $ints[$m]; }
+	  $percent = ceil(($total / $num_companionships)*100);
+	  $stat_data .= "<td align=center><font size=-2><b>$total<br>$percent%</font></b></td>";
 	}
+	$stat_data .= "</tr>";
 	
 	$this->t->set_var('table_width',$table_width);
 	$this->t->set_var('header_row',$header_row);
@@ -2751,27 +2744,19 @@ class eq
       }
 
       // Display the totals
-      if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly
-	$quarter_total = 0;
-	$totals = "<tr><td><b><font size=-2>$total_companionships Total Comps<br>Interview Quarterly Totals:</font></b></td>";
-	for($m=$num_months; $m >=0; $m--) {
-	  $month = $current_month - $m;
-	  if(($month % 3) == 1) { $quarter_total = $total_ints[$m]; }
-	  else { $quarter_total += $total_ints[$m]; }
-	  $percent = ceil(($quarter_total / $total_companionships)*100);
-	  $totals .= "<td align=center><font size=-2><b>$quarter_total<br>$percent%</font></b></td>";
-	}
-	$totals .= "</tr>";
-      }
-      else { //Monthly
-	$totals = "<tr><td><b><font size=-2>$total_companionships Total Comps<br>Interview Monthly Totals:</font></b></td>";
-	for($m=$num_months; $m >=0; $m--) {
-	  $percent = ceil(($total_ints[$m] / $total_companionships)*100);
-	  $totals .= "<td align=center><font size=-2><b>$total_ints[$m]<br>$percent%</font></b></td>";
-	}
-	$totals .= "</tr>";
+      $total = 0;
+      $totals = "<tr><td><b><font size=-2>$total_companionships Total Comps<br>Interview Totals:</font></b></td>";
+      for($m=$num_months; $m >=0; $m--) {
+	$month = $current_month - $m;
+	$month_begins = $month % $this->monthly_hometeaching_interview_stats;
+	if($this->monthly_hometeaching_interview_stats == 1) { $month_begins = 1; }
+	if(($month_begins) == 1) { $total = $total_ints[$m]; }
+	else { $total += $total_ints[$m]; }
+	$percent = ceil(($total / $total_companionships)*100);
+	$totals .= "<td align=center><font size=-2><b>$total<br>$percent%</font></b></td>";
       }
-      
+      $totals .= "</tr>";
+          
       $this->t->set_var('totals',$totals);
       $this->t->pfp('out','int_view_t');
       $this->save_sessiondata(); 
diff --git a/setup/eq_config b/setup/eq_config
index eadd5b4..54b8d4a 100644
--- a/setup/eq_config
+++ b/setup/eq_config
@@ -22,10 +22,10 @@ $this->unzip_path = "/usr/local/bin/unzip";
 // If set to 1, drop down lists will be used for the hour and minute fields
 $this->time_drop_down_lists = 1;
 
-// Compute hometeaching interview stats per month or per quarter
-// If set to 0, stats will be computed per quarter.
-// If set to 1, stats will be computed per month.
-$this->monthly_hometeaching_interview_stats = 0;
+// Frequency of hometeaching interview stats in months
+// This number must evenly divide 12.
+// Examples: Monthly=1 Quarterly=3 Yearly=12
+$this->monthly_hometeaching_interview_stats = 3;
 
 // Specify the minute interval increment to use in the time drop down lists
 $this->time_drop_down_list_inc = 15;