ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilObjCertificateSettingsGUI Class Reference

Certificate Settings. More...

+ Inheritance diagram for ilObjCertificateSettingsGUI:
+ Collaboration diagram for ilObjCertificateSettingsGUI:

Public Member Functions

 __construct ( $data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true, ?ilUserCertificateRepository $user_certificate_repo=null, ?ilCertificateActiveValidator $certificate_active_validator=null,)
 
 executeCommand ()
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 certificatesOverview ()
 
 downloadCertificate ()
 
 save ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Data Fields

const TAB_CERTIFICATES = 'certificates'
 
const CMD_CERTIFICATES_OVERVIEW = 'certificatesOverview'
 
const CMD_DOWNLOAD_CERTIFICATE = 'downloadCertificate'
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Attributes

ILIAS HTTP GlobalHttpState $httpState
 
ILIAS FileUpload FileUpload $upload
 
ilObject $object
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Attributes

IRSS $irss
 
readonly ilLogger $logger
 
readonly ilUserCertificateRepository $user_certificate_repo
 
readonly ilCertificateActiveValidator $certificate_active_validator
 
readonly FitToSquare $card_thumbnail_definition
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Detailed Description

Certificate Settings.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$ @ilCtrl_Calls ilObjCertificateSettingsGUI: ilPermissionGUI @ilCtrl_IsCalledBy ilObjCertificateSettingsGUI: ilAdministrationGUI

Definition at line 34 of file class.ilObjCertificateSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjCertificateSettingsGUI::__construct (   $data,
int  $id = 0,
bool  $call_by_reference = true,
bool  $prepare_output = true,
?ilUserCertificateRepository  $user_certificate_repo = null,
?ilCertificateActiveValidator  $certificate_active_validator = null 
)

Definition at line 50 of file class.ilObjCertificateSettingsGUI.php.

57 {
58 global $DIC;
59
61
62 $this->httpState = $DIC->http();
63 $this->upload = $DIC->upload();
64 $this->logger = $DIC->logger()->root();
65 $this->type = 'cert';
66 $this->lng->loadLanguageModule('certificate');
67 $this->lng->loadLanguageModule('cert');
68 $this->lng->loadLanguageModule('trac');
69
70 $this->irss = $DIC->resourceStorage();
71
72 $this->card_thumbnail_definition = new FitToSquare(
73 true,
74 100
75 );
76
77 $this->user_certificate_repo = $user_certificate_repo ?: new ilUserCertificateRepository();
78 $this->certificate_active_validator = $certificate_active_validator ?: new ilCertificateActiveValidator();
79 }
readonly ilCertificateActiveValidator $certificate_active_validator
readonly ilUserCertificateRepository $user_certificate_repo
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References ilObjectGUI\$call_by_reference, $certificate_active_validator, ilObjectGUI\$data, $DIC, ilObjectGUI\$id, ilObjectGUI\$prepare_output, $user_certificate_repo, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Member Function Documentation

◆ certificatesOverview()

ilObjCertificateSettingsGUI::certificatesOverview ( )

Definition at line 262 of file class.ilObjCertificateSettingsGUI.php.

262 : void
263 {
264 if (
265 !$this->certificate_active_validator->validate() ||
266 !$this->rbac_system->checkAccess('read', $this->object->getRefId())
267 ) {
268 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
269 }
270
271 $this->tabs_gui->activateTab(self::TAB_CERTIFICATES);
272
273 $table = new CertificateOverviewTable();
274
275 $this->tpl->setContent($table->render());
276 }
error(string $a_errmsg)

References error(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ downloadCertificate()

ilObjCertificateSettingsGUI::downloadCertificate ( )

Definition at line 278 of file class.ilObjCertificateSettingsGUI.php.

278 : void
279 {
280 if (!$this->certificate_active_validator->validate() ||
281 !$this->rbac_system->checkAccess('read', $this->object->getRefId())) {
282 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
283 }
284
285 $certificate_id = $this->httpState->wrapper()->query()->retrieve(
286 'cert_overview_id',
287 $this->refinery->byTrying([
288 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
289 $this->refinery->always([]),
290 ])
291 );
292
293 if ($certificate_id === []) {
294 $this->ctrl->redirect($this, self::CMD_CERTIFICATES_OVERVIEW);
295 }
296
297 // Only one download at a time is possible
298 $certificate_id = $certificate_id[array_key_first($certificate_id)];
299
300 try {
301 $certificate = $this->user_certificate_repo->fetchCertificate($certificate_id);
302 if (!$certificate->isCurrentlyActive()) {
303 throw new Exception('Certificate is not active');
304 }
305
306 $pdf_action = (new ilCertificatePdfAction(
307 (new ilPdfGenerator($this->user_certificate_repo))->withLogger($this->logger),
309 $this->lng->txt('error_creating_certificate_pdf')
310 ))->withLogger($this->logger);
311 $pdf_action->downloadPdf($certificate->getUserId(), $certificate->getObjId());
312 $this->ctrl->redirect($this, self::CMD_CERTIFICATES_OVERVIEW);
313 } catch (Exception $ex) {
314 $this->logger->error('Fetching user certificate for download failed. Ex.: ' . $ex->getMessage());
315 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('error_creating_certificate_pdf'), true);
316 $this->ctrl->redirect($this, self::CMD_CERTIFICATES_OVERVIEW);
317 }
318 }
Just a wrapper class to create Unit Test for other classes.

