ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMailSearchGroupsGUI Class Reference
+ Collaboration diagram for ilMailSearchGroupsGUI:

Public Member Functions

 __construct ($wsp_access_handler=null, $wsp_node_id=null)
 
 mail ()
 
 mailGroups ()
 
 mailMembers ()
 
 adoptMembers ()
 Take over course members to addressbook. More...
 
 cancel ()
 Cancel action. More...
 
 showMyGroups ()
 Show user's courses. 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$ @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 27 of file class.ilMailSearchGroupsGUI.php.

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 }
$_SESSION["AccountId"]
Class UserMail this class handles user mails.
Class Mail this class handles base functions for mail handling.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

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

Member Function Documentation

◆ addPermission()

ilMailSearchGroupsGUI::addPermission (   $a_obj_ids)
protected

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

552 {
553 if(!is_array($a_obj_ids))
554 {
555 $a_obj_ids = array($a_obj_ids);
556 }
557
558 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
559 $added = false;
560 foreach($a_obj_ids as $object_id)
561 {
562 if(!in_array($object_id, $existing))
563 {
564 $added = $this->wsp_access_handler->addPermission($this->wsp_node_id, $object_id);
565 }
566 }
567
568 if($added)
569 {
570 ilUtil::sendSuccess($this->lng->txt("wsp_share_success"), true);
571 }
572 $this->ctrl->redirectByClass("ilworkspaceaccessgui", "share");
573 }
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:

◆ adoptMembers()

ilMailSearchGroupsGUI::adoptMembers ( )

Take over course members to addressbook.

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

