61 public function __construct($wsp_access_handler = null, $wsp_node_id = null)
65 $this->tpl = $DIC[
'tpl'];
66 $this->ctrl = $DIC[
'ilCtrl'];
67 $this->lng = $DIC[
'lng'];
68 $this->rbacreview = $DIC[
'rbacreview'];
69 $this->object_data_cache = $DIC[
'ilObjDataCache'];
72 $this->wsp_access_handler = $wsp_access_handler;
73 $this->wsp_node_id = $wsp_node_id;
75 $this->ctrl->saveParameter($this,
"mobj_id");
76 $this->ctrl->saveParameter($this,
"ref");
83 $forward_class = $this->ctrl->getNextClass($this);
84 switch ($forward_class) {
86 if (!($cmd = $this->ctrl->getCmd())) {
101 return !isset(
$_GET[
'ref']) ||
$_GET[
'ref'] !==
'wsp';
107 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
109 $recipients = array_merge($recipients, (array)
$_POST[
'search_name_' . $recipient_type .
'_addr']);
110 $recipients = array_merge($recipients, (array)
$_POST[
'search_name_' . $recipient_type .
'_usr']);
111 $recipients = array_merge($recipients, (array)
$_POST[
'search_name_' . $recipient_type .
'_grp']);
112 $recipients = array_unique($recipients);
113 $_SESSION[
"mail_search_results_" . $recipient_type] = $recipients;
115 if (
'to' === $recipient_type) {
116 $to_recipients = $recipients;
126 $this->ctrl->returnToParent($this);
131 $mail_data = $this->umail->getSavedData();
133 $this->umail->savePostData(
134 $mail_data[
"user_id"],
135 $mail_data[
"attachments"],
136 $mail_data[
"rcp_to"],
137 $mail_data[
"rcp_cc"],
138 $mail_data[
"rcp_bcc"],
139 $mail_data[
"m_email"],
140 $mail_data[
"m_subject"],
141 $mail_data[
"m_message"],
142 $mail_data[
"use_placeholders"],
143 $mail_data[
'tpl_ctx_id'],
144 $mail_data[
'tpl_ctx_params']
150 $this->ctrl->returnToParent($this);
157 if (strlen(trim(
$_SESSION[
"mail_search_search"])) == 0) {
159 } elseif (strlen(trim(
$_SESSION[
"mail_search_search"])) < 3) {
160 $this->lng->loadLanguageModule(
'search');
173 $title = $this->lng->txt(
'search_recipients');
175 $this->lng->loadLanguageModule(
"wsp");
176 $title = $this->lng->txt(
"wsp_share_search_users");
180 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
182 $form->setTitle($title);
183 $form->setId(
'search_rcp');
184 $form->setFormAction($this->ctrl->getFormAction($this,
'search'));
186 $inp =
new ilTextInputGUI($this->lng->txt(
"search_for"),
'search');
188 $dsDataLink = $this->ctrl->getLinkTarget($this,
'lookupRecipientAsync',
'',
true,
false);
189 $inp->setDataSource($dsDataLink);
192 isset(
$_SESSION[
"mail_search_search"]) &&
193 is_string(
$_SESSION[
"mail_search_search"]) &&
194 strlen(trim(
$_SESSION[
"mail_search_search"])) > 0
198 $form->addItem($inp);
200 $form->addCommandButton(
'search', $this->lng->txt(
"search"));
201 $form->addCommandButton(
'cancel', $this->lng->txt(
"cancel"));
208 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
209 include_once
'Services/Mail/classes/class.ilMailForm.php';
210 include_once
'Services/Utilities/classes/class.ilStr.php';
213 if (isset(
$_GET[
"term"]) && is_string(
$_GET[
"term"])) {
214 $search =
$_GET[
"term"];
216 if (isset(
$_POST[
"term"]) && is_string(
$_POST[
"term"])) {
220 $search = trim($search);
230 $quoted = str_replace(
'%',
'\%', $quoted);
231 $quoted = str_replace(
'_',
'\_', $quoted);
236 $result = $mailFormObj->getRecipientAsync(
253 string $recipient_type,
258 'search_name_' . $recipient_type .
'_' . $search_type .
'[' . $index .
']',
262 $result[
$index][
'id_' . $recipient_type] =
'search_name_' . $search_type .
'_' .
$index;
263 $result[
$index][
'txt_' . $recipient_type] = $this->lng->txt(
'mail_' . $recipient_type);
270 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mail_search.html",
"Services/Contact");
271 $this->tpl->setVariable(
"ACTION", $this->ctrl->getFormAction($this));
272 $this->tpl->setTitle($this->lng->txt(
"mail"));
273 $this->tpl->setVariable(
'SEARCHFORM', $form->getHtml());
277 !isset(
$_SESSION[
"mail_search_search"]) ||
278 !is_string(
$_SESSION[
"mail_search_search"]) ||
279 strlen(trim(
$_SESSION[
"mail_search_search"])) < 3
282 $this->tpl->printToStdout();
287 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
289 if (count($relations)) {
294 $query_parser->setMinWordLength(3);
295 $query_parser->parse();
298 $user_search->enableActiveCheck(
true);
299 $user_search->setFields(array(
'login'));
300 $result_obj = $user_search->performSearch();
301 $contacts_search_result->mergeEntries($result_obj);
303 $user_search->setFields(array(
'firstname'));
304 $result_obj = $user_search->performSearch();
305 $contacts_search_result->mergeEntries($result_obj);
307 $user_search->setFields(array(
'lastname'));
308 $result_obj = $user_search->performSearch();
309 $contacts_search_result->mergeEntries($result_obj);
311 $contacts_search_result->setMaxHits(100000);
312 $contacts_search_result->preventOverwritingMaxhits(
true);
316 include_once
'Services/User/classes/class.ilUserFilter.php';
318 $users = array_intersect($users, $relations->getKeys());
321 $tbl_contacts->setTitle($this->lng->txt(
'mail_addressbook'));
322 $tbl_contacts->setRowTemplate(
'tpl.mail_search_addr_row.html',
'Services/Contact');
324 $has_mail_addr =
false;
327 foreach ($users as $user) {
331 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
340 $has_mail_addr =
true;
349 $result[$counter][
'firstname'] =
'';
350 $result[$counter][
'lastname'] =
'';
357 $tbl_contacts->addColumn(
358 $this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'mail_cc') .
'/' . $this->lng->txt(
'mail_bcc'),
363 $tbl_contacts->addColumn(
"",
"",
"1%",
true);
365 $tbl_contacts->addColumn($this->lng->txt(
'login'),
'login',
'15%');
366 $tbl_contacts->addColumn($this->lng->txt(
'firstname'),
'firstname',
'15%');
367 $tbl_contacts->addColumn($this->lng->txt(
'lastname'),
'lastname',
'15%');
368 if ($has_mail_addr) {
369 foreach (
$result as $key => $val) {
370 if ($val[
'email'] ==
'') {
371 $result[$key][
'email'] =
' ';
375 $tbl_contacts->addColumn($this->lng->txt(
'email'),
'email',
"15%");
377 $tbl_contacts->setData(
$result);
379 $tbl_contacts->setDefaultOrderField(
'login');
380 $tbl_contacts->enable(
'select_all');
381 $tbl_contacts->setSelectAllCheckbox(
'search_name_to_addr');
382 $tbl_contacts->setFormName(
'recipients');
384 $this->tpl->setVariable(
'TABLE_ADDR', $tbl_contacts->getHTML());
391 $query_parser->setMinWordLength(3);
392 $query_parser->parse();
395 $user_search->enableActiveCheck(
true);
396 $user_search->setFields(array(
'login'));
397 $result_obj = $user_search->performSearch();
398 $all_results->mergeEntries($result_obj);
400 $user_search->setFields(array(
'firstname'));
401 $result_obj = $user_search->performSearch();
402 $all_results->mergeEntries($result_obj);
404 $user_search->setFields(array(
'lastname'));
405 $result_obj = $user_search->performSearch();
406 $all_results->mergeEntries($result_obj);
408 $all_results->setMaxHits(100000);
409 $all_results->preventOverwritingMaxhits(
true);
413 $has_mail_usr =
false;
414 include_once
'Services/User/classes/class.ilUserFilter.php';
418 $tbl_users->setTitle($this->lng->txt(
'system') .
': ' . $this->lng->txt(
'persons'));
419 $tbl_users->setRowTemplate(
'tpl.mail_search_users_row.html',
'Services/Contact');
423 foreach ($users as $user) {
427 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
440 $result[$counter][
'firstname'] =
'';
441 $result[$counter][
'lastname'] =
'';
445 $has_mail_usr =
true;
453 $tbl_users->addColumn(
454 $this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'mail_cc') .
'/' . $this->lng->txt(
'mail_bcc'),
459 $tbl_users->addColumn(
"",
"",
"1%");
461 $tbl_users->addColumn($this->lng->txt(
'login'),
'login',
'15%');
462 $tbl_users->addColumn($this->lng->txt(
'firstname'),
'firstname',
'15%');
463 $tbl_users->addColumn($this->lng->txt(
'lastname'),
'lastname',
'15%');
464 if ($has_mail_usr ==
true) {
465 foreach (
$result as $key => $val) {
466 if ($val[
'email'] ==
'') {
467 $result[$key][
'email'] =
' ';
471 $tbl_users->addColumn($this->lng->txt(
'email'),
'email',
'15%');
475 $tbl_users->setDefaultOrderField(
'login');
476 $tbl_users->enable(
'select_all');
477 $tbl_users->setSelectAllCheckbox(
'search_name_to_usr');
478 $tbl_users->setFormName(
'recipients');
480 $this->tpl->setVariable(
'TABLE_USERS', $tbl_users->getHTML());
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';
492 $query_parser->setMinWordLength(3);
493 $query_parser->parse();
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');
504 $visible_groups = array();
505 if ($group_results->getResults()) {
507 $tbl_grp->setTitle($this->lng->txt(
'system') .
': ' . $this->lng->txt(
'groups'));
508 $tbl_grp->setRowTemplate(
'tpl.mail_search_groups_row.html',
'Services/Contact');
513 $this->object_data_cache->preloadReferenceCache(array_keys($group_results->getResults()));
515 $groups = $group_results->getResults();
516 foreach ($groups as $grp) {
523 $roles = $this->rbacreview->getAssignableChildRoles($grp[
'ref_id']);
524 foreach ($roles as $role) {
525 if (substr($role[
'title'], 0, 14) ==
'il_grp_member_' ||
526 substr($role[
'title'], 0, 13) ==
'il_grp_admin_' 529 array_push($members,
'#' . $role[
'title']);
532 $str_members = implode(
',', $members);
534 foreach ([
'to',
'cc',
'bcc'] as $recipient_type) {
540 $result[$counter][
'title'] = $this->object_data_cache->lookupTitle($grp[
'obj_id']);
541 $result[$counter][
'description'] = $this->object_data_cache->lookupDescription($grp[
'obj_id']);
544 $visible_groups[] = $grp;
547 if ($visible_groups) {
552 $this->lng->txt(
'mail_to') .
'/' . $this->lng->txt(
'mail_cc') .
'/' . $this->lng->txt(
'mail_bcc'),
557 $tbl_grp->addColumn(
"",
"",
"1%");
559 $tbl_grp->addColumn($this->lng->txt(
'title'),
'title',
'15%');
560 $tbl_grp->addColumn($this->lng->txt(
'description'),
'description',
'15%');
562 $tbl_grp->setDefaultOrderField(
'title');
563 $tbl_grp->enable(
'select_all');
564 $tbl_grp->setSelectAllCheckbox(
'search_name_to_grp');
565 $tbl_grp->setFormName(
'recipients');
567 $this->tpl->setVariable(
'TABLE_GRP', $tbl_grp->getHTML());
571 if (count($users) || count($visible_groups) || count($relations)) {
573 $this->tpl->setVariable(
"ALT_ARROW",
'');
575 $this->tpl->setVariable(
"ALT_ARROW_UP",
'');
578 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->lng->txt(
'adopt'));
580 $this->tpl->setVariable(
'BUTTON_ADOPT', $this->lng->txt(
'wsp_share_with_users'));
583 $this->lng->loadLanguageModule(
'search');
588 $this->tpl->printToStdout();
594 if (!is_array($a_obj_ids)) {
595 $a_obj_ids = array($a_obj_ids);
598 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
600 foreach ($a_obj_ids as $object_id) {
601 if (!in_array($object_id, $existing)) {
602 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
607 ilUtil::sendSuccess($this->lng->txt(
"wsp_share_success"),
true);
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getInstanceByGlobalUser()
__construct($wsp_access_handler=null, $wsp_node_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 _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)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
addPermission($a_obj_ids)
isDefaultRequestContext()
static _lookupEmail($a_user_id)
Lookup email.
static _lookupPref($a_usr_id, $a_keyword)
static _getObjectSearchInstance($query_parser)
get reference of ilFulltext/LikeObjectSearch.
appendRecipientSelection(array &$result, int $index, string $search_type, string $recipient_type, string $value)
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public