TYPO3 CMS  TYPO3_6-2
RecyclerGarbageCollectionAdditionalFieldProvider.php
Go to the documentation of this file.
1 <?php
3 
25 
31  protected $defaultNumberOfDays = 30;
32 
42  public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) {
43  // Initialize selected fields
44  if (!isset($taskInfo['scheduler_recyclerGarbageCollection_numberOfDays'])) {
45  $taskInfo['scheduler_recyclerGarbageCollection_numberOfDays'] = $this->defaultNumberOfDays;
46  if ($parentObject->CMD === 'edit') {
47  $taskInfo['scheduler_recyclerGarbageCollection_numberOfDays'] = $task->numberOfDays;
48  }
49  }
50  $fieldName = 'tx_scheduler[scheduler_recyclerGarbageCollection_numberOfDays]';
51  $fieldId = 'task_recyclerGarbageCollection_numberOfDays';
52  $fieldValue = (int)$taskInfo['scheduler_recyclerGarbageCollection_numberOfDays'];
53  $fieldHtml = '<input type="text" name="' . $fieldName . '" id="' . $fieldId . '" value="' . htmlspecialchars($fieldValue) . '" />';
54  $additionalFields[$fieldId] = array(
55  'code' => $fieldHtml,
56  'label' => 'LLL:EXT:scheduler/mod1/locallang.xlf:label.recyclerGarbageCollection.numberOfDays',
57  'cshKey' => '_MOD_system_txschedulerM1',
58  'cshLabel' => $fieldId
59  );
60  return $additionalFields;
61  }
62 
70  public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) {
71  $result = TRUE;
72  // Check if number of days is indeed a number and greater or equals to 0
73  // If not, fail validation and issue error message
74  if (!is_numeric($submittedData['scheduler_recyclerGarbageCollection_numberOfDays']) || (int)$submittedData['scheduler_recyclerGarbageCollection_numberOfDays'] < 0) {
75  $result = FALSE;
76  $parentObject->addMessage($GLOBALS['LANG']->sL('LLL:EXT:scheduler/mod1/locallang.xlf:msg.invalidNumberOfDays'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
77  }
78  return $result;
79  }
80 
88  public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) {
89  $task->numberOfDays = (int)$submittedData['scheduler_recyclerGarbageCollection_numberOfDays'];
90  }
91 
92 }
saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task)
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'][]