public static function sendNotificationToAdmin($args)
 {
     list($idsite, $idvisitor, $message) = $args;
     $visitorInfo = ChatPersonnalInformation::get($idvisitor);
     $subject = "New message on " . ChatSite::getSiteName($idsite);
     $mail = new Mail();
     $mail->setFrom(Config::getInstance()->General['noreply_email_address'], "Piwik Chat");
     $mail->setSubject($subject);
     $mail->setBodyHtml("Name : " . $visitorInfo['name'] . "<br />\n        Email : " . $visitorInfo['email'] . "<br />\n        Phone : " . $visitorInfo['phone'] . "<br />\n        Comments : " . $visitorInfo['comments'] . "<br />\n        <br /><br />\n        Message:<br />{$message}");
     foreach (ChatCommon::getUsersBySite($idsite) as $user) {
         if (empty($user['email'])) {
             continue;
         }
         if (ChatPiwikUser::isStaffOnline($user['login'])) {
             continue;
         }
         $mail->addTo($user['email']);
         try {
             $mail->send();
         } catch (Exception $e) {
             throw new Exception("An error occured while sending '{$subject}' " . " to " . implode(', ', $mail->getRecipients()) . ". Error was '" . $e->getMessage() . "'");
         }
         $mail->clearRecipients();
     }
 }
 public function reportBug()
 {
     Piwik::checkUserHasSomeAdminAccess();
     $idSite = Common::getRequestVar('idSite', null, 'int');
     $jsonConfig = json_decode(file_get_contents(getcwd() . '/plugins/Chat/plugin.json'), true);
     $view = new view('@Chat/reportBug.twig');
     $view->piwikVersion = Version::VERSION;
     $view->chatVersion = $jsonConfig['version'];
     $view->email = Piwik::getCurrentUserEmail();
     $view->website = ChatSite::getMainUrl($idSite);
     $view->idSite = $idSite;
     $view->displayNotice = Common::getRequestVar('submittedBugReport', '0', 'int');
     return $view->render();
 }