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