187 global
$lng,
$ilUser, $rbacreview, $ilObjDataCache;
191 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_search.html",
"Services/Contact");
192 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
193 $this->tpl->setTitle($this->lng->txt(
"mail"));
194 $this->tpl->setVariable(
'SEARCHFORM', $form->getHtml());
197 if(strlen(
$_SESSION[
'mail_search_search']) < 3)
199 if(
$_GET[
"ref"] !=
"wsp")
210 if(
$_GET[
"ref"] ==
"wsp")
212 foreach($entries as $idx => $entry)
216 unset($entries[$idx]);
224 $tbl_addr->setTitle($lng->txt(
'mail_addressbook'));
225 $tbl_addr->setRowTemplate(
'tpl.mail_search_addr_row.html',
'Services/Contact');
229 foreach($entries as $entry)
231 if(
$_GET[
"ref"] !=
"wsp")
233 $result[$counter][
'check'] =
ilUtil::formCheckbox(0,
'search_name_to_addr[]', ($entry[
'login'] ? $entry[
'login'] : $entry[
'email'])) .
234 ilUtil::formCheckbox(0,
'search_name_cc[]', ($entry[
'login'] ? $entry[
'login'] : $entry[
'email'])) .
235 ilUtil::formCheckbox(0,
'search_name_bcc[]', ($entry[
'login'] ? $entry[
'login'] : $entry[
'email']));
243 $result[$counter][
'login'] = $entry[
'login'];
244 $result[$counter][
'firstname'] = $entry[
'firstname'];
245 $result[$counter][
'lastname'] = $entry[
'lastname'];
250 $has_mail_addr =
true;
251 $result[$counter][
'email'] = $entry[
'email'];
257 if(
$_GET[
"ref"] !=
"wsp")
259 $tbl_addr->addColumn($this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'cc') .
'/' . $this->lng->txt(
'bc'),
'check',
'10%');
263 $tbl_addr->addColumn(
"",
"",
"1%");
265 $tbl_addr->addColumn($this->lng->txt(
'login'),
'login',
"15%");
266 $tbl_addr->addColumn($this->lng->txt(
'firstname'),
'firstname',
"15%");
267 $tbl_addr->addColumn($this->lng->txt(
'lastname'),
'lastname',
"15%");
270 foreach(
$result as $key => $val)
272 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
275 $tbl_addr->addColumn($this->lng->txt(
'email'),
'email',
"15%");
279 $tbl_addr->setDefaultOrderField(
'login');
280 $tbl_addr->setPrefix(
'addr_');
281 $tbl_addr->enable(
'select_all');
282 $tbl_addr->setSelectAllCheckbox(
'search_name_to_addr');
283 $tbl_addr->setFormName(
'recipients');
285 $this->tpl->setVariable(
'TABLE_ADDR', $tbl_addr->getHTML());
288 include_once
'Services/Search/classes/class.ilQueryParser.php';
289 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
290 include_once
'Services/Search/classes/class.ilSearchResult.php';
296 $query_parser->setMinWordLength(3);
297 $query_parser->parse();
300 $user_search->enableActiveCheck(
true);
301 $user_search->setFields(array(
'login'));
302 $result_obj = $user_search->performSearch();
303 $all_results->mergeEntries($result_obj);
305 $user_search->setFields(array(
'firstname'));
306 $result_obj = $user_search->performSearch();
307 $all_results->mergeEntries($result_obj);
309 $user_search->setFields(array(
'lastname'));
310 $result_obj = $user_search->performSearch();
311 $all_results->mergeEntries($result_obj);
313 $all_results->setMaxHits(100000);
314 $all_results->preventOverwritingMaxhits(
true);
315 $all_results->filter(ROOT_FOLDER_ID,
true);
318 include_once
'Services/User/classes/class.ilUserFilter.php';
323 $tbl_users->setTitle($lng->txt(
'system') .
': ' . $lng->txt(
'persons'));
324 $tbl_users->setRowTemplate(
'tpl.mail_search_users_row.html',
'Services/Contact');
328 foreach($users as $user)
332 if(
$_GET[
"ref"] !=
"wsp")
342 $result[$counter][
'login'] = $login;
347 $result[$counter][
'firstname'] = $name[
'firstname'];
348 $result[$counter][
'lastname'] = $name[
'lastname'];
352 $result[$counter][
'firstname'] =
'';
353 $result[$counter][
'lastname'] =
'';
358 $has_mail_usr =
true;
365 if(
$_GET[
"ref"] !=
"wsp")
367 $tbl_users->addColumn($this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'cc') .
'/' . $this->lng->txt(
'bc'),
'check',
'10%');
371 $tbl_users->addColumn(
"",
"",
"1%");
373 $tbl_users->addColumn($this->lng->txt(
'login'),
'login',
'15%');
374 $tbl_users->addColumn($this->lng->txt(
'firstname'),
'firstname',
'15%');
375 $tbl_users->addColumn($this->lng->txt(
'lastname'),
'lastname',
'15%');
376 if($has_mail_usr ==
true)
378 foreach(
$result as $key => $val)
380 if($val[
'email'] ==
'')
$result[$key][
'email'] =
' ';
383 $tbl_users->addColumn($this->lng->txt(
'email'),
'email',
'15%');
387 $tbl_users->setDefaultOrderField(
'login');
388 $tbl_users->setPrefix(
'usr_');
389 $tbl_users->enable(
'select_all');
390 $tbl_users->setSelectAllCheckbox(
'search_name_to_usr');
391 $tbl_users->setFormName(
'recipients');
393 $this->tpl->setVariable(
'TABLE_USERS', $tbl_users->getHTML());
396 include_once
'Services/Search/classes/class.ilQueryParser.php';
397 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
398 include_once
'Services/Search/classes/class.ilSearchResult.php';
399 include_once
'Services/Membership/classes/class.ilParticipants.php';
405 $query_parser->setMinWordLength(3);
406 $query_parser->parse();
409 $search->setFilter(array(
'grp'));
410 $result = $search->performSearch();
411 $group_results->mergeEntries(
$result);
412 $group_results->setMaxHits(PHP_INT_MAX);
413 $group_results->preventOverwritingMaxhits(
true);
414 $group_results->setRequiredPermission(
'read');
415 $group_results->filter(ROOT_FOLDER_ID,
true);
417 $visible_groups = array();
418 if($group_results->getResults())
421 $tbl_grp->setTitle($lng->txt(
'system') .
': ' . $lng->txt(
'groups'));
422 $tbl_grp->setRowTemplate(
'tpl.mail_search_groups_row.html',
'Services/Contact');
427 $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults()));
429 $groups = $group_results->getResults();
430 foreach($groups as $grp)
437 if(
$_GET[
"ref"] !=
"wsp")
440 $roles = $rbacreview->getAssignableChildRoles($grp[
'ref_id']);
441 foreach($roles as $role)
443 if(substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
444 substr($role[
'title'], 0, 13) ==
'il_grp_admin_' 450 array_push($members,
'#' . $role[
'title']);
453 $str_members = implode(
',', $members);
464 $result[$counter][
'title'] = $ilObjDataCache->lookupTitle($grp[
'obj_id']);
465 $result[$counter][
'description'] = $ilObjDataCache->lookupDescription($grp[
'obj_id']);
468 $visible_groups[] = $grp;
475 if(
$_GET[
"ref"] !=
"wsp")
477 $tbl_grp->addColumn($this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'cc') .
'/' . $this->lng->txt(
'bc'),
'check',
'10%');
481 $tbl_grp->addColumn(
"",
"",
"1%");
483 $tbl_grp->addColumn($this->lng->txt(
'title'),
'title',
'15%');
484 $tbl_grp->addColumn($this->lng->txt(
'description'),
'description',
'15%');
486 $tbl_grp->setDefaultOrderField(
'title');
487 $tbl_grp->setPrefix(
'grp_');
488 $tbl_grp->enable(
'select_all');
489 $tbl_grp->setSelectAllCheckbox(
'search_name_to_grp');
490 $tbl_grp->setFormName(
'recipients');
492 $this->tpl->setVariable(
'TABLE_GRP', $tbl_grp->getHTML());
496 if(count($users) || count($visible_groups) || count($entries))
499 $this->tpl->setVariable(
"ALT_ARROW",
'');
501 if(
$_GET[
"ref"] !=
"wsp")
503 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->lng->txt(
'adopt'));
507 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->lng->txt(
'wsp_share_with_users'));
512 $this->lng->loadLanguageModule(
'search');
516 if(
$_GET[
"ref"] !=
"wsp")
static _lookupName($a_user_id)
lookup user name
Mail Box class Base class for creating and handling mail boxes.
static _lookupId($a_user_str)
lookup id by login
_lookupPref($a_usr_id, $a_keyword)
static getInstance()
Singelton get instance.
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
_lookupLogin($a_user_id)
lookup login
_lookupEmail($a_user_id)
Lookup email.
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
searchUsers($a_query_str)
Search users in addressbook // tab: compose -> search user.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public