221 {
222 global
$lng,
$ilUser, $rbacreview, $ilObjDataCache;
223
225
226 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
227 $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
228 $this->tpl->setTitle($this->lng->txt("mail"));
229 $this->tpl->setVariable('SEARCHFORM', $form->getHtml());
230
231
232 if(strlen(
$_SESSION[
'mail_search_search']) < 3)
233 {
234 if(
$_GET[
"ref"] !=
"wsp")
235 {
236 $this->tpl->show();
237 }
238 return;
239 }
240
241 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
242 $relations = ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations();
243 if(count($relations))
244 {
246
249 $query_parser->setMinWordLength(3);
250 $query_parser->parse();
251
253 $user_search->enableActiveCheck(true);
254 $user_search->setFields(array('login'));
255 $result_obj = $user_search->performSearch();
256 $contacts_search_result->mergeEntries($result_obj);
257
258 $user_search->setFields(array('firstname'));
259 $result_obj = $user_search->performSearch();
260 $contacts_search_result->mergeEntries($result_obj);
261
262 $user_search->setFields(array('lastname'));
263 $result_obj = $user_search->performSearch();
264 $contacts_search_result->mergeEntries($result_obj);
265
266 $contacts_search_result->setMaxHits(100000);
267 $contacts_search_result->preventOverwritingMaxhits(true);
268 $contacts_search_result->filter(ROOT_FOLDER_ID, true);
269
270
271 include_once 'Services/User/classes/class.ilUserFilter.php';
273 $users = array_intersect($users, $relations->getKeys());
274
276 $tbl_contacts->setTitle(
$lng->txt(
'mail_addressbook'));
277 $tbl_contacts->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
278
279 $has_mail_addr = false;
281 $counter = 0;
282 foreach($users as $user)
283 {
285
286 if(
$_GET[
'ref'] ==
'wsp')
287 {
289 }
290 else
291 {
296 }
297
298 $result[$counter][
'login'] = $login;
300 {
301 $has_mail_addr = true;
303 }
304
306 {
308 $result[$counter][
'firstname'] = $name[
'firstname'];
309 $result[$counter][
'lastname'] = $name[
'lastname'];
310 }
311 else
312 {
313 $result[$counter][
'firstname'] =
'';
314 $result[$counter][
'lastname'] =
'';
315 }
316
317 ++$counter;
318 }
319
320 if(
$_GET[
'ref'] ==
'wsp')
321 {
322 $tbl_contacts->addColumn("", "", "1%", true);
323 }
324 else
325 {
326 $tbl_contacts->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
327 }
328 $tbl_contacts->addColumn($this->lng->txt('login'), 'login', '15%');
329 $tbl_contacts->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
330 $tbl_contacts->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
331 if($has_mail_addr)
332 {
333 foreach(
$result as $key => $val)
334 {
335 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
336 }
337
338 $tbl_contacts->addColumn($this->lng->txt('email'), 'email', "15%");
339 }
340 $tbl_contacts->setData(
$result);
341
342 $tbl_contacts->setDefaultOrderField('login');
343 $tbl_contacts->setPrefix('addr_');
344 $tbl_contacts->enable('select_all');
345 $tbl_contacts->setSelectAllCheckbox('search_name_to_addr');
346 $tbl_contacts->setFormName('recipients');
347
348 $this->tpl->setVariable('TABLE_ADDR', $tbl_contacts->getHTML());
349 }
350
352
355 $query_parser->setMinWordLength(3);
356 $query_parser->parse();
357
359 $user_search->enableActiveCheck(true);
360 $user_search->setFields(array('login'));
361 $result_obj = $user_search->performSearch();
362 $all_results->mergeEntries($result_obj);
363
364 $user_search->setFields(array('firstname'));
365 $result_obj = $user_search->performSearch();
366 $all_results->mergeEntries($result_obj);
367
368 $user_search->setFields(array('lastname'));
369 $result_obj = $user_search->performSearch();
370 $all_results->mergeEntries($result_obj);
371
372 $all_results->setMaxHits(100000);
373 $all_results->preventOverwritingMaxhits(true);
374 $all_results->filter(ROOT_FOLDER_ID, true);
375
376
377 include_once 'Services/User/classes/class.ilUserFilter.php';
379 if(count($users))
380 {
382 $tbl_users->setTitle(
$lng->txt(
'system') .
': ' .
$lng->txt(
'persons'));
383 $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
384
386 $counter = 0;
387 foreach($users as $user)
388 {
390
391 if(
$_GET[
"ref"] !=
"wsp")
392 {
396 }
397 else
398 {
400 }
401 $result[$counter][
'login'] = $login;
402
404 {
406 $result[$counter][
'firstname'] = $name[
'firstname'];
407 $result[$counter][
'lastname'] = $name[
'lastname'];
408 }
409 else
410 {
411 $result[$counter][
'firstname'] =
'';
412 $result[$counter][
'lastname'] =
'';
413 }
414
416 {
417 $has_mail_usr = true;
419 }
420
421 ++$counter;
422 }
423
424 if(
$_GET[
"ref"] !=
"wsp")
425 {
426 $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
427 }
428 else
429 {
430 $tbl_users->addColumn("", "", "1%");
431 }
432 $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
433 $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
434 $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
435 if($has_mail_usr == true)
436 {
437 foreach(
$result as $key => $val)
438 {
439 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
440 }
441
442 $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
443 }
445
446 $tbl_users->setDefaultOrderField('login');
447 $tbl_users->setPrefix('usr_');
448 $tbl_users->enable('select_all');
449 $tbl_users->setSelectAllCheckbox('search_name_to_usr');
450 $tbl_users->setFormName('recipients');
451
452 $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
453 }
454
455 include_once 'Services/Search/classes/class.ilQueryParser.php';
456 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
457 include_once 'Services/Search/classes/class.ilSearchResult.php';
458 include_once 'Services/Membership/classes/class.ilParticipants.php';
459
461
464 $query_parser->setMinWordLength(3);
465 $query_parser->parse();
466
468 $search->setFilter(array('grp'));
469 $result = $search->performSearch();
470 $group_results->mergeEntries(
$result);
471 $group_results->setMaxHits(PHP_INT_MAX);
472 $group_results->preventOverwritingMaxhits(true);
473 $group_results->setRequiredPermission('read');
474 $group_results->filter(ROOT_FOLDER_ID, true);
475
476 $visible_groups = array();
477 if($group_results->getResults())
478 {
480 $tbl_grp->setTitle(
$lng->txt(
'system') .
': ' .
$lng->txt(
'groups'));
481 $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
482
484 $counter = 0;
485
486 $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults()));
487
488 $groups = $group_results->getResults();
489 foreach($groups as $grp)
490 {
492 {
493 continue;
494 }
495
496 if(
$_GET[
"ref"] !=
"wsp")
497 {
498 $members = array();
499 $roles = $rbacreview->getAssignableChildRoles($grp['ref_id']);
500 foreach($roles as $role)
501 {
502 if(substr($role['title'], 0, 14) == 'il_grp_member_' ||
503 substr($role['title'], 0, 13) == 'il_grp_admin_'
504 )
505 {
506
507
508
509 array_push($members, '#' . $role['title']);
510 }
511 }
512 $str_members = implode(',', $members);
513
518 }
519 else
520 {
522 }
523 $result[$counter][
'title'] = $ilObjDataCache->lookupTitle($grp[
'obj_id']);
524 $result[$counter][
'description'] = $ilObjDataCache->lookupDescription($grp[
'obj_id']);
525
526 ++$counter;
527 $visible_groups[] = $grp;
528 }
529
530 if($visible_groups)
531 {
533
534 if(
$_GET[
"ref"] !=
"wsp")
535 {
536 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
537 }
538 else
539 {
540 $tbl_grp->addColumn("", "", "1%");
541 }
542 $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
543 $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
544
545 $tbl_grp->setDefaultOrderField('title');
546 $tbl_grp->setPrefix('grp_');
547 $tbl_grp->enable('select_all');
548 $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
549 $tbl_grp->setFormName('recipients');
550
551 $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
552 }
553 }
554
555 if(count($users) || count($visible_groups) || count($relations))
556 {
558 $this->tpl->setVariable("ALT_ARROW", '');
559
560 if(
$_GET[
"ref"] !=
"wsp")
561 {
562 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
563 }
564 else
565 {
566 $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
567 }
568 }
569 else
570 {
571 $this->lng->loadLanguageModule('search');
573 }
574
575 if(
$_GET[
"ref"] !=
"wsp")
576 {
577 $this->tpl->show();
578 }
579 }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
_lookupEmail($a_user_id)
Lookup email.
_lookupPref($a_usr_id, $a_keyword)
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)