ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateGUIFactory Class Reference
+ Collaboration diagram for ilCertificateGUIFactory:

Public Member Functions

 __construct (\ILIAS\DI\Container $dic=null)
 
 create (\ilObject $object)
 

Private Attributes

 $dic
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateGUIFactory::__construct ( \ILIAS\DI\Container  $dic = null)
Parameters
\ILIAS\DI\Container | null$dic

Definition at line 17 of file class.ilCertificateGUIFactory.php.

References $DIC, and $dic.

18  {
19  if (null === $dic) {
20  global $DIC;
21  $dic = $DIC;
22  }
23  $this->dic = $dic;
24  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ create()

ilCertificateGUIFactory::create ( \ilObject  $object)
Parameters
ilObject$object
Returns
ilCertificateGUI
Exceptions
ilException

Definition at line 31 of file class.ilCertificateGUIFactory.php.

References $DIC, $type, ilCertificatePathConstants\COURSE_PATH, ilCertificatePathConstants\EXERCISE_PATH, ilObject\getId(), ilObject\getType(), ilCertificatePathConstants\SCORM_PATH, and ilCertificatePathConstants\TEST_PATH.

32  {
33  global $DIC;
34 
35  $type = $object->getType();
36  $objectId = $object->getId();
37 
38  $logger = $DIC->logger()->cert();
39 
40  $templateRepository = new ilCertificateTemplateRepository($this->dic->database(), $logger);
41  $deleteAction = new ilCertificateTemplateDeleteAction($templateRepository);
42 
43  switch ($type) {
44  case 'tst':
45  $placeholderDescriptionObject = new ilTestPlaceholderDescription();
46  $placeholderValuesObject = new ilTestPlaceholderValues();
47  $adapter = new ilTestCertificateAdapter($object);
48 
49  $certificatePath = ilCertificatePathConstants::TEST_PATH . $objectId . '/';
50 
51  $formFactory = new ilCertificateSettingsTestFormRepository(
52  $objectId,
53  $certificatePath,
54  $object,
55  $DIC->language(),
56  $DIC->ui()->mainTemplate(),
57  $DIC->ctrl(),
58  $DIC->access(),
59  $DIC->toolbar(),
60  $placeholderDescriptionObject
61  );
62 
63  $certificatePath = ilCertificatePathConstants::TEST_PATH . $objectId . '/';
64 
65  $deleteAction = new ilCertificateTestTemplateDeleteAction(
66  $deleteAction,
68  );
69 
70  break;
71  case 'crs':
72  $adapter = new ilCourseCertificateAdapter($object);
73  $placeholderDescriptionObject = new ilCoursePlaceholderDescription();
74  $placeholderValuesObject = new ilCoursePlaceholderValues();
75 
76  $certificatePath = ilCertificatePathConstants::COURSE_PATH . $objectId . '/';
77 
79  $object,
80  $certificatePath,
81  $DIC->language(),
82  $DIC->ui()->mainTemplate(),
83  $DIC->ctrl(),
84  $DIC->access(),
85  $DIC->toolbar(),
86  $placeholderDescriptionObject
87  );
88 
89  $certificatePath = ilCertificatePathConstants::COURSE_PATH . $objectId . '/';
90  break;
91  case 'exc':
92  $adapter = new ilExerciseCertificateAdapter($object);
93  $placeholderDescriptionObject = new ilExercisePlaceholderDescription();
94  $placeholderValuesObject = new ilExercisePlaceholderValues();
95 
96  $certificatePath = ilCertificatePathConstants::EXERCISE_PATH . $objectId . '/';
97 
98  $formFactory = new ilCertificateSettingsExerciseRepository(
99  $object,
100  $certificatePath,
101  $DIC->language(),
102  $DIC->ui()->mainTemplate(),
103  $DIC->ctrl(),
104  $DIC->access(),
105  $DIC->toolbar(),
106  $placeholderDescriptionObject
107  );
108 
109  $certificatePath = ilCertificatePathConstants::EXERCISE_PATH . $objectId . '/';
110  break;
111  case 'sahs':
112  $adapter = new ilSCORMCertificateAdapter($object);
113  $placeholderDescriptionObject = new ilScormPlaceholderDescription($object);
114  $placeholderValuesObject = new ilScormPlaceholderValues();
115 
116  $certificatePath = ilCertificatePathConstants::SCORM_PATH . $objectId . '/';
117 
118  $formFactory = new ilCertificateSettingsScormFormRepository(
119  $object,
120  $certificatePath,
121  $DIC->language(),
122  $DIC->ui()->mainTemplate(),
123  $DIC->ctrl(),
124  $DIC->access(),
125  $DIC->toolbar(),
126  $placeholderDescriptionObject
127  );
128 
129  $certificatePath = ilCertificatePathConstants::SCORM_PATH . $objectId . '/';
130 
131  break;
132  default:
133  throw new ilException(sprintf('The type "%s" is currently not defined for certificates', $type));
134  break;
135  }
136 
137  $gui = new ilCertificateGUI(
138  $adapter,
139  $placeholderDescriptionObject,
140  $placeholderValuesObject,
141  $objectId,
142  $certificatePath,
143  $formFactory,
144  $deleteAction
145  );
146 
147  return $gui;
148  }
$type
global $DIC
Definition: saml.php:7
GUI class to create PDF certificates.
+ Here is the call graph for this function:

Field Documentation

◆ $dic

ilCertificateGUIFactory::$dic
private

Definition at line 12 of file class.ilCertificateGUIFactory.php.

Referenced by __construct().


The documentation for this class was generated from the following file: