372 {
374
376 $title->setRequired(
true);
378
381
382 if(count($contexts) <= 1)
383 {
385 $this->ctrl->redirect($this, 'showTemplates');
386 }
387
388 $context_sort = array();
389 $context_options = array();
391 foreach($contexts as $ctx)
392 {
393 if($ctx->getId() != $generic_context->getId())
394 {
395 $context_options[$ctx->getId()] = $ctx;
396 $context_sort[$ctx->getId()] = $ctx->getTitle();
397 }
398 }
399 asort($context_sort);
400 $first = null;
401 foreach($context_sort as $id =>
$title)
402 {
403 $ctx = $context_options[$id];
404 $option =
new ilRadioOption($ctx->getTitle(), $ctx->getId());
405 $option->setInfo($ctx->getDescription());
406 $context->addOption($option);
407
408 if(!$first)
409 {
410 $first = $id;
411 }
412 }
413 $context->setValue($first);
414 $context->setRequired(true);
415 $form->addItem($context);
416
417
418
419
420
421
422
423
424
425
426
428 $hidde_language->setValue($this->lng->getLangKey());
429 $form->addItem($hidde_language);
430
431 $subject =
new ilTextInputGUI($this->lng->txt(
'subject'),
'm_subject');
432 $subject->setRequired(true);
433 $subject->setSize(50);
434 $form->addItem($subject);
435
437 $message->setRequired(true);
438 $message->setCols(60);
439 $message->setRows(10);
440 $form->addItem($message);
441
442 require_once 'Services/Mail/classes/Form/class.ilManualPlaceholderInputGUI.php';
444
445 if( $template === null )
446 {
447 $context_id = $generic_context->getId();
448 }
449 else
450 {
452 }
454 foreach( $context->getPlaceholders() as $key => $value)
455 {
456 $placeholders->addPlaceholder($value['placeholder'], $value['label'] );
457 }
458 $form->addItem($placeholders);
460 {
463
464 $form->setTitle($this->lng->txt(
'mail_edit_tpl'));
465 $form->setFormAction($this->ctrl->getFormaction($this,
'updateTemplate'));
466 $form->addCommandButton(
'updateTemplate', $this->lng->txt(
'save'));
467 }
468 else
469 {
470 $form->setTitle($this->lng->txt(
'mail_create_tpl'));
471 $form->setFormAction($this->ctrl->getFormaction($this,
'insertTemplate'));
472 $form->addCommandButton(
'insertTemplate', $this->lng->txt(
'save'));
473 }
474
475 $form->addCommandButton(
'showTemplates', $this->lng->txt(
'cancel'));
477 }
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.