X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=inc%2Fclass.eq.inc.php;h=1869a5242d91d1fcf09bf25a7e1037a5ae6e9ed6;hb=efcafa2e11c27800278e38169f6ed4fc23e7e6d1;hp=06c61e0c683ea333e549a240cbb4accf37c4c0d6;hpb=47e6860c835dfef75f83a38d0c17b36062ebc470;p=eq%2F.git diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 06c61e0..1869a52 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -22,9 +22,10 @@ class eq var $default_ht_num_months; var $default_ppi_num_months; var $default_ppi_num_years; - var $default_int_num_months; + var $default_int_num_quarters; var $default_int_num_years; - var $default_att_num_months; + var $default_vis_num_years; + var $default_att_num_quarters; var $current_year; var $current_month; var $upload_target_path; @@ -61,10 +62,9 @@ class eq $this->default_ppi_num_months = 3; $this->default_ppi_num_years = 0; $this->default_int_num_quarters = 1; - $this->default_int_num_months = 3; $this->default_int_num_years = 0; - $this->default_att_num_quarters = 3; - $this->default_att_num_months = 3; + $this->default_att_num_quarters = 1; + $this->default_vis_num_years = 1; $this->upload_target_path = "/home/users/eqpres/eq_data/"; $this->script_path = "/usr/share/phpgroupware/eq/"; @@ -2378,9 +2378,19 @@ class eq $this->t->set_var('schedule_vis_link',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.vis_sched')); $this->t->set_var('schedule_vis_link_title','Schedule Yearly Visits'); + + $this->t->set_var('linkurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.vis_view')); + $num_years = get_var('num_years',array('GET','POST')); + if($num_years == '') { $num_years = $this->default_vis_num_years; } + $this->t->set_var('num_years',$num_years); + if($num_years == 1) { $this->t->set_var('lang_num_years','Year of History'); } + else { $this->t->set_var('lang_num_years','Years of History'); } + $this->t->set_var('lang_filter','Filter'); + $year = date('Y') - $num_years + 1; + $year_start = $year - 1 . "-12-31"; $year_end = $year + 1 . "-01-01"; - $sql = "SELECT * FROM eq_visit WHERE companionship=0 ORDER BY date DESC"; + $sql = "SELECT * FROM eq_visit WHERE companionship=0 and date > '$year_start' ORDER BY date DESC"; $this->db->query($sql,__LINE__,__FILE__); $total_records = $this->db->num_rows(); @@ -2573,13 +2583,20 @@ class eq $this->t->set_block('att_view_t','elder_list','list3'); $this->t->set_var('linkurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.att_view')); - $num_months = get_var('num_months',array('GET','POST')); - if($num_months == '') { $num_months = $this->default_att_num_months; } - $this->t->set_var('num_months',$num_months); + $num_quarters = get_var('num_quarters',array('GET','POST')); + if($num_quarters == '') { $num_quarters = $this->default_att_num_quarters; } + $this->t->set_var('num_quarters',$num_quarters); $this->t->set_var('lang_filter','Filter'); - if($num_months == 1) { $this->t->set_var('lang_num_months','Month of History'); } - else { $this->t->set_var('lang_num_months','Months of History'); } - + if($num_quarters == 1) { $this->t->set_var('lang_num_quarters','Quarter of History'); } + else { $this->t->set_var('lang_num_quarters','Quarters of History'); } + + $num_months = $num_quarters * 3; + $current_month = $this->current_month; + if($current_month >= 1 && $current_month <= 3) { $current_month=3; } + else if($current_month >= 4 && $current_month <= 6) { $current_month=6; } + else if($current_month >= 7 && $current_month <= 9) { $current_month=9; } + else if($current_month >= 10 && $current_month <= 12) { $current_month=12; } + $sql = "SELECT * FROM eq_elder where valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -2590,13 +2607,12 @@ class eq $i++; } array_multisort($elder_name, $elder_id); - // Create a list of sunday dates for a window of 3 months back and current month $i=0; $last_time = 0; $found_sunday = 0; - $sunday_list[0]['date'] = date("Y-m-d", mktime(0, 0, 0, date("m")-$num_months, 1, date("y"))); + $sunday_list[0]['date'] = date("Y-m-d", mktime(0, 0, 0, $current_month-$num_months, 1, date("y"))); $last_date = explode("-",$sunday_list[0]['date']); $last_time = mktime(0, 0, 0, $last_date[1], $last_date[2], $last_date[0]); $time_limit = mktime(0, 0, 0, date("m"), date("t"), date("y")); @@ -2604,7 +2620,7 @@ class eq { $day = date("w",$last_time); if(date("w",$last_time) == 0) { - $sunday_list[$i]['date'] = date("Y-m-d", $last_time); + $sunday_list[$i]['date'] = date("Y-m-d", $last_time); $last_date = explode("-",$sunday_list[$i]['date']); $last_time = mktime(0, 0, 0, $last_date[1], $last_date[2], $last_date[0]); $sunday_list[$i]['day'] = $last_date[2]; @@ -2779,6 +2795,7 @@ class eq { $elder_name[$i] = $this->db->f('name'); $elder_id[$i] = $this->db->f('elder'); + $elder_attending[$elder_id[$i]] = $this->db->f('attending'); $i++; } array_multisort($elder_name, $elder_id); @@ -2856,6 +2873,8 @@ class eq $value = $elder_id[$i] . "-" . $sunday_list[$j]['date']; if($this->db->next_record()) { $att_table .= ''; + } else if($elder_attending[$elder_id[$i]] == 1) { + $att_table .= ''; } else { $att_table .= ''; }