ILIAS  release_4-4 Revision
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 517 of file class.ilMailSearchGroupsGUI.php.

References ilUtil\sendSuccess().

Referenced by share().

518  {
519  if(!is_array($a_obj_ids))
520  {
521  $a_obj_ids = array($a_obj_ids);
522  }
523 
524  $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
525  $added = false;
526  foreach($a_obj_ids as $object_id)
527  {
528  if(!in_array($object_id, $existing))
529  {
530  $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
531  }
532  }
533 
534  if($added)
535  {
536  ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
537  }
538  $this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
539  }
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 235 of file class.ilMailSearchGroupsGUI.php.

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

236  {
237  global $lng;
238 
239  $ids = ((int)$_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
240 
241  if ($ids )
242  {
243  foreach ($ids as $member)
244  {
245  $login = ilObjUser::_lookupLogin($member);
246 
247  if (!$this->abook->checkEntry($login))
248  {
249  $name = ilObjUser::_lookupName($member);
250  $email = '';
251  if(ilObjUser::_lookupPref((int)$member, 'public_email') == 'y')
252  {
253  $email = ilObjUser::_lookupEmail($member);
254  }
255  $this->abook->addEntry(
256  $login,
257  $name["firstname"],
258  $name["lastname"],
259  $email
260  );
261  }
262  }
263  ilUtil::sendInfo($lng->txt("mail_members_added_addressbook"));
264  }
265  else
266  {
267  ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
268  }
269 
270  $this->showMembers();
271  }
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 276 of file class.ilMailSearchGroupsGUI.php.

References $_GET, and showMyGroups().

277  {
278  if ($_GET["view"] == "mygroups" &&
279  $_GET["ref"] == "mail")
280  {
281  $this->ctrl->returnToParent($this);
282  }
283  else
284  {
285  $this->showMyGroups();
286  }
287  }
$_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 
144  if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data['rcp_to']))
145  // does not work if Pear is enabled and Mailbox Address contain special chars!!
146 // array_push($members, $rcpt);
147  // FIX for Mantis: 7523, 8061
148  array_push($members, '#'.$role['title']);
149 
150  unset($rcpt);
151  }
152  else
153  {
154  // does not work if Pear is enabled and Mailbox Address contain special chars!!
155 // array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
156  // FIX for Mantis: 7523, 8061
157  array_push($members, '#'.$role['title']);
158  }
159  }
160  }
161  }
162  }
163 
164  if(count($members))
165  $mail_data = $this->umail->appendSearchResult($members, 'to');
166  else
167  $mail_data = $this->umail->getSavedData();
168 
169  $this->umail->savePostData(
170  $mail_data["user_id"],
171  $mail_data["attachments"],
172  $mail_data["rcp_to"],
173  $mail_data["rcp_cc"],
174  $mail_data["rcp_bcc"],
175  $mail_data["m_type"],
176  $mail_data["m_email"],
177  $mail_data["m_subject"],
178  $mail_data["m_message"],
179  $mail_data["use_placeholders"]
180  );
181 
182  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
183  }
$_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 185 of file class.ilMailSearchGroupsGUI.php.

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

Referenced by mail().

186  {
187  global $ilUser;
188 
189  $members = array();
190 
191  if (!is_array($this->umail->getSavedData()))
192  {
193  $this->umail->savePostData(
194  $ilUser->getId(),
195  array(),
196  "",
197  "",
198  "",
199  "",
200  "",
201  "",
202  "",
203  ""
204  );
205  }
206 
207  $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
208 
209  foreach ($ids as $member)
210  {
211  $login = ilObjUser::_lookupLogin($member);
212  array_push($members, $login);
213  }
214  $mail_data = $this->umail->appendSearchResult($members,"to");
215 
216  $this->umail->savePostData(
217  $mail_data["user_id"],
218  $mail_data["attachments"],
219  $mail_data["rcp_to"],
220  $mail_data["rcp_cc"],
221  $mail_data["rcp_bcc"],
222  $mail_data["m_type"],
223  $mail_data["m_email"],
224  $mail_data["m_subject"],
225  $mail_data["m_message"],
226  $mail_data["use_placeholders"]
227  );
228 
229  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
230  }
$_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 481 of file class.ilMailSearchGroupsGUI.php.

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

482  {
483  global $lng;
484 
485  if ($_GET["view"] == "mygroups")
486  {
487  $ids = $_REQUEST["search_grp"];
488  if (sizeof($ids))
489  {
490  $this->addPermission($ids);
491  }
492  else
493  {
494  ilUtil::sendInfo($lng->txt("mail_select_course"));
495  $this->showMyGroups();
496  }
497  }
498  else if ($_GET["view"] == "grp_members")
499  {
500  $ids = $_REQUEST["search_members"];
501  if (sizeof($ids))
502  {
503  $this->addPermission($ids);
504  }
505  else
506  {
507  ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
508  $this->showMembers();
509  }
510  }
511  else
512  {
513  $this->showMyGroups();
514  }
515  }
$_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 404 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().

