ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCertificateGUIFactory.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 {
12  private $dic;
13 
17  public function __construct(\ILIAS\DI\Container $dic = null)
18  {
19  if (null === $dic) {
20  global $DIC;
21  $dic = $DIC;
22  }
23  $this->dic = $dic;
24  }
25 
31  public function create(\ilObject $object) : ilCertificateGUI
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  $pathFactory = new ilCertificatePathFactory();
43 
44  $certificatePath = $pathFactory->create($object);
45 
46  switch ($type) {
47  case 'tst':
48  $placeholderDescriptionObject = new ilTestPlaceholderDescription();
49  $placeholderValuesObject = new ilTestPlaceholderValues();
50 
51  $formFactory = new ilCertificateSettingsTestFormRepository(
52  $objectId,
53  $certificatePath,
54  false,
55  $object,
56  $DIC->language(),
57  $DIC->ctrl(),
58  $DIC->access(),
59  $DIC->toolbar(),
60  $placeholderDescriptionObject
61  );
62 
63  $deleteAction = new ilCertificateTestTemplateDeleteAction(
64  $deleteAction,
66  );
67 
68  break;
69  case 'crs':
70  $hasAdditionalElements = true;
71 
72  $placeholderDescriptionObject = new ilCoursePlaceholderDescription();
73  $placeholderValuesObject = new ilCoursePlaceholderValues();
74 
75 
77  $object,
78  $certificatePath,
79  false,
80  $DIC->language(),
81  $DIC->ctrl(),
82  $DIC->access(),
83  $DIC->toolbar(),
84  $placeholderDescriptionObject
85  );
86 
87  break;
88  case 'exc':
89  $placeholderDescriptionObject = new ilExercisePlaceholderDescription();
90  $placeholderValuesObject = new ilExercisePlaceholderValues();
91 
92  $formFactory = new ilCertificateSettingsExerciseRepository(
93  $object,
94  $certificatePath,
95  false,
96  $DIC->language(),
97  $DIC->ctrl(),
98  $DIC->access(),
99  $DIC->toolbar(),
100  $placeholderDescriptionObject
101  );
102 
103  break;
104  case 'sahs':
105  $placeholderDescriptionObject = new ilScormPlaceholderDescription($object);
106  $placeholderValuesObject = new ilScormPlaceholderValues();
107 
108  $formFactory = new ilCertificateSettingsScormFormRepository(
109  $object,
110  $certificatePath,
111  true,
112  $DIC->language(),
113  $DIC->ctrl(),
114  $DIC->access(),
115  $DIC->toolbar(),
116  $placeholderDescriptionObject
117  );
118  break;
119  case 'lti':
120  $placeholderDescriptionObject = new ilLTIConsumerPlaceholderDescription();
121  $placeholderValuesObject = new ilLTIConsumerPlaceholderValues();
122 
124  $object,
125  $certificatePath,
126  true,
127  $DIC->language(),
128  $DIC->ctrl(),
129  $DIC->access(),
130  $DIC->toolbar(),
131  $placeholderDescriptionObject
132  );
133  break;
134  case 'cmix':
135  $placeholderDescriptionObject = new ilCmiXapiPlaceholderDescription();
136  $placeholderValuesObject = new ilCmiXapiPlaceholderValues();
137 
139  $object,
140  $certificatePath,
141  true,
142  $DIC->language(),
143  $DIC->ctrl(),
144  $DIC->access(),
145  $DIC->toolbar(),
146  $placeholderDescriptionObject
147  );
148  break;
149  case 'prg':
150  $placeholderDescriptionObject =
152  $placeholderValuesObject =
155  $object,
156  $certificatePath,
157  true,
158  $DIC->language(),
159  $DIC->ctrl(),
160  $DIC->access(),
161  $DIC->toolbar(),
162  $placeholderDescriptionObject
163  );
164  break;
165  default:
166  throw new ilException(sprintf('The type "%s" is currently not defined for certificates', $type));
167  break;
168  }
169 
170  $gui = new ilCertificateGUI(
171  $placeholderDescriptionObject,
172  $placeholderValuesObject,
173  $objectId,
174  $certificatePath,
175  $formFactory,
176  $deleteAction
177  );
178 
179  return $gui;
180  }
181 }
$type
Class ChatMainBarProvider .
getId()
get object id public
Class HTTPServicesTest.
GUI class to create PDF certificates.
getType()
get object type public
$DIC
Definition: xapitoken.php:46
__construct(\ILIAS\DI\Container $dic=null)