Skip to content

Commit

Permalink
Start with Scheduler integration
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/powermail/trunk@43180 735d13b6-9817-0410-8766-e36946ffe9aa
  • Loading branch information
wunschtacho committed Feb 6, 2011
1 parent 417b5f1 commit fac0116
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 22 deletions.
19 changes: 19 additions & 0 deletions cli/class.tx_powermail_scheduler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
class tx_powermail_scheduler extends tx_scheduler_Task {

/**
* Function executed from the Scheduler.
*
* @return bool
*/
public function execute() {




mail('[email protected]', 'scheduler', 'scheduler');
return 'fehler';
}
}

?>
55 changes: 55 additions & 0 deletions cli/class.tx_powermail_scheduler_addField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
class tx_powermail_scheduler_addField implements tx_scheduler_AdditionalFieldProvider {

public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $parentObject) {

if (empty($taskInfo['ip'])) {
if($parentObject->CMD == 'edit') {
$taskInfo['ip'] = $task->ip;
} else {
$taskInfo['ip'] = '';
}
}

if (empty($taskInfo['port'])) {
if($parentObject->CMD == 'add') {
$taskInfo['port'] = '80';
} elseif($parentObject->CMD == 'edit') {
$taskInfo['port'] = $task->port;
} else {
$taskInfo['port'] = '';
}
}

// Write the code for the field
$fieldID = 'task_ip';
$fieldCode = '<input type="text" name="tx_scheduler[ip]" id="' . $fieldID . '" value="' . $taskInfo['ip'] . '" size="30" />';
$additionalFields = array();
$additionalFields[$fieldID] = array(
'code' => $fieldCode,
'label' => 'IP-Adresse/Webseite'
);

// Write the code for the field
$fieldID = 'task_port';
$fieldCode = '<input type="text" name="tx_scheduler[port]" id="' . $fieldID . '" value="' . $taskInfo['port'] . '" size="30" />';
$additionalFields[$fieldID] = array(
'code' => $fieldCode,
'label' => 'Port'
);

return $additionalFields;
}

public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject) {
$submittedData['ip'] = trim($submittedData['ip']);
$submittedData['port'] = trim($submittedData['port']);
return true;
}

public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) {
$task->ip = $submittedData['ip'];
$task->port = $submittedData['port'];
}
}
?>
46 changes: 25 additions & 21 deletions ext_autoload.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?php
/*
* Register necessary class names with autoloader
*/

$powermailExtPath = t3lib_extMgm::extPath('powermail');

return array(

/* ajax actions*/
'tx_powermail_action' => $powermailExtPath . 'mod1/class.tx_powermail_action.php',

/* ajax repositories */
'tx_powermail_repository' => $powermailExtPath . 'mod1/class.tx_powermail_repository.php',
'tx_powermail_export' => $powermailExtPath . 'mod1/class.tx_powermail_export.php',

/* div */
'tx_powermail_functions_div' => $powermailExtPath . 'lib/class.tx_powermail_functions_div.php',

);
?>
<?php
/*
* Register necessary class names with autoloader
*/

$powermailExtPath = t3lib_extMgm::extPath('powermail');

return array(

/* ajax actions*/
'tx_powermail_action' => $powermailExtPath . 'mod1/class.tx_powermail_action.php',

/* ajax repositories */
'tx_powermail_repository' => $powermailExtPath . 'mod1/class.tx_powermail_repository.php',
'tx_powermail_export' => $powermailExtPath . 'mod1/class.tx_powermail_export.php',

/* div */
'tx_powermail_functions_div' => $powermailExtPath . 'lib/class.tx_powermail_functions_div.php',

/* scheduler */
'tx_powermail_scheduler' => $powermailExtPath . 'cli/class.tx_powermail_scheduler.php',
'tx_powermail_scheduler_addField' => $powermailExtPath . 'cli/class.tx_powermail_scheduler_addField.php'

);
?>
10 changes: 9 additions & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include_once(t3lib_extMgm::extPath('powermail') . 'lib/class.user_powermail_tx_powermail_fieldsetchoose.php');
}

$TYPO3_CONF_VARS['BE']['AJAX']['tx_powermail::controller'] = 'EXT:powermail/mod1/class.tx_powermail_ajax.php:tx_powermail_Ajax->ajaxController';
$TYPO3_CONF_VARS['BE']['AJAX']['tx_powermail::controller'] = 'EXT:powermail/mod1/class.tx_powermail_ajax.php:tx_powermail_Ajax->ajaxController';

$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); // Get backend config
include_once(t3lib_extMgm::extPath('powermail') . 'lib/user_powermailOnCurrentPage.php'); // Conditions for JS including
Expand All @@ -28,4 +28,12 @@
'icon' => TRUE,
);

/* SCHEDULER SETTINGS */
$TYPO3_CONF_VARS['SC_OPTIONS']['scheduler']['tasks']['tx_powermail_scheduler'] = array(
'extension' => 'powermail',
'title' => 'Automatic Export Mails',
'description' => 'Send your CSV or XLS exports via Email to a defined target',
'additionalFields' => 'tx_powermail_scheduler_addField'
);

?>

0 comments on commit fac0116

Please sign in to comment.