/**
  * Converts an outbound message down to a basic object for writing to the DB
  * @param MoodletxtOutboundMessage $bean Object to convert
  * @param object $existingRecord Existing DB record, if one exists
  * @return object Object for writing to the database
  * @version 2012062401
  * @since 2011081101
  */
 private function convertBeanToStandardClass(MoodletxtOutboundMessage $bean, object $existingRecord = null)
 {
     if ($existingRecord == null) {
         $existingRecord = new object();
     }
     $existingRecord->userid = $bean->getUser()->getId();
     $existingRecord->txttoolsaccount = $bean->getTxttoolsAccount()->getId();
     $existingRecord->messagetext = $bean->getMessageText();
     $existingRecord->timesent = $bean->getTimeSent();
     $existingRecord->scheduledfor = $bean->getScheduledTime();
     $existingRecord->type = $bean->getType();
     $existingRecord->fromevent = $bean->isEventCreated() ? 1 : 0;
     return $existingRecord;
 }
Esempio n. 2
0
 /**
  * Build an XML request to send messages.
  * @param MoodletxtOutboundMessage $message The message object to be sent.
  * @return array The completed XML packet(s) to be sent.
  * @version 2010090601
  * @since 2010090101
  */
 public function buildOutboundMessage(MoodletxtOutboundMessage $message)
 {
     // Set the object into "outbound mode" by building some outbound authentication
     $this->buildAuthentication($message->getTxttoolsAccount());
     $this->buildTextMessageBlocks($message);
     return $this->compileXMLRequests();
 }