/** * get all card access actions * @param $args \b can include filter, start_date, end_date, id * @return array */ public static function actions($args = '') { $args = PSU::params($args); $where = ''; if ($args['start_date']) { $where .= " AND x_timestamp >= ?"; $bind['start_date'] = PSU::db('pegasys')->BindTimeStamp(CardAccess::timeStamp($args['start_date'])); } // end if if ($args['end_date']) { $where .= " AND x_timestamp <= ?"; $bind['end_date'] = PSU::db('pegasys')->BindTimeStamp(CardAccess::timeStamp($args['end_date'], false)); } // end if if ($args['filter']) { $where .= " AND x_term_name LIKE '%'+?+'%'"; $bind['filter'] = $args['filter']; } // end if if ($args['id']) { $args['id'] = (int) $args['id']; $where .= " AND x_badge_number={$args['id']}"; } // end if $sql = "SELECT x_timestamp, x_badge_number, x_fname, x_lname, x_hist_type, x_item_name, x_term_name FROM xaction WHERE 1=1 {$where} ORDER BY x_timestamp DESC"; return PSU::db('pegasys')->GetAll($sql, $bind); }
/** * loads card access data */ protected function _load_cardaccess() { require_once 'CardAccess.class.php'; $this->person->data['door_access'] = CardAccess::doorAccess($this->person->id); $this->person->data['door_badge_issue_num'] = CardAccess::badgeIssueNumber($this->person->id); }