can('notification','read')) return; ?>
{{{html}}}
'.$infos['html'].'
'; $mail->message .= (isset($infos['meta']['link'])) ? 'Accéder à l\'ERP' : ''; $usermail = User::byLogin($recipient); $mail->recipients['to'][] = $usermail->mail; /* /!\ ralentissements /!\ */ $test = $mail->send(); } ); $sendTypes[] = array( 'slug' => 'interface', 'label' => 'Interface', 'explain' => 'Visualisation via l\'ERP', 'icon' => 'far fa-bell', 'callback' => function($recipient, $infos, $notification){ if($infos['pinned'] == 1) return; if(!isset($recipient)) throw new Exception("Aucun destinataires n\'a été renseignés pour l\'envoi de notifications à travers l\'ERP"); $userNotification = new UserNotification(); $userNotification->notification = $notification->id; $userNotification->user = $recipient; $userNotification->read = 0; $userNotification->save(); } ); } function notification_widget(&$widgets){ global $myUser; require_once(__DIR__.SLASH.'..'.SLASH.'dashboard'.SLASH.'DashboardWidget.class.php'); $modelWidget = new DashboardWidget(); $modelWidget->model = 'notification'; $modelWidget->title = 'Notification'; $modelWidget->options[] = array('function'=>'window.location = \'index.php?module=notification\';','icon'=>'fa-eye','title'=>'Toutes les notifications'); $modelWidget->icon = 'fas fa-bell'; $modelWidget->background = '#fa8231'; $modelWidget->load = 'action.php?action=notification_widget_load'; $modelWidget->configure = 'action.php?action=notification_widget_configure'; $modelWidget->configure_callback = 'notification_widget_configure_save'; $modelWidget->js = [Plugin::url().'/js/widget.js?v='.time()]; $modelWidget->css = [Plugin::url().'/css/widget.css?v=1'.time()]; $modelWidget->description = "Affiche les dernières alertes d'une catégorie donnée"; $widgets[] = $modelWidget; } //Déclaration des settings de base //Types possibles : text,select ( + "values"=> array('1'=>'Val 1'),password,checkbox. Un simple string définit une catégorie. Configuration::setting('notification',array( "E-mail", 'notification_mail_from' => array("label"=>"Envois de la part de","legend"=>"format: Nom <email>, ex: Idleman <no-reply@hackpoint.fr>","type"=>"text"), 'notification_mail_reply' => array("label"=>"Réponse au mail","legend"=>"adresse e-mail unique ex: me@domain.com","type"=>"text"), )); //Déclation des assets Plugin::addCss("/css/main.css"); Plugin::addJs("/js/main.js"); //Mapping hook / fonctions Plugin::addHook("widget", "notification_widget"); Plugin::addHook("install", "notification_install"); Plugin::addHook("uninstall", "notification_uninstall"); Plugin::addHook("section", "notification_section"); Plugin::addHook("login_header", "notification_menu"); Plugin::addHook("page", "notification_page"); Plugin::addHook("action", "notification_action"); Plugin::addHook("menu_account", "notification_menu_account"); Plugin::addHook("content_account", "notification_content_account"); Plugin::addHook("menu_setting", "notification_menu_setting"); Plugin::addHook("content_setting", "notification_content_setting"); Plugin::addHook("emit_notification", "notification_emit_notification"); Plugin::addHook("notification_methods", "notification_methods"); ?>