251 {
253
254 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
255 $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
256 $this->tpl->setTitle($this->lng->txt("mail"));
257 $this->tpl->setVariable('SEARCHFORM', $form->getHtml());
258
259
260 if(strlen(
$_SESSION[
'mail_search_search']) < 3)
261 {
262 if(
$_GET[
"ref"] !=
"wsp")
263 {
264 $this->tpl->show();
265 }
266 return;
267 }
268
269 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
271 if(count($relations))
272 {
274
277 $query_parser->setMinWordLength(3);
278 $query_parser->parse();
279
281 $user_search->enableActiveCheck(true);
282 $user_search->setFields(array('login'));
283 $result_obj = $user_search->performSearch();
284 $contacts_search_result->mergeEntries($result_obj);
285
286 $user_search->setFields(array('firstname'));
287 $result_obj = $user_search->performSearch();
288 $contacts_search_result->mergeEntries($result_obj);
289
290 $user_search->setFields(array('lastname'));
291 $result_obj = $user_search->performSearch();
292 $contacts_search_result->mergeEntries($result_obj);
293
294 $contacts_search_result->setMaxHits(100000);
295 $contacts_search_result->preventOverwritingMaxhits(true);
296 $contacts_search_result->filter(ROOT_FOLDER_ID, true);
297
298
299 include_once 'Services/User/classes/class.ilUserFilter.php';
301 $users = array_intersect($users, $relations->getKeys());
302
304 $tbl_contacts->setTitle($this->lng->txt('mail_addressbook'));
305 $tbl_contacts->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
306
307 $has_mail_addr = false;
310 foreach($users as $user)
311 {
313
314 if(
$_GET[
'ref'] ==
'wsp')
315 {
317 }
318 else
319 {
324 }
325
328 {
329 $has_mail_addr = true;
331 }
332
334 {
338 }
339 else
340 {
343 }
344
346 }
347
348 if(
$_GET[
'ref'] ==
'wsp')
349 {
350 $tbl_contacts->addColumn("", "", "1%", true);
351 }
352 else
353 {
354 $tbl_contacts->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
355 }
356 $tbl_contacts->addColumn($this->lng->txt('login'), 'login', '15%');
357 $tbl_contacts->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
358 $tbl_contacts->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
359 if($has_mail_addr)
360 {
361 foreach(
$result as $key => $val)
362 {
363 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
364 }
365
366 $tbl_contacts->addColumn($this->lng->txt('email'), 'email', "15%");
367 }
368 $tbl_contacts->setData(
$result);
369
370 $tbl_contacts->setDefaultOrderField('login');
371 $tbl_contacts->setPrefix('addr_');
372 $tbl_contacts->enable('select_all');
373 $tbl_contacts->setSelectAllCheckbox('search_name_to_addr');
374 $tbl_contacts->setFormName('recipients');
375
376 $this->tpl->setVariable('TABLE_ADDR', $tbl_contacts->getHTML());
377 }
378
380
383 $query_parser->setMinWordLength(3);
384 $query_parser->parse();
385
387 $user_search->enableActiveCheck(true);
388 $user_search->setFields(array('login'));
389 $result_obj = $user_search->performSearch();
390 $all_results->mergeEntries($result_obj);
391
392 $user_search->setFields(array('firstname'));
393 $result_obj = $user_search->performSearch();
394 $all_results->mergeEntries($result_obj);
395
396 $user_search->setFields(array('lastname'));
397 $result_obj = $user_search->performSearch();
398 $all_results->mergeEntries($result_obj);
399
400 $all_results->setMaxHits(100000);
401 $all_results->preventOverwritingMaxhits(true);
402 $all_results->filter(ROOT_FOLDER_ID, true);
403
404
405 include_once 'Services/User/classes/class.ilUserFilter.php';
407 if(count($users))
408 {
410 $tbl_users->setTitle($this->lng->txt('system') . ': ' . $this->lng->txt('persons'));
411 $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
412
415 foreach($users as $user)
416 {
418
419 if(
$_GET[
"ref"] !=
"wsp")
420 {
424 }
425 else
426 {
428 }
430
432 {
436 }
437 else
438 {
441 }
442
444 {
445 $has_mail_usr = true;
447 }
448
450 }
451
452 if(
$_GET[
"ref"] !=
"wsp")
453 {
454 $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
455 }
456 else
457 {
458 $tbl_users->addColumn("", "", "1%");
459 }
460 $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
461 $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
462 $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
463 if($has_mail_usr == true)
464 {
465 foreach(
$result as $key => $val)
466 {
467 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
468 }
469
470 $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
471 }
473
474 $tbl_users->setDefaultOrderField('login');
475 $tbl_users->setPrefix('usr_');
476 $tbl_users->enable('select_all');
477 $tbl_users->setSelectAllCheckbox('search_name_to_usr');
478 $tbl_users->setFormName('recipients');
479
480 $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
481 }
482
483 include_once 'Services/Search/classes/class.ilQueryParser.php';
484 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
485 include_once 'Services/Search/classes/class.ilSearchResult.php';
486 include_once 'Services/Membership/classes/class.ilParticipants.php';
487
489
492 $query_parser->setMinWordLength(3);
493 $query_parser->parse();
494
496 $search->setFilter(array('grp'));
497 $result = $search->performSearch();
498 $group_results->mergeEntries(
$result);
499 $group_results->setMaxHits(PHP_INT_MAX);
500 $group_results->preventOverwritingMaxhits(true);
501 $group_results->setRequiredPermission('read');
502 $group_results->filter(ROOT_FOLDER_ID, true);
503
504 $visible_groups = array();
505 if($group_results->getResults())
506 {
508 $tbl_grp->setTitle($this->lng->txt('system') . ': ' . $this->lng->txt('groups'));
509 $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
510
513
514 $this->object_data_cache->preloadReferenceCache(array_keys($group_results->getResults()));
515
516 $groups = $group_results->getResults();
517 foreach($groups as $grp)
518 {
520 {
521 continue;
522 }
523
524 if(
$_GET[
"ref"] !=
"wsp")
525 {
526 $members = array();
527 $roles = $this->rbacreview->getAssignableChildRoles($grp['ref_id']);
528 foreach($roles as $role)
529 {
530 if(substr($role['title'], 0, 14) == 'il_grp_member_' ||
531 substr($role['title'], 0, 13) == 'il_grp_admin_'
532 )
533 {
534
535 array_push($members, '#' . $role['title']);
536 }
537 }
538 $str_members = implode(',', $members);
539
544 }
545 else
546 {
548 }
549 $result[
$counter][
'title'] = $this->object_data_cache->lookupTitle($grp[
'obj_id']);
550 $result[
$counter][
'description'] = $this->object_data_cache->lookupDescription($grp[
'obj_id']);
551
553 $visible_groups[] = $grp;
554 }
555
556 if($visible_groups)
557 {
559
560 if(
$_GET[
"ref"] !=
"wsp")
561 {
562 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
563 }
564 else
565 {
566 $tbl_grp->addColumn("", "", "1%");
567 }
568 $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
569 $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
570
571 $tbl_grp->setDefaultOrderField('title');
572 $tbl_grp->setPrefix('grp_');
573 $tbl_grp->enable('select_all');
574 $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
575 $tbl_grp->setFormName('recipients');
576
577 $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
578 }
579 }
580
581 if(count($users) || count($visible_groups) || count($relations))
582 {
584 $this->tpl->setVariable("ALT_ARROW", '');
585
586 if(
$_GET[
"ref"] !=
"wsp")
587 {
588 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
589 }
590 else
591 {
592 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
593 }
594 }
595 else
596 {
597 $this->lng->loadLanguageModule('search');
599 }
600
601 if(
$_GET[
"ref"] !=
"wsp")
602 {
603 $this->tpl->show();
604 }
605 }
static getInstanceByGlobalUser()
static _lookupPref($a_usr_id, $a_keyword)
static _lookupEmail($a_user_id)
Lookup email.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
static getInstance()
Singelton get instance.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)