ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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$ 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.

References $DIC, and user().

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
Class UserMail this class handles user mails.
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addPermission()

ilMailSearchGroupsGUI::addPermission (   $a_obj_ids)
protected

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

Referenced by share().

497  {
498  if (!is_array($a_obj_ids)) {
499  $a_obj_ids = array($a_obj_ids);
500  }
501 
502  $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
503  $added = false;
504  foreach ($a_obj_ids as $object_id) {
505  if (!in_array($object_id, $existing)) {
506  $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
507  }
508  }
509 
510  if ($added) {
511  ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
512  }
513  $this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
514  }
+ Here is the caller graph for this function:

◆ cancel()

ilMailSearchGroupsGUI::cancel ( )

Cancel action.

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

References $_GET, $data, ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilParticipants\_getMembershipByType(), ilObject\_hasUntrashedReference(), ilObjectFactory\getInstanceByObjId(), and user().

265  {
266  if ($_GET["view"] == "mygroups" &&
267  $_GET["ref"] == "mail") {
268  $this->ctrl->returnToParent($this);
269  } else {
270  $this->showMyGroups();
271  }
272  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ executeCommand()

ilMailSearchGroupsGUI::executeCommand ( )

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

References ilBuddySystem\getInstance().

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

◆ mail()

ilMailSearchGroupsGUI::mail ( )

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

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

128  {
129  if ($_GET["view"] == "mygroups") {
130  $ids = ((int) $_GET['search_grp']) ? array((int) $_GET['search_grp']) : $_POST['search_grp'];
131  if ($ids) {
132  $this->mailGroups();
133  } else {
134  ilUtil::sendInfo($this->lng->txt("mail_select_group"));
135  $this->showMyGroups();
136  }
137  } elseif ($_GET["view"] == "grp_members") {
138  $ids = ((int) $_GET['search_members']) ? array((int) $_GET['search_members']) : $_POST['search_members'];
139  if ($ids) {
140  $this->mailMembers();
141  } else {
142  ilUtil::sendInfo($this->lng->txt("mail_select_one_entry"));
143  $this->showMembers();
144  }
145  } else {
146  $this->showMyGroups();
147  }
148  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
$_POST["username"]
+ Here is the call graph for this function:

◆ mailGroups()

ilMailSearchGroupsGUI::mailGroups ( )

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

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

Referenced by mail().

151  {
152  $members = array();
153 
154  if (!is_array($old_mail_data = $this->umail->getSavedData())) {
155  $this->umail->savePostData(
156  $this->user->getId(),
157  array(),
158  "",
159  "",
160  "",
161  "",
162  "",
163  "",
164  "",
165  ""
166  );
167  }
168 
169  require_once './Services/Object/classes/class.ilObject.php';
170  require_once 'Services/Mail/classes/Address/Type/class.ilMailRoleAddressType.php';
171 
172  $ids = ((int) $_GET['search_grp']) ? array((int) $_GET['search_grp']) : $_POST['search_grp'];
173  foreach ($ids as $grp_id) {
174  $ref_ids = ilObject::_getAllReferences($grp_id);
175  foreach ($ref_ids as $ref_id) {
176  $roles = $this->rbacreview->getAssignableChildRoles($ref_id);
177  foreach ($roles as $role) {
178  if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
179  substr($role['title'], 0, 13) == 'il_grp_admin_') {
180  if (isset($old_mail_data['rcp_to']) &&
181  trim($old_mail_data['rcp_to']) != '') {
182  $rcpt = (new \ilRoleMailboxAddress($role['obj_id']))->value();
183  if (!$this->umail->existsRecipient($rcpt, (string) $old_mail_data['rcp_to'])) {
184  array_push($members, $rcpt);
185  }
186  } else {
187  array_push($members, (new \ilRoleMailboxAddress($role['obj_id']))->value());
188  }
189  }
190  }
191  }
192  }
193 
194  if (count($members)) {
195  $mail_data = $this->umail->appendSearchResult($members, 'to');
196  } else {
197  $mail_data = $this->umail->getSavedData();
198  }
199 
200  $this->umail->savePostData(
201  $mail_data["user_id"],
202  $mail_data["attachments"],
203  $mail_data["rcp_to"],
204  $mail_data["rcp_cc"],
205  $mail_data["rcp_bcc"],
206  $mail_data["m_email"],
207  $mail_data["m_subject"],
208  $mail_data["m_message"],
209  $mail_data["use_placeholders"],
210  $mail_data['tpl_ctx_id'],
211  $mail_data['tpl_ctx_params']
212  );
213 
214  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
215  }
$_GET["client_id"]
Class ilRoleMailboxAddress.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailMembers()

ilMailSearchGroupsGUI::mailMembers ( )

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

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

Referenced by mail().

218  {
219  $members = array();
220 
221  if (!is_array($this->umail->getSavedData())) {
222  $this->umail->savePostData(
223  $this->user->getId(),
224  array(),
225  "",
226  "",
227  "",
228  "",
229  "",
230  "",
231  "",
232  ""
233  );
234  }
235 
236  $ids = ((int) $_GET['search_members']) ? array((int) $_GET['search_members']) : $_POST['search_members'];
237 
238  foreach ($ids as $member) {
239  $login = ilObjUser::_lookupLogin($member);
240  array_push($members, $login);
241  }
242  $mail_data = $this->umail->appendSearchResult($members, "to");
243 
244  $this->umail->savePostData(
245  $mail_data["user_id"],
246  $mail_data["attachments"],
247  $mail_data["rcp_to"],
248  $mail_data["rcp_cc"],
249  $mail_data["rcp_bcc"],
250  $mail_data["m_email"],
251  $mail_data["m_subject"],
252  $mail_data["m_message"],
253  $mail_data["use_placeholders"],
254  $mail_data['tpl_ctx_id'],
255  $mail_data['tpl_ctx_params']
256  );
257 
258  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
259  }
static _lookupLogin($a_user_id)
lookup login
$login
Definition: cron.php:13
$_GET["client_id"]
user()
Definition: user.php:4
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilMailSearchGroupsGUI::share ( )

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

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

474  {
475  if ($_GET["view"] == "mygroups") {
476  $ids = $_REQUEST["search_grp"];
477  if (is_array($ids) && count($ids)) {
478  $this->addPermission($ids);
479  } else {
480  ilUtil::sendInfo($this->lng->txt("mail_select_course"));
481  $this->showMyGroups();
482  }
483  } elseif ($_GET["view"] == "grp_members") {
484  $ids = $_REQUEST["search_members"];
485  if (is_array($ids) && count($ids)) {
486  $this->addPermission($ids);
487  } else {
488  ilUtil::sendInfo($this->lng->txt("mail_select_one_entry"));
489  $this->showMembers();
490  }
491  } else {
492  $this->showMyGroups();
493  }
494  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
+ Here is the call graph for this function:

◆ showMembers()

ilMailSearchGroupsGUI::showMembers ( )

Show course members.

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

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

Referenced by mail(), and share().

398  {
399  if ($_GET["search_grp"] != "") {
400  $_POST["search_grp"] = explode(",", $_GET["search_grp"]);
401  }
402 
403  if (!is_array($_POST["search_grp"]) ||
404  count($_POST["search_grp"]) == 0) {
405  ilUtil::sendInfo($this->lng->txt("mail_select_group"));
406  $this->showMyGroups();
407  } else {
408  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
409  include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
410  $context = $_GET["ref"] ? $_GET["ref"] : "mail";
411  $table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context, $_POST["search_grp"]);
412  $this->lng->loadLanguageModule('crs');
413 
414  $tableData = array();
415  $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
416 
417  foreach ($_POST["search_grp"] as $grp_id) {
418  $ref_ids = ilObject::_getAllReferences($grp_id);
419  $ref_id = current($ref_ids);
420 
421  if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id, false))) {
422  $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
423 
424  foreach ($grp_members as $member) {
425  $tmp_usr = new ilObjUser($member['id']);
426  if (!$tmp_usr->getActive()) {
427  continue;
428  }
429 
430  $fullname = "";
431  if (in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y'))) {
432  $fullname = $member['lastname'] . ', ' . $member['firstname'];
433  }
434 
435  $rowData = array(
436  'members_id' => $member["id"],
437  'members_login' => $member["login"],
438  'members_name' => $fullname,
439  'members_crs_grp' => $group_obj->getTitle(),
440  'search_grp' => $grp_id,
441  );
442 
443  if ('mail' == $context && ilBuddySystem::getInstance()->isEnabled()) {
444  $relation = ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId($member['id']);
445  $state_name = ilStr::convertUpperCamelCaseToUnderscoreCase($relation->getState()->getName());
446  $rowData['status'] = '';
447  if ($member['id'] != $this->user->getId()) {
448  if ($relation->isOwnedByActor()) {
449  $rowData['status'] = $this->lng->txt('buddy_bs_state_' . $state_name . '_a');
450  } else {
451  $rowData['status'] = $this->lng->txt('buddy_bs_state_' . $state_name . '_p');
452  }
453  }
454  }
455 
456  $tableData[] = $rowData;
457  }
458  }
459  }
460  $table->setData($tableData);
461  if (count($tableData)) {
462  $searchTpl->setVariable("TXT_MARKED_ENTRIES", $this->lng->txt("marked_entries"));
463  }
464  $searchTpl->setVariable('TABLE', $table->getHTML());
465  $this->tpl->setContent($searchTpl->get());
466 
467  if ($_GET["ref"] != "wsp") {
468  $this->tpl->printToStdout();
469  }
470  }
471  }
static convertUpperCamelCaseToUnderscoreCase($value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
$context
Definition: webdav.php:26
static getInstanceByGlobalUser()
$_GET["client_id"]
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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
$_POST["username"]
+ 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: