TYPO3 CMS  TYPO3_6-2
ConfirmationView.php
Go to the documentation of this file.
1 <?php
3 
23 
29  const LOCALISATION_OBJECT_NAME = 'tx_form_view_confirmation';
30 
36  protected $layout = '
37  <containerWrap />';
38 
44  protected $typoscript = array();
45 
52 
58  protected $localCobj;
59 
66  public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $model, array $typoscript) {
67  $this->localCobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
68  $this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Localization');
69  $this->typoscript = $typoscript;
70  parent::__construct($model);
71  }
72 
79  public function setData(\TYPO3\CMS\Form\Domain\Model\Form $model) {
80  $this->model = (object) $model;
81  }
82 
90  public function get() {
91  $message = $this->getMessage();
92  $node = $this->render('element', FALSE);
93  if ($node !== NULL) {
94  $formInput = LF . html_entity_decode($node->saveXML($node->firstChild), ENT_QUOTES, 'UTF-8') . LF;
95  } else {
96  $formInput = '';
97  }
98  $confirmationButtons = $this->getConfirmationButtons();
99  $content = $message . LF . $formInput . LF . $confirmationButtons;
100  return $content;
101  }
102 
115  protected function getMessage() {
116  if (isset($this->typoscript['message']) && isset($this->typoscript['message.'])) {
117  $value = $this->typoscript['message.'];
118  $type = $this->typoscript['message'];
119  } elseif (isset($this->typoscript['message.'])) {
120  $value = $this->typoscript['message.'];
121  $type = 'TEXT';
122  } else {
123  $value['wrap'] = '<p>|</p>';
124  $value['value'] = $this->getLocalLanguageLabel('message');
125  $type = 'TEXT';
126  }
127  return $this->localCobj->cObjGetSingle($type, $value);
128  }
129 
135  protected function getConfirmationButtons() {
136  $requestHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Request');
137  $prefix = $requestHandler->getPrefix();
138  $action = $this->localCobj->getTypoLink_URL($GLOBALS['TSFE']->id);
139  $confirmationButtons = '
140  <form class="csc-form-confirmation" method="post" action="' . $action . '">
141  <fieldset>
142  <ol>
143  <li class="csc-form-confirmation-false">
144  <input type="submit" value="' . $this->getLocalLanguageLabel('donotconfirm') . '" name="' . $prefix . '[confirmation-false]" />
145  </li>
146  <li class="csc-form-confirmation-true">
147  <input type="submit" value="' . $this->getLocalLanguageLabel('confirm') . '" name="' . $prefix . '[confirmation-true]" />
148  </li>
149  </ol>
150  </fieldset>
151  </form>
152  ';
153  return $confirmationButtons;
154  }
155 
162  protected function getLocalLanguageLabel($type) {
163  $label = self::LOCALISATION_OBJECT_NAME . '.' . $type;
164  $message = $this->localizationHandler->getLocalLanguageLabel($label);
165  return $message;
166  }
167 
168 }
setData(\TYPO3\CMS\Form\Domain\Model\Form $model)
__construct(\TYPO3\CMS\Form\Domain\Model\Form $model, array $typoscript)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]