378 {
380
382 $title->setRequired(
true);
385
389
390 if (count($contexts) <= 1) {
392 $this->ctrl->redirect($this, 'showTemplates');
393 }
394
395 $context_sort = array();
396 $context_options = array();
398 foreach ($contexts as $ctx) {
399 if ($ctx->getId() != $generic_context->getId()) {
400 $context_options[$ctx->getId()] = $ctx;
401 $context_sort[$ctx->getId()] = $ctx->getTitle();
402 }
403 }
404 asort($context_sort);
405 $first = null;
406 foreach ($context_sort as
$id =>
$title) {
407 $ctx = $context_options[
$id];
408 $option =
new ilRadioOption($ctx->getTitle(), $ctx->getId());
409 $option->setInfo($ctx->getDescription());
410 $context->addOption($option);
411
412 if (!$first) {
414 }
415 }
416 $context->setValue($first);
417 $context->setRequired(true);
418 $form->addItem($context);
419
421 $hidde_language->setValue($this->lng->getLangKey());
422 $form->addItem($hidde_language);
423
424 $subject =
new ilTextInputGUI($this->lng->txt(
'subject'),
'm_subject');
426 $subject->setRequired(true);
427 $subject->setSize(50);
428 $form->addItem($subject);
429
436
437 require_once 'Services/Mail/classes/Form/class.ilManualPlaceholderInputGUI.php';
440 $placeholders->setInstructionText($this->lng->txt('mail_nacc_use_placeholder'));
441 $placeholders->setAdviseText(
sprintf($this->lng->txt(
'placeholders_advise'),
'<br />'));
442 $placeholders->supportsRerenderSignal(
443 'context',
444 $this->ctrl->getLinkTarget($this, 'getAjaxPlaceholdersById', '', true, false)
445 );
447 $context_id = $generic_context->getId();
448 } else {
450 }
452 foreach ($context->getPlaceholders() as
$key => $value) {
453 $placeholders->addPlaceholder($value['placeholder'], $value['label']);
454 }
455 $form->addItem($placeholders);
459
460 $form->setTitle($this->lng->txt(
'mail_edit_tpl'));
461 $form->setFormAction($this->ctrl->getFormaction($this,
'updateTemplate'));
462
464 $form->addCommandButton(
'updateTemplate', $this->lng->txt(
'save'));
465 }
466 } else {
467 $form->setTitle($this->lng->txt(
'mail_create_tpl'));
468 $form->setFormAction($this->ctrl->getFormaction($this,
'insertTemplate'));
469
471 $form->addCommandButton(
'insertTemplate', $this->lng->txt(
'save'));
472 }
473 }
474
476 $form->addCommandButton(
'showTemplates', $this->lng->txt(
'cancel'));
477 } else {
478 $form->addCommandButton(
'showTemplates', $this->lng->txt(
'back'));
479 }
480
482 }
static getTemplateContexts($a_id=null)
Returns an array of mail template contexts, the key of each entry matches its id.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id
catch(Exception $e) $message