function get_event_accreditation_name($accreditation_id, $attendee) { $name = ''; foreach ($attendee['Accreditations'] as $a) { if ($a['Accreditation']['id'] == $accreditation_id) { $name = get_event_name($a['Accreditation']['event_id'], $attendee['Events']) . " - " . get_accreditation_type($a['Accreditation']['accreditation_type_id'], $attendee['AccreditationTypes']); } } return $name; }
public function set_prerequisites($attendee_id = null) { // Get attendees $b = $this->Attendee->find('all'); $attendees = array(); foreach ($b as $k) { if ($k['Attendee']['id'] != $attendee_id) { // Removes the currently edited attendee from the list, as they shouldnt be a subordinate of themselves. $attendees[$k['Attendee']['id']] = $k['Attendee']['name']; } } $a = ClassRegistry::init('Eventure.Accreditation')->find('all'); $at = ClassRegistry::init('Eventure.AccreditationType')->find('all'); $ev = ClassRegistry::init('Eventure.Event')->find('all'); $accreditations = array(); foreach ($a as $k) { $accreditations[$k['Accreditation']['id']] = get_event_name($k['Accreditation']['event_id'], $ev) . " - " . get_accreditation_type($k['Accreditation']['accreditation_type_id'], $at); } $this->set(compact('attendees', 'accreditations', 'subordinates')); }