/**
  * Sends a copy of the message to the user by mail
  *
  * @param class_module_messaging_message $objMessage
  * @param class_module_user_user $objUser
  * @return bool
  */
 private function sendMessageByMail(class_module_messaging_message $objMessage, class_module_user_user $objUser)
 {
     $strOriginalLang = class_carrier::getInstance()->getObjLang()->getStrTextLanguage();
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage());
     $strSubject = $objMessage->getStrTitle() != "" ? $objMessage->getStrTitle() : class_carrier::getInstance()->getObjLang()->getLang("message_notification_subject", "messaging");
     $strBody = class_carrier::getInstance()->getObjLang()->getLang("message_prolog", "messaging");
     $strBody .= "\n\n" . class_link::getLinkAdminHref("messaging", "view", "&systemid=" . $objMessage->getSystemid(), false) . "\n\n";
     $strBody .= $objMessage->getStrBody();
     $objMail = new class_mail();
     //try to get a matching sender and place it into the mail
     if (validateSystemid($objMessage->getStrSenderId())) {
         $objSenderUser = new class_module_user_user($objMessage->getStrSenderId());
         $objValidator = new class_email_validator();
         if ($objValidator->validate($objSenderUser->getStrEmail())) {
             $objMail->setSender($objSenderUser->getStrEmail());
         }
     }
     $objMail->setSubject($strSubject);
     $objMail->setText($strBody);
     $objMail->addTo($objUser->getStrEmail());
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strOriginalLang);
     return $objMail->sendMail();
 }
 /**
  * @return string
  * @permissions edit
  */
 protected function actionSendPasswordFinal()
 {
     $strReturn = "";
     $objUser = new class_module_user_user($this->getSystemid());
     //add a one-time token and reset the password
     $strToken = generateSystemid();
     $objUser->setStrAuthcode($strToken);
     $objUser->updateObjectToDb();
     $strActivationLink = class_link::getLinkAdminHref("login", "pwdReset", "&systemid=" . $objUser->getSystemid() . "&authcode=" . $strToken, false);
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage());
     $objMail = new class_mail();
     $objMail->addTo($objUser->getStrEmail());
     $objMail->setSubject($this->getLang("user_password_resend_subj"));
     $objMail->setText($this->getLang("user_password_resend_body", array($strActivationLink)));
     if ($this->getParam("form_user_sendusername") != "") {
         $objMail->setText($this->getLang("user_password_resend_body_username", array($objUser->getStrUsername(), $strActivationLink)));
     }
     $objMail->sendMail();
     $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul")));
     return $strReturn;
 }
 /**
  * @param class_module_user_user $objUser
  * @param class_module_messaging_message[] $arrMessages
  *
  * @return void
  */
 private function createMessageForUser(class_module_user_user $objUser, array $arrMessages)
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $objLang->setStrTextLanguage($objUser->getStrAdminlanguage());
     $strBody = $objLang->getLang("message_messagesummary_intro", "workflows", array(count($arrMessages))) . "\n\n";
     $intI = 0;
     foreach ($arrMessages as $objOneMessage) {
         $strBody .= $objLang->getLang("message_messagesummary_body_indicator", "workflows", array(++$intI, count($arrMessages))) . "\n";
         $strBody .= $objLang->getLang("message_subject", "messaging") . ": " . $objOneMessage->getStrTitle() . "\n";
         $strBody .= $objLang->getLang("message_link", "messaging") . ": " . class_link::getLinkAdminHref("messaging", "view", "&systemid=" . $objOneMessage->getSystemid(), false) . "\n";
         $strBody .= $objLang->getLang("message_body", "messaging") . ":\n" . $objOneMessage->getStrBody() . "\n";
         $strBody .= "\n";
         $strBody .= "-------------------------------------------\n";
         $strBody .= "\n";
     }
     $strSubject = $objLang->getLang("message_messagesummary_subject", "workflows", array(count($arrMessages)));
     $objSummary = new class_module_messaging_message();
     $objSummary->setStrTitle($strSubject);
     $objSummary->setStrBody($strBody);
     $objSummary->setObjMessageProvider(new class_messageprovider_summary());
     $objMessaging = new class_module_messaging_messagehandler();
     $objMessaging->sendMessageObject($objSummary, $objUser);
 }