protected function getEmailContact($type) { $contact = array(); if ($type == 'testregister' || $type == 'created') { $contact[] = $this; } else { if ($type === 'register' || $type === 'forgotpass') { if ($this->getPrivilege() == 98) { $contact[] = new eCRFUser($this->_adminUser); } else { $sql = "SELECT id FROM user WHERE centre_id = ?"; $pA = array('i', $this->getCentre()); $search = DB::query($sql, $pA); foreach ($search->rows as $row) { $possContact = new eCRFUser($row->id); if ($possContact->isLocalAdmin()) { $contact[] = $possContact; } } if (empty($contact)) { $contact[] = new eCRFUser($this->_adminUser); } } } else { if ($type === 'createuser') { $contact[] = new eCRFUser(11); } else { $contact[] = new eCRFUser($this->_adminUser); } } } return $contact; }