1<?php declare(strict_types=1); 2/* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4/** 5 * Class ilMailAutoCompleteBuddyRecipientsProvider 6 */ 7class ilMailAutoCompleteBuddyRecipientsProvider extends ilMailAutoCompleteUserProvider 8{ 9 /** 10 * @return string 11 */ 12 protected function getFromPart() 13 { 14 $joins = array(); 15 16 $joins[] = implode(' ', [ 17 'INNER JOIN buddylist', 18 'ON ((', 19 'buddylist.usr_id = usr_data.usr_id AND', 20 'buddylist.buddy_usr_id = ' . $this->db->quote($this->user_id, 'integer'), 21 ') OR (', 22 'buddylist.buddy_usr_id = usr_data.usr_id AND', 23 'buddylist.usr_id = ' . $this->db->quote($this->user_id, 'integer'), 24 '))', 25 ]); 26 27 $joins[] = implode(' ', [ 28 'LEFT JOIN usr_pref profpref', 29 'ON profpref.usr_id = usr_data.usr_id', 30 'AND profpref.keyword = ' . $this->db->quote('public_profile', 'text'), 31 ]); 32 33 $joins[] = implode(' ', [ 34 'LEFT JOIN usr_pref pubemail', 35 'ON pubemail.usr_id = usr_data.usr_id', 36 'AND pubemail.keyword = ' . $this->db->quote('public_email', 'text'), 37 ]); 38 39 if ($joins) { 40 return 'usr_data ' . implode(' ', $joins); 41 } else { 42 return 'usr_data '; 43 } 44 } 45} 46