Exemple #1
0
 public function notf()
 {
     $this->load->helper('review_format');
     $subject = 'New reviews';
     $users = Reviews_notification::getUniqUsers();
     foreach ($users as $user) {
         $dap_user = new User($user['user_id']);
         if (!$dap_user) {
             //Reviews_notification::deleteAllByUser($user['user_id']);
             continue;
         }
         $email = $dap_user->email;
         $reviews = Reviews_notification::getReviewsByUser($user['user_id']);
         if ($reviews->count()) {
             $notification = array('to' => $email, 'subject' => $subject, 'body' => array());
             $notification['body']['body'] = $this->template->block('notify_review', 'templates/email/notify_review', array('reviews' => $reviews));
             $notification['body']['content_type'] = 'text/html';
             $sender = $this->get('core.mailer');
             $sender->sendMail($notification['subject'], $notification['body'], $notification['to']);
             // $reviews->delete_all();
         }
     }
 }