function report_projecthours($from, $to) { $from_date = setFromDate($from); $to_date = setToDate($to); $reports = []; $all_projects = get_all_projects(); $count = 0; foreach ($all_projects as $p) { $hours = 0; $minutes = 0; $hrmin = [0, 0]; $project_date = date_create_from_mm_dd_yyyy($p->get_mm_dd_yy()); if ($project_date >= $from_date && $project_date <= $to_date && $p->get_persons() != null) { if (!isset($reports[$p->get_id()][0]) || !isset($reports[$p->get_id()][1]) || !isset($reports[$p->get_id()][2])) { $reports[$p->get_id()][0] = NULL; $reports[$p->get_id()][1] = NULL; } error_log("Getting total hours and number of volunteers---------------------------"); error_log("The number of hours is " . $p->duration()); error_log("The number of volunteers is " . $p->get_num_of_persons()); $hrmin = ConvertTimeToHrMin($p->duration()); $hours = $hrmin[0] * $p->get_num_of_persons(); $minutes = $hrmin[1] * $p->get_num_of_persons(); $projectTime = ArrangeMinutesInHours($hours, $minutes); $reports[$p->get_id()][0] = $projectTime; $reports[$p->get_id()][1] = $p->get_num_of_persons(); $count++; error_log("End of loop--------------------------------------"); } } error_log("------- " . $count . " project(s) recorded-----------"); return $reports; }
function get_all_peoples_histories_in_proj() { $today = date('m-d-y'); $histories = []; $all_projects = get_all_projects(); foreach ($all_projects as $a_project) { $persons = explode('*', $a_project->get_persons()); if (!$persons[0]) { // skip vacant projects array_shift($persons); //Was array_project, must have thought this was a user function - GIOVI } if (count($persons) > 0) { foreach ($persons as $a_person) { if (strpos($a_person, "+") > 0) { $person_id = substr($a_person, 0, strpos($a_person, "+")); if (array_key_exists($person_id, $histories)) { $histories[$person_id] .= "," . $a_project->get_id(); } else { $histories[$person_id] = $a_project->get_id(); } } } } } ksort($histories); return $histories; }
<head> <title> Current Projects </title> <link rel="stylesheet" href="styles.css" type="text/css"/> </head> <body> <div id="content"> <?php include_once 'header.php'; include_once 'accessController.php'; include_once 'domain/Project.php'; include_once 'database/dbProjects.php'; $all_projects = get_all_projects(); $projects = []; foreach ($projects as $p) { $p->get_project_name(); } ?> <p align= "center" style="font:50px Script; color:#EE162C"> Take a look at our current projects! See anything you like? <br><a href="personEdit.php?id=new">Sign up to volunteer!</a> </p> <div style="height:600px;width:1150px;border:0px solid #000;font:16px/26px Verdana;overflow:auto"> <p align= "center" style="font:50px Impact; color:#04D33B">
function report_projects_staffed_vacant($from, $to) { $from_date = setFromDate($from); $to_date = setToDate($to); $reports = []; $all_projects = get_all_projects(); $count = 0; foreach ($all_projects as $p) { $projects_date = date_create_from_mm_dd_yyyy($p->get_mm_dd_yy()); if ($projects_date >= $from_date && $projects_date <= $to_date && $p->get_vacancies() != 0) { if (!isset($reports[$p->get_id()][0])) { $reports[$p->get_id()][0] = NULL; } error_log("Getting the number of remaining vacancies--------------------------------------------"); $reports[$p->get_id()][0] += $p->get_remaining_vacancies($p->get_id()); $count++; } } error_log("------- " . $count . " vacancy(ies) recorded-----------"); return $reports; }
$result = get_funding_aggregate($v['title'], $v['owner_email']); $v['num_backers'] = $result[0]['num_backers']; $v['amount_pledged'] = $result[0]['amount_pledged']; $v['hours_left'] = hours_left($v['end_date']); $v['percent_funded'] = percent_funded($result[0]['amount_pledged'], $v['target_funds']); array_push($temp, $v); } return $temp; } $request = $_SERVER['QUERY_STRING']; parse_str($request, $req_params); if (isset($req_params['keyword'])) { $search_term = $req_params['keyword']; $projects = process_projects(get_all_projects($search_term)); } else { $projects = process_projects(get_all_projects()); } // print_r($projects); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/common.css"> </head> <body> <header class=""> <!-- Navigation --> <nav class="navbar navbar-default">
function projectLabel($from, $to, $section) { //This is used to print out display the project table the new way - GIOVI $from_date = setFromDate($from); $to_date = setToDate($to); $labels = []; $projdata = get_all_projects(); $count = 0; foreach ($projdata as $project) { $projects_date = date_create_from_mm_dd_yyyy($project->get_mm_dd_yy()); if ($section === 'hours') { if ($projects_date >= $from_date && $projects_date <= $to_date && $project->get_persons() != null) { $starthrmin = ConvertTimeToHrMin($project->get_start_time()); $endhrmin = ConvertTimeToHrMin($project->get_end_time()); array_push($labels, $project->get_date() . "<br>" . ArrangeMinutesInHours($starthrmin[0], $starthrmin[1]) . " - " . ArrangeMinutesInHours($endhrmin[0], $endhrmin[1]) . "<br><nobr>" . $project->get_name() . "</nobr>"); $count++; } } if ($section === 'vacancies') { if ($projects_date >= $from_date && $projects_date <= $to_date && $project->get_vacancies() != 0) { $starthrmin = ConvertTimeToHrMin($project->get_start_time()); $endhrmin = ConvertTimeToHrMin($project->get_end_time()); array_push($labels, $project->get_date() . "<br>" . ArrangeMinutesInHours($starthrmin[0], $starthrmin[1]) . " - " . ArrangeMinutesInHours($endhrmin[0], $endhrmin[1]) . "<br><nobr>" . $project->get_name() . "</nobr>"); $count++; } } } error_log("------- " . $count . " project label(s) recorded-----------"); return $labels; }