405  {
406  global $lng;
407 
408  if ($_GET["search_grp"] != "")
409  {
410  $_POST["search_grp"] = explode(",", $_GET["search_grp"]);
411  }
412 
413  if (!is_array($_POST["search_grp"]) ||
414  count($_POST["search_grp"]) == 0)
415  {
416  ilUtil::sendInfo($lng->txt("mail_select_group"));
417  $this->showMyGroups();
418  }
419  else
420  {
421  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
422  include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
423  $context = $_GET["ref"] ? $_GET["ref"] : "mail";
424  $table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context);
425  $table->setId('show_grps_mmbrs_tbl');
426  $lng->loadLanguageModule('crs');
427 
428  $tableData = array();
429  $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
430 
431  foreach($_POST["search_grp"] as $grp_id)
432  {
433  $ref_ids = ilObject::_getAllReferences($grp_id);
434  $ref_id = current($ref_ids);
435 
436  if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id,false)))
437  {
438  $grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
439 
440  foreach($grp_members as $member)
441  {
442  $tmp_usr = new ilObjUser($member['id']);
443  if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
444  {
445  unset($tmp_usr);
446  continue;
447  }
448  unset($tmp_usr);
449 
450  $fullname = "";
451  if(in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y')))
452  $fullname = $member['lastname'].', '.$member['firstname'];
453 
454  $rowData = array(
455  'members_id' => $member["id"],
456  'members_login' => $member["login"],
457  'members_name' => $fullname,
458  'members_crs_grp' => $group_obj->getTitle(),
459  'members_in_addressbook' => $this->abook->checkEntryByLogin($member["login"]) ? $lng->txt("yes") : $lng->txt("no"),
460  'search_grp' => $grp_id
461  );
462  $tableData[] = $rowData;
463  }
464  }
465  }
466  $table->setData($tableData);
467  if (count($tableData))
468  {
469  $searchTpl->setVariable("TXT_MARKED_ENTRIES",$lng->txt("marked_entries"));
470  }
471  $searchTpl->setVariable('TABLE', $table->getHtml());
472  $this->tpl->setContent($searchTpl->get());
473 
474  if($_GET["ref"] != "wsp")
475  {
476  $this->tpl->show();
477  }
478  }
479  }
$_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 292 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().

293  {
294  global $lng, $ilUser, $ilObjDataCache, $tree;
295 
296  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
297 
298  $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
299 
300  $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
301 
302  $_GET['view'] = 'mygroups';
303 
304  $lng->loadLanguageModule('crs');
305 
306  $this->ctrl->setParameter($this, 'view', 'mygroups');
307 
308  include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
309  $table = new ilMailSearchCoursesTableGUI($this, 'grp', $_GET["ref"]);
310  $table->setId('search_grps_tbl');
311  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
312 
313  $counter = 0;
314  $tableData = array();
315  if (is_array($grp_ids) &&
316  count($grp_ids) > 0)
317  {
318 
319  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
320  foreach($grp_ids as $grp_id)
321  {
323  {
324  $oGroupParticipants = ilGroupParticipants::_getInstanceByObjId($grp_id);
325  $grp_members = $oGroupParticipants->getParticipants();
326 
327  foreach ($grp_members as $key => $member)
328  {
329  $tmp_usr = new ilObjUser($member);
330 
331  if($tmp_usr->checkTimeLimit()== false || $tmp_usr->getActive() == false )
332  {
333  unset($grp_members[$key]);
334  }
335  }
336  unset($tmp_usr);
337 
338  $ref_ids = ilObject::_getAllReferences($grp_id);
339  $ref_id = current($ref_ids);
340  $path_arr = $tree->getPathFull($ref_id, $tree->getRootId());
341  $path_counter = 0;
342  $path = '';
343  foreach($path_arr as $data)
344  {
345  if($path_counter++)
346  {
347  $path .= " -> ";
348  }
349  $path .= $data['title'];
350  }
351  $path = $this->lng->txt('path').': '.$path;
352 
353  $current_selection_list = new ilAdvancedSelectionListGUI();
354  $current_selection_list->setListTitle($this->lng->txt("actions"));
355  $current_selection_list->setId("act_".$counter);
356 
357  $this->ctrl->setParameter($this, 'search_grp', $grp_id);
358  $this->ctrl->setParameter($this, 'view', 'mygroups');
359 
360  if($_GET["ref"] == "mail")
361  {
362  if ($this->mailing_allowed)
363  $current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail"));
364  }
365  else if($_GET["ref"] == "wsp")
366  {
367  $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share"));
368  }
369  $current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers"));
370 
371  $this->ctrl->clearParameters($this);
372 
373  $rowData = array
374  (
375  'CRS_ID' => $grp_id,
376  'CRS_NAME' => $ilObjDataCache->lookupTitle($grp_id),
377  'CRS_NO_MEMBERS' => count($grp_members),
378  'CRS_PATH' => $path,
379  'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML()
380  );
381  $counter++;
382  $tableData[] = $rowData;
383  }
384  }
385  }
386  $table->setData($tableData);
387  if($counter > 0)
388  {
389  $this->tpl->setVariable('TXT_MARKED_ENTRIES',$lng->txt('marked_entries'));
390  }
391 
392  $searchTpl->setVariable('TABLE', $table->getHtml());
393  $this->tpl->setContent($searchTpl->get());
394 
395  if($_GET["ref"] != "wsp")
396  {
397  $this->tpl->show();
398  }
399  }
$_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.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
$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: