function notifyAwaitingEdit($comment) { $emailsToSend = array(); $userWhoRequestedEdits = Member::currentUser(); if (WorkflowRequest::should_send_alert(get_class($this->owner), 'requestedit', 'publisher')) { $publishers = $this->owner->Page()->PublisherMembers(); foreach ($publishers as $publisher) { $emailsToSend[] = array($userWhoRequestedEdits, $publisher); } } if (WorkflowRequest::should_send_alert(get_class($this->owner), 'requestedit', 'approver') && $this->Page()->hasMethod('ApproverMembers')) { $approvers = $this->owner->Page()->ApproverMembers(); foreach ($approvers as $approver) { $emailsToSend[] = array($userWhoRequestedEdits, $approver); } } if (WorkflowRequest::should_send_alert(get_class($this->owner), 'requestedit', 'author')) { $emailsToSend[] = array($userWhoRequestedEdits, $this->owner->Author()); } if (count($emailsToSend)) { foreach ($emailsToSend as $email) { if ($email[1]->ID == Member::currentUserID()) { continue; } $this->owner->sendNotificationEmail($email[0], $email[1], $comment, 'requested edit'); } } }
/** * Notify any publishers assigned to this page when a new request * is lodged. */ public function notifyAwaitingApproval($comment) { $author = $this->owner->Author(); $emailsToSend = array(); if (WorkflowRequest::should_send_alert(get_class($this->owner), 'request', 'publisher')) { $publishers = $this->owner->Page()->PublisherMembers(); foreach ($publishers as $publisher) { $emailsToSend[] = array($author, $publisher); } } if (WorkflowRequest::should_send_alert(get_class($this->owner), 'request', 'author')) { $emailsToSend[] = array($author, $author); } if (count($emailsToSend)) { foreach ($emailsToSend as $email) { $this->owner->sendNotificationEmail($email[0], $email[1], $comment, 'requested approval'); } } }