262 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_search.html',
'components/ILIAS/Contact');
263 $this->tpl->setVariable(
'ACTION', $this->
ctrl->getFormAction($this));
264 $this->tpl->setTitle($this->
lng->txt(
'mail'));
265 $this->tpl->setVariable(
'SEARCHFORM', $form->getHtml());
274 $this->tpl->printToStdout();
280 if (count($relations) > 0) {
285 $query_parser->setMinWordLength(3);
286 $query_parser->parse();
289 $user_search->enableActiveCheck(
true);
290 $user_search->setFields([
'login']);
291 $result_obj = $user_search->performSearch();
292 $contacts_search_result->mergeEntries($result_obj);
294 $user_search->setFields([
'firstname']);
295 $result_obj = $user_search->performSearch();
296 $contacts_search_result->mergeEntries($result_obj);
298 $user_search->setFields([
'lastname']);
299 $result_obj = $user_search->performSearch();
300 $contacts_search_result->mergeEntries($result_obj);
302 $contacts_search_result->setMaxHits(100000);
303 $contacts_search_result->preventOverwritingMaxhits(
true);
308 $users = array_intersect($users, $relations->getKeys());
311 $tbl_contacts->setTitle($this->
lng->txt(
'mail_addressbook'));
312 $tbl_contacts->setRowTemplate(
'tpl.mail_search_addr_row.html',
'components/ILIAS/Contact');
314 $has_mail_addr =
false;
317 foreach ($users as $user) {
321 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
328 $result[$counter][
'login'] = $login;
330 $has_mail_addr =
true;
336 $result[$counter][
'firstname'] = $name[
'firstname'];
337 $result[$counter][
'lastname'] = $name[
'lastname'];
339 $result[$counter][
'firstname'] =
'';
340 $result[$counter][
'lastname'] =
'';
347 $tbl_contacts->addColumn(
348 $this->
lng->txt(
'mail_to') .
'/' . $this->
lng->txt(
'mail_cc') .
'/' . $this->
lng->txt(
'mail_bcc'),
353 $tbl_contacts->addColumn(
'',
'',
'1%',
true);
355 $tbl_contacts->addColumn($this->
lng->txt(
'login'),
'login',
'15%');
356 $tbl_contacts->addColumn($this->
lng->txt(
'firstname'),
'firstname',
'15%');
357 $tbl_contacts->addColumn($this->
lng->txt(
'lastname'),
'lastname',
'15%');
358 if ($has_mail_addr) {
359 foreach ($result as $key => $val) {
360 if (!isset($val[
'email']) || $val[
'email'] ===
'') {
361 $result[$key][
'email'] =
' ';
365 $tbl_contacts->addColumn($this->
lng->txt(
'email'),
'email',
"15%");
367 $tbl_contacts->setData($result);
369 $tbl_contacts->setDefaultOrderField(
'login');
370 $tbl_contacts->enable(
'select_all');
371 $tbl_contacts->setSelectAllCheckbox(
'search_name_to_addr');
372 $tbl_contacts->setFormName(
'recipients');
374 $this->tpl->setVariable(
'TABLE_ADDR', $tbl_contacts->getHTML());
381 $query_parser->setMinWordLength(3);
382 $query_parser->parse();
385 $user_search->enableActiveCheck(
true);
386 $user_search->setFields([
'login']);
387 $result_obj = $user_search->performSearch();
388 $all_results->mergeEntries($result_obj);
390 $user_search->setFields([
'firstname']);
391 $result_obj = $user_search->performSearch();
392 $all_results->mergeEntries($result_obj);
394 $user_search->setFields([
'lastname']);
395 $result_obj = $user_search->performSearch();
396 $all_results->mergeEntries($result_obj);
398 $all_results->setMaxHits(100000);
399 $all_results->preventOverwritingMaxhits(
true);
403 $has_mail_usr =
false;
407 $tbl_users->setTitle($this->
lng->txt(
'system') .
': ' . $this->
lng->txt(
'persons'));
408 $tbl_users->setRowTemplate(
'tpl.mail_search_users_row.html',
'components/ILIAS/Contact');
412 foreach ($users as $user) {
416 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
422 $result[$counter][
'login'] = $login;
426 $result[$counter][
'firstname'] = $name[
'firstname'];
427 $result[$counter][
'lastname'] = $name[
'lastname'];
429 $result[$counter][
'firstname'] =
'';
430 $result[$counter][
'lastname'] =
'';
434 $has_mail_usr =
true;
442 $tbl_users->addColumn(
443 $this->
lng->txt(
'mail_to') .
'/' . $this->
lng->txt(
'mail_cc') .
'/' . $this->
lng->txt(
'mail_bcc'),
448 $tbl_users->addColumn(
'',
'',
'1%');
450 $tbl_users->addColumn($this->
lng->txt(
'login'),
'login',
'15%');
451 $tbl_users->addColumn($this->
lng->txt(
'firstname'),
'firstname',
'15%');
452 $tbl_users->addColumn($this->
lng->txt(
'lastname'),
'lastname',
'15%');
454 foreach ($result as $key => $val) {
455 if (!isset($val[
'email']) || $val[
'email'] ===
'') {
456 $result[$key][
'email'] =
' ';
460 $tbl_users->addColumn($this->
lng->txt(
'email'),
'email',
'15%');
462 $tbl_users->setData($result);
464 $tbl_users->setDefaultOrderField(
'login');
465 $tbl_users->enable(
'select_all');
466 $tbl_users->setSelectAllCheckbox(
'search_name_to_usr');
467 $tbl_users->setFormName(
'recipients');
469 $this->tpl->setVariable(
'TABLE_USERS', $tbl_users->getHTML());
476 $query_parser->setMinWordLength(3);
477 $query_parser->parse();
480 $search->setFilter([
'grp']);
481 $result = $search->performSearch();
482 $group_results->mergeEntries($result);
483 $group_results->setMaxHits(PHP_INT_MAX);
484 $group_results->preventOverwritingMaxhits(
true);
485 $group_results->setRequiredPermission(
'read');
488 $visible_groups = [];
489 if ($group_results->getResults()) {
491 $tbl_grp->setTitle($this->
lng->txt(
'system') .
': ' . $this->
lng->txt(
'groups'));
492 $tbl_grp->setRowTemplate(
'tpl.mail_search_groups_row.html',
'components/ILIAS/Contact');
497 $this->object_data_cache->preloadReferenceCache(array_keys($group_results->getResults()));
499 $groups = $group_results->getResults();
500 foreach ($groups as $grp) {
507 $roles = $this->rbacreview->getAssignableChildRoles($grp[
'ref_id']);
508 foreach ($roles as $role) {
510 str_starts_with($role[
'title'],
'il_grp_member_') ||
511 str_starts_with($role[
'title'],
'il_grp_admin_')
514 $members[] =
'#' . $role[
'title'];
517 $str_members = implode(
',', $members);
519 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
525 $result[$counter][
'title'] = $this->object_data_cache->lookupTitle((
int) $grp[
'obj_id']);
526 $result[$counter][
'description'] = $this->object_data_cache->lookupDescription((
int) $grp[
'obj_id']);
529 $visible_groups[] = $grp;
532 if ($visible_groups !== []) {
533 $tbl_grp->setData($result);
537 $this->
lng->txt(
'mail_to') .
'/' . $this->
lng->txt(
'mail_cc') .
'/' . $this->
lng->txt(
'mail_bcc'),
542 $tbl_grp->addColumn(
'',
'',
'1%');
544 $tbl_grp->addColumn($this->
lng->txt(
'title'),
'title',
'15%');
545 $tbl_grp->addColumn($this->
lng->txt(
'description'),
'description',
'15%');
547 $tbl_grp->setDefaultOrderField(
'title');
548 $tbl_grp->enable(
'select_all');
549 $tbl_grp->setSelectAllCheckbox(
'search_name_to_grp');
550 $tbl_grp->setFormName(
'recipients');
552 $this->tpl->setVariable(
'TABLE_GRP', $tbl_grp->getHTML());
556 if (count($users) || count($visible_groups) || count($relations)) {
558 $this->tpl->setVariable(
"ALT_ARROW",
'');
560 $this->tpl->setVariable(
"ALT_ARROW_UP",
'');
563 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->
lng->txt(
'adopt'));
565 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->
lng->txt(
'wsp_share_with_users'));
568 $this->
lng->loadLanguageModule(
'search');
569 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'search_no_match'));
573 $this->tpl->printToStdout();
static get(string $a_var)
static _lookupName(int $a_user_id)
lookup user name
static _lookupPref(int $a_usr_id, string $a_keyword)
static _getUserSearchInstance(ilQueryParser $query_parser)
static _getObjectSearchInstance(ilQueryParser $query_parser)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static hasParticipantListAccess(int $a_obj_id, ?int $a_usr_id=null)
Check if (current) user has access to the participant list.
isDefaultRequestContext()
appendRecipientSelection(array &$result, int $index, string $search_type, string $recipient_type, string $value)
static _lookupEmail(int $a_user_id)
static getInstanceByGlobalUser(?ilObjUser $user=null)
static _lookupLogin(int $a_user_id)