$dayTime = strtotime($day . " -0000"); $dayName = gmdate('D', $dayTime); // Make sure yesterday was not a weekend day. if ($dayName != "Sat" && $dayName != "Sun") { // Log what we are doing. print "Processing Yesterday ({$dayName}, {$day}).\n"; // Get the pay period containing yesterday. $payPeriodDao = new PayPeriodDao(); $payPeriod = $payPeriodDao->getContaining($day); // Make sure the pay period was found. if (isset($payPeriod)) { // Log what we are doing. print "Found associated pay period.\n"; // Get all the active employees in the system. $employeeDao = new EmployeeDao(); $employees = $employeeDao->getAll(true); // This is used to retrieve timesheets. $timesheetDao = new TimesheetDao(); // This is used to log our timesheet reviews. $auditLogDao = new AuditLogDao(); // Make sure some active employees were found. if (isset($employees) && count($employees) > 0) { // Iterate over the available employees. foreach ($employees as $employee) { // Log what we are doing. print "\nFound employee to check: " . $employee->full_name . "\n"; // Keep track of whether we need to send notification info. $notify = false; // Get the timesheet for this employee. $timesheet = $timesheetDao->getForEmployee($employee->id, $payPeriod); // Make sure the timesheet exists.
/** * Retrieve the JSON for all the employees. */ public function jsonAction() { // Determine if we should retrieve only active employees. $activeOnly = $this->getBool('activeOnly'); // Wrap the whole thing in a try/catch. try { // Get all the employees. $employeeDao = new EmployeeDao(); $employees = $employeeDao->getAll($activeOnly); // Create the JSON object to return. $json = new stdClass(); $json->success = true; $json->employees = $employees; } catch (Zend_Exception $ex) { // Create the error JSON object to return. $json = new stdClass(); $json->success = false; $json->msg = $ex->getMessage(); $json->employees = array(); } // Return all the employees as JSON. $this->_helper->json($json); }