References ILIAS\Repository\ctrl(), error(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjCertificateSettingsGUI::executeCommand ( )

Reimplemented from ilObjectGUI.

Definition at line 81 of file class.ilObjCertificateSettingsGUI.php.

81 : void
82 {
83 $next_class = $this->ctrl->getNextClass($this) ?? '';
84 $cmd = $this->ctrl->getCmd();
85
86 $this->prepareOutput();
87
88 if (!$this->rbac_system->checkAccess('read', $this->object->getRefId())) {
89 $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
90 }
91
92 switch (strtolower($next_class)) {
93 case strtolower(ilPermissionGUI::class):
94 $this->tabs_gui->setTabActive('perm_settings');
95 $perm_gui = new ilPermissionGUI($this);
96 $this->ctrl->forwardCommand($perm_gui);
97
98 break;
99 default:
100 if (!$cmd || $cmd === 'view') {
101 $cmd = 'settings';
102 }
103
104 $this->$cmd();
105
106 break;
107 }
108 }
prepareOutput(bool $show_sub_objects=true)

References ILIAS\Repository\ctrl(), error(), ILIAS\Repository\lng(), and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjCertificateSettingsGUI::getAdminTabs ( )

administration tabs show only permissions and trash folder

Reimplemented from ilObjectGUI.

Definition at line 110 of file class.ilObjCertificateSettingsGUI.php.

110 : void
111 {
112 if ($this->certificate_active_validator->validate() && $this->rbac_system->checkAccess('read', $this->object->getRefId())) {
113 $this->tabs_gui->addTab(
114 self::TAB_CERTIFICATES,
115 $this->lng->txt('overview'),
116 $this->ctrl->getLinkTarget($this, self::CMD_CERTIFICATES_OVERVIEW)
117 );
118 }
119
120 if ($this->rbac_system->checkAccess('read', $this->object->getRefId())) {
121 $this->tabs_gui->addTarget(
122 'settings',
123 $this->ctrl->getLinkTarget($this, 'settings'),
124 ['settings', 'view']
125 );
126 }
127
128 if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
129 $this->tabs_gui->addTarget(
130 'perm_settings',
131 $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, 'perm'),
132 [],
133 strtolower(ilPermissionGUI::class)
134 );
135 }
136 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ save()

ilObjCertificateSettingsGUI::save ( )

Definition at line 320 of file class.ilObjCertificateSettingsGUI.php.

320 : void
321 {
322 $form_settings = new ilSetting('certificate');
323
324 $mode = $this->httpState->wrapper()->post()->retrieve(
325 'persistent_certificate_mode',
326 $this->refinery->kindlyTo()->string()
327 );
328 $previousMode = $form_settings->get('persistent_certificate_mode', 'persistent_certificate_mode_cron');
329 if ($mode !== $previousMode && $mode === 'persistent_certificate_mode_instant') {
330 $cron = new ilCertificateCron();
331 $cron->init();
332 $cron->run();
333 }
334
335 $form_settings->set(
336 'pageformat',
337 $this->httpState->wrapper()->post()->retrieve('pageformat', $this->refinery->kindlyTo()->string())
338 );
339 $form_settings->set(
340 'active',
341 (string) ($this->httpState->wrapper()->post()->has('active') && $this->httpState->wrapper()->post()->retrieve(
342 'active',
343 $this->refinery->kindlyTo()->bool()
344 ))
345 );
346 $form_settings->set('persistent_certificate_mode', $mode);
347
348 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
349 $this->settings();
350 }
ILIAS Setting Class.
$cron
Definition: cron.php:26

References $cron, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Field Documentation

◆ $card_thumbnail_definition

readonly FitToSquare ilObjCertificateSettingsGUI::$card_thumbnail_definition
private

Definition at line 48 of file class.ilObjCertificateSettingsGUI.php.

◆ $certificate_active_validator

readonly ilCertificateActiveValidator ilObjCertificateSettingsGUI::$certificate_active_validator
private

Definition at line 47 of file class.ilObjCertificateSettingsGUI.php.

Referenced by __construct().

◆ $httpState

ILIAS HTTP GlobalHttpState ilObjCertificateSettingsGUI::$httpState
protected

Definition at line 40 of file class.ilObjCertificateSettingsGUI.php.

◆ $irss

IRSS ilObjCertificateSettingsGUI::$irss
private

Definition at line 39 of file class.ilObjCertificateSettingsGUI.php.

◆ $logger

readonly ilLogger ilObjCertificateSettingsGUI::$logger
private

Definition at line 45 of file class.ilObjCertificateSettingsGUI.php.

◆ $object

ilObject ilObjCertificateSettingsGUI::$object
protected

Definition at line 44 of file class.ilObjCertificateSettingsGUI.php.

◆ $upload

ILIAS FileUpload FileUpload ilObjCertificateSettingsGUI::$upload
protected

Definition at line 41 of file class.ilObjCertificateSettingsGUI.php.

◆ $user_certificate_repo

readonly ilUserCertificateRepository ilObjCertificateSettingsGUI::$user_certificate_repo
private

Definition at line 46 of file class.ilObjCertificateSettingsGUI.php.

Referenced by __construct().

◆ CMD_CERTIFICATES_OVERVIEW

const ilObjCertificateSettingsGUI::CMD_CERTIFICATES_OVERVIEW = 'certificatesOverview'

◆ CMD_DOWNLOAD_CERTIFICATE

const ilObjCertificateSettingsGUI::CMD_DOWNLOAD_CERTIFICATE = 'downloadCertificate'

Definition at line 38 of file class.ilObjCertificateSettingsGUI.php.

◆ TAB_CERTIFICATES

const ilObjCertificateSettingsGUI::TAB_CERTIFICATES = 'certificates'

Definition at line 36 of file class.ilObjCertificateSettingsGUI.php.


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