65 if ($this->task !== NULL) {
66 $this->task->setScheduler();
70 if ($this->task !== NULL && $this->task->getCommandIdentifier()) {
71 $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
74 $fields = array_merge($fields, $argumentFields);
99 $task->setCommandIdentifier($submittedData[
'task_extbase'][
'action']);
100 $task->setArguments((array) $submittedData[
'task_extbase'][
'arguments']);
110 $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
113 'label' =>
'<strong>' . $command->getDescription() .
'</strong>' 123 $commands = $this->commandManager->getAvailableCommands();
125 foreach ($commands as $command) {
126 if ($command->isInternal() === FALSE) {
127 $className = $command->getControllerClassName();
128 if (strpos($className,
'\\')) {
129 $classNameParts = explode(
'\\', $className);
131 if (strpos($className,
'TYPO3\\CMS\\') === 0) {
132 $classPartsToSkip = 2;
134 $classPartsToSkip = 1;
136 $classNameParts = array_slice($classNameParts, $classPartsToSkip);
137 $extensionName = $classNameParts[0];
138 $controllerName = $classNameParts[2];
140 $classNameParts = explode(
'_', $className);
141 $extensionName = $classNameParts[1];
142 $controllerName = $classNameParts[3];
144 $identifier = $command->getCommandIdentifier();
145 $options[$identifier] = $extensionName .
' ' . str_replace(
'CommandController',
'', $controllerName) .
': ' . $command->getControllerCommandName();
149 $currentlySelectedCommand = $this->task !== NULL ? $this->task->getCommandIdentifier() : NULL;
166 $argumentValues = $this->task->getArguments();
167 foreach ($argumentDefinitions as $argument) {
168 $name = $argument->getName();
170 $this->task->addDefaultValue($name, $defaultValue);
171 $value = isset($argumentValues[$name]) ? $argumentValues[$name] : $defaultValue;
172 $fields[$name] = array(
189 if (!$extensionName) {
190 list($extensionName, $commandControllerName, $commandName) = explode(
':', $this->task->getCommandIdentifier());
203 $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
205 $methodName = $command->getControllerCommandName() .
'Command';
207 foreach ($tags[
'param'] as $tag) {
208 list($argumentType, $argumentVariableName) = explode(
' ', $tag);
209 if (substr($argumentVariableName, 1) === $argument->getName()) {
210 return $argumentType;
223 $argumentName = $argument->getName();
224 list($extensionName, $commandControllerName, $commandName) = explode(
':', $this->task->getCommandIdentifier());
225 $path = array(
'command', $commandControllerName, $commandName,
'arguments', $argumentName);
226 $labelNameIndex = implode(
'.', $path);
229 $label =
'Argument: ' . $argumentName;
231 $descriptionIndex = $labelNameIndex .
'.description';
233 if (strlen($description) === 0) {
234 $description = $argument->getDescription();
236 if (strlen($description) > 0) {
237 $label .=
'. <em>' . htmlspecialchars($description) .
'</em>';
250 $argumentName = $argument->getName();
251 $command = $this->commandManager->getCommandByIdentifier($this->task->getCommandIdentifier());
252 $argumentReflection = $this->reflectionService->getMethodParameters($command->getControllerClassName(), $command->getControllerCommandName() .
'Command');
253 $defaultValue = $argumentReflection[$argumentName][
'defaultValue'];
254 if ($type ===
'boolean') {
255 $defaultValue = (boolean) $defaultValue ? 1 : 0;
257 return $defaultValue;
266 $index =
'task.action';
269 $label =
'CommandController Command. <em>Save and reopen to define command arguments</em>';
284 '<select name="tx_scheduler[task_extbase][' . htmlspecialchars($name) .
']">' 286 foreach ($options as $optionValue => $optionLabel) {
287 $selected = $optionValue === $selectedOptionValue ?
' selected="selected"' :
'';
288 array_push($html,
'<option title="test" value="' . htmlspecialchars($optionValue) .
'"' . $selected .
'>' . htmlspecialchars($optionLabel) .
'</option>');
290 array_push($html,
'</select>');
291 return implode(LF, $html);
301 protected function renderField(\
TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition $argument, $currentValue) {
303 $name = $argument->getName();
304 $fieldName =
'tx_scheduler[task_extbase][arguments][' . htmlspecialchars($name) .
']';
305 if ($type ===
'boolean') {
307 $html =
'<input type="hidden" name="' . $fieldName .
'" value="0" />';
308 $html .=
'<input type="checkbox" name="' . $fieldName .
'" value="1" ' . ((boolean) $currentValue ?
' checked="checked"' :
'') .
'/>';
311 $html =
'<input type="text" name="' . $fieldName .
'" value="' . htmlspecialchars($currentValue) .
'" /> ';
getArgumentType(\TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition $argument)
getDefaultArgumentValue(\TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition $argument)
getCommandControllerActionDescriptionField()
getArgumentLabel(\TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition $argument)
saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task)
validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)
static makeInstance($className)
__construct(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager=NULL, \TYPO3\CMS\Extbase\Mvc\Cli\CommandManager $commandManager=NULL, \TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService=NULL)
renderField(\TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition $argument, $currentValue)
getCommandControllerActionArgumentFields(array $argumentDefinitions)
renderSelectField($name, array $options, $selectedOptionValue)
getCommandControllerActionField()
getLanguageLabel($localLanguageKey, $extensionName=NULL)
static translate($key, $extensionName, $arguments=NULL)
getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)