/**
  * Check in the certificate type if this setting is editable in the current context (crs, tst...)
  *
  * @return bool
  */
 public function isEditable()
 {
     /** @var srCertificateDefinition $definition */
     $definition = srCertificateDefinition::find($this->getDefinitionId());
     $type = $definition->getType();
     $setting = $type->getSettingByIdentifier($this->getIdentifier());
     $ref_id = $definition->getRefId();
     $object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     return in_array($object_type, $setting->getEditableIn());
 }
 /**
  * Save config
  */
 public function save()
 {
     $form = new ilCertificateConfigFormGUI($this);
     if ($form->saveObject()) {
         ilUtil::sendSuccess($this->pl->txt('msg_save_config'), true);
         $this->ctrl->redirect($this, 'configure');
     } else {
         $form->setValuesByPost();
         $this->tpl->setContent($form->getHTML());
     }
 }
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->pl->txt('certificate_placeholders'));
     // Each placeholder can define values for each language defined in the type
     $languages = $this->definition->getType()->getLanguages();
     $label_lang = in_array($this->user->getLanguage(), $languages) ? $this->user->getLanguage() : $this->definition->getDefaultLanguage();
     /** @var $placeholder_value srCertificatePlaceholderValue */
     foreach ($this->definition->getPlaceholderValues() as $placeholder_value) {
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($placeholder_value->getPlaceholder()->getLabel($label_lang));
         $this->addItem($section);
         foreach ($languages as $lang) {
             $this->addItem($this->getInputField($placeholder_value, $lang));
         }
     }
     if ($signatures = $this->definition->getType()->getSignatures()) {
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($this->pl->txt('signature'));
         $this->addItem($section);
         $select_input = new ilSelectInputGUI($this->pl->txt('signature'), 'signature');
         $options = array(0 => '');
         foreach ($signatures as $signature) {
             $options[$signature->getId()] = $signature->getFirstName() . ' ' . $signature->getLastName();
         }
         $select_input->setOptions($options);
         $select_input->setValue($this->definition->getSignatureId());
         $this->addItem($select_input);
     }
     $this->addCommandButton('updatePlaceholders', $this->pl->txt('save'));
     return;
 }
 /**
  * Add columns
  */
 protected function initColumns()
 {
     foreach ($this->columns as $column) {
         $this->addColumn($this->pl->txt($column), $column);
     }
     $this->addColumn($this->pl->txt('actions'));
 }
 public function run()
 {
     /** @var srCertificate $cert */
     $certs = srCertificate::where(array('status' => srCertificate::STATUS_NEW))->get();
     foreach ($certs as $cert) {
         // Force a reload of the members. If there are parallel cronjobs, only continue if status is still NEW
         $cert->read();
         if ($cert->getStatus() != srCertificate::STATUS_NEW) {
             continue;
         }
         $cert->generate();
     }
     // Also check for certificates with status DRAFT. They should be changed to NEW if the course is passed and the last access is more than xx minutes
     $certs = srCertificate::where(array('status' => srCertificate::STATUS_DRAFT))->get();
     foreach ($certs as $cert) {
         $cert->read();
         if ($cert->getStatus() != srCertificate::STATUS_DRAFT) {
             continue;
         }
         $max_diff_lp_seconds = $this->pl->config('max_diff_lp_seconds');
         if ($max_diff_lp_seconds) {
             if ($last_access = $this->getLastLPStatus($cert)) {
                 $diff = time() - $last_access;
                 if ($diff > $max_diff_lp_seconds) {
                     $cert->setStatus(srCertificate::STATUS_NEW);
                     $cert->update();
                 }
             }
         } else {
             // If the setting max_diff_lp_seconds is "0", the NEW status is set anyway
             $cert->setStatus(srCertificate::STATUS_NEW);
             $cert->update();
         }
     }
 }
 /**
  * @param srCertificate $certificate
  * @param string $email
  */
 function __construct(srCertificate $certificate, $email = '')
 {
     $this->email = $email;
     $this->certificate = $certificate;
     $this->mailer = new ilMimeMail();
     $this->pl = ilCertificatePlugin::getInstance();
 }
 /**
  * Get settings
  */
 protected function buildData()
 {
     $data = array();
     /** @var $setting srCertificateTypeSetting */
     foreach ($this->type->getSettings() as $setting) {
         $row = array();
         $row['identifier'] = $setting->getIdentifier();
         $row['setting'] = $this->pl->txt("setting_id_" . $setting->getIdentifier());
         $row['editable_in'] = implode(',', $setting->getEditableIn());
         $default_value = $setting->getValue();
         switch ($setting->getIdentifier()) {
             case srCertificateTypeSetting::IDENTIFIER_VALIDITY_TYPE:
                 $default_value = $this->pl->txt("setting_validity_{$default_value}");
                 break;
             case srCertificateTypeSetting::IDENTIFIER_VALIDITY:
                 $validity_type = $this->type->getSettingByIdentifier(srCertificateTypeSetting::IDENTIFIER_VALIDITY_TYPE)->getValue();
                 if ($default_value && $validity_type == srCertificateTypeSetting::VALIDITY_TYPE_DATE_RANGE) {
                     $date_data = json_decode($default_value);
                     $default_value = sprintf($this->pl->txt('validity_date_range'), $date_data->m, $date_data->d);
                 }
                 break;
         }
         $row['default_value'] = $default_value;
         $data[] = $row;
     }
     $this->setData($data);
 }
 /**
  * Get dropdown for choosing the certificate type
  *
  * @return ilSelectInputGUI
  */
 protected function getTypeInput()
 {
     $types = srcertificateType::get();
     $options = array();
     $object_type = $this->pl->isCourseTemplate((int) $_GET['ref_id']) ? 'crs-tpl' : ilObject::_lookupType((int) $_GET['ref_id'], true);
     /** @var $type srCertificateType */
     $invalid = array();
     foreach ($types as $type) {
         if (!srCertificateType::isSelectable($type, (int) $_GET['ref_id'])) {
             continue;
         }
         // Skip the type if it contains no valid template file!
         if (!is_file($type->getCertificateTemplatesPath(true))) {
             $invalid[] = $type->getTitle();
             continue;
         }
         $options[$type->getId()] = $type->getTitle();
     }
     if (count($invalid) && $this->isNew) {
         ilUtil::sendInfo(sprintf($this->pl->txt('msg_info_invalid_cert_types'), implode(', ', $invalid)));
     }
     $item = new ilSelectInputGUI($this->pl->txt('setting_id_type'), 'type_id');
     asort($options);
     $item->setOptions($options);
     $info = $this->isNew ? $this->pl->txt('setting_id_type_info_new') : $this->pl->txt('setting_id_type_info_change');
     $item->setInfo($info);
     $item->setValue($this->definition->getTypeId());
     $item->setRequired(true);
     return $item;
 }
 public function __construct()
 {
     global $ilLog;
     $this->log = $ilLog;
     $this->pl = ilCertificatePlugin::getInstance();
     // Concrete classes must set their properties here...
 }
 /**
  * @return array
  */
 public function getSelectableColumns()
 {
     $columns = array();
     foreach ($this->columns as $column) {
         $columns[$column] = array('txt' => $this->pl->txt($column), 'default' => true);
     }
     return $columns;
 }
 /**
  * Add columns
  */
 protected function initColumns()
 {
     foreach ($this->columns as $column) {
         $this->addColumn($this->pl->txt($column), $column);
     }
     foreach ($this->type->getLanguages() as $lang_code) {
         $this->addColumn(sprintf($this->pl->txt('default_value_lang'), $lang_code), "default_value_{$lang_code}");
         $this->addColumn(sprintf($this->pl->txt('label_lang'), $lang_code), "label_{$lang_code}");
     }
 }
 protected function addLabelInput($lang_code)
 {
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt("meta_l_{$lang_code}"));
     $this->addItem($section);
     $item = new ilTextInputGUI($this->pl->txt('label'), "label_{$lang_code}");
     $item->setValue($this->setting->getLabel($lang_code));
     $item->setRequired(true);
     $this->addItem($item);
 }
 /**
  * Create or update a type
  */
 public function saveType()
 {
     $type = $this->type === NULL ? new srCertificateType() : $this->type;
     $form = new srCertificateTypeFormGUI($this, $type);
     if ($form->saveObject()) {
         ilUtil::sendSuccess($this->pl->txt('msg_type_saved'), true);
         $this->ctrl->setParameter($this, 'type_id', $type->getId());
         $this->ctrl->redirect($this, 'editType');
     } else {
         $this->tpl->setContent($form->getHTML());
     }
 }
 /**
  * Set Course title and icon in header
  *
  */
 protected function initHeader()
 {
     $lgui = ilObjectListGUIFactory::_getListGUIByType($this->crs->getType());
     $this->tpl->setTitle($this->crs->getTitle());
     $this->tpl->setDescription($this->crs->getDescription());
     if ($this->crs->getOfflineStatus()) {
         $this->tpl->setAlertProperties($lgui->getAlertProperties());
     }
     $this->tpl->setTitleIcon(ilUtil::getTypeIconPath('crs', $this->crs->getId(), 'big'));
     $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->ref_id);
     $this->tabs->setBackTarget($this->pl->txt('back_to_course'), $this->ctrl->getLinkTargetByClass('ilrepositorygui'));
 }
 /**
  * Init form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $title = $this->isNew ? $this->pl->txt('add_new_type') : $this->pl->txt('edit_type');
     $this->setTitle($title);
     $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $item->setRequired(true);
     $item->setValue($this->type->getTitle());
     $this->addItem($item);
     $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $item->setValue($this->type->getDescription());
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->lng->txt('languages'), 'languages');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $langs = $this->lng->getInstalledLanguages();
     $options = array();
     foreach ($langs as $lang_code) {
         $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
     }
     $item->setOptions($options);
     $item->setValue($this->type->getLanguages());
     $item->setRequired(true);
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->lng->txt('roles'), 'roles');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $roles = $this->rbac->getRolesByFilter(ilRbacReview::FILTER_ALL, 0, '');
     $options = array();
     $hide_roles = array(14, 5);
     foreach ($roles as $role) {
         if (strpos($role['title'], 'il_') === 0 || in_array($role['obj_id'], $hide_roles)) {
             // Don't show auto-generated roles. If this takes to much performance, write query...
             continue;
         }
         $options[$role['obj_id']] = $role['title'];
     }
     $item->setOptions($options);
     $item->setValue($this->type->getRoles());
     $item->setInfo($this->pl->txt('roles_info'));
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->pl->txt('available_objects'), 'available_objects');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $options = array();
     foreach (srCertificateType::getAllAvailableObjectTypes() as $type) {
         $options[$type] = $type;
     }
     $item->setOptions($options);
     $item->setValue($this->type->getAvailableObjects());
     $item->setRequired(true);
     $item->setInfo($this->pl->txt('available_objects_info'));
     $this->addItem($item);
     $this->addCommandButton('saveType', $this->lng->txt('save'));
 }
 /**
  * See formatDate() method
  *
  * @param $identifier
  * @param int $timestamp
  * @return string
  */
 protected function formatDateTime($identifier, $timestamp = 0)
 {
     $timestamp = $timestamp ? $timestamp : time();
     $utc = ilCertificateConfig::get('time_format_utc');
     $format = ilCertificateConfig::get('str_format_datetime');
     // Check if a hook wants to modify the date format
     $format_custom = $this->pl->getHooks()->formatDate($this->certificate, $identifier);
     if ($format_custom) {
         $format = $format_custom;
     }
     $value = $utc ? gmdate($format, $timestamp) : date($format, $timestamp);
     return $value;
 }
 /**
  * Init form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $this->setTitle($this->pl->txt('edit_type_template'));
     $types_available = array();
     $types = array(srCertificateTemplateTypeFactory::getById(srCertificateTemplateType::TEMPLATE_TYPE_HTML), srCertificateTemplateTypeFactory::getById(srCertificateTemplateType::TEMPLATE_TYPE_JASPER));
     /** @var $type srCertificateTemplateType */
     foreach ($types as $type) {
         if ($type->isAvailable()) {
             $types_available[$type->getId()] = $type->getTitle();
         }
     }
     if (!count($types_available)) {
         ilUtil::sendInfo($this->pl->txt('msg_no_template_types'));
     }
     $item = new ilSelectInputGUI($this->pl->txt('template_type_id'), 'template_type_id');
     $item->setOptions($types_available);
     $item->setRequired(true);
     $item->setValue($this->type->getTemplateTypeId());
     $this->addItem($item);
     $item = new ilFileInputGUI($this->pl->txt('template_file'), 'template_file');
     $template_file = $this->type->getCertificateTemplatesPath(true);
     if (is_file($template_file)) {
         $item->setValue($template_file);
     }
     $item->setFilename($template_file);
     $item->setInfo($this->pl->txt('template_file_info'));
     $item->setRequired(!is_file($template_file));
     $this->addItem($item);
     $assets = $this->type->getAssets();
     if (count($assets)) {
         $item = new ilMultiSelectInputGUI($this->pl->txt('assets'), 'remove_assets');
         $options = array();
         foreach ($assets as $asset) {
             $options[$asset] = $asset;
         }
         $item->setOptions($options);
         $item->setInfo($this->pl->txt('assets_info'));
         $this->addItem($item);
     }
     $item = new ilFileWizardInputGUI($this->pl->txt('add_assets'), 'add_assets');
     $item->setFilenames(array(0 => ''));
     $this->addItem($item);
     $this->addCommandButton('downloadDefaultTemplate', $this->pl->txt('download_default_template'));
     if (is_file($this->type->getCertificateTemplatesPath(true))) {
         $this->addCommandButton('downloadTemplate', $this->pl->txt('download_template'));
     }
     $this->addCommandButton('updateTemplate', $this->lng->txt('save'));
 }
 /**
  * Download a certificate
  *
  */
 public function downloadCertificate()
 {
     if ($cert_id = (int) $_GET['cert_id']) {
         /** @var srCertificate $cert */
         $cert = srCertificate::find($cert_id);
         if ($cert->getStatus() == srCertificate::STATUS_CALLED_BACK) {
             ilUtil::sendFailure($this->pl->txt('msg_called_back'));
         } elseif ($cert->getStatus() != srCertificate::STATUS_PROCESSED) {
             ilUtil::sendFailure($this->pl->txt('msg_not_created_yet'));
         } else {
             $cert->download();
         }
     }
     $this->index();
 }
 /**
  * Get settings
  */
 protected function buildData()
 {
     $data = array();
     /** @var $setting srCertificateCustomTypeSetting */
     foreach ($this->type->getCustomSettings() as $setting) {
         $row = array();
         $row['id'] = $setting->getId();
         $row['identifier'] = $setting->getIdentifier();
         $row['editable_in'] = implode(',', $setting->getEditableIn());
         $row['setting_type'] = $this->pl->txt('custom_setting_type_' . $setting->getSettingTypeId());
         $row['default_value'] = $setting->getValue();
         $data[] = $row;
     }
     $this->setData($data);
 }
 /**
  * @param $a_comp
  * @param $a_part
  * @param array $a_par
  */
 public function modifyGUI($a_comp, $a_part, $a_par = array())
 {
     /**
      * @var $ilTabsGUI ilTabsGUI
      */
     if ($a_part == 'tabs' && isset($_GET['ref_id']) && self::$ref_is_crs !== false) {
         // ATM only display certificate tab in courses
         if (self::$ref_is_crs === null && ilObject::_lookupType((int) $_GET['ref_id'], true) != 'crs' || $_GET['admin_mode']) {
             self::$ref_is_crs = false;
             return;
         }
         self::$ref_is_crs = true;
         // User needs write access to course to see the tab 'certificate'
         if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) {
             $ilTabsGUI = $a_par['tabs'];
             $this->ctrl->setParameterByClass('srCertificateDefinitionGUI', 'ref_id', $_GET['ref_id']);
             $link = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), 'srCertificateDefinitionGUI'));
             $ilTabsGUI->addTarget('certificate', $link, 'show', 'srCertificateDefinitionGUI');
         }
     }
 }
 /**
  * Init form
  */
 protected function initForm()
 {
     $title = $this->signature->getId() ? $this->pl->txt('edit_signature') : $this->pl->txt('add_new_signature');
     $this->setTitle($title);
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $item = new ilTextInputGUI($this->pl->txt('first_name'), 'first_name');
     $item->setValue($this->signature->getFirstName());
     $item->setRequired(true);
     $this->addItem($item);
     $item = new ilTextInputGUI($this->pl->txt('last_name'), 'last_name');
     $item->setValue($this->signature->getLastName());
     $item->setRequired(true);
     $this->addItem($item);
     // If the signature is a rasterized image, we display it base64 encoded
     $is_vector = in_array(strtolower($this->signature->getSuffix()), array('svg'));
     if ($is_vector) {
         $item = new ilFileInputGUI($this->pl->txt('signature_file'), 'signature_file');
     } else {
         $item = new ilImageFileInputGUI($this->pl->txt('signature_file'), 'signature_file');
     }
     $item->setSuffixes(array('jpeg', 'jpg', 'gif', 'bmp', 'png', 'svg'));
     $signature_file = $this->signature->getFilePath(true);
     if (is_file($signature_file) && !$is_vector) {
         $item->setValue($signature_file);
         $base64 = base64_encode(file_get_contents($signature_file));
         $suffix = $this->signature->getSuffix();
         $item->setImage("data:image/{$suffix};base64,{$base64}");
     }
     $item->setFilename($signature_file);
     $item->setInfo($this->pl->txt('signature_file_info'));
     $item->setRequired(!is_file($signature_file));
     $item->setValue($this->signature->getFilePath(true));
     $this->addItem($item);
     $command = $this->signature->getId() ? 'updateSignature' : 'createSignature';
     $this->addCommandButton($command, $this->lng->txt('save'));
 }
 /**
  * @param $field
  *
  * @return string
  */
 public function txt($field)
 {
     return $this->pl->txt('admin_form_' . $field);
 }
 /**
  * @param string $identifier
  * @throws srCertificateException
  */
 public function setIdentifier($identifier)
 {
     if (!preg_match(self::REGEX_VALID_IDENTIFIER, $identifier)) {
         throw new srCertificateException(sprintf($this->pl->txt('msg_identifier_not_valid'), $identifier));
     }
     if (srCertificateStandardPlaceholders::isReservedIdentifier($identifier)) {
         throw new srCertificateException(sprintf($this->pl->txt('msg_reserved_identifier'), $identifier));
     }
     $this->identifier = $identifier;
 }
 /**
  * Check if a given user is allowed to select a given certificate type to create a new definition for the given ref_id.
  * This method checks the following steps:
  *  1) Is the type restricted to certain object types, e.g. is the object type of the given ref_id valid?
  *  2) Is the type restricted to certain roles, e.g. check if the a user has at least one role
  *
  * @param srCertificateType $type
  * @param $ref_id
  * @param int $user_id If empty, the current user is used
  * @return bool
  */
 public static function isSelectable(srCertificateType $type, $ref_id, $user_id = 0)
 {
     global $ilUser, $rbacreview;
     $user_id = $user_id ? $user_id : $ilUser->getId();
     $pl = ilCertificatePlugin::getInstance();
     $object_type = $pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     if (!in_array($object_type, $type->getAvailableObjects())) {
         return false;
     }
     // Access restricted by roles. Check if current user has a role to choose the type
     if (count($type->getRoles()) && !$rbacreview->isAssignedToAtLeastOneGivenRole($user_id, $type->getRoles())) {
         return false;
     }
     return true;
 }
 /**
  * Returns in what class the command/ctrl chain should start for this plugin.
  * Return value is ilRouterGUI for ILIAS <= 4.4.x, ilUIPluginRouterGUI for ILIAS >= 4.5, of false otherwise
  *
  * @return bool|string
  */
 public static function getBaseClass()
 {
     if (!is_null(self::$base_class)) {
         return self::$base_class;
     }
     global $ilCtrl;
     if ($ilCtrl->lookupClassPath('ilUIPluginRouterGUI')) {
         self::$base_class = 'ilUIPluginRouterGUI';
     } elseif ($ilCtrl->lookupClassPath('ilRouterGUI')) {
         self::$base_class = 'ilRouterGUI';
     } else {
         self::$base_class = false;
     }
     return self::$base_class;
 }
 /**
  * Load all the placeholders (standard and custom) with key => value
  * Custom placeholders are loaded in the correct language
  * All placeholders are passed to the hook class to do custom logic.
  * Finally keys are wrapped with the start/end symbols, e.g. [[key]]
  *
  * @param bool $anonymized
  */
 protected function loadPlaceholders($anonymized = false)
 {
     $placeholders = $this->getStandardPlaceholders($anonymized)->getParsedPlaceholders();
     $available_langs = $this->definition->getType()->getLanguages();
     $user_lang = $this->getUser()->getLanguage();
     $default_lang = $this->definition->getSettingByIdentifier(srCertificateTypeSetting::IDENTIFIER_DEFAULT_LANG);
     $lang = in_array($user_lang, $available_langs) ? $user_lang : $default_lang;
     /** @var $ph_value srCertificatePlaceholderValue */
     foreach ($this->definition->getPlaceholderValues() as $ph_value) {
         $placeholders[$ph_value->getPlaceholder()->getIdentifier()] = $ph_value->getValue($lang);
     }
     // Hacky: Add signature placeholders
     if ($this->definition->getSignatureId()) {
         $signature = $this->definition->getSignature();
         $placeholders['SIGNATURE_NAME'] = $signature->getFirstName() . ' ' . $signature->getLastName();
         $placeholders['SIGNATURE_FIRSTNAME'] = $signature->getFirstName();
         $placeholders['SIGNATURE_LASTNAME'] = $signature->getLastName();
         $placeholders['SIGNATURE_IMAGE'] = $signature->getFilePath(true);
         $placeholders['SIGNATURE_IMAGE_SUFFIX'] = $signature->getSuffix();
     }
     $this->placeholders = $this->pl->getHooks()->processPlaceholders($this, $placeholders);
     $this->placeholders = srCertificatePlaceholder::getFormattedPlaceholders($this->placeholders);
 }
 public function __construct($id = 0)
 {
     parent::__construct($id);
     $this->pl = ilCertificatePlugin::getInstance();
 }
 /**
  * Check in the value of the placeholder is editable in the current context (crs, crs-tpl, tst...)
  *
  * @return bool
  */
 public function isEditable()
 {
     $ref_id = $this->getDefinition()->getRefId();
     $object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     return in_array($object_type, $this->getPlaceholder()->getEditableIn());
 }
 /**
  * Get input GUI depending on identifier
  *
  * @return ilFormPropertyGUI|null
  */
 protected function getInputByIdentifier()
 {
     $name = 'default_value';
     $title = $this->pl->txt('default_value');
     switch ($this->identifier) {
         case srCertificateTypeSetting::IDENTIFIER_DEFAULT_LANG:
             $input = new ilSelectInputGUI($title, $name);
             $options = array();
             foreach ($this->type->getLanguages() as $lang) {
                 $options[$lang] = $this->lng->txt("meta_l_{$lang}");
             }
             $input->setOptions($options);
             $input->setValue($this->setting->getValue());
             break;
         case srCertificateTypeSetting::IDENTIFIER_GENERATION:
             $input = new ilRadioGroupInputGUI($title, $name);
             $option = new ilRadioOption($this->pl->txt('setting_generation_auto'), srCertificateTypeSetting::GENERATION_AUTO);
             $input->addOption($option);
             $option = new ilRadioOption($this->pl->txt('setting_generation_manually'), srCertificateTypeSetting::GENERATION_MANUAL);
             $input->addOption($option);
             $input->setValue($this->setting->getValue());
             break;
         case srCertificateTypeSetting::IDENTIFIER_VALIDITY_TYPE:
             $input = new ilRadioGroupInputGUI($title, $name);
             $option = new ilRadioOption($this->pl->txt('always'), srCertificateTypeSetting::VALIDITY_TYPE_ALWAYS);
             $input->addOption($option);
             $option = new ilRadioOption($this->pl->txt('setting_validity_range'), srCertificateTypeSetting::VALIDITY_TYPE_DATE_RANGE);
             $input->addOption($option);
             $option = new ilRadioOption($this->pl->txt('setting_validity_date'), srCertificateTypeSetting::VALIDITY_TYPE_DATE);
             $input->addOption($option);
             $input->setValue($this->setting->getValue());
             break;
         case srCertificateTypeSetting::IDENTIFIER_VALIDITY:
             $validity_value = $this->setting->getValue();
             switch ($this->type->getSettingByIdentifier(srCertificateTypeSetting::IDENTIFIER_VALIDITY_TYPE)->getValue()) {
                 case srCertificateTypeSetting::VALIDITY_TYPE_DATE_RANGE:
                     $input = new ilDurationInputGUI($title, $name);
                     $input->setShowMinutes(false);
                     $input->setShowHours(false);
                     $input->setShowDays(true);
                     $input->setShowMonths(true);
                     if ($validity_value) {
                         $range_array = json_decode($validity_value, true);
                         $data = array();
                         $data[$input->getPostVar()]['MM'] = $range_array['m'];
                         $data[$input->getPostVar()]['dd'] = $range_array['d'];
                         $input->setValueByArray($data);
                     }
                     break;
                 case srCertificateTypeSetting::VALIDITY_TYPE_DATE:
                     $input = new ilDateTimeInputGUI($title, $name);
                     $input->setMode(ilDateTimeInputGUI::MODE_INPUT);
                     if ($validity_value) {
                         $input->setDate(new ilDateTime($validity_value, IL_CAL_DATE));
                     }
                     break;
                 case srCertificateTypeSetting::VALIDITY_TYPE_ALWAYS:
                     // Makes no sence to configure this further
                     $input = null;
                     break;
                 default:
                     $input = new ilTextInputGUI($title, $name);
             }
             break;
         case srCertificateTypeSetting::IDENTIFIER_DOWNLOADABLE:
         case srCertificateTypeSetting::IDENTIFIER_SCORM_TIMING:
         case srCertificateTypeSetting::IDENTIFIER_NOTIFICATION_USER:
             $input = new ilCheckboxInputGUI($title, $name);
             if ($this->setting->getValue()) {
                 $input->setChecked(true);
             }
             break;
         default:
             $input = new ilTextInputGUI($title, $name);
             $input->setValue($this->setting->getValue());
     }
     return $input;
 }