Example #1
0
 /**
  * send notification to a single attender
  * 
  * @param Webconference_Model_Event       $_event
  * @param Tinebase_Model_FullAccount      $_updater
  * @return void
  */
 public function sendNotificationToAttender($users, $moderator, $roomName)
 {
     $translate = Tinebase_Translation::getTranslation('Webconference');
     try {
         /*        
                     // find organizer account
                     if ($_event->organizer && $_event->resolveOrganizer()->account_id) {
                         $organizer = Tinebase_User::getInstance()->getFullUserById($_event->resolveOrganizer()->account_id);
                     } else {
                         // use creator as organizer
                         $organizer = Tinebase_User::getInstance()->getFullUserById($_event->created_by);
                     }
           // get prefered language, timezone and notification level
                     $prefUser = $_attender->getUserAccountId();
                     $locale = Tinebase_Translation::getLocale(Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::LOCALE, $prefUser ? $prefUser : $organizer->getId()));
                     $timezone = Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::TIMEZONE, $prefUser ? $prefUser : $organizer->getId());
                     
         //            $translate = Tinebase_Translation::getTranslation('Calendar', $locale);
         
           // get date strings
                     $startDateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat($_event->dtstart, $timezone, $locale);
                     $endDateString = Tinebase_Translation::dateToStringInTzAndLocaleFormat($_event->dtend, $timezone, $locale);
                     $messageSubject = sprintf($translate->_('Attendee changes for event "%1$s" at %2$s' ), $_event->summary, $startDateString);
         */
         $fullUser = Tinebase_Core::getUser();
         foreach ($users as $user) {
             $userName = $user[n_fn];
             $url = Webconference_Controller_BigBlueButton::getInstance()->joinRoom($roomName, $moderator, $userName)->bbbUrl->bbbUrl;
             //$webconfMail = new Webconference_Model_Invite($url, $roomName, $moderator, $fullUser, $userName);
             $webconfMail = new Webconference_Model_Invite(array('url' => $url, 'roomName' => $roomName, 'moderator' => $moderator, 'createdBy' => $fullUser, 'to' => $userName), true);
             $messageSubject = $translate->_("Webconference Invite");
             $view = new Zend_View();
             $view->setScriptPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views');
             $view->translate = $translate;
             //$view->timezone     = $timezone;
             $view->url = $url;
             $view->fullUser = $fullUser;
             $method = 'Webconference';
             $messageBody = $view->render('eventNotification.php');
             $mailPart = new Zend_Mime_Part(serialize($webconfMail));
             $mailPart->charset = 'UTF-8';
             $mailPart->type = 'text/webconference; method=' . $method;
             $mailPart->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
             $attachments = null;
             $contact = new Addressbook_Model_Contact($user);
             $sender = $fullUser;
             $result = Tinebase_Notification::getInstance()->send($sender, array($contact), $messageSubject, $messageBody, $mailPart, $attachments);
         }
     } catch (Exception $e) {
         Tinebase_Core::getLogger()->WARN(__METHOD__ . '::' . __LINE__ . " could not send notification :" . $e);
         return array('message' => $e->getMessage(), 'result' => $translate->_('An error has occured inviting users'));
     }
     return array('success' => TRUE, 'message' => $translate->_('Users invited successfully') . '!');
 }
Example #2
0
 public function getAccountId()
 {
     return Webconference_Controller_BigBlueButton::getInstance()->getRoom();
 }
Example #3
0
 public function inviteUsersToJoinToFelamimail($roomId, $moderator, $userName, $email)
 {
     $translation = Tinebase_Translation::getTranslation('Webconference');
     $defaultEmailAccount = Tinebase_Core::getPreference("Felamimail")->{Felamimail_Preference::DEFAULTACCOUNT};
     $url = Webconference_Controller_BigBlueButton::getInstance()->joinRoom($roomId, $moderator, $userName, $email)->bbbUrl->bbbUrl;
     $accountFullName = Tinebase_Core::getUser()->accountFullName;
     $messageHtml = sprintf($translation->_("The user %s is inviting you to a Webconference"), $accountFullName);
     $messageHtml .= "<br/><br/>";
     $messageHtml .= "<div>";
     $messageHtml .= "<span class=\"{$url}\" />";
     $messageHtml .= "<span class=\"tinebase-webconference-link\">";
     $messageHtml .= $translation->_("Log in to Webconference");
     $messageHtml .= "</span>";
     $messageHtml .= "</div>";
     $recordData = array("note" => null, "content_type" => "text/html", "account_id" => $defaultEmailAccount, "to" => array($email), "cc" => array(), "bcc" => array(), "subject" => $translation->_("Invite User To Join Webconference"), "body" => $messageHtml, "attachments" => array(), "from_email" => Tinebase_Core::getUser()->accountEmailAddress, "customfields" => array());
     $message = new Felamimail_Model_Message();
     $message->setFromArray($recordData);
     try {
         $result = Felamimail_Controller_Message_Send::getInstance()->sendMessage($message);
         $result = $this->_recordToJson($result);
     } catch (Zend_Mail_Protocol_Exception $zmpe) {
         Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not send message: ' . $zmpe->getMessage());
         throw $zmpe;
     }
     return $result;
 }