372 {
374
375 $title =
new ilTextInputGUI($this->lng->txt(
'mail_template_title'),
'title');
376 $title->setRequired(true);
377 $form->addItem($title);
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->setSize(50);
433 $form->addItem($subject);
434
436 $message->setRequired(true);
437 $message->setCols(60);
438 $message->setRows(10);
439 $form->addItem($message);
440
441 require_once 'Services/Mail/classes/Form/class.ilManualPlaceholderInputGUI.php';
443
444 if( $template === null )
445 {
446 $context_id = $generic_context->getId();
447 }
448 else
449 {
451 }
453 foreach( $context->getPlaceholders() as $key => $value)
454 {
455 $placeholders->addPlaceholder($value['placeholder'], $value['label'] );
456 }
457 $form->addItem($placeholders);
459 {
462
463 $form->setTitle($this->lng->txt(
'mail_edit_tpl'));
464 $form->setFormAction($this->ctrl->getFormaction($this,
'updateTemplate'));
465 $form->addCommandButton(
'updateTemplate', $this->lng->txt(
'save'));
466 }
467 else
468 {
469 $form->setTitle($this->lng->txt(
'mail_create_tpl'));
470 $form->setFormAction($this->ctrl->getFormaction($this,
'insertTemplate'));
471 $form->addCommandButton(
'insertTemplate', $this->lng->txt(
'save'));
472 }
473
474 $form->addCommandButton(
'showTemplates', $this->lng->txt(
'cancel'));
476 }
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.