public function build($runData) { $pl = $runData->getParameterList(); $source = $pl->getParameterValue("source"); $subject = $pl->getParameterValue("subject"); $toUserId = $pl->getParameterValue("to_user_id"); $wt = new WikiTransformation(); $wt->setMode('pm'); $result = $wt->processSource($source); $body = $result; $message = new DB_PrivateMessage(); $message->setFromUserId($runData->getUserId()); $message->setToUserId($toUserId); $message->setBody($body); $message->setSubject($subject); $runData->contextAdd("message", $message); }
public function saveDraftEvent($runData) { $pl = $runData->getParameterList(); $source = $pl->getParameterValue("source"); $subject = $pl->getParameterValue("subject"); $toUserId = $pl->getParameterValue("to_user_id"); // saving source only $body = $source; $db = Database::connection(); $db->begin(); $message = new DB_PrivateMessage(); $message->setDate(new ODate()); // date of saving draft $message->setFromUserId($runData->getUserId()); $message->setToUserId($toUserId); $message->setSubject($subject); $message->setBody($body); $message->setFlag(2); // 2 for draft $message->save(); $db->commit(); }