TYPO3 CMS  TYPO3_6-2
TestTaskAdditionalFieldProvider.php
Go to the documentation of this file.
1 <?php
3 
22 
32  public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) {
33  // Initialize extra field value
34  if (empty($taskInfo['email'])) {
35  if ($parentObject->CMD == 'add') {
36  // In case of new task and if field is empty, set default email address
37  $taskInfo['email'] = $GLOBALS['BE_USER']->user['email'];
38  } elseif ($parentObject->CMD == 'edit') {
39  // In case of edit, and editing a test task, set to internal value if not data was submitted already
40  $taskInfo['email'] = $task->email;
41  } else {
42  // Otherwise set an empty value, as it will not be used anyway
43  $taskInfo['email'] = '';
44  }
45  }
46  // Write the code for the field
47  $fieldID = 'task_email';
48  $fieldCode = '<input type="text" name="tx_scheduler[email]" id="' . $fieldID . '" value="' . htmlspecialchars($taskInfo['email']) . '" size="30" />';
49  $additionalFields = array();
50  $additionalFields[$fieldID] = array(
51  'code' => $fieldCode,
52  'label' => 'LLL:EXT:scheduler/mod1/locallang.xlf:label.email',
53  'cshKey' => '_MOD_system_txschedulerM1',
54  'cshLabel' => $fieldID
55  );
56  return $additionalFields;
57  }
58 
67  public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) {
68  $submittedData['email'] = trim($submittedData['email']);
69  if (empty($submittedData['email'])) {
70  $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xlf:msg.noEmail'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
71  $result = FALSE;
72  } else {
73  $result = TRUE;
74  }
75  return $result;
76  }
77 
86  public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) {
87  $task->email = $submittedData['email'];
88  }
89 
90 }
getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.
validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task)