| @@ -25,10 +25,8 @@ | ||
| 25 | 25 | public $translate; |
| 26 | 26 | public $usersQuery; |
| 27 | 27 | public $auth; |
| 28 | 28 | |
| 29 | - public $loaded = false; | |
| 30 | - | |
| 31 | 29 | public function __construct( |
| 32 | 30 | HC3_Hooks $hooks, |
| 33 | 31 | |
| 34 | 32 | HC3_Post $post, |
| @@ -52,52 +50,23 @@ | ||
| 52 | 50 | } |
| 53 | 51 | |
| 54 | 52 | public function isOn() |
| 55 | 53 | { |
| 56 | - $this->loadConf(); | |
| 57 | - $ret = $this->off ? false : true; | |
| 54 | + $ret = $this->off ? FALSE : TRUE; | |
| 58 | 55 | return $ret; |
| 59 | 56 | } |
| 60 | 57 | |
| 61 | - public function isOff() | |
| 62 | - { | |
| 63 | - $this->loadConf(); | |
| 64 | - $ret = $this->off ? true : false; | |
| 65 | - return $ret; | |
| 66 | - } | |
| 67 | - | |
| 68 | - public function loadConf() | |
| 69 | - { | |
| 70 | - if( ! $this->loaded ){ | |
| 71 | - $isOff = $this->session()->getUserdata( 'noNotification' ); | |
| 72 | - $this->off = $isOff ? true : false; | |
| 73 | - $this->loaded = true; | |
| 74 | - } | |
| 75 | - | |
| 76 | - return $this; | |
| 77 | - } | |
| 78 | - | |
| 79 | 58 | public function setOff() |
| 80 | 59 | { |
| 81 | - if( $this->isOff() ){ | |
| 82 | - return $this; | |
| 83 | - } | |
| 84 | - | |
| 85 | - $this->off = true; | |
| 60 | + $this->off = TRUE; | |
| 86 | 61 | $this->session()->setUserdata('noNotification', 1); |
| 87 | - | |
| 88 | 62 | return $this; |
| 89 | 63 | } |
| 90 | 64 | |
| 91 | 65 | public function setOn() |
| 92 | 66 | { |
| 93 | - if( ! $this->isOff() ){ | |
| 94 | - return $this; | |
| 95 | - } | |
| 96 | - | |
| 97 | - $this->off = false; | |
| 67 | + $this->off = FALSE; | |
| 98 | 68 | $this->session()->setUserdata('noNotification', 0); |
| 99 | - | |
| 100 | 69 | return $this; |
| 101 | 70 | } |
| 102 | 71 | |
| 103 | 72 | public function session() |
| @@ -106,9 +75,14 @@ | ||
| 106 | 75 | } |
| 107 | 76 | |
| 108 | 77 | public function queue( HC3_Users_Model $user, $key, $msg ) |
| 109 | 78 | { |
| 110 | - if( $this->isOff() ){ | |
| 79 | + $isOff = $this->session()->getUserdata('noNotification'); | |
| 80 | + if( $isOff ){ | |
| 81 | + $this->setOff(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + if( $this->off ){ | |
| 111 | 85 | return $this; |
| 112 | 86 | } |
| 113 | 87 | |
| 114 | 88 | $to = $user->getEmail(); |