function show_time_sheets_list_for_classes($template_name, $doAdmin = false) { $current_user =& singleton("current_user"); global $TPL; if ($doAdmin) { $db = get_pending_admin_timesheet_db(); } else { $db = get_pending_timesheet_db(); } $people =& get_cached_table("person"); while ($db->next_record()) { $timeSheet = new timeSheet(); $timeSheet->read_db_record($db); $timeSheet->set_values(); unset($date); if ($timeSheet->get_value("status") == "manager") { $date = $timeSheet->get_value("dateSubmittedToManager"); } else { if ($timeSheet->get_value("status") == "admin") { $date = $timeSheet->get_value("dateSubmittedToAdmin"); } } unset($TPL["warning"]); // older than $current_user->prefs["timeSheetDaysWarn"] days if ($date && imp($current_user->prefs["timeSheetDaysWarn"]) && (mktime() - format_date("U", $date)) / 60 / 60 / 24 > $current_user->prefs["timeSheetDaysWarn"]) { $TPL["warning"] = page::help("This time sheet was submitted to you over " . $current_user->prefs["timeSheetDaysWarn"] . " days ago.", page::warn()); } $TPL["date"] = "<a href=\"" . $TPL["url_alloc_timeSheet"] . "timeSheetID=" . $timeSheet->get_id() . "\">" . $date . "</a>"; $TPL["user"] = $people[$timeSheet->get_value("personID")]["name"]; $TPL["projectName"] = $db->f("projectName"); include_template("../time/templates/" . $template_name); } }
} // ============ END FUNCTIONS global $timeSheet; global $timeSheetItem; global $timeSheetItemID; global $db; $current_user =& singleton("current_user"); global $TPL; $timeSheetID = $_POST["timeSheetID"] or $timeSheetID = $_GET["timeSheetID"]; $db = new db_alloc(); $timeSheet = new timeSheet(); if ($timeSheetID) { $timeSheet = new timeSheet(); $timeSheet->set_id($timeSheetID); $timeSheet->select(); $timeSheet->set_values(); } // Manually update the Client Billing field if ($_REQUEST["updateCB"] && $timeSheet->get_id() && $timeSheet->can_edit_rate()) { $project = new project(); $project->set_id($timeSheet->get_value("projectID")); $project->select(); $timeSheet->set_value("customerBilledDollars", page::money($project->get_value("currencyTypeID"), $project->get_value("customerBilledDollars"), "%mo")); $timeSheet->set_value("currencyTypeID", $project->get_value("currencyTypeID")); $timeSheet->save(); } // Manually update the person's rate if ($_REQUEST["updateRate"] && $timeSheet->get_id() && $timeSheet->can_edit_rate()) { $row_projectPerson = projectPerson::get_projectPerson_row($timeSheet->get_value("projectID"), $timeSheet->get_value("personID")); if (!$row_projectPerson) { alloc_error("The person has not been added to the project.");