243 {
245
246 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
247 $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
248 $this->tpl->setTitle($this->lng->txt("mail"));
249 $this->tpl->setVariable(
'SEARCHFORM',
$form->getHtml());
250
251
252 if (
253 !isset(
$_SESSION[
"mail_search_search"]) ||
254 !is_string(
$_SESSION[
"mail_search_search"]) ||
255 strlen(trim(
$_SESSION[
"mail_search_search"])) < 3
256 ) {
257 if (
$_GET[
"ref"] !=
"wsp") {
258 $this->tpl->show();
259 }
260 return;
261 }
262
263 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
265 if (count($relations)) {
267
270 $query_parser->setMinWordLength(3);
271 $query_parser->parse();
272
274 $user_search->enableActiveCheck(true);
275 $user_search->setFields(array('login'));
276 $result_obj = $user_search->performSearch();
277 $contacts_search_result->mergeEntries($result_obj);
278
279 $user_search->setFields(array('firstname'));
280 $result_obj = $user_search->performSearch();
281 $contacts_search_result->mergeEntries($result_obj);
282
283 $user_search->setFields(array('lastname'));
284 $result_obj = $user_search->performSearch();
285 $contacts_search_result->mergeEntries($result_obj);
286
287 $contacts_search_result->setMaxHits(100000);
288 $contacts_search_result->preventOverwritingMaxhits(true);
289 $contacts_search_result->filter(ROOT_FOLDER_ID, true);
290
291
292 include_once 'Services/User/classes/class.ilUserFilter.php';
294 $users = array_intersect(
$users, $relations->getKeys());
295
297 $tbl_contacts->setTitle($this->lng->txt('mail_addressbook'));
298 $tbl_contacts->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
299
300 $has_mail_addr = false;
303 foreach (
$users as $user) {
305
306 if (
$_GET[
'ref'] ==
'wsp') {
308 } else {
313 }
314
317 $has_mail_addr = true;
319 }
320
325 } else {
328 }
329
331 }
332
333 if (
$_GET[
'ref'] ==
'wsp') {
334 $tbl_contacts->addColumn("", "", "1%", true);
335 } else {
336 $tbl_contacts->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
337 }
338 $tbl_contacts->addColumn($this->lng->txt('login'), 'login', '15%');
339 $tbl_contacts->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
340 $tbl_contacts->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
341 if ($has_mail_addr) {
343 if ($val['email'] == '') {
345 }
346 }
347
348 $tbl_contacts->addColumn($this->lng->txt('email'), 'email', "15%");
349 }
350 $tbl_contacts->setData(
$result);
351
352 $tbl_contacts->setDefaultOrderField('login');
353 $tbl_contacts->setPrefix('addr_');
354 $tbl_contacts->enable('select_all');
355 $tbl_contacts->setSelectAllCheckbox('search_name_to_addr');
356 $tbl_contacts->setFormName('recipients');
357
358 $this->tpl->setVariable('TABLE_ADDR', $tbl_contacts->getHTML());
359 }
360
362
365 $query_parser->setMinWordLength(3);
366 $query_parser->parse();
367
369 $user_search->enableActiveCheck(true);
370 $user_search->setFields(array('login'));
371 $result_obj = $user_search->performSearch();
372 $all_results->mergeEntries($result_obj);
373
374 $user_search->setFields(array('firstname'));
375 $result_obj = $user_search->performSearch();
376 $all_results->mergeEntries($result_obj);
377
378 $user_search->setFields(array('lastname'));
379 $result_obj = $user_search->performSearch();
380 $all_results->mergeEntries($result_obj);
381
382 $all_results->setMaxHits(100000);
383 $all_results->preventOverwritingMaxhits(true);
384 $all_results->filter(ROOT_FOLDER_ID, true);
385
386
387 include_once 'Services/User/classes/class.ilUserFilter.php';
391 $tbl_users->setTitle($this->lng->txt('system') . ': ' . $this->lng->txt('persons'));
392 $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
393
396 foreach (
$users as $user) {
398
399 if (
$_GET[
"ref"] !=
"wsp") {
403 } else {
405 }
407
412 } else {
415 }
416
418 $has_mail_usr = true;
420 }
421
423 }
424
425 if (
$_GET[
"ref"] !=
"wsp") {
426 $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
427 } else {
428 $tbl_users->addColumn("", "", "1%");
429 }
430 $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
431 $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
432 $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
433 if ($has_mail_usr == true) {
435 if ($val['email'] == '') {
437 }
438 }
439
440 $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
441 }
443
444 $tbl_users->setDefaultOrderField('login');
445 $tbl_users->setPrefix('usr_');
446 $tbl_users->enable('select_all');
447 $tbl_users->setSelectAllCheckbox('search_name_to_usr');
448 $tbl_users->setFormName('recipients');
449
450 $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
451 }
452
453 include_once 'Services/Search/classes/class.ilQueryParser.php';
454 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
455 include_once 'Services/Search/classes/class.ilSearchResult.php';
456 include_once 'Services/Membership/classes/class.ilParticipants.php';
457
459
462 $query_parser->setMinWordLength(3);
463 $query_parser->parse();
464
466 $search->setFilter(array('grp'));
467 $result = $search->performSearch();
468 $group_results->mergeEntries(
$result);
469 $group_results->setMaxHits(PHP_INT_MAX);
470 $group_results->preventOverwritingMaxhits(true);
471 $group_results->setRequiredPermission('read');
472 $group_results->filter(ROOT_FOLDER_ID, true);
473
474 $visible_groups = array();
475 if ($group_results->getResults()) {
477 $tbl_grp->setTitle($this->lng->txt('system') . ': ' . $this->lng->txt('groups'));
478 $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
479
482
483 $this->object_data_cache->preloadReferenceCache(array_keys($group_results->getResults()));
484
485 $groups = $group_results->getResults();
486 foreach ($groups as $grp) {
488 continue;
489 }
490
491 if (
$_GET[
"ref"] !=
"wsp") {
492 $members = array();
493 $roles = $this->rbacreview->getAssignableChildRoles($grp['ref_id']);
494 foreach ($roles as $role) {
495 if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
496 substr($role['title'], 0, 13) == 'il_grp_admin_'
497 ) {
498
499 array_push($members, '#' . $role['title']);
500 }
501 }
502 $str_members = implode(',', $members);
503
508 } else {
510 }
511 $result[
$counter][
'title'] = $this->object_data_cache->lookupTitle($grp[
'obj_id']);
512 $result[
$counter][
'description'] = $this->object_data_cache->lookupDescription($grp[
'obj_id']);
513
515 $visible_groups[] = $grp;
516 }
517
518 if ($visible_groups) {
520
521 if (
$_GET[
"ref"] !=
"wsp") {
522 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
523 } else {
524 $tbl_grp->addColumn("", "", "1%");
525 }
526 $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
527 $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
528
529 $tbl_grp->setDefaultOrderField('title');
530 $tbl_grp->setPrefix('grp_');
531 $tbl_grp->enable('select_all');
532 $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
533 $tbl_grp->setFormName('recipients');
534
535 $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
536 }
537 }
538
539 if (count(
$users) || count($visible_groups) || count($relations)) {
541 $this->tpl->setVariable("ALT_ARROW", '');
542
543 if (
$_GET[
"ref"] !=
"wsp") {
544 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
545 } else {
546 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
547 }
548 } else {
549 $this->lng->loadLanguageModule('search');
551 }
552
553 if (
$_GET[
"ref"] !=
"wsp") {
554 $this->tpl->show();
555 }
556 }
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)