Dotclear


Ignore:
Timestamp:
10/01/13 09:06:01 (12 years ago)
Author:
Dsls
Branch:
default
Message:

Non-repeatable notifications, step 1, see #1710.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.page.php

    r2167 r2181  
    175175               '</div>'; 
    176176          } 
    177      } 
    178  
     177           
     178          if (isset($_SESSION['notifications'])) { 
     179               $types = array("success" => "success", "warning" => "warning-msg"); 
     180               $notifications = $_SESSION['notifications']; 
     181               foreach ($types as $type => $class) { 
     182                    if (isset($notifications[$type])) { 
     183                         foreach ($notifications[$type] as $n) { 
     184                              echo self::getNotification($n,$class); 
     185                         } 
     186                    } 
     187               } 
     188               unset($_SESSION['notifications']); 
     189          } 
     190           
     191     } 
     192     public static function AddNotice($type,$message) { 
     193          $notification = isset($_SESSION['notifications']) ? $_SESSION['notifications']:array(); 
     194          $notification[$type][] = array('ts' => time(), 'text' => $message); 
     195          $_SESSION['notifications'] = $notification; 
     196     } 
     197     public static function addSuccessNotice($message) { 
     198          self::addNotice("success",$message); 
     199     } 
     200     public static function addWarningNotice($message) { 
     201          self::addNotice("warning",$message); 
     202     } 
     203      
     204     protected static function getNotification($msg,$class) { 
     205          global $core; 
     206          $res = '<p class="'.$class.'">'. 
     207          dt::str(__('[%H:%M:%S] '),$msg['ts'],$core->auth->getInfo('user_tz')).' '.$msg['text']. 
     208          '</p>'; 
     209          return $res;    
     210     } 
    179211     public static function close() 
    180212     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map