$student->load(); if (empty($student->id)) { return get_string('studentnotfound', 'local_elisprogram'); } // Retrieve the certificate settings record $certsettingrec = new certificatesettings($csid); $certsettingrec->load(); // Check if the record exists or if the certificate is disabled if (empty($certsettingrec->id) and !empty($certsettingrec->disable)) { // Passing hard coded error code to disallow administrators from changing them to // custom strings echo get_string('errorfindingcertsetting', 'local_elisprogram', 'Error 11'); } // Retrieve the certificate issued record $certissuedrec = new certificateissued($ciid); $certissuedrec->load(); // Check if the record exists or if the certificate is disabled if (empty($certissuedrec->id) and !empty($certissuedrec->disable)) { // Passing hard coded error code to disallow administrators from changing them to // custom strings echo get_string('errorfindingcertissued', 'local_elisprogram', 'Error 22'); } // Set the border, seal and template filenames and other info $borderimage = $certsettingrec->cert_border; $sealimage = $certsettingrec->cert_seal; $template = $certsettingrec->cert_template; $instructor = ''; $params = array(); // Retrieve additional metadata about the entity $params = certificate_get_entity_metadata($certsettingrec, $certissuedrec, $student); if (!empty($params)) {
/** * Test retrieving course metadata */ public function test_retrieve_metadata_for_course_entity() { $this->load_csv_data(); $student = new user(104); $certsetting = new certificatesettings(6); $certissued = new certificateissued(9); $certissued->load(); $student->load(); $certsetting->load(); $result = certificate_get_course_entity_metadata($certsetting, $certissued, $student); $expected = array('student_name' => 'User Test2', 'course_name' => 'Test Course', 'class_idnumber' => 'Test_Class_Instance_1', 'class_enrol_time' => 1358315400, 'class_startdate' => 0, 'class_enddate' => 0, 'class_grade' => '10.00000', 'cert_timeissued' => 1358363100, 'cert_code' => '339Fjap8j6oPKnw', 'class_instructor_name' => 'User Test1'); $this->assertEquals($expected, $result); }