echo '<input id="invitation-' . $mi->getID() . '" type="button" class="viewInvite" value="View Invitation" />'; // invite box echo '<div id="invite-box-' . $mi->getID() . '" class="invite-box hidden">'; if ($mi->getTrusted()) { echo '<p>' . $inviterLink . ' invited ' . $inviteeLink . ' to join this project as a <a href="' . Url::help() . '">trusted member</a>. (' . formatTimeTag($mi->getDateCreated()) . ')</p>'; } else { echo '<p>' . $inviterLink . ' invited ' . $inviteeLink . ' to join this project. (' . formatTimeTag($mi->getDateCreated()) . ')</p>'; } if ($mi->getInvitationMessage() != null) { echo '<blockquote>' . formatInvitationMessage($mi->getInvitationMessage()) . '</blockquote>'; } echo '<div class="line"></div>'; if ($mi->getResponse() == Invitation::DECLINED) { echo '<p>' . $inviteeLink . ' declined the invitation. (' . formatTimeTag($mi->getDateResponded()) . ')</p>'; if ($mi->getResponseMessage() != null) { echo '<blockquote>' . formatInvitationMessage($mi->getResponseMessage()) . '</blockquote>'; } } else { echo '<p>(no response yet)</p>'; } echo '</div>'; // invitee picture and username if ($mi->getInviteeID() != null) { echo formatUserPicture($mi->getInviteeID(), 'small'); } else { echo formatBlankUserPicture('mailto:' . $mi->getInviteeEmail(), 'small'); } echo '<h6 class="primary">' . $inviteeLink . '</h6>'; // response if ($mi->getResponse() == Invitation::DECLINED) { echo '<p class="secondary">declined</p>';
Email::send($email); } } foreach ($emails as $e) { // generate code // $code = sha1(microtime(true).mt_rand(10000,90000)); // send invitation $invite = new Invitation(array('inviter_id' => Session::getUserID(), 'invitee_email' => $e, 'project_id' => $project->getID(), 'trusted' => $trusted, 'invitation_message' => $message)); $invite->save(); // log event $logEvent = new Event(array('event_type_id' => 'invite_member_email', 'project_id' => $project->getID(), 'user_1_id' => Session::getUserID(), 'item_1_id' => $invite->getID(), 'data_1' => $e, 'data_2' => $message, 'data_3' => $trusted)); $logEvent->save(); // compose email $body = "<p>" . formatUserLink(Session::getUserID()) . ' invited you to join the project ' . formatProjectLink($project->getID()) . '.</p>'; if (!empty($message)) { $body .= '<blockquote>' . formatInvitationMessage($message) . '</blockquote>'; } if ($trusted) { $body .= '<p>If you accept this invitation, you will become a <a href="' . Url::help() . '">trusted member</a> of this project.</p>'; } $body .= '<p>To respond to this invitation, <a href="' . Url::consent($e) . '">register</a> a free account on ' . PIPELINE_NAME . ' using this email address (' . $e . ').</p>'; $email = array('to' => $e, 'subject' => '[' . PIPELINE_NAME . '] Invitation to join the project ' . $project->getTitle(), 'message' => $body); // send email Email::send($email); } // send us back $numInvitations = count($users) + count($emails); Session::setMessage(formatCount($numInvitations, 'invitation', 'invitations') . ' sent.'); $json = array('success' => '1'); echo json_encode($json); } else {