From: Owen Leonard Date: Tue, 5 Oct 2010 23:52:06 +0000 (-0600) Subject: make ppi frequency configurable X-Git-Tag: release_1_1_0~14 X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=commitdiff_plain;h=a7b3dad05fd92523cda0ebb5ba7c85e194b4e82f;p=eq%2F.git make ppi frequency configurable --- diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php index 985f5ed..d1dae8e 100644 --- a/inc/class.tc.inc.php +++ b/inc/class.tc.inc.php @@ -35,6 +35,7 @@ class tc var $script_path; var $max_appointments; var $max_presidency_members; + var $ppi_frequency_label; var $public_functions = array ( @@ -105,6 +106,18 @@ class tc $this->current_month = $this->current_month-0; // Make it numeric $this->current_year = `date '+%Y'`; $this->current_year = $this->current_year-0; // Make it numeric + + if ($this->ppi_frequency == 12) { + $this->ppi_frequency_label = "Annual"; + } else if ($this->ppi_frequency == 6) { + $this->ppi_frequency_label = "Semi-Annual"; + } else if ($this->ppi_frequency == 3) { + $this->ppi_frequency_label = "Quarterly"; + } else if ($this->ppi_frequency == 1) { + $this->ppi_frequency_label = "Monthly"; + } else { + $this->ppi_frequency_label = "Periodic"; + } echo parse_navbar(); $this->display_app_header(); @@ -1344,13 +1357,13 @@ class tc $this->t->set_var('lang_reset','Clear Changes'); $this->t->set_var('ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view')); - $this->t->set_var('ppi_link_title','Yearly PPIs'); + $this->t->set_var('ppi_link_title',$this->ppi_frequency_label . ' PPIs'); $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched')); - $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs'); + $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs'); $this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched&action=save')); - $this->t->set_var('title','Yearly PPI Scheduler'); + $this->t->set_var('title',$this->ppi_frequency_label . ' PPI Scheduler'); $indiv_width=500; $phone_width=25; $pri_width=10; $notes_width=128; $ppi_date_width=20; $table_width=$indiv_width + $phone_width + $pri_width + $notes_width + $ppi_date_width; @@ -1362,6 +1375,10 @@ class tc $table_data=""; $completed_data=""; $totals_data=""; $year = date('Y'); + $month = date('m'); + $period = intval(($month-1)/$this->ppi_frequency) + 1; + $start_of_period = ($period-1)*$this->ppi_frequency + 1; + $end_of_period = $period * $this->ppi_frequency; if($action == 'save') { // Save any changes made to the appointment table @@ -1454,8 +1471,8 @@ class tc // Display a scheduling table for this presidency member $district_number = '*'; $district_name = $presidency_name; - $table_title = "District ".$district_number.": ".$district_name.": All indivs with Yearly PPI Not Completed"; - $appt_table_title = "District ".$district_number.": ".$district_name.": Yearly PPI Appointment Slots"; + $table_title = "District ".$district_number.": ".$district_name.": All indivs with " . $this->ppi_frequency_label . " PPI Not Completed"; + $appt_table_title = "District ".$district_number.": ".$district_name.": ".$this->ppi_frequency_label." PPI Appointment Slots"; $this->t->set_var('table_title',$table_title); $this->t->set_var('appt_table_title',$appt_table_title); @@ -1527,7 +1544,7 @@ class tc } $max = count($individual); - + for($i=0; $i < $max; $i++) { $id = $individual[$i]; $name = $indiv_name[$i]; @@ -1535,9 +1552,10 @@ class tc $priority = $indiv_priority[$id]; $notes = $indiv_notes[$id]; - // If this individual has had a yearly PPI this year, don't show him on the schedule list - $year_start = $year - 1 . "-12-31"; $year_end = $year + 1 . "-01-01"; - $sql = "SELECT * FROM tc_interview WHERE date > '$year_start' AND date < '$year_end' ". + // If this individual has had a PPI this period, don't show him on the schedule list + $year_start = $year . "-" . $start_of_period . "-01"; + $year_end = $year . "-" . $end_of_period . "-31"; + $sql = "SELECT * FROM tc_interview WHERE date >= '$year_start' AND date <= '$year_end' ". "AND individual=" . $id . " AND interview_type='ppi' ORDER BY date DESC"; $this->db2->query($sql,__LINE__,__FILE__); @@ -1623,7 +1641,7 @@ class tc $totals_header_row = "Individuals"; $totals_header_row.= "$year"; $totals_data.= ""; - $totals_data.= "Total Individuals with yearly PPIs completed:"; + $totals_data.= "Total Individuals with " . $this->ppi_frequency_label . " PPIs completed:"; $totals_data.= "$indivs_with_yearly_ppi / $total_indivs"; $percent = ceil(($indivs_with_yearly_ppi / $total_indivs)*100); $tr_color = $this->nextmatchs->alternate_row_color($tr_color); @@ -2315,12 +2333,12 @@ class tc $this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view')); $this->t->set_var('ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_view')); - $this->t->set_var('ppi_link_title','Yearly PPIs'); + $this->t->set_var('ppi_link_title',$this->ppi_frequency_label . ' PPIs'); $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched')); - $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs'); + $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs'); - $this->t->set_var('title','Yearly PPIs'); + $this->t->set_var('title',$this->ppi_frequency_label . ' PPIs'); $num_months = get_var('num_months',array('GET','POST')); if($num_months == '') { $num_months = $this->default_ppi_num_years; } $this->t->set_var('num_months',$num_months); @@ -3515,7 +3533,7 @@ class tc $this->t->set_var('schedule_int_link_title','Schedule Hometeaching Interviews'); $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched')); - $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs'); + $this->t->set_var('schedule_ppi_link_title','Schedule ' . $this->ppi_frequency_label . ' PPIs'); $date_width=160; $time_width=220; $indiv_width=170; $family_width=180; $location_width=100; $table_width=$date_width + $time_width + $indiv_width + $family_width + $location_width; diff --git a/setup/tc_config b/setup/tc_config index 19849a2..7b959ae 100644 --- a/setup/tc_config +++ b/setup/tc_config @@ -33,6 +33,11 @@ $this->time_drop_down_lists = 1; // Examples: Monthly=1 Quarterly=3 Yearly=12 $this->monthly_hometeaching_interview_stats = 3; +// Frequency of PPIs in months +// This number must evenly divide 12. +// Examples: Monthly=1 Quarterly=3 Yearly=12 +$this->ppi_frequency = 12; + // Specify who can hold yearly PPIs // 1 = EQ President // 2 = EQ President + Counselors