From: Owen Leonard Date: Thu, 21 Oct 2010 18:06:05 +0000 (-0600) Subject: made sandbox configurable so that you can show either all visits for the family,... X-Git-Tag: release_1_1_0~3 X-Git-Url: http://git.pippins.net/embedvideo/.git/static/images/%24link?a=commitdiff_plain;h=c55bb22273cd071e0b871736eab0324076ecaa67;p=eq%2F.git made sandbox configurable so that you can show either all visits for the family, or only the visit stats the companionship is accountable for --- diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php index c4337f1..dee205c 100644 --- a/inc/class.tc.inc.php +++ b/inc/class.tc.inc.php @@ -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 .= ""; $sandbox_table_data .= "$family_name"; @@ -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()) { diff --git a/setup/tc_config b/setup/tc_config index 2c45522..4bf7b6d 100644 --- a/setup/tc_config +++ b/setup/tc_config @@ -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; + ?> diff --git a/sql/schema.dot b/sql/schema.dot index d53f0b6..d25ce91 100644 --- a/sql/schema.dot +++ b/sql/schema.dot @@ -91,7 +91,7 @@ digraph schema { shape = "record" ]; companionship_sandbox [ - label = "companionship_sandbox|| companionship| district" + label = "companionship_sandbox|| companionship| tc_companionship| 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 diff --git a/sql/tc.jpg b/sql/tc.jpg index 4145720..2851094 100644 Binary files a/sql/tc.jpg and b/sql/tc.jpg differ diff --git a/sql/tc.sql b/sql/tc.sql index 3d287e5..7b23e08 100644 --- a/sql/tc.sql +++ b/sql/tc.sql @@ -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 ;