function pdf_info() { //checklist subject $format = 'f m l'; $info['person_name'] = parent::get_name($this->user, $format); //checklist categories $info['categories'] = HRChecklist::categories($this->checklist_type); //category items foreach ($info['categories'] as &$category) { $category['items'] = HRChecklist::get_items($category); } //checklist info .... date created, id, user, type. the latter two should already be defined before this point. $info['checklist_info'] = HRChecklist::get($this->user, $this->type); $info['checklist_info']['title'] = self::format_type_slug($info['checklist_info']['type']) . ' Checklist'; //checklist status $info['is_complete'] = HRChecklist::is_complete($this->type, $info['checklist_info']['id']); //if a closed date exists if (HRChecklist::get_meta($info['checklist_info']['id'], 'closed', 'activity_date')) { $info['checklist_info']['closed_date'] = HRChecklist::get_meta($info['checklist_info']['id'], 'closed', 'activity_date'); $info['closed_date'] = new DateTime($info['checklist_info']['closed_date']['activity_date']); $info['closed_date'] = $info['closed_date']->format('l F j, Y'); } return $info; }
} else { if (!APEAuthZ::employee_clearance()) { $pdf->setTextColor(0, 0, 0); $pdf->Cell(190, 5, 'Please contribute any information you may have regarding the following item(s).'); } foreach ($checklist_items as $key => $checklist_item) { if ($key != 'id' && $key != 'type' && $key != 'pidm') { if ($key == 'Campus Police' && $AUTHZ . permission . ape_checklist_employee_exit_police || $key == 'Travel Office/Accounts Payable' && $AUTHZ . permission . ape_checklist_employee_exit_payable || $key == 'Residential Life' && $AUTHZ . permission . ape_checklist_employee_exit_reslife || $key == 'Library' && $AUTHZ . permission . ape_checklist_employee_exit_library || $key == "Student Account Services Office" && $AUTHZ . permission . ape_checklist_employee_exit_bursar || $key == 'Physical Plant' && $AUTHZ . permission . ape_checklist_employee_exit_physicalplant || $key == 'Finance' && $AUTHZ . permission . ape_checklist_employee_exit_finance || $key == 'Supervisor of Student Employees Attribute' && $AUTHZ . permission . ape_checklist_employee_exit_student_supervisor || $AUTHZ . permission . ape_checklist_employee_exit_hr || $key == 'Information Technology' && $AUTHZ . permission . ape_checklist_employee_exit_infotech || $key == 'Department' && $myuser->department == $person->department) { $pdf->SetFont('Arial', 'BU', 12); $pdf->setTextColor(5, 66, 6); $pdf->Cell(190, 5, $key, 0, 1, 'L'); foreach ($checklist_item as $entry) { $pdf->SetFont('Arial', '', 10); $pdf->setTextColor(0, 0, 0); $pdf->Cell(190, 5, $entry['name'] . ': ' . $entry['description'], 0, 1, 'L'); $response = HRChecklist::item_responses($person->pidm, $entry['id'], '*'); if ($response) { $no_answer = 't'; foreach ($response as $record) { $pdf->setTextColor(120, 7, 41); $prev_response = $record['response']; $pdf->Cell(25, 5, ' Marked as', 0, 0, 'L'); if ($record['response'] == 'incomplete') { $pdf->Cell(20, 5, 'incomplete', 0, 0, 'L'); $no_answer = 'f'; } elseif ($record['response'] == 'complete') { $pdf->Cell(20, 5, 'complete', 0, 0, 'L'); $no_answer = 'f'; } elseif ($record['response'] == 'n/a') { $pdf->Cell(20, 5, 'n/a', 0, 0, 'L'); $no_answer = 'f';
/** * retrieves all of the checklists and associated meta data selected in the contructor args or the defaults */ public function populate_checklists() { $this->get_all_checklists(); $this->categories = HRChecklist::categories($this->type); if ($this->checklists['pending']) { foreach ($this->checklists['pending'] as &$checklist) { $checklist['closed'] = HRChecklist::is_complete($this->type, $checklist['id']); $checklist['person_name'] = self::get_name($checklist['pidm']); $checklist['meta']['end_date'] = HRChecklist::get_meta($checklist['id'], 'end_date', 1); foreach ($this->categories as $category) { $category['is_complete'] = self::is_category_complete($category['id'], $checklist['id']); $category['updated'] = self::last_updated_by($category['id'], $checklist['id']); $category['reminder'] = HRChecklist::get_meta($checklist['id'], 'reminder_' . $category['slug'], 1); $items = HRChecklist::get_items(array('category' => $category['id'])); $category['items'] = array(); foreach ($items as $item) { $item['response'] = HRChecklist::item_response($item['id'], $checklist['id'], '*', 'GetRow'); $category['items'][$item['slug']] = $item; } //end foreach $checklist['category'][] = $category; } //end foreach } //end foreach } //end if $checklist_temp = array(); if ($this->checklists['closed']) { while ($c = $this->checklists['closed']->fetchrow()) { $c['closed'] = HRChecklist::is_complete($this->type, $c['id']); $c['person_name'] = self::get_name($c['pidm']); $c['meta']['closed'] = HRChecklist::get_meta($c['id'], 'closed', 1); $c['meta']['end_date'] = HRChecklist::get_meta($c['id'], 'end_date', 1); foreach ($this->categories as $category) { $category['is_complete'] = self::is_category_complete($category['id'], $c['id']); $category['updated'] = self::last_updated_by($category['id'], $c['id']); $category['reminder'] = HRChecklist::get_meta($c['id'], 'reminder_' . $category['slug'], 1); $c['category'][] = $category; } //end foreach $checklist_temp[] = $c; } //end foreach $this->checklists['closed'] = $checklist_temp; } //end if }
} //end if $time = time(); $one_month_ago = strtotime('-1 month'); $sql = "SELECT * FROM v_emp_clearance_candidates"; if ($results = PSU::db('banner')->Execute($sql)) { foreach ($results as $row) { if ($checklist = HRChecklist::get($row['pidm'], 'employee-exit')) { if ($checklist['position_code'] == $row['position_code'] && strtotime($checklist['activity_date']) >= $one_month_ago) { continue; } //end if } //end if $person = PSUPerson::get($row['pidm']); $response = HRChecklist::start($person->pidm, strtotime($row['end_date']), 'employee-exit', $row['position_code'], 0); $checklist_id = $response->id; if ($checklist_id) { HRChecklist::email($person, strtotime($row['end_date']), 'ape_checklist_employee_exit', 2, 'employee-exit', $checklist_id, $response); } //end if } //end foreach } //end if if ($command_line) { $cron->stopTimer(); $cron->log('Employee Exit Checklist Trigger completed (Run Time: ' . $cron->getRunTime() . ')'); $cron->unlock(); } //end if
/** * start a checklist process */ public static function start($pidm, $date, $type, $position, $initiator_pidm) { if ($id = self::get($pidm, $type, $position)) { return $id; } //end if $person = new PSUPerson($pidm); $response = new StdClass(); $sql = "INSERT INTO person_checklists (type, pidm, position_code) VALUES (?, ?, ?)"; if (PSU::db('hr')->Execute($sql, array($type, $pidm, $position))) { $response->id = PSU::db('hr')->Insert_ID(); $sql = "INSERT INTO person_checklist_meta (\n\t\t\t\t checklist_id,\n\t\t\t\t\t\t\t\tmeta_key,\n\t\t\t\t\t\t\t\tmeta_value\n\t\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t\t?,\n\t\t\t\t\t\t\t\t'end_date',\n\t\t\t\t\t\t\t\t?\n\t\t\t\t\t\t\t)"; if (PSU::db('hr')->Execute($sql, array($response->id, $date))) { $response->no_outstanding_charges = HRChecklist::auto_mark_outstanding_charges($person, $response->id, $initiator_pidm); $response->no_ape_attributes = HRChecklist::auto_mark_ape_attributes($person, $response->id, $initiator_pidm); return $response; } //end if } //end if return $response; }