function testRetrieve_persons_by_name() { // $m = new Person("John", "Smith", "Male", "555 Main Street", "Flushing", "NY", "11111", "Queens", PHONE, "2072654046", "*****@*****.**", "volunteer", "applicant","Schedule", "I like helping out", "55555", "03-14-14"); $newProject = new Project(PROJID, "03-12-14", "Main Building", "UnloadDelivery", 10, 13, 15, "", "notes"); echo 'will test retrieve_persons_by_name </br>'; $result = add_person($m); if ($result) { echo "add_person - person was inserted </br>"; } else { echo "add_person - person not inserted </br>"; } echo "test retrieve_persons_by_name</br>"; $personList = retrieve_persons_by_name("John Smith"); if ($personList == null) { echo 'Retrieve failed</br>'; } else { checkEquals($personList[0]->get_id(), ID); checkEquals($personList[0]->get_phone1(), PHONE); checkEquals($personList[0]->get_email(), "*****@*****.**"); } $res = remove_person(ID); if ($res == null) { echo 'Retrieve failed</br>'; } }
function report_by_individual_volunteer($name, $shifthistories, $projecthistories, $from, $to) { echo "<br><b>Individual Volunteer Hours</b>"; $labels = IndividualHoursLabel($from, $to); foreach ($name as $n) { $individual = retrieve_persons_by_name($n); } foreach ($individual as $i) { if ($i != null) { echo "<br>This report shows the total hours worked by " . $i->get_first_name() . " " . $i->get_last_name() . " from " . $from . " {$to} " . $to; error_log("/////ENTERING the report_hours function for " . $i->get_first_name() . " " . $i->get_last_name() . "--------------------"); $reports = $i->report_individual_hours($shifthistories, $projecthistories, $from, $to); //An array contaning [0] shift, [1] project, and [2] total should be returned - GIOVI } } echo displayIndividualHoursReport($labels, $reports); }
function testRetrieve_persons_by_name() { $m = new Person("John", "Smith", "10-12-87", "Male", "555 Main Street", "Flushing", "NY", "11111", PHONE, "2072654046", "*****@*****.**", "volunteer", " ", "Schedule", "I like helping out", "55555", "03-14-14", "email"); echo 'will test retrieve_persons_by_name </br>'; $result = add_person($m); if ($result) { echo "add_person - person was inserted </br>"; } else { echo "add_person - person not inserted </br>"; } echo "test retrieve_persons_by_name</br>"; $personList = retrieve_persons_by_name("John Smith"); if ($personList == null) { echo 'Retrieve failed</br>'; } else { checkEquals($personList[0]->get_id(), ID); checkEquals($personList[0]->get_phone1(), PHONE); checkEquals($personList[0]->get_email(), "*****@*****.**"); } $res = remove_person(ID); if ($res == null) { echo 'Remove failed</br>'; } }