Fork me on GitHub

Rapport de message :*
 

Re: SmartMail en français ?

Titre du sujet : Re: SmartMail en français ?
par adeaicel sur 24/01/2007 15:03:13

Et bien alors personne ne l'utilise?? Pourtant je vous assure c'est superbe.

Reste pour moi ce probleme de calendrier d'envoi.
Je pense que c'est dans le fichier : Class/rule.php où on trouve ceci :
$Citation :
if (!class_exists('SmartPersistableObjectHandler')) {
include_once(XOOPS_ROOT_PATH . "/modules/smartobject/class/smartobjecthandler.php");
}

class SmartmailRule extends SmartObject {
function SmartmailRule() {
$this->initVar("rule_id", XOBJ_DTYPE_INT);
$this->initVar("newsletterid", XOBJ_DTYPE_INT);
$this->initVar("rule_weekday", XOBJ_DTYPE_INT); //0 means every day, 1 through 7 means monday through sunday
$this->initVar("rule_timeofday", XOBJ_DTYPE_TXTBOX, "10:00"); //on the form HH:MM
}

/**
* Get a {@link XoopsForm} object for creating/editing objects
* @param mixed $action receiving page - defaults to $_SERVER['REQUEST_URI']
* @param mixed $title title of the form
*
* @return object
*/
function getForm($action = false, $title = false) {
include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");

if ($action == false) {
$action = $_SERVER['REQUEST_URI'];
}
if ($title == false) {
$title = $this->isNew() ? _ADD : _EDIT;
$title .= " "._NL_AM_NEWSLETTERRULE;
}

$form = new XoopsThemeForm($title, 'form', $action);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('id', $this->getVar('rule_id')));
}

$newsletter_select = new XoopsFormSelect(_NL_AM_NEWSLETTER, 'newsletterid', $this->getVar('newsletterid'));
$smartmail_newsletter_handler = xoops_getmodulehandler('newsletter');
$newsletter_select->addOptionArray($smartmail_newsletter_handler->getList());
$form->addElement($newsletter_select);

if (file_exists(XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/calendar.php")) {
include_once XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/calendar.php";
}
else {
include_once XOOPS_ROOT_PATH."/language/english/calendar.php";
}
$weekday_select = new XoopsFormSelect(_NL_AM_WEEKDAY, 'rule_weekday', $this->getVar('rule_weekday', 'e'));
$weekday_select->addOption(0, _NL_AM_EVERYDAY);
$weekday_select->addOption(1, _CAL_MONDAY);
$weekday_select->addOption(2, _CAL_TUESDAY);
$weekday_select->addOption(3, _CAL_WEDNESDAY);
$weekday_select->addOption(4, _CAL_THURSDAY);
$weekday_select->addOption(5, _CAL_FRIDAY);
$weekday_select->addOption(6, _CAL_SATURDAY);
$weekday_select->addOption(7, _CAL_SUNDAY);
$form->addElement($weekday_select);

$form->addElement(new XoopsFormText(_NL_AM_TIMEOFDAY, 'rule_timeofday', 6, 6, $this->getVar('rule_timeofday', 'e')));

$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _ADD." "._NL_AM_NEWSLETTERRULE, 'submit'));
return $form;
}

/**
* Process submissal of form from getForm()
*
* @return bool
*/
function processFormSubmit() {
$this->setVar('newsletterid', $_REQUEST['newsletterid']);
$this->setVar('rule_weekday', $_REQUEST['rule_weekday']);
$this->setVar('rule_timeofday', $_REQUEST['rule_timeofday']);
return true;
}

/**
* Process post-save operations following save of object after submissal of form from getForm()
*
* @return bool
*/
function postSave() {
return true;
}

/**
* Get next dispatch for this newsletter from start time
*
* @param int $starttime time to start with
*
* @return int
*/
function getNextDispatchTime($starttime) {
$day_array = array(1 => "Monday",
2 => "Tuesday",
3 => "Wednesday",
4 => "Thursday",
5 => "Friday",
6 => "Saturday",
7 => "Sunday");
$today_time = intval(date('Hi', $starttime));
$today_weekday = date("w", $starttime) == 0 ? 7 : date("w", $starttime);
//Replace : with nothing in HH:mm string and get intval of the result
$time_of_day = intval(str_replace(":", "", $this->getVar('rule_timeofday', 'n')));
switch ($this->getVar('rule_weekday')) {
case 0:
$add_days = 0;
if ($time_of_day <= $today_time || $today_weekday == 0) {
$add_days=1;
}

if ($time_of_day <= $today_time && $today_weekday == 5) {
$add_days = 3;
}
elseif ($today_weekday == 6) {
$add_days = 2;
}
$day_clause = $add_days > 0 ? "+".$add_days." days" : "";
break;

default:
if ($today_weekday == $this->getVar('rule_weekday') && $today_time < $time_of_day) {
$day_clause = "";
}
else {
$day_clause = "Next ".$day_array[$this->getVar('rule_weekday')];
}
break;
}
$time_string = "$day_clause ".$this->getVar('rule_timeofday', 'n');
// echo "$time_string <br />";

$dispatchtime = strtotime($time_string, $starttime);
return $dispatchtime > time() ? $dispatchtime : $this->getNextDispatchTime($dispatchtime);
}
}

class SmartmailRuleHandler extends SmartPersistableObjectHandler {
function SmartmailRuleHandler($db) {
parent::SmartPersistableObjectHandler($db, "rule", "rule_id", "", "", "smartmail");
}
}
?>


une petite idée pour l'envoi tous les 15 jours ou envoi par mois
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

53 Personne(s) en ligne (41 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 53 | Plus ...