X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;f=inc%2Fclass.eq.inc.php;h=c7601008cc1bcb0f13c2cba2fcc2598999e22d81;hb=8c3a64633fe59a227723d29b6965a6a7b6dd2d73;hp=2ffb985a68c0870437e2752f0c88dd3727e06302;hpb=eb177664b7f5915b1d1a31e6d148cc02bbe062f3;p=eq%2F.git diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 2ffb985..c760100 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -235,12 +235,11 @@ class eq $this->t->set_var('district_number',$districts[$i]['district']); $this->t->set_var('district_name',$districts[$i]['name']); $supervisor = $districts[$i]['supervisor']; - $unique_companionships=''; // Select all the unique companionship numbers for this district $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $districts[$i]['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'); @@ -418,7 +417,7 @@ class eq // Get a list of all the companionships in this district $sql = "SELECT distinct companionship FROM eq_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'); @@ -485,7 +484,7 @@ class eq // Select all the unique companionship numbers for this district $sql = "SELECT distinct companionship FROM eq_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'); @@ -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(); } @@ -772,12 +771,14 @@ class eq // 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__); - } - + if(is_array($elders)) { // Only do the foreach loop if we have a valid array of elders to work with + foreach ($elders as $elder) + { + $this->db->query("INSERT INTO eq_participation (elder,activity) " + . "VALUES (" . $elder . ",". $activity['activity'] . ")",__LINE__,__FILE__); + } + } + $this->act_list(); return false; } @@ -1423,6 +1424,16 @@ class eq $interviewer = $this->db->f('elder'); $district_number = '*'; $district_name = $president_name; + $sql = "SELECT * FROM eq_elder where elder='$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'"; + $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

