ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCertificateFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
14 public function create(ilObject $object) : ilCertificate
15 {
16 $type = $object->getType();
17
18 switch ($type) {
19 case 'tst':
20 $adapter = new ilTestCertificateAdapter($object);
21 $placeholderDescriptionObject = new ilTestPlaceholderDescription();
22 $placeholderValuesObject = new ilTestPlaceholderValues();
23 $certificatePath = ilCertificatePathConstants::TEST_PATH . $object->getId() . '/';
24 break;
25 case 'crs':
26 $adapter = new ilCourseCertificateAdapter($object);
27 $placeholderDescriptionObject = new ilCoursePlaceholderDescription();
28 $placeholderValuesObject = new ilCoursePlaceholderValues();
29 $certificatePath = ilCertificatePathConstants::COURSE_PATH . $object->getId() . '/';
30 break;
31 case 'scrm':
32 $adapter = new ilSCORMCertificateAdapter($object);
33 $placeholderDescriptionObject = new ilScormPlaceholderDescription($object);
34 $placeholderValuesObject = new ilScormPlaceholderValues();
35 $certificatePath = ilCertificatePathConstants::SCORM_PATH . $object->getId() . '/';
36 break;
37 case 'exc':
38 $adapter = new ilExerciseCertificateAdapter($object);
39 $placeholderDescriptionObject = new ilExercisePlaceholderDescription();
40 $placeholderValuesObject = new ilExercisePlaceholderValues();
41 $certificatePath = ilCertificatePathConstants::EXERCISE_PATH . $object->getId() . '/';
42 break;
43 default:
44 throw new ilException(sprintf(
45 'The type "%s" is currently not supported for certificates',
46 $type
47 ));
48 break;
49 }
50
52 $adapter,
53 $placeholderDescriptionObject,
54 $placeholderValuesObject,
55 $object->getId(),
56 $certificatePath
57 );
58
59 return $certificate;
60 }
61}
An exception for terminatinating execution or to throw for unit testing.
Create PDF certificates.
Base class for ILIAS Exception handling.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getId()
get object id @access public
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$type