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; }
/** * 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 }
/** * returns the contributors to the given checklist or checklist section * * @param $subject PSUPerson person the checklist is for * @param $attribute string checklist permission * @param $type_id int type of attribute */ public static function contributors($subject, $checklist_id, $attribute = null, $type_id = null, $list = null) { if ($type_id != 1 || $list == 'Department') { // get all the supervisors $attributes = array('attribute' => array("pa.type_id" => 2, "pa.attribute" => 'supervisor')); $users = PSU::get('idmobject')->getUsersByAttribute($attributes); foreach ((array) $users as $user) { $person = new PSUPerson($user['username']); // only email supervisors whose departments match the person leaving if ($person->department == $subject->department) { $people[$user['username']] = $person; } //end if } //end foreach $categories = HRChecklist::categories('employee-exit', 'slug'); // get emails of non-completed checklist categories $attributes = array(); foreach ($categories as $category) { if (!HRChecklist::is_complete('employee-exit', $checklist_id)) { $attributes[] = array("pa.type_id" => 1, "pa.attribute" => 'ape_checklist_employee_exit_' . $category); } //end if } //end foreach } else { // get all people that match the given checklist $attributes = array('attribute' => array("pa.type_id" => $type_id, "pa.attribute" => $attribute)); } //end else $users = PSU::get('idmobject')->getUsersByAttribute($attributes); foreach ((array) $users as $user) { $people[$user['username']] = new PSUPerson($user['username']); } //end foreach return $people; }