"; return; @@ -1438,7 +1449,7 @@ class eq $elder = $entry['elder']; $appointment = $entry['appointment']; $location = $entry['location']; - if($location == "") { $location = "$president_last_name"." home"; } + if($location == "") { $location = "$president_last_name"." home ($president_address)"; } if($elder == 0) { $location = ""; } //Only perform a database update if we have made a change to this appointment @@ -1518,7 +1529,7 @@ class eq $appointment = $this->db->f('appointment'); $elder = $this->db->f('elder'); $location = $this->db->f('location'); - if(($location == "") && ($elder > 0)) { $location = "$president_last_name"." home"; } + if(($location == "") && ($elder > 0)) { $location = "$president_last_name"." home ($president_address)"; } $date = $this->db->f('date'); $date_array = explode("-",$date); @@ -1589,7 +1600,7 @@ class eq $this->db2->query($sql,__LINE__,__FILE__); if(!$this->db2->next_record()) { - $sql = "SELECT * FROM eq_ppi WHERE elder=" . $id . " ORDER BY date DESC"; + $sql = "SELECT * FROM eq_ppi WHERE elder=" . $id . " AND eqpresppi=1 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.ppi_update'; @@ -1747,7 +1758,17 @@ class eq $supervisor = $entry['supervisor']; $supervisor_array = explode(",", $elderid2name[$supervisor]); $supervisor_last_name = $supervisor_array[0]; - $location = "$supervisor_last_name"." home"; + $sql = "SELECT * FROM eq_elder where elder='$supervisor'"; + $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'"; + $this->db2->query($sql,__LINE__,__FILE__); + if($this->db2->next_record()) { + $supervisor_address = $this->db2->f('address'); + } + $location = "$supervisor_last_name"." home ($supervisor_address)"; } if($elder == 0) { $location = ""; } @@ -1830,6 +1851,17 @@ class eq $supervisor = $districts[$d]['supervisor']; $supervisor_array = explode(",", $supervisor); $supervisor_last_name = $supervisor_array[0]; + $sql = "SELECT * FROM eq_elder where elder='$supervisor'"; + $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'"; + $this->db2->query($sql,__LINE__,__FILE__); + if($this->db2->next_record()) { + $supervisor_address = $this->db2->f('address'); + } + $location = "$supervisor_last_name"." home ($supervisor_address)"; $table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": All Elders with Interviews Not Completed"; $appt_table_title = "District ".$districts[$d]['district'].": ".$districts[$d]['name'].": Interview Appointment Slots"; $this->t->set_var('table_title',$table_title); @@ -1844,7 +1876,7 @@ class eq $appointment = $this->db->f('appointment'); $elder = $this->db->f('elder'); $location = $this->db->f('location'); - if(($location == "") && ($elder > 0)) { $location = "$supervisor_last_name"." home"; } + if(($location == "") && ($elder > 0)) { $location = "$supervisor_last_name"." home ($supervisor_address)"; } $date = $this->db->f('date'); $date_array = explode("-",$date); @@ -1888,7 +1920,7 @@ class eq // Select all the unique companionship numbers for this district $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $districts[$d]['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'); @@ -2521,15 +2553,22 @@ class eq $date = get_var('date',array('GET','POST')); $notes = get_var('notes',array('GET','POST')); $eqpresppi = get_var('eqpresppi',array('GET','POST')); - - $sql = "SELECT * FROM eq_elder WHERE elder=" . $interviewer; + + $sql = "SELECT * FROM eq_presidency where valid=1 and (president=1 or counselor=1 or secretary=1)"; $this->db2->query($sql,__LINE__,__FILE__); - $this->db2->next_record(); - $interviewer_name = $this->db2->f('name'); - $this->t->set_var('interviewer',$interviewer . ' selected'); - $this->t->set_var('interviewer_name',$interviewer_name); - $this->t->set_var('eqpresppi_checked',''); - $this->t->fp('int_list','interviewer_list',True); + while ($this->db2->next_record()) + { + $elder = $this->db2->f('elder'); + $interviewer_name = $this->db2->f('name'); + if($elder == $interviewer) { + $this->t->set_var('interviewer',$interviewer . ' selected'); + } else { + $this->t->set_var('interviewer',$interviewer); + } + $this->t->set_var('interviewer_name',$interviewer_name); + $this->t->set_var('eqpresppi_checked',''); + $this->t->fp('int_list','interviewer_list',True); + } if($action == 'save') { @@ -2695,13 +2734,11 @@ class eq $this->t->set_var('district_number',$districts[$i]['district']); $this->t->set_var('district_name',$districts[$i]['name']); $supervisor = $districts[$i]['supervisor']; - $unique_companionships=''; // Select all the unique companionship numbers for this district $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $districts[$i]['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'); @@ -2853,25 +2890,21 @@ class eq $date = get_var('date',array('GET','POST')); $notes = get_var('notes',array('GET','POST')); $eqpresppi = get_var('eqpresppi',array('GET','POST')); - - $sql = "SELECT * FROM eq_district where valid=1 ORDER BY district ASC"; - $this->db->query($sql,__LINE__,__FILE__); - while ($this->db->next_record()) - { - $supervisor = $this->db->f('supervisor'); - $sql = "SELECT * FROM eq_elder WHERE elder=" . $supervisor; - $this->db2->query($sql,__LINE__,__FILE__); - $this->db2->next_record(); - $interviewer_name = $this->db2->f('name'); - - if($supervisor == $interviewer) { - $this->t->set_var('interviewer',$supervisor . ' selected'); - } else { - $this->t->set_var('interviewer',$interviewer); - } - $this->t->set_var('interviewer_name',$interviewer_name); - $this->t->fp('int_list','interviewer_list',True); - } + + $sql = "SELECT * FROM eq_presidency where valid=1 and (president=1 or counselor=1 or secretary=1 or district!=0)"; + $this->db2->query($sql,__LINE__,__FILE__); + while ($this->db2->next_record()) + { + $elder = $this->db2->f('elder'); + $interviewer_name = $this->db2->f('name'); + if($elder == $interviewer) { + $this->t->set_var('interviewer',$interviewer . ' selected'); + } else { + $this->t->set_var('interviewer',$interviewer); + } + $this->t->set_var('interviewer_name',$interviewer_name); + $this->t->fp('int_list','interviewer_list',True); + } if($action == 'save') { @@ -3618,7 +3651,7 @@ class eq $this->t->set_var('schedule_ppi_link',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.ppi_sched')); $this->t->set_var('schedule_ppi_link_title','Schedule Yearly PPIs'); - $date_width=150; $time_width=225; $elder_width=200; $family_width=200; $location_width=100; + $date_width=150; $time_width=220; $elder_width=170; $family_width=180; $location_width=100; $table_width=$date_width + $time_width + $elder_width + $family_width + $location_width; $header_row = "Date"; $header_row.= "Time"; @@ -3636,6 +3669,7 @@ class eq $presidency_data[$i]['name'] = $this->db->f('name'); $presidency_data[$i]['elder'] = $this->db->f('elder'); $presidency2name[$presidency_data[$i]['id']] = $presidency_data[$i]['name']; + $presidency2elder[$presidency_data[$i]['id']] = $presidency_data[$i]['elder']; $i++; } @@ -3688,7 +3722,17 @@ class eq else if($elder > 0) { $supervisor_name_array = explode(",",$presidency2name[$presidency]); $supervisor_last_name = $supervisor_name_array[0]; - $location = "$supervisor_last_name"." home"; + $sql = "SELECT * FROM eq_elder where elder='$presidency2elder[$presidency]'"; + $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'"; + $this->db2->query($sql,__LINE__,__FILE__); + if($this->db2->next_record()) { + $supervisor_address = $this->db2->f('address'); + } + $location = "$supervisor_last_name"." home ($supervisor_address)"; } } @@ -3805,7 +3849,17 @@ class eq else if($elder > 0) { $supervisor_name_array = explode(",",$presidency2name[$presidency]); $supervisor_last_name = $supervisor_name_array[0]; - $location = "$supervisor_last_name"." home"; + $sql = "SELECT * FROM eq_elder where elder='$presidency2elder[$presidency]'"; + $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'"; + $this->db2->query($sql,__LINE__,__FILE__); + if($this->db2->next_record()) { + $supervisor_address = $this->db2->f('address'); + } + $location = "$supervisor_last_name"." home ($supervisor_address)"; } } @@ -3835,7 +3889,7 @@ class eq $table_data.= ""; // Elder drop down list (for PPIs) - $table_data.= ''; $table_data.= ''; for ($j=0; $j < count($elder_id); $j++) { $id = $elder_id[$j]; @@ -3846,7 +3900,7 @@ class eq $table_data.=''; // Family drop down list (for Visits) - $table_data.= ''; $table_data.= ''; for ($j=0; $j < count($elder_id); $j++) { $id = $family_id[$j]; @@ -3858,7 +3912,7 @@ class eq // Location text box $table_data.= ''; + $table_data.= 'name="sched['.$presidency.']['.$appointment.'][location]" value="'.$location.'" STYLE="font-size : 8pt">'; $table_data.= ''; $table_data.= ''; @@ -3884,7 +3938,7 @@ class eq $table_data.= ""; // Elder drop down list - $table_data.= ''; $table_data.= ''; for ($j=0; $j < count($elder_id); $j++) { $id = $elder_id[$j]; @@ -3894,7 +3948,7 @@ class eq $table_data.=''; // Family drop down list - $table_data.= ''; $table_data.= ''; for ($j=0; $j < count($elder_id); $j++) { $id = $family_id[$j]; @@ -3905,7 +3959,7 @@ class eq // Location text box $table_data.= ''; + $table_data.= 'name="sched['.$presidency.']['.$appointment.'][location]" value="" STYLE="font-size : 8pt">'; $table_data.= ''; $table_data.= ''; @@ -3996,6 +4050,12 @@ class eq if(!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $uploadstatus = " -E- Unable to move the uploaded file to "; $uploadstatus.= "the target path (check the path and permissions) of: $target_path"; + $uploadstatus = "The following file was uploaded successfully:

"; + $uploadstatus.= "Tmp Filename : " . $_FILES['uploadedfile']['tmp_name'] . "
"; + $uploadstatus.= "Filename : " . $_FILES['uploadedfile']['name'] . "
"; + $uploadstatus.= "Type : " . $_FILES['uploadedfile']['type'] . "
"; + $uploadstatus.= "Size : " . $_FILES['uploadedfile']['size'] . "
"; + $uploadstatus.= "Error : " . $_FILES['uploadedfile']['error'] . "
"; $this->t->set_var('uploadstatus',$uploadstatus); $this->t->pfp('uploadhandle','upload',True); return 0;