Ejemplo n.º 1
0
 //The score must be between 0 and 100
 $config_form->addRule('notifications_max_sent_messages', _THEFIELD . ' "' . _MAXIMUMSENTMESSAGESSTORED . '" ' . _MUSTBENUMERIC, 'numeric', null, 'client');
 $config_form->addRule('notifications_max_sent_messages', _THEFIELD . ' "' . _MAXIMUMSENTMESSAGESSTORED . '" ' . _ISMANDATORY, 'required', null, 'client');
 $config_form->addElement('select', 'notifications_send_mode', _SENDMODE, array(_EMAIL, _PERSONALMESSAGE, _EMAILANDPM));
 $config_form->addRule('notifications_max_sent_messages', _THEFIELD . ' "' . _MAXIMUMSENTMESSAGESSTORED . '" ' . _MUSTBENUMERIC, 'numeric', null, 'client');
 $config_form->addElement('submit', 'submit_variables', _SUBMIT, 'class = "flatButton"');
 $notification_configurations = array('notifications_use_cron', 'notifications_pageloads', 'notifications_maximum_inter_time', 'notifications_messages_per_time', 'notifications_max_sent_messages', 'notifications_send_mode');
 foreach ($notification_configurations as $conf_option) {
     $config_form->setDefaults(array($conf_option => $GLOBALS['configuration'][$conf_option]));
 }
 if ($config_form->isSubmitted()) {
     foreach ($notification_configurations as $conf_option) {
         EfrontConfiguration::setValue($conf_option, $config_form->exportValue($conf_option));
     }
     // Clear the stored sent messages according to the new limitations
     EfrontNotification::clearSentMessages();
     $message = _NOTIFICATIONCONFIGURATIONSUPDATEDSUCCESSFULLY;
     $message_type = 'success';
     eF_redirect("" . $_SESSION['s_type'] . ".php?ctg=digests&message=" . urlencode($message) . "&message_type=" . $message_type);
 }
 $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
 //Create a smarty renderer
 $renderer->setRequiredTemplate('{$html}{if $required}
         &nbsp;<span class = "formRequired">*</span>
     {/if}');
 if (isset($currentUser->coreAccess['notifications']) && $currentUser->coreAccess['notifications'] != 'change') {
     $config_form->freeze();
 }
 $config_form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
 //Set javascript error messages
 $config_form->setRequiredNote(_REQUIREDNOTE);