Example #1
0
 protected function getRecipients(Support $issue)
 {
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $repo = $em->getRepository('ActsCamdramSecurityBundle:User');
     $issueFrom = From::fromString('From:' . $issue->getFrom())->getAddressList()->current();
     $recipients = array();
     if ($issue->getOriginal()->getOwner()) {
         //The issue has an owner, so just include the issue owner
         $owner = $issue->getOriginal()->getOwner();
         if ($issueFrom->getEmail() != $owner->getFullEmail()) {
             $recipients[$owner->getFullEmail()] = $owner->getName();
         }
     } else {
         //No owner, so include all admins
         $admins = $repo->findAdmins(AccessControlEntry::LEVEL_FULL_ADMIN);
         foreach ($admins as $admin) {
             if ($issueFrom->getEmail() != $admin->getFullEmail()) {
                 $recipients[$admin->getFullEmail()] = $admin->getName();
             }
         }
     }
     //Also include the original sender and receiver
     $from = From::fromString('From:' . $issue->getOriginal()->getFrom());
     $to = To::fromString('To:' . $issue->getOriginal()->getTo());
     foreach (array($from, $to) as $email) {
         /** @var $email \Zend\Mail\Header\AbstractAddressList */
         foreach ($email->getAddressList() as $address) {
             if (strpos($address->getEmail(), '@camdram.net') === false && $address->getEmail() != $issueFrom->getEmail()) {
                 $recipients[$address->getEmail()] = $address->getName();
             }
         }
     }
     return $recipients;
 }
Example #2
0
 /**
  * Action for pages that represent a single issue.
  */
 public function getAction($identifier)
 {
     $this->checkAuthorised();
     $issue = $this->getEntity($identifier);
     $request = $this->getRequest();
     if ($request->query->has('action')) {
         $this->processRequestData($request, $issue);
     }
     $reply = new Support();
     $reply->setTo(htmlspecialchars_decode($issue->getFrom()));
     $reply->setSubject('Re: ' . $issue->getSubject());
     $reply->setBody("\n\n\n--\nSent by " . $this->getUser()->getName() . " on behalf of Camdram's support team.\nFor further correspondence relating to this email, contact support-" . $issue->getId() . "@camdram.net.\nFor new enquiries, contact websupport@camdram.net.");
     $form = $this->createForm(new SupportType(), $reply, array('action' => $this->generateUrl('post_issue_reply', array('identifier' => $identifier))));
     $this->get('camdram.security.acl.helper')->ensureGranted('VIEW', $issue, false);
     $view = $this->view(array('issue' => $issue, 'form' => $form->createView()), 200)->setTemplate('ActsCamdramAdminBundle:Support:show.html.twig');
     return $view;
 }