";
// Get the names of the families assigned this home teaching companionship
- $sql = "SELECT * from eq_family where valid=1 AND companionship=".$unique_companionships[$j]['companionship'];
+ $sql = "SELECT * from 3rd_family where valid=1 AND companionship=".$unique_companionships[$j]['companionship'];
$sql = $sql . " ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$k=0;
@@ -304,14 +303,14 @@ class eq
// " AND companionship=" . $unique_companionships[$j]['companionship'].
// First check to see if the currently assigned companionship has visited them
- $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
+ $sql = "SELECT * FROM 3rd_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
" AND companionship=".$unique_companionships[$j]['companionship'].
" AND family=". $family_id;
$query_id = $this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->num_rows($query_id) == 0) {
// We did not find any visits made by the currently assigned companionship,
// look for visits made by any other companionship other than 0. (0 == EQ Presidency Visit)
- $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
+ $sql = "SELECT * FROM 3rd_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
" AND companionship!=0".
" AND family=". $family_id;
$query_id = $this->db2->query($sql,__LINE__,__FILE__);
@@ -416,9 +415,9 @@ class eq
if($action == 'save')
{
// Get a list of all the companionships in this district
- $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $district;
+ $sql = "SELECT distinct companionship FROM 3rd_companionship where valid=1 and district=". $district;
$this->db->query($sql,__LINE__,__FILE__);
- $j=0;
+ $j=0; $unique_companionships = '';
while ($this->db->next_record())
{
$unique_companionships[$j]['companionship'] = $this->db->f('companionship');
@@ -427,9 +426,9 @@ class eq
for ($j=0; $j < count($unique_companionships); $j++)
{
//$comp=$unique_companionships[$j]['companionship'];
- //print "deleting from eq_visit where companionship=$comp and date=$date and district=$district ";
+ //print "deleting from 3rd_visit where companionship=$comp and date=$date and district=$district ";
// Delete all the visits that have taken place for all families for this companionsthip for this month
- $this->db->query("DELETE from eq_visit where companionship=" . $unique_companionships[$j]['companionship'] .
+ $this->db->query("DELETE from 3rd_visit where companionship=" . $unique_companionships[$j]['companionship'] .
" AND " . "date='" . $date . "'",__LINE__,__FILE__);
}
@@ -447,7 +446,7 @@ class eq
$visited = $data_array[3];
if($visited == "") { $visited = $data_array[4]; }
//print "family_id: $family_id companionship: $companionship date: $date visited: $visited ";
- $this->db->query("INSERT INTO eq_visit (family,companionship,date,notes,visited) "
+ $this->db->query("INSERT INTO 3rd_visit (family,companionship,date,notes,visited) "
. "VALUES (" . $family_id .",". $companionship .",'". $date ."','','". $visited ."')",__LINE__,__FILE__);
}
}
@@ -455,25 +454,25 @@ class eq
return false;
}
- $sql = "SELECT * FROM eq_elder where valid=1 ORDER BY elder ASC";
+ $sql = "SELECT * FROM 3rd_indiv where valid=1 ORDER BY indiv ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record())
{
- $elder_id[$i] = $this->db->f('elder');
- $elder_name[$i] = $this->db->f('name');
- $elder_phone[$elder_id[$i]] = $this->db->f('phone');
+ $indiv_id[$i] = $this->db->f('indiv');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_phone[$indiv_id[$i]] = $this->db->f('phone');
$i++;
}
- array_multisort($elder_name, $elder_id);
+ array_multisort($indiv_name, $indiv_id);
- // Make an array mapping elder_ids to elder_names
- for($i=0; $i < count($elder_id); $i++) {
- $id = $elder_id[$i];
- $elders[$id] = $elder_name[$i];
+ // Make an array mapping indiv_ids to indiv_names
+ for($i=0; $i < count($indiv_id); $i++) {
+ $id = $indiv_id[$i];
+ $indivs[$id] = $indiv_name[$i];
}
- $sql = "SELECT * FROM eq_aaronic where valid=1 ORDER BY aaronic ASC";
+ $sql = "SELECT * FROM 3rd_aaronic where valid=1 ORDER BY aaronic ASC";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
@@ -483,9 +482,9 @@ class eq
}
// Select all the unique companionship numbers for this district
- $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $district;
+ $sql = "SELECT distinct companionship FROM 3rd_companionship where valid=1 and district=". $district;
$this->db->query($sql,__LINE__,__FILE__);
- $j=0; $unique_companionships='';
+ $j=0; $unique_companionships = '';
while ($this->db->next_record())
{
$unique_companionships[$j]['companionship'] = $this->db->f('companionship');
@@ -497,7 +496,7 @@ class eq
for ($j=0; $j < count($unique_companionships); $j++) {
$companion_table_entry = "";
// Select all the companions in each companionship
- $sql = "SELECT * FROM eq_companionship where valid=1 and ".
+ $sql = "SELECT * FROM 3rd_companionship where valid=1 and ".
"companionship=". $unique_companionships[$j]['companionship'];
$this->db->query($sql,__LINE__,__FILE__);
@@ -506,11 +505,11 @@ class eq
// Get this companions information
if($companion_table_entry != "") { $companion_table_entry .= "
";
// Get the names of the families assigned this home teaching companionship
- $sql = "SELECT * from eq_family where valid=1 AND companionship=".$unique_companionships[$j]['companionship'];
+ $sql = "SELECT * from 3rd_family where valid=1 AND companionship=".$unique_companionships[$j]['companionship'];
$sql = $sql . " ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
@@ -534,14 +533,14 @@ class eq
$header_row="
Families
";
// First check to see if the currently assigned companionship has visited them
- $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
+ $sql = "SELECT * FROM 3rd_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
" AND companionship=".$unique_companionships[$j]['companionship'].
" AND family=". $family_id;
$query_id = $this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->num_rows($query_id) == 0) {
// We did not find any visits made by the currently assigned companionship,
// look for visits made by any other companionship other than 0. (0 == EQ Presidency Visit)
- $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
+ $sql = "SELECT * FROM 3rd_visit WHERE date >= '$month_start' AND date <= '$month_end' ".
" AND companionship!=0".
" AND family=". $family_id;
$query_id = $this->db2->query($sql,__LINE__,__FILE__);
@@ -617,7 +616,7 @@ class eq
$this->t->set_var('lang_date','Date');
$this->t->set_var('lang_notes','Description');
- $sql = "SELECT * FROM eq_activity ORDER BY date DESC";
+ $sql = "SELECT * FROM 3rd_activity ORDER BY date DESC";
$this->db->query($sql,__LINE__,__FILE__);
$total_records = $this->db->num_rows();
@@ -629,7 +628,7 @@ class eq
$activity_list[$i]['date'] = $this->db->f('date');
$activity_list[$i]['notes'] = $this->db->f('notes');
- $sql = "SELECT * FROM eq_assignment WHERE assignment='" . $activity_list[$i]['assignment'] . "'";
+ $sql = "SELECT * FROM 3rd_assignment WHERE assignment='" . $activity_list[$i]['assignment'] . "'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record())
{
@@ -660,15 +659,15 @@ class eq
$this->t->set_var('edit',$GLOBALS['phpgw']->link('/eq/index.php',$link_data));
$this->t->set_var('lang_edit','Edit');
- $link_data['menuaction'] = 'eq.eq.act_update';
- $link_data['activity'] = '0';
- $link_data['action'] = 'add';
- $this->t->set_var('add','');
-
$this->t->fp('list','act_list',True);
}
+ $link_data['menuaction'] = 'eq.eq.act_update';
+ $link_data['activity'] = '0';
+ $link_data['action'] = 'add';
+ $this->t->set_var('add','');
+
$this->t->pfp('out','act_list_t');
$this->save_sessiondata();
}
@@ -678,14 +677,14 @@ class eq
$this->t->set_file(array('act_view_t' => 'act_view.tpl'));
$this->t->set_block('act_view_t','part_list','list');
- $sql = "SELECT * FROM eq_activity WHERE activity=" . intval(get_var('activity',array('GET','POST')));
+ $sql = "SELECT * FROM 3rd_activity WHERE activity=" . intval(get_var('activity',array('GET','POST')));
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$this->t->set_var('assignment', $this->db->f('assignment'));
$this->t->set_var('date', $this->db->f('date'));
$this->t->set_var('notes', $this->db->f('notes'));
- $sql = "SELECT * FROM eq_assignment WHERE assignment='" . $this->db->f('assignment') . "'";
+ $sql = "SELECT * FROM 3rd_assignment WHERE assignment='" . $this->db->f('assignment') . "'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record())
{
@@ -710,21 +709,21 @@ class eq
$this->t->set_var('lang_edit','Edit');
$this->t->set_var('cal_date',$this->db->f('date'));
- // Now find out which elders participated in this activity
- $sql = "SELECT * FROM eq_participation WHERE activity=" . intval(get_var('activity',array('GET','POST')));
+ // Now find out which indivs participated in this activity
+ $sql = "SELECT * FROM 3rd_participation WHERE activity=" . intval(get_var('activity',array('GET','POST')));
$this->db->query($sql,__LINE__,__FILE__);
$total_records = $this->db->num_rows();
$i = 0;
while ($this->db->next_record())
{
- $part_list[$i]['elder'] = $this->db->f('elder');
+ $part_list[$i]['indiv'] = $this->db->f('indiv');
$i++;
}
for ($i=0; $i < count($part_list); $i++)
{
- $sql = "SELECT * FROM eq_elder WHERE elder=" . $part_list[$i]['elder'];
+ $sql = "SELECT * FROM 3rd_indiv WHERE indiv=" . $part_list[$i]['indiv'];
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$names[$i] = $this->db->f('name');
@@ -733,7 +732,7 @@ class eq
for ($i=0; $i < count($names); $i++)
{
//$this->nextmatchs->template_alternate_row_color(&$this->t);
- $this->t->set_var('elder_name',$names[$i]);
+ $this->t->set_var('indiv_name',$names[$i]);
if(($i+1) % 3 == 0) { $this->t->set_var('table_sep',"
"); }
else { $this->t->set_var('table_sep',""); }
if(($i) % 3 == 0) { $this->nextmatchs->template_alternate_row_color(&$this->t); }
@@ -747,7 +746,7 @@ class eq
function act_update()
{
$this->t->set_file(array('form' => 'act_update.tpl'));
- $this->t->set_block('form','elder_list','list');
+ $this->t->set_block('form','indiv_list','list');
$this->t->set_block('form','add','addhandle');
$this->t->set_block('form','edit','edithandle');
$this->t->set_var('lang_done','Done');
@@ -761,23 +760,25 @@ class eq
$activity['assignment'] = get_var('assignment',array('POST'));
$activity['date'] = get_var('date',array('POST'));
$activity['notes']= get_var('notes',array('POST'));
- $this->db->query("UPDATE eq_activity set " .
+ $this->db->query("UPDATE 3rd_activity set " .
" assignment='" . $activity['assignment'] .
"', date='" . $activity['date'] . "'" .
", notes='" . $activity['notes'] . "'" .
" WHERE activity=" . $activity['activity'],__LINE__,__FILE__);
- // Delete all the elders who have particiapted in this activity
- $this->db->query("DELETE from eq_participation where activity=".$activity['activity'],__LINE__,__FILE__);
+ // Delete all the individuals who have particiapted in this activity
+ $this->db->query("DELETE from 3rd_participation where activity=".$activity['activity'],__LINE__,__FILE__);
+
+ // Re-add the individuals who are checked as having participated in this activity
+ $indivs = get_var('indiv_name',array('POST'));
+ if(is_array($indivs)) { // Only do the foreach loop if we have a valid array of indivs to work with
+ foreach ($indivs as $indiv)
+ {
+ $this->db->query("INSERT INTO 3rd_participation (indiv,activity) "
+ . "VALUES (" . $indiv . ",". $activity['activity'] . ")",__LINE__,__FILE__);
+ }
+ }
- // Re-add the elders who are checked as having participated in this activity
- $elders = get_var('elder_name',array('POST'));
- foreach ($elders as $elder)
- {
- $this->db->query("INSERT INTO eq_participation (elder,activity) "
- . "VALUES (" . $elder . ",". $activity['activity'] . ")",__LINE__,__FILE__);
- }
-
$this->act_list();
return false;
}
@@ -787,11 +788,11 @@ class eq
$activity['assignment'] = get_var('assignment',array('POST'));
$activity['date'] = get_var('date',array('POST'));
$activity['notes']= get_var('notes',array('POST'));
- $this->db->query("INSERT INTO eq_activity (assignment,date,notes) "
+ $this->db->query("INSERT INTO 3rd_activity (assignment,date,notes) "
. "VALUES ('" . $activity['assignment'] . "','"
. $activity['date'] . "','" . $activity['notes'] . "')",__LINE__,__FILE__);
- $sql = "SELECT * FROM eq_activity WHERE assignment='".$activity['assignment']."' "
+ $sql = "SELECT * FROM 3rd_activity WHERE assignment='".$activity['assignment']."' "
. " AND date='".$activity['date']."' AND notes='".$activity['notes']."'";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
@@ -799,11 +800,11 @@ class eq
$activity['activity'] = $this->db->f('activity');
}
- $elders = get_var('elder_name',array('POST'));
- foreach ($elders as $elder)
+ $indivs = get_var('indiv_name',array('POST'));
+ foreach ($indivs as $indiv)
{
- $this->db->query("INSERT INTO eq_participation (elder,activity) "
- . "VALUES (" . $elder . ",". $activity['activity'] . ")",__LINE__,__FILE__);
+ $this->db->query("INSERT INTO 3rd_participation (indiv,activity) "
+ . "VALUES (" . $indiv . ",". $activity['activity'] . ")",__LINE__,__FILE__);
}
$this->act_list();
@@ -825,7 +826,7 @@ class eq
if($action == 'edit')
{
- $sql = "SELECT * FROM eq_activity WHERE activity=" . $activity['activity'];
+ $sql = "SELECT * FROM 3rd_activity WHERE activity=" . $activity['activity'];
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$this->t->set_var('cal_date',$this->jscal->input('date',$this->db->f('date'),'','','','','',$this->cal_options));
@@ -841,7 +842,7 @@ class eq
}
// Create the assignments drop-down list
- $sql = "SELECT * FROM eq_assignment ORDER BY name ASC";
+ $sql = "SELECT * FROM 3rd_assignment ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i = 0;
while ($this->db->next_record())
@@ -863,36 +864,36 @@ class eq
$assignment_data.='';
$this->t->set_var('assignment_data',$assignment_data);
- // Create elder selection boxes
- $sql = "SELECT * FROM eq_elder";
+ // Create individual selection boxes
+ $sql = "SELECT * FROM 3rd_indiv";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record())
{
if($this->db->f('valid') == 1 || $action != 'add') {
- $elder_name[$i] = $this->db->f('name');
- $elder_id[$i] = $this->db->f('elder');
- $elder_valid[$i] = $this->db->f('valid');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_id[$i] = $this->db->f('indiv');
+ $indiv_valid[$i] = $this->db->f('valid');
$i++;
}
}
- array_multisort($elder_name, $elder_id, $elder_valid);
+ array_multisort($indiv_name, $indiv_id, $indiv_valid);
$j=0;
- for ($i=0; $i < count($elder_id); $i++)
+ for ($i=0; $i < count($indiv_id); $i++)
{
//$this->nextmatchs->template_alternate_row_color(&$this->t);
- $sql = "SELECT * FROM eq_participation where activity=". $activity['activity'] . " AND elder=" . $elder_id[$i];
+ $sql = "SELECT * FROM 3rd_participation where activity=". $activity['activity'] . " AND indiv=" . $indiv_id[$i];
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) { $this->t->set_var('checked','checked'); $checked=1; }
else { $this->t->set_var('checked',''); $checked=0; }
- if($checked || $elder_valid[$i] == 1) {
- $this->t->set_var('elder_name',$elder_name[$i]);
- $this->t->set_var('elder',$elder_id[$i]);
+ if($checked || $indiv_valid[$i] == 1) {
+ $this->t->set_var('indiv_name',$indiv_name[$i]);
+ $this->t->set_var('indiv',$indiv_id[$i]);
if(($j+1) % 3 == 0) { $this->t->set_var('table_sep',"
"); }
else { $this->t->set_var('table_sep',""); }
if(($j) % 3 == 0) { $this->nextmatchs->template_alternate_row_color(&$this->t); }
- $this->t->fp('list','elder_list',True);
+ $this->t->fp('list','indiv_list',True);
$j++;
}
}
@@ -918,7 +919,7 @@ class eq
$this->t->set_var('lang_name','Assignment Name');
$this->t->set_var('lang_code','Code');
- $sql = "SELECT * FROM eq_assignment ORDER BY name ASC";
+ $sql = "SELECT * FROM 3rd_assignment ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$total_records = $this->db->num_rows();
@@ -971,7 +972,7 @@ class eq
{
$assignment['name'] = get_var('name',array('POST'));
$assignment['code'] = get_var('code',array('POST'));
- $this->db->query("UPDATE eq_assignment set " .
+ $this->db->query("UPDATE 3rd_assignment set " .
" name='" . $assignment['name'] . "'" .
", code='" . $assignment['code'] . "'" .
" WHERE assignment=" . $assignment['assignment'],__LINE__,__FILE__);
@@ -984,7 +985,7 @@ class eq
{
$assignment['name'] = get_var('name',array('POST'));
$assignment['code'] = get_var('code',array('POST'));
- $this->db->query("INSERT INTO eq_assignment (name,code) "
+ $this->db->query("INSERT INTO 3rd_assignment (name,code) "
. "VALUES ('" . $assignment['name'] . "','"
. $assignment['code'] . "')",__LINE__,__FILE__);
$this->assign_view();
@@ -1004,7 +1005,7 @@ class eq
if($action == 'edit')
{
- $sql = "SELECT * FROM eq_assignment WHERE assignment=" . $assignment['assignment'];
+ $sql = "SELECT * FROM 3rd_assignment WHERE assignment=" . $assignment['assignment'];
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$this->t->set_var('name', $this->db->f('name'));
@@ -1033,20 +1034,20 @@ class eq
{
$this->t->set_file(array('par_view_t' => 'par_view.tpl'));
$this->t->set_block('par_view_t','header_list','list1');
- $this->t->set_block('par_view_t','elder_list','list2');
+ $this->t->set_block('par_view_t','indiv_list','list2');
- $sql = "SELECT * FROM eq_elder where valid=1";
+ $sql = "SELECT * FROM 3rd_indiv where valid=1";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record())
{
- $elder_name[$i] = $this->db->f('name');
- $elder_id[$i] = $this->db->f('elder');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_id[$i] = $this->db->f('indiv');
$i++;
}
- array_multisort($elder_name, $elder_id);
+ array_multisort($indiv_name, $indiv_id);
- $sql = "SELECT * FROM eq_activity ORDER BY date DESC";
+ $sql = "SELECT * FROM 3rd_activity ORDER BY date DESC";
$this->db->query($sql,__LINE__,__FILE__);
$total_records = $this->db->num_rows();
@@ -1059,7 +1060,7 @@ class eq
$i++;
}
- $sql = "SELECT * FROM eq_assignment ORDER BY name ASC";
+ $sql = "SELECT * FROM 3rd_assignment ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while($this->db->next_record())
@@ -1070,8 +1071,8 @@ class eq
$i++;
}
- $elder_width=300; $part_width=25; $assignment_width=50;
- $total_width=$elder_width+$part_width;
+ $indiv_width=300; $part_width=25; $assignment_width=50;
+ $total_width=$indiv_width+$part_width;
for ($i=0; $i < count($assignment_list); $i++) {
$this->t->set_var('assignment_name',$assignment_list[$i]['name']);
$this->t->set_var('assignment_code',$assignment_list[$i]['code']);
@@ -1079,17 +1080,17 @@ class eq
$total_width += $assignment_width;
}
- for ($i=0; $i < count($elder_id); $i++) {
+ for ($i=0; $i < count($indiv_id); $i++) {
$participated=0; $part_table = '';
$this->nextmatchs->template_alternate_row_color(&$this->t);
- $this->t->set_var('elder_name',$elder_name[$i]);
+ $this->t->set_var('indiv_name',$indiv_name[$i]);
for ($j=0; $j < count($assignment_list); $j++) {
$date = "0000-00-00"; $checkmark=0; $num_matches=0;
for ($k=0; $k < count($activity_list); $k++) {
if($assignment_list[$j]['assignment'] == $activity_list[$k]['assignment']) {
- $sql = "SELECT * FROM eq_participation where "
+ $sql = "SELECT * FROM 3rd_participation where "
. " activity=" . $activity_list[$k]['activity']
- . " AND elder=" . $elder_id[$i];
+ . " AND indiv=" . $indiv_id[$i];
$this->db->query($sql,__LINE__,__FILE__);
while($this->db->next_record()) {
if($activity_list[$k]['date'] > $date) {
@@ -1112,10 +1113,10 @@ class eq
if($participated) { $part_table .= '
'.$participated.'
'; }
else { $part_table .= '
'; }
$this->t->set_var('part_table',$part_table);
- $this->t->fp('list2','elder_list',True);
+ $this->t->fp('list2','indiv_list',True);
}
$this->t->set_var('total_width',$total_width);
- $this->t->set_var('elder_width',$elder_width);
+ $this->t->set_var('indiv_width',$indiv_width);
$this->t->set_var('part_width',$part_width);
$this->t->set_var('act_width',$act_width);
$this->t->pfp('out','par_view_t');
@@ -1126,10 +1127,10 @@ class eq
{
$this->t->set_file(array('willing_view_t' => 'willing_view.tpl'));
$this->t->set_block('willing_view_t','header_list','list1');
- $this->t->set_block('willing_view_t','elder_list','list2');
+ $this->t->set_block('willing_view_t','indiv_list','list2');
$this->t->set_var('lang_filter','Filter');
- $this->t->set_var('lang_filter_unwilling','Filter out unwilling Elders:');
+ $this->t->set_var('lang_filter_unwilling','Filter out unwilling individuals:');
$filter_unwilling = get_var('filter_unwilling',array('POST'));
$this->t->set_var('filter_unwilling',$filter_unwilling);
@@ -1145,19 +1146,19 @@ class eq
}
$this->t->set_var('filter_input',$filter_input);
- $sql = "SELECT * FROM eq_elder where valid=1";
+ $sql = "SELECT * FROM 3rd_indiv where valid=1";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record())
{
- $elder_name[$i] = $this->db->f('name');
- $elder_id[$i] = $this->db->f('elder');
- $elder_phone[$elder_id[$i]] = $this->db->f('phone');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_id[$i] = $this->db->f('indiv');
+ $indiv_phone[$indiv_id[$i]] = $this->db->f('phone');
$i++;
}
- array_multisort($elder_name, $elder_id);
+ array_multisort($indiv_name, $indiv_id);
- $sql = "SELECT * FROM eq_assignment ORDER BY name ASC";
+ $sql = "SELECT * FROM 3rd_assignment ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while($this->db->next_record())
@@ -1168,7 +1169,7 @@ class eq
$i++;
}
- $sql = "SELECT * FROM eq_activity ORDER BY date DESC";
+ $sql = "SELECT * FROM 3rd_activity ORDER BY date DESC";
$this->db->query($sql,__LINE__,__FILE__);
$total_records = $this->db->num_rows();
@@ -1181,8 +1182,8 @@ class eq
$i++;
}
- $elder_width=275; $willing_width=40; $assignment_width=50;
- $total_width=$elder_width+$willing_width;
+ $indiv_width=275; $willing_width=40; $assignment_width=50;
+ $total_width=$indiv_width+$willing_width;
for ($i=0; $i < count($assignment_list); $i++) {
$this->t->set_var('assignment_name',$assignment_list[$i]['name']);
@@ -1192,31 +1193,31 @@ class eq
$total_willing[$i] = 0;
}
- for ($i=0; $i < count($elder_id); $i++) {
- $willing_table = ''; $elder_willing=0;
- $this->t->set_var('elder_name',$elder_name[$i]);
- $this->t->set_var('elder_phone',$elder_phone[$elder_id[$i]]);
- $this->t->set_var('editurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.willing_update&elder_id='
- . $elder_id[$i] . '&action=' . 'edit'));
+ for ($i=0; $i < count($indiv_id); $i++) {
+ $willing_table = ''; $indiv_willing=0;
+ $this->t->set_var('indiv_name',$indiv_name[$i]);
+ $this->t->set_var('indiv_phone',$indiv_phone[$indiv_id[$i]]);
+ $this->t->set_var('editurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.willing_update&indiv_id='
+ . $indiv_id[$i] . '&action=' . 'edit'));
for ($j=0; $j < count($assignment_list); $j++) {
$found_willingness=0;
- $sql = "SELECT * FROM eq_willingness where "
+ $sql = "SELECT * FROM 3rd_willingness where "
. " assignment=" . $assignment_list[$j]['assignment']
- . " AND elder=" . $elder_id[$i];
+ . " AND indiv=" . $indiv_id[$i];
$this->db->query($sql,__LINE__,__FILE__);
while($this->db->next_record()) {
$found_willingness=1;
$date_part="";
- $sql = "SELECT * FROM eq_activity where "
+ $sql = "SELECT * FROM 3rd_activity where "
. " assignment=". $assignment_list[$j]['assignment']
. " ORDER by date DESC";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record()) {
$activity = $this->db2->f('activity');
$date = $this->db2->f('date');
- $sql = "SELECT * FROM eq_participation where "
+ $sql = "SELECT * FROM 3rd_participation where "
. " activity=" . $activity
- . " AND elder=". $elder_id[$i];
+ . " AND indiv=". $indiv_id[$i];
$this->db3->query($sql,__LINE__,__FILE__);
if($this->db3->next_record()) {
$date_part = $date;
@@ -1225,25 +1226,25 @@ class eq
if($this->db->f('willing') == 'y') {
$total_willing[$j]++;
- $elder_willing=1;
+ $indiv_willing=1;
$willing_table .= '
";
@@ -1412,29 +1413,29 @@ class eq
$year = date('Y');
// Get the EQ President
- $sql = "SELECT * FROM eq_presidency where president=1 and valid=1";
+ $sql = "SELECT * FROM 3rd_presidency where president=1 and valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$president_name = $this->db->f('name');
$president_name_array = explode(",",$president_name);
$president_last_name = $president_name_array[0];
- $president_id = $this->db->f('elder');
+ $president_id = $this->db->f('indiv');
$presidency_id = $this->db->f('presidency');
- $interviewer = $this->db->f('elder');
+ $interviewer = $this->db->f('indiv');
$district_number = '*';
$district_name = $president_name;
- $sql = "SELECT * FROM eq_elder where elder='$president_id'";
+ $sql = "SELECT * FROM 3rd_indiv where indiv='$president_id'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record()) {
$indiv_id = $this->db2->f('indiv_id');
}
- $sql = "SELECT * FROM eq_parent where indiv_id='$indiv_id'";
+ $sql = "SELECT * FROM 3rd_parent where indiv_id='$indiv_id'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record()) {
$president_address = $this->db2->f('address');
}
} else {
- print "
-E- Unable to locate EQ President in eq_presidency table
";
+ print "
-E- Unable to locate President in 3rd_presidency table
";
return;
}
@@ -1445,19 +1446,19 @@ class eq
if($new_data != "") {
foreach ($new_data as $entry)
{
- $elder = $entry['elder'];
+ $indiv = $entry['indiv'];
$appointment = $entry['appointment'];
$location = $entry['location'];
if($location == "") { $location = "$president_last_name"." home ($president_address)"; }
- if($elder == 0) { $location = ""; }
+ if($indiv == 0) { $location = ""; }
//Only perform a database update if we have made a change to this appointment
- $sql = "SELECT * FROM eq_appointment where appointment='$appointment' and elder='$elder' and location='$location'";
+ $sql = "SELECT * FROM 3rd_appointment where appointment='$appointment' and indiv='$indiv' and location='$location'";
$this->db->query($sql,__LINE__,__FILE__);
if(!$this->db->next_record()) {
// Perform database save actions here
- $this->db->query("UPDATE eq_appointment set " .
- " elder='" . $elder . "'" .
+ $this->db->query("UPDATE 3rd_appointment set " .
+ " indiv='" . $indiv . "'" .
",location='" . $location . "'" .
" WHERE appointment=" . $appointment,__LINE__,__FILE__);
// Email the appointment
@@ -1472,14 +1473,14 @@ class eq
foreach ($new_data as $entry)
{
$ppi_notes = $entry['notes'];
- $elder_id = $entry['elder_id'];
+ $indiv_id = $entry['indiv_id'];
$ppi_pri = $entry['pri'];
// Perform database save actions here
- $this->db->query("UPDATE eq_elder set " .
+ $this->db->query("UPDATE 3rd_indiv set " .
" ppi_notes='" . $ppi_notes . "'" .
",ppi_pri='" . $ppi_pri . "'" .
- " WHERE elder=" . $elder_id,__LINE__,__FILE__);
+ " WHERE indiv=" . $indiv_id,__LINE__,__FILE__);
}
@@ -1487,48 +1488,48 @@ class eq
//Header('Location: ' . $take_me_to_url);
}
- // create the elder id -> elder name mapping
- $sql = "SELECT * FROM eq_elder where valid=1 ORDER BY name ASC";
+ // create the individual id -> individual name mapping
+ $sql = "SELECT * FROM 3rd_indiv where valid=1 ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
- $elder_id = NULL;
- $elder_name = NULL;
+ $indiv_id = NULL;
+ $indiv_name = NULL;
while ($this->db->next_record())
{
- $elder_name[$i] = $this->db->f('name');
- $elder_id[$i] = $this->db->f('elder');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_id[$i] = $this->db->f('indiv');
$i++;
}
- array_multisort($elder_name, $elder_id);
+ array_multisort($indiv_name, $indiv_id);
// APPOINTMENT TABLE
- $date_width=250; $time_width=100; $elder_width=200; $location_width=100;
- $appt_table_width=$date_width + $time_width + $elder_width + $location_width;
+ $date_width=250; $time_width=100; $indiv_width=200; $location_width=100;
+ $appt_table_width=$date_width + $time_width + $indiv_width + $location_width;
$appt_header_row = "
Date
";
$appt_header_row.= "
Time
";
- $appt_header_row.= "
Elder
";
+ $appt_header_row.= "
indiv
";
$appt_header_row.= "
Location
";
$appt_table_data = "";
- $total_elders=0; $elders_with_yearly_ppi=0;
+ $total_indivs=0; $indivs_with_yearly_ppi=0;
// Display a scheduling table for the EQ President
$table_data=""; $appt_table_data="";
- $table_title = "District ".$district_number.": ".$district_name.": All Elders with Yearly PPI Not Completed";
+ $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";
$this->t->set_var('table_title',$table_title);
$this->t->set_var('appt_table_title',$appt_table_title);
// query the database for all the appointments
- $sql = "SELECT * FROM eq_appointment where presidency=".$presidency_id." and date>=CURDATE() ORDER BY date ASC, time ASC";
+ $sql = "SELECT * FROM 3rd_appointment where presidency=".$presidency_id." and date>=CURDATE() ORDER BY date ASC, time ASC";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
$appointment = $this->db->f('appointment');
- $elder = $this->db->f('elder');
+ $indiv = $this->db->f('indiv');
$location = $this->db->f('location');
- if(($location == "") && ($elder > 0)) { $location = "$president_last_name"." home ($president_address)"; }
+ if(($location == "") && ($indiv > 0)) { $location = "$president_last_name"." home ($president_address)"; }
$date = $this->db->f('date');
$date_array = explode("-",$date);
@@ -1543,12 +1544,12 @@ class eq
$appt_table_data.= "
";
@@ -2109,7 +2110,7 @@ class eq
$this->t->set_var('schedule_vis_link_title','Schedule Yearly Visits');
$this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.vis_sched&action=save'));
- $this->t->set_var('title','EQ Presidency Yearly Visit Scheduler');
+ $this->t->set_var('title','Presidency Yearly Visit Scheduler');
$family_width=500; $phone_width=40; $pri_width=10; $notes_width=128; $visit_date_width=20;
$table_width=$family_width + $phone_width + $pri_width + $notes_width + $visit_date_width;
@@ -2123,7 +2124,7 @@ class eq
$year = date('Y');
// create the family id -> family name mapping
- $sql = "SELECT * FROM eq_family where valid=1 and elder_id != 0 ORDER BY name ASC";
+ $sql = "SELECT * FROM 3rd_family where valid=1 and indiv_id != 0 ORDER BY name ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
$family_id = NULL;
@@ -2132,7 +2133,7 @@ class eq
$family_id[$i] = $this->db->f('family');
$family_name[$i] = $this->db->f('name');
$familyid2name[$family_id[$i]] = $family_name[$i];
- $sql = "SELECT * FROM eq_parent where family='$family_id[$i]'";
+ $sql = "SELECT * FROM 3rd_parent where family='$family_id[$i]'";
$this->db2->query($sql,__LINE__,__FILE__);
if($this->db2->next_record()) {
$familyid2address[$family_id[$i]] = $this->db2->f('address');
@@ -2160,11 +2161,11 @@ class eq
if($family == 0) { $location = ""; }
//Only perform a database update if we have made a change to this appointment
- $sql = "SELECT * FROM eq_appointment where appointment='$appointment' and family='$family' and location='$location'";
+ $sql = "SELECT * FROM 3rd_appointment where appointment='$appointment' and family='$family' and location='$location'";
$this->db->query($sql,__LINE__,__FILE__);
if(!$this->db->next_record()) {
// Perform database save actions here
- $this->db->query("UPDATE eq_appointment set " .
+ $this->db->query("UPDATE 3rd_appointment set " .
" family='" . $family . "'" .
",location='" . $location . "'" .
" WHERE appointment=" . $appointment,__LINE__,__FILE__);
@@ -2184,7 +2185,7 @@ class eq
$visit_pri = $entry['pri'];
// Perform database save actions here
- $this->db->query("UPDATE eq_family set " .
+ $this->db->query("UPDATE 3rd_family set " .
" visit_notes='" . $visit_notes . "'" .
",visit_pri='" . $visit_pri . "'" .
" WHERE family=" . $family,__LINE__,__FILE__);
@@ -2205,18 +2206,18 @@ class eq
$appt_table_data = "";
// Find out what the EQ Presidency ID is
- $sql = "SELECT * FROM eq_presidency where eqpres=1 and valid=1";
+ $sql = "SELECT * FROM 3rd_presidency where eqpres=1 and valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$presidency_name = $this->db->f('name');
$presidency_id = $this->db->f('presidency');
} else {
- print "
-E- Unable to locate EQ Presidency in eq_presidency table
";
+ print "
-E- Unable to locate Presidency in 3rd_presidency table
";
return;
}
// query the database for all the appointments
- $sql = "SELECT * FROM eq_appointment where presidency=$presidency_id and date>=CURDATE() ORDER BY date ASC, time ASC";
+ $sql = "SELECT * FROM 3rd_appointment where presidency=$presidency_id and date>=CURDATE() ORDER BY date ASC, time ASC";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
@@ -2267,7 +2268,7 @@ class eq
// VISIT SCHEDULING TABLE
- $sql = "SELECT * FROM eq_family where valid=1 and elder_id != 0 ORDER BY visit_pri ASC";
+ $sql = "SELECT * FROM 3rd_family where valid=1 and indiv_id != 0 ORDER BY visit_pri ASC";
$this->db->query($sql,__LINE__,__FILE__);
$total_families=0; $families_with_yearly_visit=0;
@@ -2289,7 +2290,7 @@ class eq
$total_families++;
}
- $sql = "SELECT * FROM eq_parent where valid=1";
+ $sql = "SELECT * FROM 3rd_parent where valid=1";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
@@ -2309,12 +2310,12 @@ class eq
// If this family has had a yearly visit this year, don't show them on the schedule list
$year_start = $year - 1 . "-12-31"; $year_end = $year + 1 . "-01-01";
- $sql = "SELECT * FROM eq_visit WHERE date > '$year_start' AND date < '$year_end' ".
+ $sql = "SELECT * FROM 3rd_visit WHERE date > '$year_start' AND date < '$year_end' ".
"AND family=" . $id . " AND companionship=0";
$this->db2->query($sql,__LINE__,__FILE__);
if(!$this->db2->next_record()) {
- $sql = "SELECT * FROM eq_visit WHERE family=" . $id . " AND companionship=0 ORDER BY date DESC";
+ $sql = "SELECT * FROM 3rd_visit WHERE family=" . $id . " AND companionship=0 ORDER BY date DESC";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) { $date = $this->db->f('date'); } else { $date = ""; }
$link_data['menuaction'] = 'eq.eq.vis_update';
@@ -2429,38 +2430,38 @@ class eq
if($num_months == 1) { $this->t->set_var('lang_num_months','Year of History'); }
else { $this->t->set_var('lang_num_months','Years of History'); }
- $sql = "SELECT * FROM eq_presidency where president=1 and valid=1";
+ $sql = "SELECT * FROM 3rd_presidency where president=1 and valid=1";
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record()) {
$president_name = $this->db->f('name');
- $interviewer = $this->db->f('elder');
- $eqpresppi = 1;
+ $interviewer = $this->db->f('indiv');
+ $interview_type = 'ppi';
} else {
- print "
-E- Unable to locate EQ President in eq_presidency table
";
+ print "
-E- Unable to locate President in 3rd_presidency table
";
return;
}
$this->t->set_var('district_number','*');
$this->t->set_var('district_name',$president_name);
- $sql = "SELECT * FROM eq_elder where valid=1 ORDER BY elder ASC";
+ $sql = "SELECT * FROM 3rd_indiv where valid=1 ORDER BY indiv ASC";
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
while ($this->db->next_record())
{
- $elder_id[$i] = $this->db->f('elder');
- $elder_name[$i] = $this->db->f('name');
- $elder_phone[$elder_id[$i]] = $this->db->f('phone');
- $elder_ppi_pri[$elder_id[$i]] = $this->db->f('ppi_pri');
- $elder_ppi_notes[$elder_id[$i]] = $this->db->f('ppi_notes');
+ $indiv_id[$i] = $this->db->f('indiv');
+ $indiv_name[$i] = $this->db->f('name');
+ $indiv_phone[$indiv_id[$i]] = $this->db->f('phone');
+ $indiv_ppi_pri[$indiv_id[$i]] = $this->db->f('ppi_pri');
+ $indiv_ppi_notes[$indiv_id[$i]] = $this->db->f('ppi_notes');
$i++;
}
- $total_elders=$i;
- array_multisort($elder_name, $elder_id);
- //var_dump($elder_name); print "
";
- // Find out how many times PPIs were performed in the past $num_months for this Elder
+ // Find out how many times PPIs were performed in the past $num_months for this individual
for($m=$num_months; $m >= 0; $m--) {
$year = date('Y') - $m;
$year_start = $year - 1 . "-12-31"; $year_end = $year + 1 . "-01-01";
- $sql = "SELECT * FROM eq_ppi WHERE date > '$year_start' AND date < '$year_end' ".
- "AND elder=" . $id . " AND eqpresppi=1";
+ $sql = "SELECT * FROM 3rd_interview WHERE date > '$year_start' AND date < '$year_end' ".
+ "AND indiv=" . $id . " AND interview_type='ppi'";
$this->db2->query($sql,__LINE__,__FILE__);
if(!$total_ppis[$m]) { $total_ppis[$m] = 0; }
@@ -2498,10 +2499,10 @@ class eq
$link_data['menuaction'] = 'eq.eq.ppi_update';
$link_data['companionship'] = $companionship;
$link_data['interviewer'] = $this->db2->f('interviewer');
- $link_data['elder'] = $id;
+ $link_data['indiv'] = $id;
$link_data['name'] = $name;
- $link_data['ppi'] = $this->db2->f('ppi');
- $link_data['eqpresppi'] = $eqpresppi;
+ $link_data['interview'] = $this->db2->f('interview');
+ $link_data['interview_type'] = $interview_type;
$link_data['action'] = 'view';
$date = $this->db2->f('date');
$date_array = explode("-",$date);
@@ -2516,9 +2517,9 @@ class eq
}
$table_data .= "
";
- // Find out how many times Interviews were performed in the past $num_months for this Elder
+ // Find out how many times Interviews were performed in the past $num_months for this individual
$header_row="
Companionship
";
for($m=$num_months; $m >= 0; $m--) {
$month = $current_month - $m;
@@ -2786,8 +2792,8 @@ class eq
$month_start = "$year"."-"."$month"."-"."01";
$month_end = "$year"."-"."$month"."-"."31";
$month = "$month"."/"."$year";
- $sql = "SELECT * FROM eq_ppi WHERE date >= '$month_start' AND date <= '$month_end' ".
- "AND elder=" . $elder_id . " AND aaronic=" . $aaronic_id;
+ $sql = "SELECT * FROM 3rd_interview WHERE date >= '$month_start' AND date <= '$month_end' ".
+ "AND indiv=" . $indiv_id . " AND aaronic=" . $aaronic_id;
$this->db2->query($sql,__LINE__,__FILE__);
$header_row .= "