diff --git a/notifications/trunk/batch/config/config.xml.default b/notifications/trunk/batch/config/config.xml.default index b2fa5a62b47ee9294726d4a8ef8d137b83feaef9..01d330388351d39fdc1ce024e590c029360692d7 100755 --- a/notifications/trunk/batch/config/config.xml.default +++ b/notifications/trunk/batch/config/config.xml.default @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <ROOT> + +<!-- le nom du fichier doit etre config.xml ou config_{custom_id}.xml --> + <CONFIG> <Lang>fr</Lang> <!-- fr, en--> <MaarchDirectory>C:\xampp\htdocs\maarch_entreprise\</MaarchDirectory> diff --git a/notifications/trunk/class/class_schedule_notifications.php b/notifications/trunk/class/class_schedule_notifications.php new file mode 100644 index 0000000000000000000000000000000000000000..4cee65fc22785e44f04075d4e278bcddd91550d7 --- /dev/null +++ b/notifications/trunk/class/class_schedule_notifications.php @@ -0,0 +1,137 @@ +<?php +/** +* Class for schedule notifications +* +* +* @package maarch +* @version 1.5 +* @since 01/2015 +* @license GPL v3 +* @author <dev@maarch.org> +* +*/ + +class ScheduleNotifications{ + + function getCrontab(){ + $crontab = shell_exec('crontab -l'); + $lines = explode("\n", $crontab); + $data = array(); + + foreach ($lines as $id => $l) { + $l = trim($l); + if (strpos($l, '#') !== false) + $l = substr($l, 0, strpos($l, '#')); + if (empty($l)) + continue; + $l = preg_replace('![ \t]+!', ' ', $l); + if ($l[0] == '@') + list($time, $cmd) = explode(' ',$l, 2); + else + list($m, $h, $dom, $mon, $dow, $cmd) = explode(' ',$l, 6); + + $data[$id] = array( + 'm' => $m, + 'h' => $h, + 'dom' => $dom, + 'mon' => $mon, + 'dow' => $dow, + 'cmd' => $cmd, + ); + } + + return $data; + } + + function saveCrontab($data, $delete=false){ + foreach($data AS $id => $d) { + if ($d['state'] == 'deleted') { + unset($file[$id]); + } else + $file[$id] = "{$d['m']}\t{$d['h']}\t{$d['dom']}\t{$d['mon']}\t{$d['dow']}\t{$d['cmd']}"; + } + + $output = ''; + + if (isset($file)) { + foreach ($file as $l) + $output .= "$l\n"; + } + + $output = preg_replace("!\n+$!", "\n", $output); + file_put_contents('/tmp/crontab.plain', print_r($file, true)); + file_put_contents('/tmp/crontab.txt', $output); + + exec('crontab /tmp/crontab.txt'); + + $core_tools = new core_tools(); + $core_tools->load_lang(); + + if (!$delete) { + $_SESSION['info'] = _CRONTAB_SAVED; + } + + return 0; + } + + function getAuthorizedNotifications (){ + require_once ("core/class/class_request.php"); + $db = new dbquery(); + $db->connect(); + $db->query("SELECT notification_sid, description FROM notifications WHERE is_enabled = 'Y'"); + $notificationsArray = array(); + + + while($result = $db->fetch_object()){ + $filename = "notification"; + if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id']<>"") { + $filename.="_".str_replace(" ", "", $_SESSION['custom_override_id']); + } + $filename.="_".$result->notification_sid.".sh"; + + $path = $_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename; + + if (file_exists($path)) { + $notificationsArray[$path] = $result->description; + } + } + + return $notificationsArray; + } + + function createScriptNotification($notification_sid, $notification_id){ + //Creer le script sh pour les notifications + $filename = "notification"; + if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id']<>"") { + $filename.="_".str_replace(" ", "", $_SESSION['custom_override_id']); + } + $filename.="_".$notification_sid.".sh"; + + if (file_exists($_SESSION['config']['corepath']. 'custom/'.$_SESSION['custom_override_id'] .'/modules/notifications/batch/config/config.xml')) { + $ConfigNotif = $_SESSION['config']['corepath']. 'custom/'. $_SESSION['custom_override_id'] .'/modules/notifications/batch/config/config.xml'; + } else if (file_exists($_SESSION['config']['corepath']. 'custom/'. $_SESSION['custom_override_id'] .'/modules/notifications/batch/config/config_'.$_SESSION['custom_override_id'].'.xml')) { + $ConfigNotif = $_SESSION['config']['corepath']. 'custom/'. $_SESSION['custom_override_id'] .'/modules/notifications/batch/config/config_'.$_SESSION['custom_override_id'].'.xml'; + } else if (file_exists($_SESSION['config']['corepath']. 'modules/notifications/batch/config/config_'.$_SESSION['custom_override_id'].'.xml')) { + $ConfigNotif = $_SESSION['config']['corepath']. 'modules/notifications/batch/config/config_'.$_SESSION['custom_override_id'].'.xml'; + } else { + $ConfigNotif = $_SESSION['config']['corepath']. 'modules/notifications/batch/config/config.xml'; + } + + $file_open = fopen($_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename, 'w+'); + fwrite($file_open, '#!/bin/sh'); + fwrite($file_open, "\n"); + fwrite($file_open, 'path=\''.$_SESSION['config']['corepath'].'modules/notifications/batch/\''); + fwrite($file_open, "\n"); + fwrite($file_open, 'cd $path'); + fwrite($file_open, "\n"); + fwrite($file_open, 'php \'process_event_stack.php\' -c '.$ConfigNotif.' -n '.$notification_id); + fwrite($file_open, "\n"); + fwrite($file_open, 'cd $path'); + fwrite($file_open, "\n"); + fwrite($file_open, 'php \'process_email_stack.php\' -c '.$ConfigNotif); + fwrite($file_open, "\n"); + fclose($file_open); + shell_exec("chmod +x " . $_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename); + } + +} \ No newline at end of file diff --git a/notifications/trunk/class/notifications_controler.php b/notifications/trunk/class/notifications_controler.php index 01a80f913a00e45154fb0ef4838c0c8b1e90721a..4d588841c7cd0ba78863cbb84c4b4acb3a8707a6 100644 --- a/notifications/trunk/class/notifications_controler.php +++ b/notifications/trunk/class/notifications_controler.php @@ -209,8 +209,12 @@ class notifications_controler extends ObjectControler implements ObjectControler } } else { //mode == add if ($this->insert($notification)) { + $dbConn = new dbquery(); + $dbConn->connect(); + $dbConn->query("SELECT notification_sid FROM notifications ORDER BY notification_sid DESC limit 1"); + $result_sid = $dbConn->fetch_object(); $control = array('status' => 'ok', - 'value' => $notification->notification_sid); + 'value' => $result_sid->notification_sid); //log if ($params['log_notif_add'] == 'true') { $history = new history(); diff --git a/notifications/trunk/create_notif_script.php b/notifications/trunk/create_notif_script.php new file mode 100644 index 0000000000000000000000000000000000000000..f9bbaf2035492cee38a274b978769a0b9215abcc --- /dev/null +++ b/notifications/trunk/create_notif_script.php @@ -0,0 +1,44 @@ +<?php + +/* +* Copyright 2015 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief create notification script +* +* +* @file +* @author <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + + +$core_tools = new core_tools(); +$core_tools->test_user(); + +require_once 'modules/notifications/class/class_schedule_notifications.php'; + +$ScheduleNotifications = new ScheduleNotifications(); + +$ScheduleNotifications->createScriptNotification($_POST['notification_sid'], $_POST['notification_id']); + +echo "{status : 0}"; +exit; \ No newline at end of file diff --git a/notifications/trunk/js/functions.js b/notifications/trunk/js/functions.js index e16fda24b95db27fd692dbc07c24d3d94dbb709d..36bace352e7ed28290145664b65bb0f17c54785f 100755 --- a/notifications/trunk/js/functions.js +++ b/notifications/trunk/js/functions.js @@ -204,3 +204,24 @@ function launch_autocompleter_users(path_script, user) } } } + +function del(id) { + $("state-"+id).value = 'deleted'; + $("row-"+id).style.display='none'; +} + +function createNotifScript(path_manage_script, notification_sid, notification_id){ + new Ajax.Request(path_manage_script, + { + method:'post', + parameters: { notification_sid : notification_sid, + notification_id : notification_id + }, + onSuccess: function(answer){ + eval("response = "+answer.responseText); + if(response.status == 0 ) { + $('create_notif_script').style.display="none"; + } + } + }); +} \ No newline at end of file diff --git a/notifications/trunk/lang/en.php b/notifications/trunk/lang/en.php index e59d69858b5b06020f152a7078ad658bb2149ad4..6b2ce8444cd781901a6217a9703f0e2a8c7a73b3 100644 --- a/notifications/trunk/lang/en.php +++ b/notifications/trunk/lang/en.php @@ -1,232 +1,273 @@ -<?php -/* - * - * Copyright 2008,2009 Maarch - * - * This file is part of Maarch Framework. - * - * Maarch Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Maarch Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. - */ - -//communs -if (!defined('_NOTIFICATIONS')) - define('_NOTIFICATIONS', 'Notifications'); -if (!defined('_NOTIFS')) - define('_NOTIFS', 'Notifications'); -if (!defined('_NOTIF')) - define('_NOTIF', 'notif.'); -if (!defined('_MAIL_TO_PROCESS')) - define('_MAIL_TO_PROCESS', 'Courriers pour traitement'); -if (!defined('_HELLO')) - define('_HELLO','Bonjour'); -if (!defined('_THE_MAIL_NUM')) - define('_THE_MAIL_NUM', 'le courrier n°'); -if (!defined('_OF_TYPE')) - define('_OF_TYPE', 'de type'); -if (!defined('_OBJECT')) - define('_OBJECT', 'objet'); -if (!defined('_RECEIVED_THE')) - define('_RECEIVED_THE', 'reçu le'); -if (!defined('_SEND_BY')) - define('_SEND_BY', 'adressé par'); -if (!defined('_MUST_BE_PROCESSED_BEFORE')) - define('_MUST_BE_PROCESSED_BEFORE', 'est à traiter avant le'); -if (!defined('_ACCESS_TO_MAIL_TO_PROCESS')) - define('_ACCESS_TO_MAIL_TO_PROCESS', 'Accéder au courrier pour le traiter'); -if (!defined('_PROCESS_MAIL')) - define('_PROCESS_MAIL', 'Traitement courrier'); -if (!defined('_USER')) - define('_USER', 'Utilisateur'); -if (!defined('_MAIL')) - define('_MAIL', 'Courrier'); -if (!defined('_WAS_SENT_TO')) - define('_WAS_SENT_TO', 'a été transmis à'); -if (!defined('_SEE_MAIL')) - define('_SEE_MAIL', 'Voir ce courrier'); -if (!defined('_NO_SENDED')) - define('_NO_SENDED',' L’email n\'a pas été envoyé'); - -// notifs.php -if (!defined('_MUST_SPECIFY_CONFIG_FILE')) - define('_MUST_SPECIFY_CONFIG_FILE', 'Vous devez spécifier le fichier de configuration'); -if (!defined('_DU')) - define('_DU', 'du'); -if (!defined('_OF')) - define('_OF', 'de'); -if (!defined('_TO')) - define('_TO', 'de la part de '); -if (!defined('_FOR')) - define('_FOR', 'déstiné à'); -if (!defined('_LIST_OF_MAIL_TO_PROCESS')) - define('_LIST_OF_MAIL_TO_PROCESS', 'voici la liste des nouveaux courriers à traiter'); -if (!defined('_MAIL_COPIES_TO')) - define('_MAIL_COPIES_TO', 'Courriers pour information du'); -if (!defined('_MAIL_COPIES_LIST')) - define('_MAIL_COPIES_LIST', 'voici la liste des copies des courriers dont vous êtes destinataire'); -if (!defined('_WHO_MUST_PROCESS_BEFORE')) - define('_WHO_MUST_PROCESS_BEFORE', 'qui doit le traiter avant le'); -if (!defined('_ORIGINAL_PAPERS_ALREADY_SEND')) - define('_ORIGINAL_PAPERS_ALREADY_SEND', 'Les originaux papier vous ont été adressés'); -if (!defined('_WARNING')) - define('_WARNING', 'Attention'); -if (!defined('_YOU_MUST_BE_LOGGED')) - define('_YOU_MUST_BE_LOGGED', 'vous devez être identifié sur le logiciel avant de tenter d\'accéder au courrier'); -if (!defined('_MAIL_TO_PROCESS_LIST')) - define('_MAIL_TO_PROCESS_LIST','Liste des courriers pour traitement'); -if (!defined('_COPIES_MAIL_LIST')) - define('_COPIES_MAIL_LIST', 'Liste des courriers pour information'); -if (!defined('_BY')) - define('_BY', 'par'); -if (!defined('_DEPARTMENT')) - define('_DEPARTMENT', 'le service'); -if (!defined('_')) - define('_',''); - -//relance1.php -if (!defined('_FIRST_WARNING')) - define('_FIRST_WARNING', 'Première relance'); -if (!defined('_FIRST_WARNING_TITLE')) - define('_FIRST_WARNING_TITLE', 'Relance sur les courriers'); -if (!defined('_THIS_IS_FIRST_WARNING')) - define('_THIS_IS_FIRST_WARNING', 'Ceci est la première relance pour les courriers suivants'); -if (!defined('_MUST_BE_ADDED_TO_PRIORITY')) - define('_MUST_BE_ADDED_TO_PRIORITY', 'Merci d’ajouter ce ou ces courriers à vos traitements prioritaires'); -if (!defined('_TO_PROCESS')) - define('_TO_PROCESS', 'à traiter'); - -//relance2.php -if (!defined('_SECOND_WARNING')) - define('_SECOND_WARNING', 'Relance sur mes courriers'); -if (!defined('_LATE_MAIL_TO_PROCESS')) - define('_LATE_MAIL_TO_PROCESS', 'Courriers en retard à traiter'); -if (!defined('_YOU_ARE_LATE')) - define('_YOU_ARE_LATE', 'Vous avez du retard dans le traitement des courriers suivants'); -if (!defined('_WAS_TO_PROCESS_BEFORE')) - define('_WAS_TO_PROCESS_BEFORE', 'était à traiter avant le'); -if (!defined('_PROCESS_THIS_MAIL_QUICKLY')) - define('_PROCESS_THIS_MAIL_QUICKLY', 'Merci de rédiger une réponse sous 48 heures'); -if (!defined('_LATE')) - define('_LATE', 'Retard'); -if (!defined('_MAIL_TO_CC')) - define('_MAIL_TO_CC', 'courriers en copies'); -if (!defined('_FOLLOWING_MAIL_ARE_LATE')) - define('_FOLLOWING_MAIL_ARE_LATE', 'Le traitement des courriers suivants a pris du retard'); -if (!defined('_WHO_MUST_BE_PROCESSED_BEFORE')) - define('_WHO_MUST_BE_PROCESSED_BEFORE', 'qui devait le traiter avant le'); -if (!defined('_COPY_TITLE')) - define('_COPY_TITLE', 'En copie'); - -//notifications engine -if (!defined('_WRONG_FUNCTION_OR_WRONG_PARAMETERS')) - define('_WRONG_FUNCTION_OR_WRONG_PARAMETERS','Mauvaise fonction ou mauvais paramètre'); - -//annotations -if (!defined('_NEW_NOTE_BY_MAIL')) - define('_NEW_NOTE_BY_MAIL', 'Nouvelle annotation pour le courrier'); -if (!defined('_HELLO_NOTE')) - define('_HELLO_NOTE', 'Bonjour, vous avez une nouvelle annotation pour le courrier'); -if (!defined('_NOTE_BODY')) - define('_NOTE_BODY', 'La note est la suivante : '); -if (!defined('_NOTE_DETAILS')) - define('_NOTE_DETAILS', 'Cette note à été ajoutée par : '); -if (!defined('_NOTE_DATE_DETAILS')) - define('_NOTE_DATE_DETAILS', 'le'); -if (!defined('_LINK_TO_MAARCH')) - define('_LINK_TO_MAARCH', 'Vous pouvez accéder au courrier depuis ce lien'); - -//v2.0 -if (!defined('_ADMIN_NOTIFICATIONS')) - define('_ADMIN_NOTIFICATIONS', 'Notifications'); -if (!defined('_ADMIN_NOTIFICATIONS_DESC')) - define('_ADMIN_NOTIFICATIONS_DESC', 'Create and manage notifications for users based on events on the app'); -if (!defined('_MANAGE_NOTIFS')) - define('_MANAGE_NOTIFS', 'Manage notifications'); -if (!defined('_MANAGE_NOTIFS_DESC')) - define('_MANAGE_NOTIFS_DESC', 'Add or modify notifications'); -if (!defined('_TEST_SENDMAIL')) - define('_TEST_SENDMAIL', 'Test the configuration'); -if (!defined('_TEST_SENDMAIL_DESC')) - define('_TEST_SENDMAIL_DESC', 'Test the parameters of notifications'); -if (!defined('_NOTIFS_LIST')) - define('_NOTIFS_LIST', 'List of notifications'); -if (!defined('_THIS_NOTIF')) - define('_THIS_NOTIF', 'This notification'); -if (!defined('_IS_UNKNOWN')) - define('_IS_UNKNOWN', 'is unknown'); -if (!defined('_MODIFY_NOTIF')) - define('_MODIFY_NOTIF', 'Modify notification'); -if (!defined('_ADD_NOTIF')) - define('_ADD_NOTIF', 'Add notification'); -if (!defined('_NOTIFICATION_ID')) - define('_NOTIFICATION_ID', 'Notification identifier'); -if (!defined('_DIFFUSION_TYPE')) - define('_DIFFUSION_TYPE', 'Diffusion type'); -if (!defined('_NOTIFICATION_MODE')) - define('_NOTIFICATION_MODE', 'Diffusion mode'); -if (!defined('_RSS')) - define('_RSS', 'RSS Feed'); -if (!defined('_RSS_URL_TEMPLATE')) - define('_RSS_URL_TEMPLATE', 'Link of feed'); -if (!defined('_SYSTEM_NOTIF')) - define('_SYSTEM_NOTIF', 'System notification'); -if (!defined('_ATTACH_MAIL_FILE')) - define('_ATTACH_MAIL_FILE', 'Join the document to the notifications'); -if (!defined('_NEVER')) - define('_NEVER', 'Never'); -if (!defined('_NO_ATTACHMENT_WITH_NOTIFICATION')) - define('_NO_ATTACHMENT_WITH_NOTIFICATION', 'No attachment for any recipient'); - -//List of require -if (!defined('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE')) - define('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE', 'Les courriels de notifications seront diffusés à tous les utilisateurs de la liste de diffusion (destinataire principal et copies)'); -if (!defined('_DIFFUSION_LIST')) - define('_DIFFUSION_LIST', 'Diffusion list'); -if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE')) - define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE', 'Send to the main recipient of the document'); -if (!defined('_DEST_USER')) - if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS')) - define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS', 'Send to the main recipient of the document with status:'); - define('_DEST_USER', 'Doc recipient'); -if (!defined('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE')) - define('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE', 'Send to the users in copy of the document'); -if (!defined('_COPYLIST')) - define('_COPYLIST', 'Copy list'); -if (!defined('_NOTIFICATIONS_GROUP_DIFF_TYPE')) - define('_NOTIFICATIONS_GROUP_DIFF_TYPE', 'Send to the users of specified groups'); -if (!defined('_NOTIFICATIONS_ENTITY_DIFF_TYPE')) - define('_NOTIFICATIONS_ENTITY_DIFF_TYPE', 'Send to the users of specified entities'); -if (!defined('_NOTIFICATIONS_USER_DIFF_TYPE')) - define('_NOTIFICATIONS_USER_DIFF_TYPE', 'Send to the specified users'); -if (!defined('_SELECT_EVENT_TYPE')) - define('_SELECT_EVENT_TYPE', '-- Select the event --'); -if (!defined('_SELECT_TEMPLATE')) - define('_SELECT_TEMPLATE', '-- Select the template --'); -if (!defined('_SELECT_DIFFUSION_TYPE')) - define('_SELECT_DIFFUSION_TYPE', '-- Select the diffusion type --'); -if (!defined('_NOTIF_ADDED')) - define('_NOTIF_ADDED', 'Notification added'); -if (!defined('_NOTIF_DELETED')) - define('_NOTIF_DELETED', 'Notification deleted'); -if (!defined('_NOTIF_MODIFIED')) - define('_NOTIF_MODIFIED', 'Notification modified'); -if (!defined('_NOTIF_EMPTY')) - define('_NOTIF_EMPTY', 'Notification is empty'); -if (!defined('_ALL_NOTIFS')) - define('_ALL_NOTIFS', 'All notifications'); -if (!defined('_SYSTEM')) - define('_SYSTEM', 'System'); -if (!defined('_ENTITY')) - define('_ENTITY', 'Entity'); -if (!defined('_NOTIFICATIONS_CONTACT_DIFF_TYPE')) - define('_NOTIFICATIONS_CONTACT_DIFF_TYPE', 'Send to the mail sender'); +<?php +/* + * + * Copyright 2008,2009 Maarch + * + * This file is part of Maarch Framework. + * + * Maarch Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maarch Framework is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. + */ + +//communs +if (!defined('_NOTIFICATIONS')) + define('_NOTIFICATIONS', 'Notifications'); +if (!defined('_NOTIFS')) + define('_NOTIFS', 'Notifications'); +if (!defined('_NOTIF')) + define('_NOTIF', 'notif.'); +if (!defined('_MAIL_TO_PROCESS')) + define('_MAIL_TO_PROCESS', 'Courriers pour traitement'); +if (!defined('_HELLO')) + define('_HELLO','Bonjour'); +if (!defined('_THE_MAIL_NUM')) + define('_THE_MAIL_NUM', 'le courrier n°'); +if (!defined('_OF_TYPE')) + define('_OF_TYPE', 'de type'); +if (!defined('_OBJECT')) + define('_OBJECT', 'objet'); +if (!defined('_RECEIVED_THE')) + define('_RECEIVED_THE', 'reçu le'); +if (!defined('_SEND_BY')) + define('_SEND_BY', 'adressé par'); +if (!defined('_MUST_BE_PROCESSED_BEFORE')) + define('_MUST_BE_PROCESSED_BEFORE', 'est à traiter avant le'); +if (!defined('_ACCESS_TO_MAIL_TO_PROCESS')) + define('_ACCESS_TO_MAIL_TO_PROCESS', 'Accéder au courrier pour le traiter'); +if (!defined('_PROCESS_MAIL')) + define('_PROCESS_MAIL', 'Traitement courrier'); +if (!defined('_USER')) + define('_USER', 'Utilisateur'); +if (!defined('_MAIL')) + define('_MAIL', 'Courrier'); +if (!defined('_WAS_SENT_TO')) + define('_WAS_SENT_TO', 'a été transmis à'); +if (!defined('_SEE_MAIL')) + define('_SEE_MAIL', 'Voir ce courrier'); +if (!defined('_NO_SENDED')) + define('_NO_SENDED',' L’email n\'a pas été envoyé'); + +// notifs.php +if (!defined('_MUST_SPECIFY_CONFIG_FILE')) + define('_MUST_SPECIFY_CONFIG_FILE', 'Vous devez spécifier le fichier de configuration'); +if (!defined('_DU')) + define('_DU', 'du'); +if (!defined('_OF')) + define('_OF', 'de'); +if (!defined('_TO')) + define('_TO', 'de la part de '); +if (!defined('_FOR')) + define('_FOR', 'déstiné à'); +if (!defined('_LIST_OF_MAIL_TO_PROCESS')) + define('_LIST_OF_MAIL_TO_PROCESS', 'voici la liste des nouveaux courriers à traiter'); +if (!defined('_MAIL_COPIES_TO')) + define('_MAIL_COPIES_TO', 'Courriers pour information du'); +if (!defined('_MAIL_COPIES_LIST')) + define('_MAIL_COPIES_LIST', 'voici la liste des copies des courriers dont vous êtes destinataire'); +if (!defined('_WHO_MUST_PROCESS_BEFORE')) + define('_WHO_MUST_PROCESS_BEFORE', 'qui doit le traiter avant le'); +if (!defined('_ORIGINAL_PAPERS_ALREADY_SEND')) + define('_ORIGINAL_PAPERS_ALREADY_SEND', 'Les originaux papier vous ont été adressés'); +if (!defined('_WARNING')) + define('_WARNING', 'Attention'); +if (!defined('_YOU_MUST_BE_LOGGED')) + define('_YOU_MUST_BE_LOGGED', 'vous devez être identifié sur le logiciel avant de tenter d\'accéder au courrier'); +if (!defined('_MAIL_TO_PROCESS_LIST')) + define('_MAIL_TO_PROCESS_LIST','Liste des courriers pour traitement'); +if (!defined('_COPIES_MAIL_LIST')) + define('_COPIES_MAIL_LIST', 'Liste des courriers pour information'); +if (!defined('_BY')) + define('_BY', 'par'); +if (!defined('_DEPARTMENT')) + define('_DEPARTMENT', 'le service'); +if (!defined('_')) + define('_',''); + +//relance1.php +if (!defined('_FIRST_WARNING')) + define('_FIRST_WARNING', 'Première relance'); +if (!defined('_FIRST_WARNING_TITLE')) + define('_FIRST_WARNING_TITLE', 'Relance sur les courriers'); +if (!defined('_THIS_IS_FIRST_WARNING')) + define('_THIS_IS_FIRST_WARNING', 'Ceci est la première relance pour les courriers suivants'); +if (!defined('_MUST_BE_ADDED_TO_PRIORITY')) + define('_MUST_BE_ADDED_TO_PRIORITY', 'Merci d’ajouter ce ou ces courriers à vos traitements prioritaires'); +if (!defined('_TO_PROCESS')) + define('_TO_PROCESS', 'à traiter'); + +//relance2.php +if (!defined('_SECOND_WARNING')) + define('_SECOND_WARNING', 'Relance sur mes courriers'); +if (!defined('_LATE_MAIL_TO_PROCESS')) + define('_LATE_MAIL_TO_PROCESS', 'Courriers en retard à traiter'); +if (!defined('_YOU_ARE_LATE')) + define('_YOU_ARE_LATE', 'Vous avez du retard dans le traitement des courriers suivants'); +if (!defined('_WAS_TO_PROCESS_BEFORE')) + define('_WAS_TO_PROCESS_BEFORE', 'était à traiter avant le'); +if (!defined('_PROCESS_THIS_MAIL_QUICKLY')) + define('_PROCESS_THIS_MAIL_QUICKLY', 'Merci de rédiger une réponse sous 48 heures'); +if (!defined('_LATE')) + define('_LATE', 'Retard'); +if (!defined('_MAIL_TO_CC')) + define('_MAIL_TO_CC', 'courriers en copies'); +if (!defined('_FOLLOWING_MAIL_ARE_LATE')) + define('_FOLLOWING_MAIL_ARE_LATE', 'Le traitement des courriers suivants a pris du retard'); +if (!defined('_WHO_MUST_BE_PROCESSED_BEFORE')) + define('_WHO_MUST_BE_PROCESSED_BEFORE', 'qui devait le traiter avant le'); +if (!defined('_COPY_TITLE')) + define('_COPY_TITLE', 'En copie'); + +//notifications engine +if (!defined('_WRONG_FUNCTION_OR_WRONG_PARAMETERS')) + define('_WRONG_FUNCTION_OR_WRONG_PARAMETERS','Mauvaise fonction ou mauvais paramètre'); + +//annotations +if (!defined('_NEW_NOTE_BY_MAIL')) + define('_NEW_NOTE_BY_MAIL', 'Nouvelle annotation pour le courrier'); +if (!defined('_HELLO_NOTE')) + define('_HELLO_NOTE', 'Bonjour, vous avez une nouvelle annotation pour le courrier'); +if (!defined('_NOTE_BODY')) + define('_NOTE_BODY', 'La note est la suivante : '); +if (!defined('_NOTE_DETAILS')) + define('_NOTE_DETAILS', 'Cette note à été ajoutée par : '); +if (!defined('_NOTE_DATE_DETAILS')) + define('_NOTE_DATE_DETAILS', 'le'); +if (!defined('_LINK_TO_MAARCH')) + define('_LINK_TO_MAARCH', 'Vous pouvez accéder au courrier depuis ce lien'); + +//v2.0 +if (!defined('_ADMIN_NOTIFICATIONS')) + define('_ADMIN_NOTIFICATIONS', 'Notifications'); +if (!defined('_ADMIN_NOTIFICATIONS_DESC')) + define('_ADMIN_NOTIFICATIONS_DESC', 'Create and manage notifications for users based on events on the app'); +if (!defined('_MANAGE_NOTIFS')) + define('_MANAGE_NOTIFS', 'Manage notifications'); +if (!defined('_MANAGE_NOTIFS_DESC')) + define('_MANAGE_NOTIFS_DESC', 'Add or modify notifications'); +if (!defined('_TEST_SENDMAIL')) + define('_TEST_SENDMAIL', 'Test the configuration'); +if (!defined('_TEST_SENDMAIL_DESC')) + define('_TEST_SENDMAIL_DESC', 'Test the parameters of notifications'); +if (!defined('_NOTIFS_LIST')) + define('_NOTIFS_LIST', 'List of notifications'); +if (!defined('_THIS_NOTIF')) + define('_THIS_NOTIF', 'This notification'); +if (!defined('_IS_UNKNOWN')) + define('_IS_UNKNOWN', 'is unknown'); +if (!defined('_MODIFY_NOTIF')) + define('_MODIFY_NOTIF', 'Modify notification'); +if (!defined('_ADD_NOTIF')) + define('_ADD_NOTIF', 'Add notification'); +if (!defined('_NOTIFICATION_ID')) + define('_NOTIFICATION_ID', 'Notification identifier'); +if (!defined('_DIFFUSION_TYPE')) + define('_DIFFUSION_TYPE', 'Diffusion type'); +if (!defined('_NOTIFICATION_MODE')) + define('_NOTIFICATION_MODE', 'Diffusion mode'); +if (!defined('_RSS')) + define('_RSS', 'RSS Feed'); +if (!defined('_RSS_URL_TEMPLATE')) + define('_RSS_URL_TEMPLATE', 'Link of feed'); +if (!defined('_SYSTEM_NOTIF')) + define('_SYSTEM_NOTIF', 'System notification'); +if (!defined('_ATTACH_MAIL_FILE')) + define('_ATTACH_MAIL_FILE', 'Join the document to the notifications'); +if (!defined('_NEVER')) + define('_NEVER', 'Never'); +if (!defined('_NO_ATTACHMENT_WITH_NOTIFICATION')) + define('_NO_ATTACHMENT_WITH_NOTIFICATION', 'No attachment for any recipient'); + +//List of require +if (!defined('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE')) + define('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE', 'Les courriels de notifications seront diffusés à tous les utilisateurs de la liste de diffusion (destinataire principal et copies)'); +if (!defined('_DIFFUSION_LIST')) + define('_DIFFUSION_LIST', 'Diffusion list'); +if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE')) + define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE', 'Send to the main recipient of the document'); +if (!defined('_DEST_USER')) + if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS')) + define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS', 'Send to the main recipient of the document with status:'); + define('_DEST_USER', 'Doc recipient'); +if (!defined('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE')) + define('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE', 'Send to the users in copy of the document'); +if (!defined('_COPYLIST')) + define('_COPYLIST', 'Copy list'); +if (!defined('_NOTIFICATIONS_GROUP_DIFF_TYPE')) + define('_NOTIFICATIONS_GROUP_DIFF_TYPE', 'Send to the users of specified groups'); +if (!defined('_NOTIFICATIONS_ENTITY_DIFF_TYPE')) + define('_NOTIFICATIONS_ENTITY_DIFF_TYPE', 'Send to the users of specified entities'); +if (!defined('_NOTIFICATIONS_USER_DIFF_TYPE')) + define('_NOTIFICATIONS_USER_DIFF_TYPE', 'Send to the specified users'); +if (!defined('_SELECT_EVENT_TYPE')) + define('_SELECT_EVENT_TYPE', '-- Select the event --'); +if (!defined('_SELECT_TEMPLATE')) + define('_SELECT_TEMPLATE', '-- Select the template --'); +if (!defined('_SELECT_DIFFUSION_TYPE')) + define('_SELECT_DIFFUSION_TYPE', '-- Select the diffusion type --'); +if (!defined('_NOTIF_ADDED')) + define('_NOTIF_ADDED', 'Notification added'); +if (!defined('_NOTIF_DELETED')) + define('_NOTIF_DELETED', 'Notification deleted'); +if (!defined('_NOTIF_MODIFIED')) + define('_NOTIF_MODIFIED', 'Notification modified'); +if (!defined('_NOTIF_EMPTY')) + define('_NOTIF_EMPTY', 'Notification is empty'); +if (!defined('_ALL_NOTIFS')) + define('_ALL_NOTIFS', 'All notifications'); +if (!defined('_SYSTEM')) + define('_SYSTEM', 'System'); +if (!defined('_ENTITY')) + define('_ENTITY', 'Entity'); +if (!defined('_NOTIFICATIONS_CONTACT_DIFF_TYPE')) + define('_NOTIFICATIONS_CONTACT_DIFF_TYPE', 'Send to the mail sender'); +if (!defined('_SCHEDULE_NOTIFICATIONS')) + define('_SCHEDULE_NOTIFICATIONS', 'Schedule notifications'); +if (!defined('_HOUR')) + define('_HOUR', 'Hour'); +if (!defined('_MINUTE')) + define('_MINUTE', 'Minute'); +if (!defined('_DAY')) + define('_DAY', 'Day'); +if (!defined('_WEEKDAY')) + define('_WEEKDAY', 'Weekday'); +if (!defined('_NOTIF_DESCRIPTION')) + define('_NOTIF_DESCRIPTION', 'Notification description'); +if (!defined('_CRONTAB_SAVED')) + define('_CRONTAB_SAVED', 'Schedule notification was saved'); +if (!defined('_MONDAY')) + define('_MONDAY', 'Monday'); +if (!defined('_TUESDAY')) + define('_TUESDAY', 'Tuesday'); +if (!defined('_WEDNESDAY')) + define('_WEDNESDAY', 'Wednesday'); +if (!defined('_THURSDAY')) + define('_THURSDAY', 'Thursday'); +if (!defined('_FRIDAY')) + define('_FRIDAY', 'Friday'); +if (!defined('_SATURDAY')) + define('_SATURDAY', 'Saturday'); +if (!defined('_SUNDAY')) + define('_SUNDAY', 'Sunday'); +if (!defined('_HELP_CRON')) + define('_HELP_CRON', 'This part help you to define when the notifications are send. + <br/><br/>If you choose * in all lists, notifications will be send every minutes 365 days per year. + <br/><br/>Exemple : + <br/> + <br/>14 30 * * * [Mail] New mail for treatment : The notification will be send every day at 2.30pm + <br/> 9 30 * * Monday [Mail] New mail for treatment : The notification will be send every monday at 9.30am'); +if (!defined('_CHOOSE_NOTIF')) + define('_CHOOSE_NOTIF', 'Choose a notification'); +if (!defined('_NO_NOTIF')) + define('_NO_NOTIF', 'No notification scheduled'); +if (!defined('_CREATE_NOTIF_SCRIPT')) + define('_CREATE_NOTIF_SCRIPT', 'Create the script'); diff --git a/notifications/trunk/lang/fr.php b/notifications/trunk/lang/fr.php index bc93aa8e9d2820d8780a284699b8172ec6704203..60b8ee321e01d1fe49c12de1dfb56a67a782c640 100644 --- a/notifications/trunk/lang/fr.php +++ b/notifications/trunk/lang/fr.php @@ -1,236 +1,277 @@ -<?php -/* - * - * Copyright 2008,2009 Maarch - * - * This file is part of Maarch Framework. - * - * Maarch Framework is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Maarch Framework is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. - */ - -//communs -if (!defined('_NOTIFICATIONS')) - define('_NOTIFICATIONS', 'Notifications'); -if (!defined('_NOTIFS')) - define('_NOTIFS', 'Notifications'); -if (!defined('_NOTIF')) - define('_NOTIF', 'notif.'); -if (!defined('_MAIL_TO_PROCESS')) - define('_MAIL_TO_PROCESS', 'Courriers pour traitement'); -if (!defined('_HELLO')) - define('_HELLO','Bonjour'); -if (!defined('_THE_MAIL_NUM')) - define('_THE_MAIL_NUM', 'le courrier n°'); -if (!defined('_OF_TYPE')) - define('_OF_TYPE', 'de type'); -if (!defined('_OBJECT')) - define('_OBJECT', 'objet'); -if (!defined('_RECEIVED_THE')) - define('_RECEIVED_THE', 'reçu le'); -if (!defined('_SEND_BY')) - define('_SEND_BY', 'adressé par'); -if (!defined('_MUST_BE_PROCESSED_BEFORE')) - define('_MUST_BE_PROCESSED_BEFORE', 'est à traiter avant le'); -if (!defined('_ACCESS_TO_MAIL_TO_PROCESS')) - define('_ACCESS_TO_MAIL_TO_PROCESS', 'Accéder au courrier pour le traiter'); -if (!defined('_PROCESS_MAIL')) - define('_PROCESS_MAIL', 'Traitement courrier'); -if (!defined('_USER')) - define('_USER', 'Utilisateur'); -if (!defined('_MAIL')) - define('_MAIL', 'Courrier'); -if (!defined('_WAS_SENT_TO')) - define('_WAS_SENT_TO', 'a été transmis à'); -if (!defined('_SEE_MAIL')) - define('_SEE_MAIL', 'Voir ce courrier'); -if (!defined('_NO_SENDED')) - define('_NO_SENDED',' L’email n\'a pas été envoyé'); - -// notifs.php -if (!defined('_MUST_SPECIFY_CONFIG_FILE')) - define('_MUST_SPECIFY_CONFIG_FILE', 'Vous devez spécifier le fichier de configuration'); -if (!defined('_DU')) - define('_DU', 'du'); -if (!defined('_OF')) - define('_OF', 'de'); -if (!defined('_TO')) - define('_TO', 'de la part de '); -if (!defined('_FOR')) - define('_FOR', 'déstiné à'); -if (!defined('_LIST_OF_MAIL_TO_PROCESS')) - define('_LIST_OF_MAIL_TO_PROCESS', 'voici la liste des nouveaux courriers à traiter'); -if (!defined('_MAIL_COPIES_TO')) - define('_MAIL_COPIES_TO', 'Courriers pour information du'); -if (!defined('_MAIL_COPIES_LIST')) - define('_MAIL_COPIES_LIST', 'voici la liste des copies des courriers dont vous êtes destinataire'); -if (!defined('_WHO_MUST_PROCESS_BEFORE')) - define('_WHO_MUST_PROCESS_BEFORE', 'qui doit le traiter avant le'); -if (!defined('_ORIGINAL_PAPERS_ALREADY_SEND')) - define('_ORIGINAL_PAPERS_ALREADY_SEND', 'Les originaux papier vous ont été adressés'); -if (!defined('_WARNING')) - define('_WARNING', 'Attention'); -if (!defined('_YOU_MUST_BE_LOGGED')) - define('_YOU_MUST_BE_LOGGED', 'vous devez être identifié sur le logiciel avant de tenter d\'accéder au courrier'); -if (!defined('_MAIL_TO_PROCESS_LIST')) - define('_MAIL_TO_PROCESS_LIST','Liste des courriers pour traitement'); -if (!defined('_COPIES_MAIL_LIST')) - define('_COPIES_MAIL_LIST', 'Liste des courriers pour information'); -if (!defined('_BY')) - define('_BY', 'par'); -if (!defined('_DEPARTMENT')) - define('_DEPARTMENT', 'le service'); -if (!defined('_')) - define('_',''); - -//relance1.php -if (!defined('_FIRST_WARNING')) - define('_FIRST_WARNING', 'Première relance'); -if (!defined('_FIRST_WARNING_TITLE')) - define('_FIRST_WARNING_TITLE', 'Relance sur les courriers'); -if (!defined('_THIS_IS_FIRST_WARNING')) - define('_THIS_IS_FIRST_WARNING', 'Ceci est la première relance pour les courriers suivants'); -if (!defined('_MUST_BE_ADDED_TO_PRIORITY')) - define('_MUST_BE_ADDED_TO_PRIORITY', 'Merci d’ajouter ce ou ces courriers à vos traitements prioritaires'); -if (!defined('_TO_PROCESS')) - define('_TO_PROCESS', 'à traiter'); - -//relance2.php -if (!defined('_SECOND_WARNING')) - define('_SECOND_WARNING', 'Relance sur mes courriers'); -if (!defined('_LATE_MAIL_TO_PROCESS')) - define('_LATE_MAIL_TO_PROCESS', 'Courriers en retard à traiter'); -if (!defined('_YOU_ARE_LATE')) - define('_YOU_ARE_LATE', 'Vous avez du retard dans le traitement des courriers suivants'); -if (!defined('_WAS_TO_PROCESS_BEFORE')) - define('_WAS_TO_PROCESS_BEFORE', 'était à traiter avant le'); -if (!defined('_PROCESS_THIS_MAIL_QUICKLY')) - define('_PROCESS_THIS_MAIL_QUICKLY', 'Merci de rédiger une réponse sous 48 heures'); -if (!defined('_LATE')) - define('_LATE', 'Retard'); -if (!defined('_MAIL_TO_CC')) - define('_MAIL_TO_CC', 'courriers en copies'); -if (!defined('_FOLLOWING_MAIL_ARE_LATE')) - define('_FOLLOWING_MAIL_ARE_LATE', 'Le traitement des courriers suivants a pris du retard'); -if (!defined('_WHO_MUST_BE_PROCESSED_BEFORE')) - define('_WHO_MUST_BE_PROCESSED_BEFORE', 'qui devait le traiter avant le'); -if (!defined('_COPY_TITLE')) - define('_COPY_TITLE', 'En copie'); - -//notifications engine -if (!defined('_WRONG_FUNCTION_OR_WRONG_PARAMETERS')) - define('_WRONG_FUNCTION_OR_WRONG_PARAMETERS','Mauvaise fonction ou mauvais paramètre'); - -//annotations -if (!defined('_NEW_NOTE_BY_MAIL')) - define('_NEW_NOTE_BY_MAIL', 'Nouvelle annotation pour le courrier'); -if (!defined('_HELLO_NOTE')) - define('_HELLO_NOTE', 'Bonjour, vous avez une nouvelle annotation pour le courrier'); -if (!defined('_NOTE_BODY')) - define('_NOTE_BODY', 'La note est la suivante : '); -if (!defined('_NOTE_DETAILS')) - define('_NOTE_DETAILS', 'Cette note à été ajoutée par : '); -if (!defined('_NOTE_DATE_DETAILS')) - define('_NOTE_DATE_DETAILS', 'le'); -if (!defined('_LINK_TO_MAARCH')) - define('_LINK_TO_MAARCH', 'Vous pouvez accéder au courrier depuis ce lien'); - -//v2.0 -if (!defined('_ADMIN_NOTIFICATIONS')) - define('_ADMIN_NOTIFICATIONS', 'Notifications'); -if (!defined('_ADMIN_NOTIFICATIONS_DESC')) - define('_ADMIN_NOTIFICATIONS_DESC', 'Créer et gérer des notifications aux utilisateurs basées sur des événements de l\'application'); -if (!defined('_MANAGE_NOTIFS')) - define('_MANAGE_NOTIFS', 'Gérer les notifications'); -if (!defined('_MANAGE_NOTIFS_DESC')) - define('_MANAGE_NOTIFS_DESC', 'Ajouter ou modifier des notifications à notifier'); -if (!defined('_TEST_SENDMAIL')) - define('_TEST_SENDMAIL', 'Tester la configuration'); -if (!defined('_TEST_SENDMAIL_DESC')) - define('_TEST_SENDMAIL_DESC', 'Vérifier le paramétrage du module de notification'); -if (!defined('_NOTIFS_LIST')) - define('_NOTIFS_LIST', 'Liste des notifications'); -if (!defined('_THIS_NOTIF')) - define('_THIS_NOTIF', 'Cette notification'); -if (!defined('_IS_UNKNOWN')) - define('_IS_UNKNOWN', 'est inconnue'); -if (!defined('_MODIFY_NOTIF')) - define('_MODIFY_NOTIF', 'Modifier notification'); -if (!defined('_ADD_NOTIF')) - define('_ADD_NOTIF', 'Ajouter notification'); -if (!defined('_NOTIFICATION_ID')) - define('_NOTIFICATION_ID', 'Identifiant de notification'); -if (!defined('_DIFFUSION_TYPE')) - define('_DIFFUSION_TYPE', 'Type de diffusion'); -if (!defined('_NOTIFICATION_MODE')) - define('_NOTIFICATION_MODE', 'Mode de notification'); -if (!defined('_RSS')) - define('_RSS', 'Flux RSS'); -if (!defined('_RSS_URL_TEMPLATE')) - define('_RSS_URL_TEMPLATE', 'Lien du flux'); -if (!defined('_SYSTEM_NOTIF')) - define('_SYSTEM_NOTIF', 'Notification système'); -if (!defined('_ATTACH_MAIL_FILE')) - define('_ATTACH_MAIL_FILE', 'Joindre le document à la notification'); -if (!defined('_NEVER')) - define('_NEVER', 'Jamais'); -if (!defined('_NO_ATTACHMENT_WITH_NOTIFICATION')) - define('_NO_ATTACHMENT_WITH_NOTIFICATION', 'Les documents ne sont joints à la notification pour aucun utilisateur'); - -//List of require -if (!defined('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE')) - define('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE', 'Les courriels de notifications seront diffusés à tous les utilisateurs de la liste de diffusion (destinataire principal et copies)'); -if (!defined('_DIFFUSION_LIST')) - define('_DIFFUSION_LIST', 'Liste de diffusion'); -if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE')) - define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE', 'Envoi au destinataire principal du document'); -if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS')) - define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS', 'Envoi au destinataire principal du document avec le(s) statut(s):'); -if (!defined('_DEST_USER')) - define('_DEST_USER', 'Destinataire principal'); -if (!defined('_NOTE_DEST_USER')) - define('_NOTE_DEST_USER', 'Destinataire principal du document annoté'); -if (!defined('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE')) - define('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE', 'Envoi aux utilisateurs en copie du document'); -if (!defined('_COPYLIST')) - define('_COPYLIST', 'Utilisateurs en copie'); -if (!defined('_NOTE_COPY_LIST')) - define('_NOTE_COPY_LIST', 'Destinataires en copie du document annoté'); -if (!defined('_NOTIFICATIONS_GROUP_DIFF_TYPE')) - define('_NOTIFICATIONS_GROUP_DIFF_TYPE', 'Envoi aux utilisateurs du(des) groupe(s) spécifié(s)'); -if (!defined('_NOTIFICATIONS_ENTITY_DIFF_TYPE')) - define('_NOTIFICATIONS_ENTITY_DIFF_TYPE', 'Envoi aux utilisateurs des entité(s) spécifiée(s)'); -if (!defined('_NOTIFICATIONS_USER_DIFF_TYPE')) - define('_NOTIFICATIONS_USER_DIFF_TYPE', 'Envoi aux utilisateurs spécifiés'); -if (!defined('_SELECT_EVENT_TYPE')) - define('_SELECT_EVENT_TYPE', '-- Sélectionner l\'événement --'); -if (!defined('_SELECT_TEMPLATE')) - define('_SELECT_TEMPLATE', '-- Sélectionner le modèle --'); -if (!defined('_SELECT_DIFFUSION_TYPE')) - define('_SELECT_DIFFUSION_TYPE', '-- Sélectionner la diffusion --'); -if (!defined('_NOTIF_ADDED')) - define('_NOTIF_ADDED', 'Notification ajoutée'); -if (!defined('_NOTIF_DELETED')) - define('_NOTIF_DELETED', 'Notification supprimée'); -if (!defined('_NOTIF_MODIFIED')) - define('_NOTIF_MODIFIED', 'Notification modifiée'); -if (!defined('_NOTIF_EMPTY')) - define('_NOTIF_EMPTY', 'Notification vide'); -if (!defined('_ALL_NOTIFS')) - define('_ALL_NOTIFS', 'Toutes les notifications'); -if (!defined('_SYSTEM')) - define('_SYSTEM', 'Système'); -if (!defined('_ENTITY')) - define('_ENTITY', 'Entité'); -if (!defined('_NOTIFICATIONS_CONTACT_DIFF_TYPE')) - define('_NOTIFICATIONS_CONTACT_DIFF_TYPE', 'Envoi à l\'expéditeur du courrier'); +<?php +/* + * + * Copyright 2008,2009 Maarch + * + * This file is part of Maarch Framework. + * + * Maarch Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Maarch Framework is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. + */ + +//communs +if (!defined('_NOTIFICATIONS')) + define('_NOTIFICATIONS', 'Notifications'); +if (!defined('_NOTIFS')) + define('_NOTIFS', 'Notifications'); +if (!defined('_NOTIF')) + define('_NOTIF', 'notif.'); +if (!defined('_MAIL_TO_PROCESS')) + define('_MAIL_TO_PROCESS', 'Courriers pour traitement'); +if (!defined('_HELLO')) + define('_HELLO','Bonjour'); +if (!defined('_THE_MAIL_NUM')) + define('_THE_MAIL_NUM', 'le courrier n°'); +if (!defined('_OF_TYPE')) + define('_OF_TYPE', 'de type'); +if (!defined('_OBJECT')) + define('_OBJECT', 'objet'); +if (!defined('_RECEIVED_THE')) + define('_RECEIVED_THE', 'reçu le'); +if (!defined('_SEND_BY')) + define('_SEND_BY', 'adressé par'); +if (!defined('_MUST_BE_PROCESSED_BEFORE')) + define('_MUST_BE_PROCESSED_BEFORE', 'est à traiter avant le'); +if (!defined('_ACCESS_TO_MAIL_TO_PROCESS')) + define('_ACCESS_TO_MAIL_TO_PROCESS', 'Accéder au courrier pour le traiter'); +if (!defined('_PROCESS_MAIL')) + define('_PROCESS_MAIL', 'Traitement courrier'); +if (!defined('_USER')) + define('_USER', 'Utilisateur'); +if (!defined('_MAIL')) + define('_MAIL', 'Courrier'); +if (!defined('_WAS_SENT_TO')) + define('_WAS_SENT_TO', 'a été transmis à'); +if (!defined('_SEE_MAIL')) + define('_SEE_MAIL', 'Voir ce courrier'); +if (!defined('_NO_SENDED')) + define('_NO_SENDED',' L’email n\'a pas été envoyé'); + +// notifs.php +if (!defined('_MUST_SPECIFY_CONFIG_FILE')) + define('_MUST_SPECIFY_CONFIG_FILE', 'Vous devez spécifier le fichier de configuration'); +if (!defined('_DU')) + define('_DU', 'du'); +if (!defined('_OF')) + define('_OF', 'de'); +if (!defined('_TO')) + define('_TO', 'de la part de '); +if (!defined('_FOR')) + define('_FOR', 'déstiné à'); +if (!defined('_LIST_OF_MAIL_TO_PROCESS')) + define('_LIST_OF_MAIL_TO_PROCESS', 'voici la liste des nouveaux courriers à traiter'); +if (!defined('_MAIL_COPIES_TO')) + define('_MAIL_COPIES_TO', 'Courriers pour information du'); +if (!defined('_MAIL_COPIES_LIST')) + define('_MAIL_COPIES_LIST', 'voici la liste des copies des courriers dont vous êtes destinataire'); +if (!defined('_WHO_MUST_PROCESS_BEFORE')) + define('_WHO_MUST_PROCESS_BEFORE', 'qui doit le traiter avant le'); +if (!defined('_ORIGINAL_PAPERS_ALREADY_SEND')) + define('_ORIGINAL_PAPERS_ALREADY_SEND', 'Les originaux papier vous ont été adressés'); +if (!defined('_WARNING')) + define('_WARNING', 'Attention'); +if (!defined('_YOU_MUST_BE_LOGGED')) + define('_YOU_MUST_BE_LOGGED', 'vous devez être identifié sur le logiciel avant de tenter d\'accéder au courrier'); +if (!defined('_MAIL_TO_PROCESS_LIST')) + define('_MAIL_TO_PROCESS_LIST','Liste des courriers pour traitement'); +if (!defined('_COPIES_MAIL_LIST')) + define('_COPIES_MAIL_LIST', 'Liste des courriers pour information'); +if (!defined('_BY')) + define('_BY', 'par'); +if (!defined('_DEPARTMENT')) + define('_DEPARTMENT', 'le service'); +if (!defined('_')) + define('_',''); + +//relance1.php +if (!defined('_FIRST_WARNING')) + define('_FIRST_WARNING', 'Première relance'); +if (!defined('_FIRST_WARNING_TITLE')) + define('_FIRST_WARNING_TITLE', 'Relance sur les courriers'); +if (!defined('_THIS_IS_FIRST_WARNING')) + define('_THIS_IS_FIRST_WARNING', 'Ceci est la première relance pour les courriers suivants'); +if (!defined('_MUST_BE_ADDED_TO_PRIORITY')) + define('_MUST_BE_ADDED_TO_PRIORITY', 'Merci d’ajouter ce ou ces courriers à vos traitements prioritaires'); +if (!defined('_TO_PROCESS')) + define('_TO_PROCESS', 'à traiter'); + +//relance2.php +if (!defined('_SECOND_WARNING')) + define('_SECOND_WARNING', 'Relance sur mes courriers'); +if (!defined('_LATE_MAIL_TO_PROCESS')) + define('_LATE_MAIL_TO_PROCESS', 'Courriers en retard à traiter'); +if (!defined('_YOU_ARE_LATE')) + define('_YOU_ARE_LATE', 'Vous avez du retard dans le traitement des courriers suivants'); +if (!defined('_WAS_TO_PROCESS_BEFORE')) + define('_WAS_TO_PROCESS_BEFORE', 'était à traiter avant le'); +if (!defined('_PROCESS_THIS_MAIL_QUICKLY')) + define('_PROCESS_THIS_MAIL_QUICKLY', 'Merci de rédiger une réponse sous 48 heures'); +if (!defined('_LATE')) + define('_LATE', 'Retard'); +if (!defined('_MAIL_TO_CC')) + define('_MAIL_TO_CC', 'courriers en copies'); +if (!defined('_FOLLOWING_MAIL_ARE_LATE')) + define('_FOLLOWING_MAIL_ARE_LATE', 'Le traitement des courriers suivants a pris du retard'); +if (!defined('_WHO_MUST_BE_PROCESSED_BEFORE')) + define('_WHO_MUST_BE_PROCESSED_BEFORE', 'qui devait le traiter avant le'); +if (!defined('_COPY_TITLE')) + define('_COPY_TITLE', 'En copie'); + +//notifications engine +if (!defined('_WRONG_FUNCTION_OR_WRONG_PARAMETERS')) + define('_WRONG_FUNCTION_OR_WRONG_PARAMETERS','Mauvaise fonction ou mauvais paramètre'); + +//annotations +if (!defined('_NEW_NOTE_BY_MAIL')) + define('_NEW_NOTE_BY_MAIL', 'Nouvelle annotation pour le courrier'); +if (!defined('_HELLO_NOTE')) + define('_HELLO_NOTE', 'Bonjour, vous avez une nouvelle annotation pour le courrier'); +if (!defined('_NOTE_BODY')) + define('_NOTE_BODY', 'La note est la suivante : '); +if (!defined('_NOTE_DETAILS')) + define('_NOTE_DETAILS', 'Cette note à été ajoutée par : '); +if (!defined('_NOTE_DATE_DETAILS')) + define('_NOTE_DATE_DETAILS', 'le'); +if (!defined('_LINK_TO_MAARCH')) + define('_LINK_TO_MAARCH', 'Vous pouvez accéder au courrier depuis ce lien'); + +//v2.0 +if (!defined('_ADMIN_NOTIFICATIONS')) + define('_ADMIN_NOTIFICATIONS', 'Notifications'); +if (!defined('_ADMIN_NOTIFICATIONS_DESC')) + define('_ADMIN_NOTIFICATIONS_DESC', 'Créer et gérer des notifications aux utilisateurs basées sur des événements de l\'application'); +if (!defined('_MANAGE_NOTIFS')) + define('_MANAGE_NOTIFS', 'Gérer les notifications'); +if (!defined('_MANAGE_NOTIFS_DESC')) + define('_MANAGE_NOTIFS_DESC', 'Ajouter ou modifier des notifications à notifier'); +if (!defined('_TEST_SENDMAIL')) + define('_TEST_SENDMAIL', 'Tester la configuration'); +if (!defined('_TEST_SENDMAIL_DESC')) + define('_TEST_SENDMAIL_DESC', 'Vérifier le paramétrage du module de notification'); +if (!defined('_NOTIFS_LIST')) + define('_NOTIFS_LIST', 'Liste des notifications'); +if (!defined('_THIS_NOTIF')) + define('_THIS_NOTIF', 'Cette notification'); +if (!defined('_IS_UNKNOWN')) + define('_IS_UNKNOWN', 'est inconnue'); +if (!defined('_MODIFY_NOTIF')) + define('_MODIFY_NOTIF', 'Modifier notification'); +if (!defined('_ADD_NOTIF')) + define('_ADD_NOTIF', 'Ajouter notification'); +if (!defined('_NOTIFICATION_ID')) + define('_NOTIFICATION_ID', 'Identifiant de notification'); +if (!defined('_DIFFUSION_TYPE')) + define('_DIFFUSION_TYPE', 'Type de diffusion'); +if (!defined('_NOTIFICATION_MODE')) + define('_NOTIFICATION_MODE', 'Mode de notification'); +if (!defined('_RSS')) + define('_RSS', 'Flux RSS'); +if (!defined('_RSS_URL_TEMPLATE')) + define('_RSS_URL_TEMPLATE', 'Lien du flux'); +if (!defined('_SYSTEM_NOTIF')) + define('_SYSTEM_NOTIF', 'Notification système'); +if (!defined('_ATTACH_MAIL_FILE')) + define('_ATTACH_MAIL_FILE', 'Joindre le document à la notification'); +if (!defined('_NEVER')) + define('_NEVER', 'Jamais'); +if (!defined('_NO_ATTACHMENT_WITH_NOTIFICATION')) + define('_NO_ATTACHMENT_WITH_NOTIFICATION', 'Les documents ne sont joints à la notification pour aucun utilisateur'); + +//List of require +if (!defined('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE')) + define('_NOTIFICATIONS_LISTINSTANC_DIFF_TYPE', 'Les courriels de notifications seront diffusés à tous les utilisateurs de la liste de diffusion (destinataire principal et copies)'); +if (!defined('_DIFFUSION_LIST')) + define('_DIFFUSION_LIST', 'Liste de diffusion'); +if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE')) + define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE', 'Envoi au destinataire principal du document'); +if (!defined('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS')) + define('_NOTIFICATIONS_DEST_USER_DIFF_TYPE_WITH_STATUS', 'Envoi au destinataire principal du document avec le(s) statut(s):'); +if (!defined('_DEST_USER')) + define('_DEST_USER', 'Destinataire principal'); +if (!defined('_NOTE_DEST_USER')) + define('_NOTE_DEST_USER', 'Destinataire principal du document annoté'); +if (!defined('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE')) + define('_NOTIFICATIONS_COPY_LIST_DIFF_TYPE', 'Envoi aux utilisateurs en copie du document'); +if (!defined('_COPYLIST')) + define('_COPYLIST', 'Utilisateurs en copie'); +if (!defined('_NOTE_COPY_LIST')) + define('_NOTE_COPY_LIST', 'Destinataires en copie du document annoté'); +if (!defined('_NOTIFICATIONS_GROUP_DIFF_TYPE')) + define('_NOTIFICATIONS_GROUP_DIFF_TYPE', 'Envoi aux utilisateurs du(des) groupe(s) spécifié(s)'); +if (!defined('_NOTIFICATIONS_ENTITY_DIFF_TYPE')) + define('_NOTIFICATIONS_ENTITY_DIFF_TYPE', 'Envoi aux utilisateurs des entité(s) spécifiée(s)'); +if (!defined('_NOTIFICATIONS_USER_DIFF_TYPE')) + define('_NOTIFICATIONS_USER_DIFF_TYPE', 'Envoi aux utilisateurs spécifiés'); +if (!defined('_SELECT_EVENT_TYPE')) + define('_SELECT_EVENT_TYPE', '-- Sélectionner l\'événement --'); +if (!defined('_SELECT_TEMPLATE')) + define('_SELECT_TEMPLATE', '-- Sélectionner le modèle --'); +if (!defined('_SELECT_DIFFUSION_TYPE')) + define('_SELECT_DIFFUSION_TYPE', '-- Sélectionner la diffusion --'); +if (!defined('_NOTIF_ADDED')) + define('_NOTIF_ADDED', 'Notification ajoutée'); +if (!defined('_NOTIF_DELETED')) + define('_NOTIF_DELETED', 'Notification supprimée'); +if (!defined('_NOTIF_MODIFIED')) + define('_NOTIF_MODIFIED', 'Notification modifiée'); +if (!defined('_NOTIF_EMPTY')) + define('_NOTIF_EMPTY', 'Notification vide'); +if (!defined('_ALL_NOTIFS')) + define('_ALL_NOTIFS', 'Toutes les notifications'); +if (!defined('_SYSTEM')) + define('_SYSTEM', 'Système'); +if (!defined('_ENTITY')) + define('_ENTITY', 'Entité'); +if (!defined('_NOTIFICATIONS_CONTACT_DIFF_TYPE')) + define('_NOTIFICATIONS_CONTACT_DIFF_TYPE', 'Envoi à l\'expéditeur du courrier'); +if (!defined('_SCHEDULE_NOTIFICATIONS')) + define('_SCHEDULE_NOTIFICATIONS', 'Planifier les notifications'); +if (!defined('_HOUR')) + define('_HOUR', 'Heure'); +if (!defined('_MINUTE')) + define('_MINUTE', 'Minute'); +if (!defined('_DAY')) + define('_DAY', 'Jour'); +if (!defined('_WEEKDAY')) + define('_WEEKDAY', 'Jour de la semaine'); +if (!defined('_NOTIF_DESCRIPTION')) + define('_NOTIF_DESCRIPTION', 'Description de la notification'); +if (!defined('_CRONTAB_SAVED')) + define('_CRONTAB_SAVED', 'La tâche planifiée à été sauvegardée'); +if (!defined('_MONDAY')) + define('_MONDAY', 'Lundi'); +if (!defined('_TUESDAY')) + define('_TUESDAY', 'Mardi'); +if (!defined('_WEDNESDAY')) + define('_WEDNESDAY', 'Mercredi'); +if (!defined('_THURSDAY')) + define('_THURSDAY', 'Jeudi'); +if (!defined('_FRIDAY')) + define('_FRIDAY', 'Vendredi'); +if (!defined('_SATURDAY')) + define('_SATURDAY', 'Samedi'); +if (!defined('_SUNDAY')) + define('_SUNDAY', 'Dimanche'); +if (!defined('_HELP_CRON')) + define('_HELP_CRON', 'Cette partie permet de définir quand seront envoyées les notifications. + <br/><br/>Si vous choisissez * dans toutes les listes déroulantes, la notification sera envoyée toutes les minutes 365 jours par an. + <br/><br/>Exemple de fréquence : + <br/> + <br/>14 30 * * * [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les jours à 14h30 + <br/> 9 30 * * Lundi [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les lundi à 9h30'); +if (!defined('_CHOOSE_NOTIF')) + define('_CHOOSE_NOTIF', 'Choisissez une notification'); +if (!defined('_NO_NOTIF')) + define('_NO_NOTIF', 'Aucune notification planifiée'); +if (!defined('_CREATE_NOTIF_SCRIPT')) + define('_CREATE_NOTIF_SCRIPT', 'Créer le script'); diff --git a/notifications/trunk/manage_notifications.php b/notifications/trunk/manage_notifications.php index dd2fa9a885c532746c549fca2de03494b2cb98d1..b23d38205ac15dff1c2f9686fffbd333a8537532 100644 --- a/notifications/trunk/manage_notifications.php +++ b/notifications/trunk/manage_notifications.php @@ -272,7 +272,21 @@ if ($mode == 'list') { echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=manage_notifications_controler&mode=list&module=notifications'"/> + <?php + $filename = "notification"; + if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id']<>"") { + $filename.="_".str_replace(" ", "", $_SESSION['custom_override_id']); + } + $filename.="_".$notification_sid.".sh"; + + if ($mode == 'up' && PHP_OS == "Linux" && !file_exists($_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename)) {?> + <input class="button" type="button" name="create_notif_script" id="create_notif_script" value="<?php echo _CREATE_NOTIF_SCRIPT; ?>" + onclick="createNotifScript('<?php echo $_SESSION['config']['businessappurl']; + ?>index.php?display=true&page=create_notif_script&module=notifications', '<?php echo $_SESSION['m_admin']['notification']['notification_sid'];?>', '<?php echo $_SESSION['m_admin']['notification']['notification_id'];?>')"/> + <?php + } + ?> </p> </form > <?php diff --git a/notifications/trunk/manage_notifications_controler.php b/notifications/trunk/manage_notifications_controler.php index 506d4bfb64f4030541e9e4c6c5c0842249f55fd9..a4a6e029dc28bf3468a3a65a00f2fb165ab5e411 100644 --- a/notifications/trunk/manage_notifications_controler.php +++ b/notifications/trunk/manage_notifications_controler.php @@ -18,14 +18,14 @@ try{ require_once 'modules/templates/class/templates_controler.php' ; require_once 'modules/notifications/class/notifications_controler.php'; require_once 'modules/notifications/class/diffusion_type_controler.php'; - + require_once 'modules/notifications/class/class_schedule_notifications.php'; if ($mode == 'list') { require_once 'core/class/class_request.php' ; require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_list_show.php' ; - }else if($mode == 'add' || $mode == 'up'){ + }else if($mode == 'add' || $mode == 'up' || $mode == 'del'){ require_once 'core/class/class_request.php' ; } } catch (Exception $e) { @@ -164,6 +164,18 @@ function display_add() * Initialize session parameters for list display */ function display_list() { + + if (PHP_OS == "Linux") { + ?> + <table width="100%"> + <tr> + <td align="right"> + <input class="button" type="button" value="<?php echo _SCHEDULE_NOTIFICATIONS;?>" onclick="window.location.href='<?php echo $_SESSION['config']['businessappurl'] . 'index.php?page=schedule_notifications&module=notifications'?>'"/> + </td> + </tr> + </table> + <?php + } $_SESSION['m_admin'] = array(); $list = new list_show(); $func = new functions(); @@ -266,6 +278,33 @@ function display_del($notification_sid) { $_SESSION['error'] = str_replace("#", "<br />", $control['error']); } else { $_SESSION['error'] = _NOTIF_DELETED.' : '.$notification_sid; + + if (PHP_OS == "Linux") { + // delete scheduled notification + $filename = "notification"; + if (isset($_SESSION['custom_override_id']) && $_SESSION['custom_override_id']<>"") { + $filename.="_".str_replace(" ", "", $_SESSION['custom_override_id']); + } + $filename.="_".$notification_sid.".sh"; + + $scheduleNotification = new ScheduleNotifications(); + $cronTab = $scheduleNotification->getCrontab(); + + $flagCron = false; + foreach ($cronTab as $key => $value) { + if($value['cmd'] == $_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename){ + $cronTab[$key]['state'] = 'deleted'; + $flagCron = true; + break; + } + } + + if ($flagCron) { + $scheduleNotification->saveCrontab($cronTab, true); + } + + shell_exec("rm -f ".$_SESSION['config']['corepath'].'modules/notifications/batch/scripts/'.$filename); + } } ?><script type="text/javascript">window.top.location='<?php echo $_SESSION['config']['businessappurl'] @@ -398,6 +437,11 @@ function validate_notif_submit() { } else { if ($mode == 'add') { $_SESSION['error'] = _NOTIF_ADDED; + + if (PHP_OS == "Linux") { + $ScheduleNotifications = new ScheduleNotifications(); + $ScheduleNotifications->createScriptNotification($control['value'], $notifObj->notification_id); + } } else { $_SESSION['error'] = _NOTIF_MODIFIED; } diff --git a/notifications/trunk/schedule_notifications.php b/notifications/trunk/schedule_notifications.php new file mode 100644 index 0000000000000000000000000000000000000000..29079a3b5b0e62c6bc58d7bf37c2606cc90a4d60 --- /dev/null +++ b/notifications/trunk/schedule_notifications.php @@ -0,0 +1,299 @@ +<?php + +/* +* Copyright 2015 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief schedule notifications +* +* +* @file +* @author <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->test_admin('admin_notif', 'notifications'); + +require_once 'modules/notifications/class/class_schedule_notifications.php'; + +/****************Management of the location bar ************/ + $init = false; + if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == 'true') { + $init = true; + } + + $level = ''; + if (isset($_REQUEST['level']) + && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 + || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) { + $level = $_REQUEST['level']; + } + + $pagePath = $_SESSION['config']['businessappurl'] . 'index.php?page=' + . 'schedule_notifications&module=notifications' ; + $pageLabel = _SCHEDULE_NOTIFICATIONS; + $pageId = "schedule_notifications"; + $ct = new core_tools(); + $ct->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); +/***********************************************************/ + +?> +<h1> + <img class="title_img" alt="" src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=view_history_b.gif"> + <?php echo _SCHEDULE_NOTIFICATIONS;?> +</h1> + +<?php + +$schedule = new ScheduleNotifications(); + +$data = $schedule->getCrontab(); +$notifications = $schedule->getAuthorizedNotifications(); + +?> + +<script> + var linecount = <?php echo count($data); ?>; + + function add_cronLine(){ + $("cron").innerHTML += "<tr id='row-"+linecount+"'>\ + <td>\ + <select name='data["+linecount+"][h]'>\ + <option value=\"*\">*</option>\ + <?php + for($iHours=0;$iHours<24;$iHours++){?>\ + <option value='<?php echo $iHours;?>'\ + <?php if ($iHours == $e['h']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $iHours;?>\ + </option>\ + <?php } ?>\ + </select>\ + </td>\ + <td width=\"10%\">\ + <select name='data["+linecount+"][m]'>\ + <option value=\"*\">*</option>\ + <?php + for($iMinutes=0;$iMinutes<60;$iMinutes++){ ?>\ + <option value='<?php echo $iMinutes;?>'\ + <?php if ($iMinutes == $e['m']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $iMinutes;?>\ + </option>\ + <?php } ?>\ + </select>\ + </td>\ + <td width=\"10%\">\ + <select name='data["+linecount+"][dom]'>\ + <option value=\"*\">*</option>\ + <?php + for($iDay=1;$iDay<32;$iDay++){ ?>\ + <option value='<?php echo $iDay;?>'\ + <?php if ($iDay == $e['dom']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $iDay;?>\ + </option>\ + <?php } ?>\ + </select>\ + </td>\ + <td width=\"15%\">\ + <select name='data["+linecount+"][mon]'>\ + <option value =\"*\">*</option>\ + <?php $month_array = array(1 => _JANUARY, _FEBRUARY, _MARCH, _APRIL, _MAY, _JUNE, _JULY, _AUGUST, _SEPTEMBER, _OCTOBER, _NOVEMBER, _DECEMBER); + for($iMonth=1;$iMonth<13;$iMonth++) { + ?> <option value=\"<?php echo $iMonth;?>\"\ + <?php if ($iMonth == $e['mon']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $month_array[$iMonth];?>\ + </option>\ + <?php } ?>\ + </select>\ + </td>\ + <td width=\"20%\">\ + <select name='data["+linecount+"][dow]'>\ + <option value =\"*\">*</option>\ + <?php $weekday_array = array(1 => _MONDAY, _TUESDAY, _WEDNESDAY, _THURSDAY, _FRIDAY, _SATURDAY, _SUNDAY); + for($iWeekDay=1;$iWeekDay<8;$iWeekDay++) { + ?> <option value=\"<?php echo $iWeekDay;?>\"\ + <?php if ($iWeekDay == $e['dow']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $weekday_array[$iWeekDay];?>\ + </option>\ + <?php } ?>\ + </select>\ + </td>\ + <td width=\"40%\">\ + <select style=\"width:100%\" name='data["+linecount+"][cmd]'>\ + <option><?php echo _CHOOSE_NOTIF;?></option>\ + <?php foreach ($notifications as $key => $value) { + ?><option value=\"<?php echo $key;?>\"\ + <?php if ($key == $e['cmd']) { ?>\ + selected=\"selected\"\ + <?php } ?>\ + >\ + <?php echo $value;?>\ + </option>\ + <?php } ?>\ + </select></td>\ + <td width=\"20px\" align=\"center\">\ + <input type='hidden' id='state-"+linecount+"' name='data["+linecount+"][state]' value='normal' />\ + <img onclick='del("+linecount+");' alt='X' src='<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=picto_delete.gif' onmouseover=\"this.style.cursor='pointer'\"/>\ + </td>\ + </tr>"; + linecount++; + $('no_notif').style.display="none"; + } +</script> +<br/> +<br/> +<?php echo _HELP_CRON;?> +<br/> +<br/> +<div class='crontab'> + <form method='POST' action="<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&module=notifications&page=schedule_notifications_controler"> + <table id='cron'> + <tr> + <td style="color:#16adeb"><?php echo _HOUR ?></td> + <td width="10%" style="color:#16adeb"><?php echo _MINUTE ?></td> + <td width="10%" style="color:#16adeb"><?php echo _DAY ?></td> + <td width="15%" style="color:#16adeb"><?php echo _MONTH ?></td> + <td width="20%" style="color:#16adeb"><?php echo _WEEKDAY ?></td> + <td width="40%" style="color:#16adeb"><?php echo _NOTIF_DESCRIPTION ?></td> + <td></td> + </tr> + <?php foreach ($data as $id => $e) { ?> + <tr id='row-<?php echo $id; ?>'> + <td> + <select name='data[<?php echo $id; ?>][h]'> + <option value="*">*</option> + <?php + for($iHours=0;$iHours<24;$iHours++){?> + <option value='<?php echo $iHours;?>' + <?php if ($iHours == $e['h']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $iHours;?> + </option> + <?php } ?> + </select> + </td> + <td width="10%"> + <select name='data[<?php echo $id; ?>][m]'> + <option value="*">*</option> + <?php + for($iMinutes=0;$iMinutes<60;$iMinutes++){ ?> + <option value='<?php echo $iMinutes;?>' + <?php if ($iMinutes == $e['m']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $iMinutes;?> + </option> + <?php } ?> + </select> + </td> + <td width="10%"> + <select name='data[<?php echo $id; ?>][dom]'> + <option value="*">*</option> + <?php + for($iDay=1;$iDay<32;$iDay++){ ?> + <option value='<?php echo $iDay;?>' + <?php if ($iDay == $e['dom']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $iDay;?> + </option> + <?php } ?> + </select> + </td> + <td width="15%"> + <select name='data[<?php echo $id; ?>][mon]'> + <option value ="*">*</option> + <?php $month_array = array(1 => _JANUARY, _FEBRUARY, _MARCH, _APRIL, _MAY, _JUNE, _JULY, _AUGUST, _SEPTEMBER, _OCTOBER, _NOVEMBER, _DECEMBER); + for($iMonth=1;$iMonth<13;$iMonth++) { + ?> <option value="<?php echo $iMonth;?>" + <?php if ($iMonth == $e['mon']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $month_array[$iMonth];?> + </option> + <?php } ?> + </select> + </td> + <td width="20%"> + <select name='data[<?php echo $id; ?>][dow]'> + <option value ="*">*</option> + <?php $weekday_array = array(1 => _MONDAY, _TUESDAY, _WEDNESDAY, _THURSDAY, _FRIDAY, _SATURDAY, _SUNDAY); + for($iWeekDay=1;$iWeekDay<8;$iWeekDay++) { + ?> <option value="<?php echo $iWeekDay;?>" + <?php if ($iWeekDay == $e['dow']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $weekday_array[$iWeekDay];?> + </option> + <?php } ?> + </select> + </td> + <td width="40%"> + <select style="width:100%" name='data[<?php echo $id; ?>][cmd]'> + <option><?php echo _CHOOSE_NOTIF;?></option> + <?php foreach ($notifications as $key => $value) { + ?><option value="<?php echo $key;?>" + <?php if ($key == $e['cmd']) { ?> + selected="selected" + <?php } ?> + > + <?php echo $value;?> + </option> + <?php } ?> + </select> + </td> + <td width="20px" align="center"> + <input type='hidden' id='state-<?php echo $id; ?>' name='data[<?php echo $id; ?>][state]' value='normal' /> + <img onclick='del(<?php echo $id; ?>);' alt='X' src='<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=picto_delete.gif' onmouseover="this.style.cursor='pointer'"/> + </td> + </tr> + <?php } ?> + </table> + <span id="no_notif"><i><?php echo _NO_NOTIF;?></i></span><br/> + <img class='addbutton' onclick='add_cronLine();' src='<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=add_schedule_notif.gif' onmouseover="this.style.cursor='pointer'" alt='+' /> + <br /> + <br /> + <input type='submit' value='<?php echo _VALIDATE; ?>' name='save' class="button" /> + <input type="button" class="button" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=manage_notifications_controler&mode=list&module=notifications'" value="<?php echo _CANCEL; ?>" name="cancel"> + </form> +</div> diff --git a/notifications/trunk/schedule_notifications_controler.php b/notifications/trunk/schedule_notifications_controler.php new file mode 100644 index 0000000000000000000000000000000000000000..f899378f878be9da342818742c1b9843e41879dd --- /dev/null +++ b/notifications/trunk/schedule_notifications_controler.php @@ -0,0 +1,45 @@ +<?php + +/* +* Copyright 2015 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* Maarch Framework is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** +* @brief schedule notifications controler +* +* +* @file +* @author <dev@maarch.org> +* @date $date$ +* @version $Revision$ +* @ingroup admin +*/ + +$core_tools = new core_tools(); +$core_tools->test_user(); +$core_tools->test_admin('admin_notif', 'notifications'); + +require_once 'modules/notifications/class/class_schedule_notifications.php'; +$schedule = new ScheduleNotifications(); + +$return = $schedule->saveCrontab($_POST['data']); + +header( + 'location: ' . $_SESSION['config']['businessappurl'] + . 'index.php?page=schedule_notifications&module=notifications' +);