$year = date('Y');
// Get the President
- $sql = "SELECT * FROM tc_presidency where president=1 and valid=1";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti where tp.individual=ti.individual AND tp.president=1 AND tp.valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$president_name = $this->db->f('name');
$interviewer = $this->db->f('individual');
$district_number = '*';
$district_name = $president_name;
- $sql = "SELECT * FROM tc_individual where individual='$president_id'";
- $this->db2->query($sql,__LINE__,__FILE__);
- if($this->db2->next_record()) {
- $mls_id = $this->db2->f('mls_id');
- }
- $sql = "SELECT * FROM tc_individual where mls_id='$mls_id'";
- $this->db2->query($sql,__LINE__,__FILE__);
- if($this->db2->next_record()) {
- $president_address = $this->db2->f('address');
- }
+ $president_address = $this->db->f('address');
} else {
print "<hr><font color=red><h3>-E- Unable to locate President in tc_presidency table</h3></font></hr>";
return;
}
// Get the Districts
- $sql = "SELECT * FROM tc_district where valid=1 ORDER BY district ASC";
+ $sql = "SELECT * FROM tc_district AS td JOIN tc_presidency AS tp WHERE td.district=tp.district AND td.valid=1 ORDER BY td.district ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record()) {
$districts[$i]['district'] = $this->db->f('district');
$districts[$i]['name'] = $this->db->f('name');
$districts[$i]['supervisor'] = $this->db->f('supervisor');
- $sql = "SELECT * FROM tc_presidency where district=$district and valid=1";
- $this->db2->query($sql,__LINE__,__FILE__);
- if($this->db2->next_record()) {
- $districts[$i]['presidency'] = $this->db2->f('presidency');
- }
+ $districts[$i]['presidency'] = $this->db->f('presidency');
$i++;
}
$appt_table_data = "";
// Find out what the President ID is
- $sql = "SELECT * FROM tc_presidency where president=1 and valid=1";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.president=1 AND tp.valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$presidency_name = $this->db->f('name');
$this->t->set_var('lang_num_months','Years of History');
}
- $sql = "SELECT * FROM tc_presidency where president=1 and valid=1";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.president=1 AND tp.valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$president_name = $this->db->f('name');
$notes = get_var('notes',array('GET','POST'));
$interview_type = get_var('interview_type',array('GET','POST'));
- $sql = "SELECT * FROM tc_presidency where valid=1 and (president=1 or counselor=1 or secretary=1)";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.valid=1 AND (tp.president=1 OR tp.counselor=1 OR tp.secretary=1)";
$this->db2->query($sql,__LINE__,__FILE__);
while ($this->db2->next_record()) {
$indiv = $this->db2->f('individual');
$notes = get_var('notes',array('GET','POST'));
$interview_type = get_var('interview_type',array('GET','POST'));
- $sql = "SELECT * FROM tc_presidency where valid=1 and (president=1 or counselor=1 or secretary=1 or district!=0)";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.valid=1 AND (tp.president=1 OR tp.counselor=1 OR tp.secretary=1 OR tp.district!=0)";
$this->db2->query($sql,__LINE__,__FILE__);
while ($this->db2->next_record()) {
$indiv = $this->db2->f('individual');
$header_row.= "<th width=$location_width><font size=-2>Location</th>";
$table_data = "";
- $sql = "SELECT * FROM tc_presidency where valid=1 GROUP BY individual ORDER BY name ASC";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.valid=1 GROUP BY tp.individual ORDER BY ti.name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record()) {
$this->db2->query("UPDATE tc_presidency set" .
" individual=" . $indiv .
" ,district=" . $district .
- " ,name='" . $name . "'" .
" ,email='" . $email . "'" .
" ,president='" . $president . "'" .
" ,counselor='" . $counselor . "'" .
" WHERE presidency=" . $id,__LINE__,__FILE__);
} else {
//print "Adding New Entry<br>";
- $this->db2->query("INSERT INTO tc_presidency (presidency,individual,district,name," .
+ $this->db2->query("INSERT INTO tc_presidency (presidency,individual,district," .
"email,president,counselor,secretary,valid) " .
"VALUES (NULL,'" . $indiv . "','" . $district . "','" .
- $name . "','" . $email . "','" . $president . "','" .
+ $email . "','" . $president . "','" .
$counselor . "','" . $secretary . "','1'" .
")",__LINE__,__FILE__);
}
")",__LINE__,__FILE__);
// Requery the tc_presidency table
- $sql = "SELECT * FROM tc_presidency where valid=1";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.valid=1";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record()) {
// Extract the data for each presidency record
$indiv = $this->db->f('individual');
$name = $this->db->f('name');
$district = $this->db->f('district');
- $name = $this->db->f('name');
$valid = 1;
// If we have a valid district, add it to the district table
// Now save off the data needed for a Presidency Table Update
- $sql = "SELECT * FROM tc_presidency where valid=1";
+ $sql = "SELECT tp.*, ti.name FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.valid=1";
$this->db->query($sql,__LINE__,__FILE__);
$table_data = "";
$header_row = "<th>Individual</th><th>Email</th><th>District</th><th>President</th><th>Counselor</th><th>Secretary</th>";
$dtstart = gmdate("Ymd"."\T"."His"."\Z", mktime($hour,$minute,$seconds,$month,$day,$year));
$dtstartstr = date("l, F d, o g:i A", mktime($hour,$minute,$seconds,$month,$day,$year));
- $sql = "SELECT * FROM tc_presidency where presidency='$presidency'";
+ $sql = "SELECT * FROM tc_presidency AS tp JOIN tc_individual AS ti WHERE tp.individual=ti.individual AND tp.presidency='$presidency'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record()) {
$email = $this->db2->f('email');
graph [
rankdir = "LR"
];
- family [
- label = "<f> family||<i> hofh_id|<n> name|<ni> name_id|<i> indiv_id|<c> companionship|<vp> visit_pri|<vn> visit_notes|<v> valid"
+ activity [
+ label = "activity||<a> activity|<s> assignment|<t> date|<n> notes"
+ shape = "record"
+ ];
+ appointment [
+ label = "appointment||<a> appointment|<p> presidency|<f> family|<i> individual |<d> date|<t> time|<l> location|<u> uid"
+ shape = "record"
+ ];
+ assignment [
+ label = "assignment||<a> assignment|<n> name|<ab> abbreviation"
+ shape = "record"
+ ];
+ attendance [
+ label = "attendance||<i> individual|<d> date"
shape = "record"
];
- indiv [
- label = "<i> indiv||<id> indiv_id|<n> name|<a> address|<p> phone|<em> email|<f> family|<hh> hh position|<po> priesthood|<st> steward|<pr> prospective|<pp> ppi_pri|<t> ppi_notes|<hp> hti_pri|<hn> hti_notes|<a> attending|<v> valid"
+ calling [
+ label = "calling||<n> name|<o> organization|<p> position|<s> sustained"
shape = "record"
];
companionship [
- label = "<c> companionship||<i> indiv|<d> district|<v> valid"
+ label = "companionship||<c> companionship|<i> individual|<d> district|<sp> scheduling_priority|<v> valid"
shape = "record"
];
- visit [
- label = "<v> visit||<f> family|<c> companionship|<c1> companion1|<c2> companion2|<t> date|<n> notes|<v> visited|<vt> visit_type"
+ district [
+ label = "district||<d> district|<n> name|<s> supervisor|<v> valid"
shape = "record"
];
- interview [
- label = "<in> interview||<i> interviewer|<il> indiv|<t> date|<n> notes|<it> interview_type"
+ individual [
+ label = "individual||<i> individual|<id> mls_id|<n> name|<a> address|<p> phone|<em> email|<hh> hh position|<pr> priesthood|<st> steward|<sp> scheduling_priority|<a> attending|<v> valid"
shape = "record"
];
- activity [
- label = "<a> activity||<s> assignment|<t> date|<n> notes"
+ family [
+ label = "family||<f> family|<i> individual|<c> companionship|<sp> scheduling_priority|<v> valid"
shape = "record"
];
participation [
- label = "participation||<i> indiv|<a> activity"
+ label = "participation||<i> individual|<a> activity"
shape = "record"
];
- attendance [
- label = "attendance||<i> indiv|<d> date"
+ interview [
+ label = "interview||<in> interview|<i> interviewer|<il> individual|<t> date|<n> notes|<it> interview_type"
shape = "record"
];
- appointment [
- label = "<a> appointment||<p> presidency|<f> family|<i> indiv |<d> date|<t> time|<l> location|<u> uid"
+ presidency [
+ label = "presidency||<p> presidency||<i> individual|<d> district|<em> email|<pr> president|<cn> counselor|<sec> secreatary|<v> valid"
shape = "record"
];
- assignment [
- label = "<a> assignment||<n> name|<c> code"
+ visit [
+ label = "visit||<v> visit|<f> family|<c> companionship|<c1> companion1|<c2> companion2|<t> date|<n> notes|<v> visited|<vt> visit_type"
shape = "record"
];
- calling [
- label = "calling||<i> indiv_id|<n> name|<o> organization|<p> position|<s> sequence|<t> sustained"
+ willingness [
+ label = "willingness||<i> individual|<a> assignment|<w> willing"
shape = "record"
];
- district [
- label = "<d> district||<n> name|<s> supervisor|<v> valid"
+ scheduling_priority [
+ label = "scheduling_priority||<sp> scheduling_priority|<p> priority|<n> notes"
shape = "record"
];
- presidency [
- label = "<p> presidency||<i> indiv|<d> district|<n> name|<em> email|<pr> president|<cn> counselor|<sec> secreatary|<v> valid"
+ email_list [
+ label = "email_list||<e> email_list|<n> name"
shape = "record"
];
- willingness [
- label = "<i> indiv||<a> assignment|<w> willing"
+ email_list_membership [
+ label = "email_list_membership||<i> individual|<e> email_list"
+ shape = "record"
+ ];
+ accomplishment [
+ label = "accomplishment||<a> accomplishment|<i> individual|<d> date|<t> task|<n> note"
+ shape = "record"
+ ];
+ task [
+ label = "task||<t> task|<n> name|<d> description"
shape = "record"
];
- family:c -> companionship:c
- companionship:i -> indiv:i
+ activity:s -> assignment:a
- appointment:i -> indiv:i
+ appointment:p -> presidency:p
appointment:f -> family:f
+ appointment:i -> individual:i
- interview:il -> indiv:i
- interview:i -> indiv:i
+ attendance:i -> individual:i
- presidency:i -> indiv:i
- presidency:d -> district:d
+ companionship:i -> individual:i
+ companionship:d -> district:d
+ companionship:sp -> scheduling_priority:sp
+
+ district:s -> individual:i
+
+ individual:sp -> scheduling_priority:sp
+
+ family:i -> individual:i
+ family:c -> companionship:c
+ family:sp -> scheduling_priority:sp
- willingness:i -> indiv:i
- willingness:a -> assignment:a
+ participation:i -> individual:i
+ participation:a -> activity:a
- activity:s -> assignment:a
+ interview:il -> individual:i
+ interview:i -> individual:i
+
+ presidency:i -> individual:i
+ presidency:d -> district:d
visit:c -> companionship:c
visit:f -> family:f
visit:c1 -> presidency:i
visit:c2 -> presidency:i
- participation:i -> indiv:i
- participation:a -> activity:a
-
- attendance:i -> indiv:i
+ willingness:i -> individual:i
+ willingness:a -> assignment:a
- indiv:f -> family:f
+ email_list_membership:i -> individual:i
+ email_list_membership:e -> email_list:e
+
+ accomplishment:i -> individual:i
+ accomplishment:t -> task:t
+
}