protected function addLanguageInput($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->placeholder->getLabel($lang_code)); $item->setRequired(true); $this->addItem($item); $item = new ilTextInputGUI($this->pl->txt('default_value'), "default_value_{$lang_code}"); $item->setValue($this->placeholder->getDefaultValue($lang_code)); $this->addItem($item); }
/** * Update placeholder */ public function updatePlaceholder() { try { $placeholder = srCertificatePlaceholder::find($_REQUEST['placeholder_id']); if ($placeholder === null) { throw new srCertificateException("Placeholder with ID " . $_REQUEST['placeholder_id'] . " not found"); } $form = new srCertificateTypePlaceholderFormGUI($this, $placeholder); if ($form->saveObject()) { ilUtil::sendSuccess($this->pl->txt('msg_placeholder_saved'), true); $this->ctrl->redirect($this, 'showPlaceholders'); } else { $this->tpl->setContent($form->getHTML()); } } catch (ilException $e) { ilUtil::sendFailure($e->getMessage(), true); $this->ctrl->redirect($this, 'showPlaceholders'); } }
?> <#2> <?php /* * Create tables */ require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Type/class.srCertificateType.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Definition/class.srCertificateDefinition.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Placeholder/class.srCertificatePlaceholder.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Placeholder/class.srCertificatePlaceholderValue.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Definition/class.srCertificateDefinitionSetting.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Type/class.srCertificateTypeSetting.php'; srCertificateType::installDB(); srCertificateDefinition::installDB(); srCertificatePlaceholder::installDB(); srCertificatePlaceholderValue::installDB(); srCertificate::installDB(); srCertificateTypeSetting::installDB(); srCertificateDefinitionSetting::installDB(); ?> <#3> <?php require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php'; srCertificate::updateDB(); ?> <#4> <?php /* * Add new setting "notification_user" to certificate types and every existing definitions */
/** * @return srCertificatePlaceholder[] */ public function getPlaceholders() { if (is_null($this->placeholders)) { $this->placeholders = srCertificatePlaceholder::where(array('type_id' => (int) $this->getId()))->get(); } return $this->placeholders; }
/** * @return \srCertificatePlaceholder */ public function getPlaceholder() { if (is_null($this->placeholder)) { $this->placeholder = srCertificatePlaceholder::find($this->getPlaceholderId()); } return $this->placeholder; }
/** * 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); }