ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMailUserActionProvider.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/User/Actions/classes/class.ilUserActionProvider.php");
6 
15 {
16  static $user_access = array();
17 
24  function checkUserMailAccess($a_user_id)
25  {
26  global $rbacsystem;
27 
28  if (!isset(self::$user_access[$a_user_id]))
29  {
30  include_once("./Services/Mail/classes/class.ilMailGlobalServices.php");
31  self::$user_access[$a_user_id] =
32  $rbacsystem->checkAccessOfUser($a_user_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId());
33  }
34  return self::$user_access[$a_user_id];
35  }
36 
40  function getComponentId()
41  {
42  return "mail";
43  }
44 
48  function getActionTypes()
49  {
50  return array(
51  "compose" => $this->lng->txt("mail")
52  );
53  }
54 
61  function collectActionsForTargetUser($a_target_user)
62  {
64  include_once("./Services/User/Actions/classes/class.ilUserAction.php");
65  include_once("./Services/Mail/classes/class.ilMailFormCall.php");
66 
67  // check mail permission of user
68  if ($this->getUserId() == ANONYMOUS_USER_ID || !$this->checkUserMailAccess($this->getUserId()))
69  {
70  return $coll;
71  }
72 
73  // check mail permission of target user
74  if ($this->checkUserMailAccess($a_target_user))
75  {
76  $f = new ilUserAction();
77  $f->setType("compose");
78  $f->setText($this->lng->txt("mail"));
79  $tn = ilObjUser::_lookupName($a_target_user);
80  $f->setHref(ilMailFormCall::getLinkTarget("", '', array(), array('type' => 'new', 'rcp_to' => $tn["login"])));
81  $coll->addAction($f);
82  }
83 
84  return $coll;
85  }
86 }
87 ?>
static _lookupName($a_user_id)
lookup user name
A class that provides a collection of actions on users.
static getInstance()
Get instance.
collectActionsForTargetUser($a_target_user)
Collect user actions.
Create styles array
The data for the language used.
static getLinkTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array(), $context_params=array())
checkUserMailAccess($a_user_id)
Check user chat access.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
Action that can be performed on a user.