public function get_licenses($context) { $elearning_id = ""; $customer_id = ""; foreach ($context as $c) { if ($c instanceof elearning_context) { $elearning_id = $c->get_context_object(); } else { if ($c instanceof unternehmens_context) { $customer_id = $c->get_context_object(); } } } $licenses = array(); foreach ($this->license_xml->license as $xml) { $license = new license($xml); if ($license->get_course_id() == $elearning_id && $license->get_customer_id() == $customer_id) { $licenses[] = $license; } } return $licenses; }