ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 ()
 
 adoptMembers ()
 Take over course members to addressbook. More...
 
 cancel ()
 Cancel action. More...
 
 showMyGroups ()
 Show user's courses. More...
 
 showMembers ()
 Show course members. More...
 
 share ()
 

Protected Member Functions

 addPermission ($a_obj_ids)
 

Protected Attributes

 $mailing_allowed
 

Private Attributes

 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $umail = null
 
 $abook = null
 

Detailed Description

Author
Jens Conze
Version
$Id$

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 27 of file class.ilMailSearchGroupsGUI.php.

References $_SESSION, $ilCtrl, $ilUser, $lng, and $tpl.

28  {
29  global $tpl, $ilCtrl, $lng, $ilUser, $rbacsystem;
30 
31  $this->tpl = $tpl;
32  $this->ctrl = $ilCtrl;
33  $this->lng = $lng;
34 
35  // personal workspace
36  $this->wsp_access_handler = $wsp_access_handler;
37  $this->wsp_node_id = $wsp_node_id;
38 
39  $this->ctrl->saveParameter($this, "mobj_id");
40  $this->ctrl->saveParameter($this, "ref");
41 
42  // check if current user may send mails
43  include_once "Services/Mail/classes/class.ilMail.php";
44  $mail = new ilMail($_SESSION["AccountId"]);
45  $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail',$mail->getMailObjectReferenceId());
46 
47  $this->umail = new ilFormatMail($ilUser->getId());
48  $this->abook = new ilAddressbook($ilUser->getId());
49  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
Mail Box class Base class for creating and handling mail boxes.
global $ilCtrl
Definition: ilias.php:18
Class UserMail this class handles user mails.
Class Mail this class handles base functions for mail handling.
global $ilUser
Definition: imgupload.php:15

Member Function Documentation

◆ addPermission()

ilMailSearchGroupsGUI::addPermission (   $a_obj_ids)
protected

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

References ilUtil\sendSuccess().

Referenced by share().

511  {
512  if(!is_array($a_obj_ids))
513  {
514  $a_obj_ids = array($a_obj_ids);
515  }
516 
517  $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
518  $added = false;
519  foreach($a_obj_ids as $object_id)
520  {
521  if(!in_array($object_id, $existing))
522  {
523  $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
524  }
525  }
526 
527  if($added)
528  {
529  ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
530  }
531  $this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
532  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adoptMembers()

ilMailSearchGroupsGUI::adoptMembers ( )

Take over course members to addressbook.

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

References $_GET, $_POST, $lng, ilObjUser\_lookupEmail(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilObjUser\_lookupPref(), ilUtil\sendInfo(), and showMembers().

229  {
230  global $lng;
231 
232  $ids = ((int)$_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
233 
234  if ($ids )
235  {
236  foreach ($ids as $member)
237  {
238  $login = ilObjUser::_lookupLogin($member);
239 
240  if (!$this->abook->checkEntry($login))
241  {
242  $name = ilObjUser::_lookupName($member);
243  $email = '';
244  if(ilObjUser::_lookupPref((int)$member, 'public_email') == 'y')
245  {
246  $email = ilObjUser::_lookupEmail($member);
247  }
248  $this->abook->addEntry(
249  $login,
250  $name["firstname"],
251  $name["lastname"],
252  $email
253  );
254  }
255  }
256  ilUtil::sendInfo($lng->txt("mail_members_added_addressbook"));
257  }
258  else
259  {
260  ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
261  }
262 
263  $this->showMembers();
264  }
static _lookupName($a_user_id)
lookup user name
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
_lookupPref($a_usr_id, $a_keyword)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
_lookupLogin($a_user_id)
lookup login
_lookupEmail($a_user_id)
Lookup email.
+ Here is the call graph for this function:

◆ cancel()

ilMailSearchGroupsGUI::cancel ( )

Cancel action.

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

References $_GET, and showMyGroups().

270  {
271  if ($_GET["view"] == "mygroups" &&
272  $_GET["ref"] == "mail")
273  {
274  $this->ctrl->returnToParent($this);
275  }
276  else
277  {
278  $this->showMyGroups();
279  }
280  }
$_GET["client_id"]
showMyGroups()
Show user&#39;s courses.
+ Here is the call graph for this function:

◆ executeCommand()

ilMailSearchGroupsGUI::executeCommand ( )

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

References $cmd.

52  {
53  $forward_class = $this->ctrl->getNextClass($this);
54  switch($forward_class)
55  {
56  default:
57  if (!($cmd = $this->ctrl->getCmd()))
58  {
59  $cmd = "showMyGroups";
60  }
61 
62  $this->$cmd();
63  break;
64  }
65  return true;
66  }
$cmd
Definition: sahs_server.php:35

◆ mail()

ilMailSearchGroupsGUI::mail ( )

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

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

69  {
70  global $lng;
71 
72  if ($_GET["view"] == "mygroups")
73  {
74  $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
75  if ($ids)
76  {
77  $this->mailGroups();
78  }
79  else
80  {
81  ilUtil::sendInfo($lng->txt("mail_select_group"));
82  $this->showMyGroups();
83  }
84  }
85  else if ($_GET["view"] == "grp_members")
86  {
87  $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
88  if ($ids)
89  {
90  $this->mailMembers();
91  }
92  else
93  {
94  ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
95  $this->showMembers();
96  }
97  }
98  else
99  {
100  $this->showMyGroups();
101  }
102  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
showMyGroups()
Show user&#39;s courses.
+ Here is the call graph for this function:

◆ mailGroups()

ilMailSearchGroupsGUI::mailGroups ( )

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

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

Referenced by mail().

105  {
106  global $ilUser, $rbacreview;
107 
108  $members = array();
109 
110  if (!is_array($old_mail_data = $this->umail->getSavedData()))
111  {
112  $this->umail->savePostData(
113  $ilUser->getId(),
114  array(),
115  "",
116  "",
117  "",
118  "",
119  "",
120  "",
121  "",
122  ""
123  );
124  }
125 
126  require_once './Services/Object/classes/class.ilObject.php';
127  $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
128  foreach ($ids as $grp_id)
129  {
130  $ref_ids = ilObject::_getAllReferences($grp_id);
131  foreach ($ref_ids as $ref_id)
132  {
133  $roles = $rbacreview->getAssignableChildRoles($ref_id);
134  foreach ($roles as $role)
135  {
136  if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
137  substr($role['title'], 0, 13) == 'il_grp_admin_')
138  {
139  if(isset($old_mail_data['rcp_to']) &&
140  trim($old_mail_data['rcp_to']) != '')
141  {
142  $rcpt = $rbacreview->getRoleMailboxAddress($role['obj_id']);
143  if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data['rcp_to']))
144  {
145  array_push($members, $rcpt);
146  }
147  }
148  else
149  {
150  array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
151  }
152  }
153  }
154  }
155  }
156 
157  if(count($members))
158  $mail_data = $this->umail->appendSearchResult($members, 'to');
159  else
160  $mail_data = $this->umail->getSavedData();
161 
162  $this->umail->savePostData(
163  $mail_data["user_id"],
164  $mail_data["attachments"],
165  $mail_data["rcp_to"],
166  $mail_data["rcp_cc"],
167  $mail_data["rcp_bcc"],
168  $mail_data["m_type"],
169  $mail_data["m_email"],
170  $mail_data["m_subject"],
171  $mail_data["m_message"],
172  $mail_data["use_placeholders"]
173  );
174 
175  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
176  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static _getAllReferences($a_id)
get all reference ids of object
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mailMembers()

ilMailSearchGroupsGUI::mailMembers ( )

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

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

Referenced by mail().

179  {
180  global $ilUser;
181 
182  $members = array();
183 
184  if (!is_array($this->umail->getSavedData()))
185  {
186  $this->umail->savePostData(
187  $ilUser->getId(),
188  array(),
189  "",
190  "",
191  "",
192  "",
193  "",
194  "",
195  "",
196  ""
197  );
198  }
199 
200  $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
201 
202  foreach ($ids as $member)
203  {
204  $login = ilObjUser::_lookupLogin($member);
205  array_push($members, $login);
206  }
207  $mail_data = $this->umail->appendSearchResult($members,"to");
208 
209  $this->umail->savePostData(
210  $mail_data["user_id"],
211  $mail_data["attachments"],
212  $mail_data["rcp_to"],
213  $mail_data["rcp_cc"],
214  $mail_data["rcp_bcc"],
215  $mail_data["m_type"],
216  $mail_data["m_email"],
217  $mail_data["m_subject"],
218  $mail_data["m_message"],
219  $mail_data["use_placeholders"]
220  );
221 
222  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
223  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
_lookupLogin($a_user_id)
lookup login
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilMailSearchGroupsGUI::share ( )

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

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

475  {
476  global $lng;
477 
478  if ($_GET["view"] == "mygroups")
479  {
480  $ids = $_REQUEST["search_grp"];
481  if (sizeof($ids))
482  {
483  $this->addPermission($ids);
484  }
485  else
486  {
487  ilUtil::sendInfo($lng->txt("mail_select_course"));
488  $this->showMyGroups();
489  }
490  }
491  else if ($_GET["view"] == "grp_members")
492  {
493  $ids = $_REQUEST["search_members"];
494  if (sizeof($ids))
495  {
496  $this->addPermission($ids);
497  }
498  else
499  {
500  ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
501  $this->showMembers();
502  }
503  }
504  else
505  {
506  $this->showMyGroups();
507  }
508  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showMembers()
Show course members.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
showMyGroups()
Show user&#39;s courses.
+ 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, $lng, $ref_id, ilObject\_getAllReferences(), ilObjUser\_lookupPref(), ilObjectFactory\getInstanceByRefId(), ilUtil\sendInfo(), and showMyGroups().

Referenced by adoptMembers(), mail(), and share().

398  {
399  global $lng;
400 
401  if ($_GET["search_grp"] != "")
402  {
403  $_POST["search_grp"] = explode(",", $_GET["search_grp"]);
404  }
405 
406  if (!is_array($_POST["search_grp"]) ||
407  count($_POST["search_grp"]) == 0)
408  {
409  ilUtil::sendInfo($lng->txt("mail_select_group"));
410  $this->showMyGroups();
411  }
412  else
413  {
414  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
415  include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
416  $context = $_GET["ref"] ? $_GET["ref"] : "mail";
417  $table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context);
418  $table->setId('show_grps_mmbrs_tbl');
419  $lng->loadLanguageModule('crs');
420 
421  $tableData = array();
422  $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
423 
424  foreach($_POST["search_grp"] as $grp_id)
425  {
426  $ref_ids = ilObject::_getAllReferences($grp_id);
427  $ref_id = current($ref_ids);
428 
429  if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id,false)))
430  {
431  $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
432 
433  foreach($grp_members as $member)
434  {
435  $tmp_usr = new ilObjUser($member['id']);
436  if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
437  {
438  unset($tmp_usr);
439  continue;
440  }
441  unset($tmp_usr);
442 
443  $fullname = "";
444  if(in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y')))
445  $fullname = $member['lastname'].', '.$member['firstname'];
446 
447  $rowData = array(
448  'members_id' => $member["id"],
449  'members_login' => $member["login"],
450  'members_name' => $fullname,
451  'members_crs_grp' => $group_obj->getTitle(),
452  'members_in_addressbook' => $this->abook->checkEntryByLogin($member["login"]) ? $lng->txt("yes") : $lng->txt("no"),
453  'search_grp' => $grp_id
454  );
455  $tableData[] = $rowData;
456  }
457  }
458  }
459  $table->setData($tableData);
460  if (count($tableData))
461  {
462  $searchTpl->setVariable("TXT_MARKED_ENTRIES",$lng->txt("marked_entries"));
463  }
464  $searchTpl->setVariable('TABLE', $table->getHtml());
465  $this->tpl->setContent($searchTpl->get());
466 
467  if($_GET["ref"] != "wsp")
468  {
469  $this->tpl->show();
470  }
471  }
472  }
$_POST['username']
Definition: cron.php:12
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$_GET["client_id"]
_lookupPref($a_usr_id, $a_keyword)
static _getAllReferences($a_id)
get all reference ids of object
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
special template class to simplify handling of ITX/PEAR
$ref_id
Definition: sahs_server.php:39
showMyGroups()
Show user&#39;s courses.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMyGroups()

ilMailSearchGroupsGUI::showMyGroups ( )

Show user's courses.

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

References $_GET, $data, $ilUser, $lng, $path, $ref_id, ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilParticipants\_getMembershipByType(), and ilObject\_hasUntrashedReference().

Referenced by cancel(), mail(), share(), and showMembers().

286  {
287  global $lng, $ilUser, $ilObjDataCache, $tree;
288 
289  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
290 
291  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
292 
293  $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
294 
295  $_GET['view'] = 'mygroups';
296 
297  $lng->loadLanguageModule('crs');
298 
299  $this->ctrl->setParameter($this, 'view', 'mygroups');
300 
301  include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
302  $table = new ilMailSearchCoursesTableGUI($this, 'grp', $_GET["ref"]);
303  $table->setId('search_grps_tbl');
304  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
305 
306  $counter = 0;
307  $tableData = array();
308  if (is_array($grp_ids) &&
309  count($grp_ids) > 0)
310  {
311 
312  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
313  foreach($grp_ids as $grp_id)
314  {
316  {
317  $oGroupParticipants = ilGroupParticipants::_getInstanceByObjId($grp_id);
318  $grp_members = $oGroupParticipants->getParticipants();
319 
320  foreach ($grp_members as $key => $member)
321  {
322  $tmp_usr = new ilObjUser($member);
323 
324  if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
325  {
326  unset($grp_members[$key]);
327  }
328  }
329  unset($tmp_usr);
330 
331  $ref_ids = ilObject::_getAllReferences($grp_id);
332  $ref_id = current($ref_ids);
333  $path_arr = $tree->getPathFull($ref_id, $tree->getRootId());
334  $path_counter = 0;
335  $path = '';
336  foreach($path_arr as $data)
337  {
338  if($path_counter++)
339  {
340  $path .= " -> ";
341  }
342  $path .= $data['title'];
343  }
344  $path = $this->lng->txt('path').': '.$path;
345 
346  $current_selection_list = new ilAdvancedSelectionListGUI();
347  $current_selection_list->setListTitle($this->lng->txt("actions"));
348  $current_selection_list->setId("act_".$counter);
349 
350  $this->ctrl->setParameter($this, 'search_grp', $grp_id);
351  $this->ctrl->setParameter($this, 'view', 'mygroups');
352 
353  if($_GET["ref"] == "mail")
354  {
355  if ($this->mailing_allowed)
356  $current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail"));
357  }
358  else if($_GET["ref"] == "wsp")
359  {
360  $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share"));
361  }
362  $current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers"));
363 
364  $this->ctrl->clearParameters($this);
365 
366  $rowData = array
367  (
368  'CRS_ID' => $grp_id,
369  'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
370  'CRS_NO_MEMBERS' => count($grp_members),
371  'CRS_PATH' => $path,
372  'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
373  );
374  $counter++;
375  $tableData[] = $rowData;
376  }
377  }
378  }
379  $table->setData($tableData);
380  if($counter > 0)
381  {
382  $this->tpl->setVariable('TXT_MARKED_ENTRIES',$lng->txt('marked_entries'));
383  }
384 
385  $searchTpl->setVariable('TABLE', $table->getHtml());
386  $this->tpl->setContent($searchTpl->get());
387 
388  if($_GET["ref"] != "wsp")
389  {
390  $this->tpl->show();
391  }
392  }
$_GET["client_id"]
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _getAllReferences($a_id)
get all reference ids of object
special template class to simplify handling of ITX/PEAR
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
User interface class for advanced drop-down selection lists.
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $abook

ilMailSearchGroupsGUI::$abook = null
private

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

◆ $ctrl

ilMailSearchGroupsGUI::$ctrl = null
private

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

◆ $lng

ilMailSearchGroupsGUI::$lng = null
private

◆ $mailing_allowed

ilMailSearchGroupsGUI::$mailing_allowed
protected

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

◆ $tpl

ilMailSearchGroupsGUI::$tpl = null
private

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

Referenced by __construct().

◆ $umail

ilMailSearchGroupsGUI::$umail = null
private

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


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