Exemplo n.º 1
0
         {/if}');
     if (isset($currentUser->coreAccess['notifications']) && $currentUser->coreAccess['notifications'] != 'change') {
         $form->freeze();
     }
     $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
     //Set javascript error messages
     $form->setRequiredNote(_REQUIREDNOTE);
     $form->accept($renderer);
     //Assign this form to the renderer, so that corresponding template code is created
     $smarty->assign('T_DIGESTS_FORM', $renderer->toArray());
     //Assign the form to the template
 } else {
     // Getting first the messages' queue table, because it is ajaxed
     $smarty->assign("T_TIMESTAMP_NOW", time());
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'sentQueueTable') {
         $dataSource = EfrontNotification::getRecentlySent();
         $tableName = $_GET['ajax'];
         include "sorted_table.php";
         //$smarty -> assign("T_RECENTLY_SENT_NOTIFICATIONS", EfrontNotification::getRecentlySent());
     }
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'msgQueueTable') {
         isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
         if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
             $sort = $_GET['sort'];
             // @TODO fix
             if ($sort == "timestamp") {
                 $order = "desc";
             } else {
                 isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
             }
         } else {
 public static function clearSentMessages()
 {
     $all_stored_sent = EfrontNotification::getRecentlySent();
     $total_num = sizeof($all_stored_sent);
     if ($total_num > $GLOBALS['configuration']['notifications_max_sent_messages']) {
         $sent_messages_to_delete = $total_num - $GLOBALS['configuration']['notifications_max_sent_messages'];
         // he list is sorted so delete the messages after the Nth entry
         $ids_to_delete = array();
         for ($i = $GLOBALS['configuration']['notifications_max_sent_messages']; isset($all_stored_sent[$i]); $i++) {
             $ids_to_delete[] = $all_stored_sent[$i]['id'];
         }
         if (!empty($ids_to_delete)) {
             eF_deleteTableData("sent_notifications", "id in ('" . implode("','", $ids_to_delete) . "')");
         }
     }
 }