public function sendNotifications($app_id, $from, $to, $subject, $body, $cc = null, $bcc = null, $attachments = null) { if (!is_array($to)) { $to = array(); } $getFriends = Api_Dao_Friends::friendsGetFriends($from->id); $toids = array(); foreach ($to as $to_user) { $toids[] = $to->id; } $sendFriends = array_intersect($toids, $getFriends); if (count($sendFriends) > 0) { $mailid = Api_Dao_Notification::createMail($uid, $subject); // If uid sends email to others, are they really in the thread yet? only when response exists? foreach ($sendFriends as $friend) { Api_Dao_Notification::addUserToMail($mailid, $friend); } Api_Dao_Notification::addMessage($mailid, $uid, $notification, 0); } }
/** * Enter description here... * * @param unknown_type $userId * @param unknown_type $subject * @return unknown */ public static function createMail($userId, $subject) { return Api_Dao_Notification::createMail($userId, $subject); }