Commits

Heiko Wollersheim authored 46f01ebcc1e
Passe das Gesuchformular an
No tags

Classes/Controller/SearchController.php

Modified
87 87 }
88 88
89 89 /**
90 90 * action Send
91 91 *
92 92 * @param \GI\MentorFinder\Domain\Model\Contact $contact
93 93 * @return void
94 94 */
95 95 public function sendAction(\GI\MentorFinder\Domain\Model\Contact $contact = NULL){
96 96
97 - $mentor = $this->frontendUserRepository->findByUid($contact->getMentor());
97 + if ($contact->getType() == 'contact') {
98 + $mentor = $this->frontendUserRepository->findByUid($contact->getMentor());
98 99
99 - if ($mentor->getEmail() && $contact->getEmail()) {
100 - $this->sendMail($this->settings['mail']['systemMailAddress'],$mentor->getEmail(),'Mentor',$mentor,$contact);
101 - }
100 + if ($mentor->getEmail() && $contact->getEmail()) {
101 + $this->sendMail($this->settings['mail']['systemMailAddress'],$mentor->getEmail(),'Mentor',$mentor,$contact);
102 + }
102 103
103 - if ($this->settings['mail']['systemMailAddress'] && $contact->getEmail()) {
104 - $this->sendMail($this->settings['mail']['systemMailAddress'],$contact->getEmail(),'Mentee',$contact);
105 - }
104 + if ($this->settings['mail']['systemMailAddress'] && $contact->getEmail()) {
105 + $this->sendMail($this->settings['mail']['systemMailAddress'],$contact->getEmail(),'Mentee',$contact);
106 + }
107 +
108 + $requests = $mentor->getRequests();
109 + $requests = $requests+1;
110 + $mentor->setRequests($requests);
111 + $this->frontendUserRepository->update($mentor);
112 + } else if ($contact->getType() == 'request') {
106 113
107 - $requests = $mentor->getRequests();
108 - $requests = $requests+1;
109 - $mentor->setRequests($requests);
110 - $this->frontendUserRepository->update($mentor);
114 + if ($this->settings['mail']['adminMailAddress'] && $contact->getEmail()) {
115 + $this->sendMail($this->settings['mail']['systemMailAddress'],$this->settings['mail']['adminMailAddress'],'RequestMentor',$contact);
116 + }
117 +
118 + if ($this->settings['mail']['systemMailAddress'] && $contact->getEmail()) {
119 + $this->sendMail($this->settings['mail']['systemMailAddress'],$contact->getEmail(),'RequestMentee',$contact);
120 + }
121 +
122 + }
111 123
112 124 $this->view->assign('contact', $contact);
113 125 }
114 126
115 127 /**
116 128 * send mail
117 129 *
118 130 * @param string $from
119 131 * @param string $to
120 132 * @param string $type

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut