ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailSearchGroupsGUI Class Reference
+ Collaboration diagram for ilMailSearchGroupsGUI:

Public Member Functions

 __construct ($wsp_access_handler=null, $wsp_node_id=null)
 
 executeCommand ()
 
 mail ()
 
 mailGroups ()
 
 mailMembers ()
 
 cancel ()
 Cancel action. More...
 
 showMembers ()
 Show course members. More...
 
 share ()
 

Protected Member Functions

 addPermission ($a_obj_ids)
 

Protected Attributes

 $tpl
 
 $ctrl
 
 $lng
 
 $user
 
 $error
 
 $rbacsystem
 
 $rbacreview
 
 $tree
 
 $cache
 
 $umail
 
 $mailing_allowed
 

Detailed Description

Author
Jens Conze
Version
$Id$ @ilCtrl_Calls ilMailSearchGroupsGUI: ilBuddySystemGUI

Definition at line 16 of file class.ilMailSearchGroupsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailSearchGroupsGUI::__construct (   $wsp_access_handler = null,
  $wsp_node_id = null 
)

Definition at line 73 of file class.ilMailSearchGroupsGUI.php.

74 {
75 global $DIC;
76
77 $this->tpl = $DIC['tpl'];
78 $this->ctrl = $DIC['ilCtrl'];
79 $this->lng = $DIC['lng'];
80 $this->user = $DIC['ilUser'];
81 $this->error = $DIC['ilErr'];
82 $this->rbacsystem = $DIC['rbacsystem'];
83 $this->rbacreview = $DIC['rbacreview'];
84 $this->tree = $DIC['tree'];
85 $this->cache = $DIC['ilObjDataCache'];
86
87 // personal workspace
88 $this->wsp_access_handler = $wsp_access_handler;
89 $this->wsp_node_id = $wsp_node_id;
90
91 $this->ctrl->saveParameter($this, "mobj_id");
92 $this->ctrl->saveParameter($this, "ref");
93
94 include_once "Services/Mail/classes/class.ilMail.php";
95 $mail = new ilMail($this->user->getId());
96 $this->mailing_allowed = $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
97
98 $this->umail = new ilFormatMail($this->user->getId());
99 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public
Class UserMail this class handles user mails.
This class handles base functions for mail handling.
global $DIC

References $DIC, error(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addPermission()

ilMailSearchGroupsGUI::addPermission (   $a_obj_ids)
protected

Definition at line 567 of file class.ilMailSearchGroupsGUI.php.

568 {
569 if(!is_array($a_obj_ids))
570 {
571 $a_obj_ids = array($a_obj_ids);
572 }
573
574 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
575 $added = false;
576 foreach($a_obj_ids as $object_id)
577 {
578 if(!in_array($object_id, $existing))
579 {
580 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
581 }
582 }
583
584 if($added)
585 {
586 ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
587 }
588 $this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
589 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References ilUtil\sendSuccess().

Referenced by share().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilMailSearchGroupsGUI::cancel ( )

Cancel action.

Definition at line 290 of file class.ilMailSearchGroupsGUI.php.

291 {
292 if ($_GET["view"] == "mygroups" &&
293 $_GET["ref"] == "mail")
294 {
295 $this->ctrl->returnToParent($this);
296 }
297 else
298 {
299 $this->showMyGroups();
300 }
301 }
$_GET["client_id"]

References $_GET.

◆ executeCommand()

ilMailSearchGroupsGUI::executeCommand ( )

Definition at line 101 of file class.ilMailSearchGroupsGUI.php.

102 {
103 $forward_class = $this->ctrl->getNextClass($this);
104 switch($forward_class)
105 {
106 case 'ilbuddysystemgui':
107 if(!ilBuddySystem::getInstance()->isEnabled())
108 {
109 $this->error->raiseError($this->lng->txt('msg_no_perm_read'), $this->error->MESSAGE);
110 }
111
112 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
113 $this->ctrl->saveParameter($this, 'search_grp');
114 $this->ctrl->setReturn($this, 'showMembers');
115 $this->ctrl->forwardCommand(new ilBuddySystemGUI());
116 break;
117
118 default:
119 if (!($cmd = $this->ctrl->getCmd()))
120 {
121 $cmd = "showMyGroups";
122 }
123
124 $this->$cmd();
125 break;
126 }
127 return true;
128 }
Class ilBuddySystemGUI.
$cmd
Definition: sahs_server.php:35

References $cmd, error(), and ilBuddySystem\getInstance().

+ Here is the call graph for this function:

◆ mail()

ilMailSearchGroupsGUI::mail ( )

Definition at line 130 of file class.ilMailSearchGroupsGUI.php.

131 {
132 if ($_GET["view"] == "mygroups")
133 {
134 $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
135 if ($ids)
136 {
137 $this->mailGroups();
138 }
139 else
140 {
141 ilUtil::sendInfo($this->lng->txt("mail_select_group"));
142 $this->showMyGroups();
143 }
144 }
145 else if ($_GET["view"] == "grp_members")
146 {
147 $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
148 if ($ids)
149 {
150 $this->mailMembers();
151 }
152 else
153 {
154 ilUtil::sendInfo($this->lng->txt("mail_select_one_entry"));
155 $this->showMembers();
156 }
157 }
158 else
159 {
160 $this->showMyGroups();
161 }
162 }
$_POST["username"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $_POST, mailGroups(), mailMembers(), ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ mailGroups()

ilMailSearchGroupsGUI::mailGroups ( )

Definition at line 164 of file class.ilMailSearchGroupsGUI.php.

165 {
166 $members = array();
167
168 if (!is_array($old_mail_data = $this->umail->getSavedData()))
169 {
170 $this->umail->savePostData(
171 $this->user->getId(),
172 array(),
173 "",
174 "",
175 "",
176 "",
177 "",
178 "",
179 "",
180 ""
181 );
182 }
183
184 require_once './Services/Object/classes/class.ilObject.php';
185 require_once 'Services/Mail/classes/Address/Type/class.ilMailRoleAddressType.php';
186
187 $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
188 foreach ($ids as $grp_id)
189 {
190 $ref_ids = ilObject::_getAllReferences($grp_id);
191 foreach ($ref_ids as $ref_id)
192 {
193 $roles = $this->rbacreview->getAssignableChildRoles($ref_id);
194 foreach ($roles as $role)
195 {
196 if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
197 substr($role['title'], 0, 13) == 'il_grp_admin_')
198 {
199 if(isset($old_mail_data['rcp_to']) &&
200 trim($old_mail_data['rcp_to']) != '')
201 {
202 $rcpt = ilMailRoleAddressType::getRoleMailboxAddress($role['obj_id']);
203 if(!$this->umail->existsRecipient($rcpt, $old_mail_data['rcp_to']))
204 {
205 array_push($members, $rcpt);
206 }
207 }
208 else
209 {
210 array_push($members, ilMailRoleAddressType::getRoleMailboxAddress($role['obj_id']));
211 }
212 }
213 }
214 }
215 }
216
217 if(count($members))
218 $mail_data = $this->umail->appendSearchResult($members, 'to');
219 else
220 $mail_data = $this->umail->getSavedData();
221
222 $this->umail->savePostData(
223 $mail_data["user_id"],
224 $mail_data["attachments"],
225 $mail_data["rcp_to"],
226 $mail_data["rcp_cc"],
227 $mail_data["rcp_bcc"],
228 $mail_data["m_type"],
229 $mail_data["m_email"],
230 $mail_data["m_subject"],
231 $mail_data["m_message"],
232 $mail_data["use_placeholders"],
233 $mail_data['tpl_ctx_id'],
234 $mail_data['tpl_ctx_params']
235 );
236
237 ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
238 }
static _getAllReferences($a_id)
get all reference ids of object
static redirect($a_script)
http redirect to other script
$ref_id
Definition: sahs_server.php:39

References $_GET, $_POST, $ref_id, ilObject\_getAllReferences(), ilUtil\redirect(), and user().

Referenced by mail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailMembers()

ilMailSearchGroupsGUI::mailMembers ( )

Definition at line 240 of file class.ilMailSearchGroupsGUI.php.

241 {
242 $members = array();
243
244 if (!is_array($this->umail->getSavedData()))
245 {
246 $this->umail->savePostData(
247 $this->user->getId(),
248 array(),
249 "",
250 "",
251 "",
252 "",
253 "",
254 "",
255 "",
256 ""
257 );
258 }
259
260 $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
261
262 foreach ($ids as $member)
263 {
264 $login = ilObjUser::_lookupLogin($member);
265 array_push($members, $login);
266 }
267 $mail_data = $this->umail->appendSearchResult($members,"to");
268
269 $this->umail->savePostData(
270 $mail_data["user_id"],
271 $mail_data["attachments"],
272 $mail_data["rcp_to"],
273 $mail_data["rcp_cc"],
274 $mail_data["rcp_bcc"],
275 $mail_data["m_type"],
276 $mail_data["m_email"],
277 $mail_data["m_subject"],
278 $mail_data["m_message"],
279 $mail_data["use_placeholders"],
280 $mail_data['tpl_ctx_id'],
281 $mail_data['tpl_ctx_params']
282 );
283
284 ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
285 }
static _lookupLogin($a_user_id)
lookup login

References $_GET, $_POST, ilObjUser\_lookupLogin(), ilUtil\redirect(), and user().

Referenced by mail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilMailSearchGroupsGUI::share ( )

Definition at line 533 of file class.ilMailSearchGroupsGUI.php.

534 {
535 if ($_GET["view"] == "mygroups")
536 {
537 $ids = $_REQUEST["search_grp"];
538 if (sizeof($ids))
539 {
540 $this->addPermission($ids);
541 }
542 else
543 {
544 ilUtil::sendInfo($this->lng->txt("mail_select_course"));
545 $this->showMyGroups();
546 }
547 }
548 else if ($_GET["view"] == "grp_members")
549 {
550 $ids = $_REQUEST["search_members"];
551 if (sizeof($ids))
552 {
553 $this->addPermission($ids);
554 }
555 else
556 {
557 ilUtil::sendInfo($this->lng->txt("mail_select_one_entry"));
558 $this->showMembers();
559 }
560 }
561 else
562 {
563 $this->showMyGroups();
564 }
565 }

References $_GET, addPermission(), ilUtil\sendInfo(), and showMembers().

+ Here is the call graph for this function:

◆ showMembers()

ilMailSearchGroupsGUI::showMembers ( )

Show course members.

Definition at line 441 of file class.ilMailSearchGroupsGUI.php.

442 {
443 if ($_GET["search_grp"] != "")
444 {
445 $_POST["search_grp"] = explode(",", $_GET["search_grp"]);
446 }
447
448 if (!is_array($_POST["search_grp"]) ||
449 count($_POST["search_grp"]) == 0)
450 {
451 ilUtil::sendInfo($this->lng->txt("mail_select_group"));
452 $this->showMyGroups();
453 }
454 else
455 {
456 $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
457 include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
458 $context = $_GET["ref"] ? $_GET["ref"] : "mail";
459 $table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context);
460 $this->lng->loadLanguageModule('crs');
461
462 $tableData = array();
463 $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
464
465 foreach($_POST["search_grp"] as $grp_id)
466 {
467 $ref_ids = ilObject::_getAllReferences($grp_id);
468 $ref_id = current($ref_ids);
469
470 if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id,false)))
471 {
472 $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
473
474 foreach($grp_members as $member)
475 {
476 $tmp_usr = new ilObjUser($member['id']);
477 if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
478 {
479 unset($tmp_usr);
480 continue;
481 }
482 unset($tmp_usr);
483
484 $fullname = "";
485 if(in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y')))
486 $fullname = $member['lastname'].', '.$member['firstname'];
487
488 $rowData = array(
489 'members_id' => $member["id"],
490 'members_login' => $member["login"],
491 'members_name' => $fullname,
492 'members_crs_grp' => $group_obj->getTitle(),
493 'search_grp' => $grp_id,
494 );
495
496 if('mail' == $context && ilBuddySystem::getInstance()->isEnabled())
497 {
498 $relation = ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId($member['id']);
499 $state_name = ilStr::convertUpperCamelCaseToUnderscoreCase($relation->getState()->getName());
500 $rowData['status'] = '';
501 if($member['id'] != $this->user->getId())
502 {
503 if($relation->isOwnedByRequest())
504 {
505 $rowData['status'] = $this->lng->txt('buddy_bs_state_' . $state_name . '_a');
506 }
507 else
508 {
509 $rowData['status'] = $this->lng->txt('buddy_bs_state_' . $state_name . '_p');
510 }
511 }
512 }
513
514 $tableData[] = $rowData;
515 }
516 }
517 }
518 $table->setData($tableData);
519 if (count($tableData))
520 {
521 $searchTpl->setVariable("TXT_MARKED_ENTRIES", $this->lng->txt("marked_entries"));
522 }
523 $searchTpl->setVariable('TABLE', $table->getHTML());
524 $this->tpl->setContent($searchTpl->get());
525
526 if($_GET["ref"] != "wsp")
527 {
528 $this->tpl->show();
529 }
530 }
531 }
static getInstanceByGlobalUser()
static _lookupPref($a_usr_id, $a_keyword)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static convertUpperCamelCaseToUnderscoreCase($value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
special template class to simplify handling of ITX/PEAR

References $_GET, $_POST, $ref_id, ilObject\_getAllReferences(), ilObjUser\_lookupPref(), ilStr\convertUpperCamelCaseToUnderscoreCase(), ilBuddySystem\getInstance(), ilBuddyList\getInstanceByGlobalUser(), ilObjectFactory\getInstanceByRefId(), ilUtil\sendInfo(), and user().

Referenced by mail(), and share().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cache

ilMailSearchGroupsGUI::$cache
protected

Definition at line 61 of file class.ilMailSearchGroupsGUI.php.

◆ $ctrl

ilMailSearchGroupsGUI::$ctrl
protected

Definition at line 26 of file class.ilMailSearchGroupsGUI.php.

◆ $error

ilMailSearchGroupsGUI::$error
protected

Definition at line 41 of file class.ilMailSearchGroupsGUI.php.

◆ $lng

ilMailSearchGroupsGUI::$lng
protected

Definition at line 31 of file class.ilMailSearchGroupsGUI.php.

◆ $mailing_allowed

ilMailSearchGroupsGUI::$mailing_allowed
protected

Definition at line 71 of file class.ilMailSearchGroupsGUI.php.

◆ $rbacreview

ilMailSearchGroupsGUI::$rbacreview
protected

Definition at line 51 of file class.ilMailSearchGroupsGUI.php.

◆ $rbacsystem

ilMailSearchGroupsGUI::$rbacsystem
protected

Definition at line 46 of file class.ilMailSearchGroupsGUI.php.

◆ $tpl

ilMailSearchGroupsGUI::$tpl
protected

Definition at line 21 of file class.ilMailSearchGroupsGUI.php.

◆ $tree

ilMailSearchGroupsGUI::$tree
protected

Definition at line 56 of file class.ilMailSearchGroupsGUI.php.

◆ $umail

ilMailSearchGroupsGUI::$umail
protected

Definition at line 66 of file class.ilMailSearchGroupsGUI.php.

◆ $user

ilMailSearchGroupsGUI::$user
protected

Definition at line 36 of file class.ilMailSearchGroupsGUI.php.


The documentation for this class was generated from the following file: