made sandbox configurable so that you can show either all visits for the family,...
authorOwen Leonard <owen@balawis.leonard.fam>
Thu, 21 Oct 2010 18:06:05 +0000 (12:06 -0600)
committerOwen Leonard <owen@balawis.leonard.fam>
Thu, 21 Oct 2010 18:06:05 +0000 (12:06 -0600)
inc/class.tc.inc.php
setup/tc_config
sql/schema.dot
sql/tc.jpg
sql/tc.sql

index c4337f1d5a8a05d0eeeeaec1ebec9e5ba29303e8..dee205c5ed178e6d8682324c09da8fc66fa35595 100644 (file)
@@ -426,7 +426,7 @@ class tc
                        $unassigned_family_list = get_var('unassignedFamilies',array('POST'));
                        
                        if ($assignedHT_list || $unassignedHT_list) {
-                               $sql = "INSERT INTO tc_companionship_sandbox (district) VALUES (\"$district\")";
+                               $sql = "INSERT INTO tc_companionship_sandbox (tc_companionship,district) VALUES (\"NULL\",\"$district\")";
                                $this->db2->query($sql,__LINE__,__FILE__);
                                $companionship_sandbox = mysql_insert_id();
                                
@@ -540,7 +540,7 @@ class tc
                        while ($this->db->next_record()) {
                                $companionship = $this->db->f('companionship');
                                $district = $this->db->f('district');
-                               $sql = "INSERT INTO tc_companionship_sandbox (district) VALUES (\"$district\")";
+                               $sql = "INSERT INTO tc_companionship_sandbox (tc_companionship,district) VALUES (\"$companionship\",\"$district\")";
                                $this->db2->query($sql,__LINE__,__FILE__);
                                $companionship_sandbox = mysql_insert_id();
                                
@@ -673,6 +673,7 @@ class tc
                                while ($this->db2->next_record()) {
                                        $family_name = $this->db2->f('name') . " Family";
                                        $family_id = $this->db2->f('tc_family');
+                                       $tc_companionship = $this->db2->f('tc_companionship');
                                        $sandbox_table_data .= "<tr>";
                                        $sandbox_table_data .= "<td align=\"Left\" width=\"1000\">$family_name</td>";
                                        
@@ -686,7 +687,11 @@ class tc
                                                $month_end = "$year"."-"."$month"."-"."31";
                                                $month = "$month"."/"."$year";
 
-                                               $sql = "SELECT * FROM tc_visit WHERE date >= '$month_start' AND date <= '$month_end' AND companionship!=0 AND family=". $family_id;
+                                               if ($this->sandbox_visits_comp_only == 0) {
+                                                       $sql = "SELECT * FROM tc_visit WHERE date >= '$month_start' AND date <= '$month_end' AND companionship!=0 AND family=". $family_id;
+                                               } else {
+                                                       $sql = "SELECT * FROM tc_visit WHERE date >= '$month_start' AND date <= '$month_end' AND companionship=$tc_companionship AND family=". $family_id;
+                                               }
                                                $query_id = $this->db3->query($sql,__LINE__,__FILE__);
 
                                                if($this->db3->next_record()) {
index 2c45522df6e4cce99f15c3686bad1d5569e7f128..4bf7b6dc57683b03ed0b0927043c13c1a0b621f7 100644 (file)
@@ -79,4 +79,10 @@ $this->max_num_districts = 4;
 
 // The number of months of home teaching stats to show in the hometeaching sandbox
 $this->sandbox_stats_num_months = 12;
+
+// Show visit stats only for the visits this companionship is accountable for
+// non-zero = true
+// 0 = false
+$this->sandbox_visits_comp_only = 1;
+
 ?>
index d53f0b6c96c70d8a2e881fa58022584ab6e26b06..d25ce9183e8235461a00fe535f17e2932d7fb0f3 100644 (file)
@@ -91,7 +91,7 @@ digraph schema {
     shape = "record"
   ];
   companionship_sandbox   [
-    label = "companionship_sandbox||<cp> companionship|<d> district"
+    label = "companionship_sandbox||<cp> companionship|<tcp> tc_companionship|<d> district"
     shape = "record"
   ];
   family_sandbox   [
@@ -149,6 +149,7 @@ digraph schema {
   district_sandbox:s      -> individual:i
   companion_sandbox:i     -> individual:i
   companion_sandbox:cp    -> companionship_sandbox:cp
+  companionship_sandbox:tcp -> companionship:c
   companionship_sandbox:d -> district_sandbox:d
   family_sandbox:tcf      -> family:f
   family_sandbox:i        -> individual:i
index 41457203727994b5ed4b85bdd04b1cba8d58f2d4..28510948ff1a73517512a082dfac697b1d8d8ec8 100644 (file)
Binary files a/sql/tc.jpg and b/sql/tc.jpg differ
index 3d287e52ee948d1f5eadd9b1d033772ae669abde..7b23e0817b6b1e0d813ebf9b1664eefd402088b8 100644 (file)
@@ -263,6 +263,7 @@ CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companion_sandbox` (
 --
 CREATE TABLE /*!42501 IF NOT EXISTS*/ `tc_companionship_sandbox` (
   `companionship` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+  `tc_companionship` INT( 16 ) UNSIGNED NOT NULL ,
   `district` INT( 16 ) UNSIGNED NULL DEFAULT NULL
 ) ENGINE = MYISAM ;