249 {
250 global $lng;
251
252 $ids = ((int)$_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
253
254 if ($ids )
255 {
256 foreach ($ids as $member)
257 {
258 $login = ilObjUser::_lookupLogin($member);
259
260 if (!$this->abook->checkEntry($login))
261 {
262 $name = ilObjUser::_lookupName($member);
263 $email = '';
264 if(ilObjUser::_lookupPref((int)$member, 'public_email') == 'y')
265 {
266 $email = ilObjUser::_lookupEmail($member);
267 }
268 $this->abook->addEntry(
269 $login,
270 $name["firstname"],
271 $name["lastname"],
272 $email
273 );
274 }
275 }
276 ilUtil::sendInfo($lng->txt("mail_members_added_addressbook"));
277 }
278 else
279 {
280 ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
281 }
282
283 $this->showMembers();
284 }
$_GET["client_id"]
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
_lookupEmail($a_user_id)
Lookup email.
_lookupPref($a_usr_id, $a_keyword)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ cancel()

ilMailSearchGroupsGUI::cancel ( )

Cancel action.

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

290 {
291 if ($_GET["view"] == "mygroups" &&
292 $_GET["ref"] == "mail")
293 {
294 $this->ctrl->returnToParent($this);
295 }
296 else
297 {
298 $this->showMyGroups();
299 }
300 }
showMyGroups()
Show user's courses.

References $_GET, and showMyGroups().

+ Here is the call graph for this function:

◆ mail()

ilMailSearchGroupsGUI::mail ( )

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

85 {
86 global $lng;
87
88 if ($_GET["view"] == "mygroups")
89 {
90 $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
91 if ($ids)
92 {
93 $this->mailGroups();
94 }
95 else
96 {
97 ilUtil::sendInfo($lng->txt("mail_select_group"));
98 $this->showMyGroups();
99 }
100 }
101 else if ($_GET["view"] == "grp_members")
102 {
103 $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
104 if ($ids)
105 {
106 $this->mailMembers();
107 }
108 else
109 {
110 ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
111 $this->showMembers();
112 }
113 }
114 else
115 {
116 $this->showMyGroups();
117 }
118 }

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

+ Here is the call graph for this function:

◆ mailGroups()

ilMailSearchGroupsGUI::mailGroups ( )

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

121 {
122 global $ilUser, $rbacreview;
123
124 $members = array();
125
126 if (!is_array($old_mail_data = $this->umail->getSavedData()))
127 {
128 $this->umail->savePostData(
129 $ilUser->getId(),
130 array(),
131 "",
132 "",
133 "",
134 "",
135 "",
136 "",
137 "",
138 ""
139 );
140 }
141
142 require_once './Services/Object/classes/class.ilObject.php';
143 $ids = ((int) $_GET['search_grp']) ? array((int)$_GET['search_grp']) : $_POST['search_grp'];
144 foreach ($ids as $grp_id)
145 {
146 $ref_ids = ilObject::_getAllReferences($grp_id);
147 foreach ($ref_ids as $ref_id)
148 {
149 $roles = $rbacreview->getAssignableChildRoles($ref_id);
150 foreach ($roles as $role)
151 {
152 if (substr($role['title'], 0, 14) == 'il_grp_member_' ||
153 substr($role['title'], 0, 13) == 'il_grp_admin_')
154 {
155 if(isset($old_mail_data['rcp_to']) &&
156 trim($old_mail_data['rcp_to']) != '')
157 {
158 $rcpt = $rbacreview->getRoleMailboxAddress($role['obj_id']);
159 if(!$this->umail->doesRecipientStillExists($rcpt, $old_mail_data['rcp_to']))
160 {
161 array_push($members, $rcpt);
162 }
163 }
164 else
165 {
166 array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
167 }
168 }
169 }
170 }
171 }
172
173 if(count($members))
174 $mail_data = $this->umail->appendSearchResult($members, 'to');
175 else
176 $mail_data = $this->umail->getSavedData();
177
178 $this->umail->savePostData(
179 $mail_data["user_id"],
180 $mail_data["attachments"],
181 $mail_data["rcp_to"],
182 $mail_data["rcp_cc"],
183 $mail_data["rcp_bcc"],
184 $mail_data["m_type"],
185 $mail_data["m_email"],
186 $mail_data["m_subject"],
187 $mail_data["m_message"],
188 $mail_data["use_placeholders"],
189 $mail_data['tpl_ctx_id'],
190 $mail_data['tpl_ctx_params']
191 );
192
193 ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
194 }
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, $ilUser, $ref_id, ilObject\_getAllReferences(), and ilUtil\redirect().

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

197 {
198 global $ilUser;
199
200 $members = array();
201
202 if (!is_array($this->umail->getSavedData()))
203 {
204 $this->umail->savePostData(
205 $ilUser->getId(),
206 array(),
207 "",
208 "",
209 "",
210 "",
211 "",
212 "",
213 "",
214 ""
215 );
216 }
217
218 $ids = ((int) $_GET['search_members']) ? array((int)$_GET['search_members']) : $_POST['search_members'];
219
220 foreach ($ids as $member)
221 {
222 $login = ilObjUser::_lookupLogin($member);
223 array_push($members, $login);
224 }
225 $mail_data = $this->umail->appendSearchResult($members,"to");
226
227 $this->umail->savePostData(
228 $mail_data["user_id"],
229 $mail_data["attachments"],
230 $mail_data["rcp_to"],
231 $mail_data["rcp_cc"],
232 $mail_data["rcp_bcc"],
233 $mail_data["m_type"],
234 $mail_data["m_email"],
235 $mail_data["m_subject"],
236 $mail_data["m_message"],
237 $mail_data["use_placeholders"],
238 $mail_data['tpl_ctx_id'],
239 $mail_data['tpl_ctx_params']
240 );
241
242 ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
243 }

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

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

516 {
517 global $lng;
518
519 if ($_GET["view"] == "mygroups")
520 {
521 $ids = $_REQUEST["search_grp"];
522 if (sizeof($ids))
523 {
524 $this->addPermission($ids);
525 }
526 else
527 {
528 ilUtil::sendInfo($lng->txt("mail_select_course"));
529 $this->showMyGroups();
530 }
531 }
532 else if ($_GET["view"] == "grp_members")
533 {
534 $ids = $_REQUEST["search_members"];
535 if (sizeof($ids))
536 {
537 $this->addPermission($ids);
538 }
539 else
540 {
541 ilUtil::sendInfo($lng->txt("mail_select_one_entry"));
542 $this->showMembers();
543 }
544 }
545 else
546 {
547 $this->showMyGroups();
548 }
549 }
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

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

+ Here is the call graph for this function:

◆ showMyGroups()

ilMailSearchGroupsGUI::showMyGroups ( )

Show user's courses.

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

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

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

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

+ 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

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

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

◆ $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: