ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  public static $user_access = array();
17 
24  public function checkUserMailAccess($a_user_id)
25  {
26  global $DIC;
27 
28  $rbacsystem = $DIC['rbacsystem'];
29 
30  if (!isset(self::$user_access[$a_user_id])) {
31  include_once("./Services/Mail/classes/class.ilMailGlobalServices.php");
32  self::$user_access[$a_user_id] =
33  $rbacsystem->checkAccessOfUser($a_user_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId());
34  }
35  return self::$user_access[$a_user_id];
36  }
37 
41  public function getComponentId()
42  {
43  return "mail";
44  }
45 
49  public function getActionTypes()
50  {
51  return array(
52  "compose" => $this->lng->txt("mail")
53  );
54  }
55 
62  public function collectActionsForTargetUser($a_target_user)
63  {
65  include_once("./Services/User/Actions/classes/class.ilUserAction.php");
66  include_once("./Services/Mail/classes/class.ilMailFormCall.php");
67 
68  // check mail permission of user
69  if ($this->getUserId() == ANONYMOUS_USER_ID || !$this->checkUserMailAccess($this->getUserId())) {
70  return $coll;
71  }
72 
73  // check mail permission of target user
74  if ($this->checkUserMailAccess($a_target_user)) {
75  $f = new ilUserAction();
76  $f->setType("compose");
77  $f->setText($this->lng->txt("mail"));
78  $tn = ilObjUser::_lookupName($a_target_user);
79  $f->setHref(ilMailFormCall::getLinkTarget("", '', array(), array('type' => 'new', 'rcp_to' => $tn["login"])));
80  $coll->addAction($f);
81  }
82 
83  return $coll;
84  }
85 }
static _lookupName($a_user_id)
lookup user name
A class that provides a collection of actions on users.
static getInstance()
Get instance.
global $DIC
Definition: saml.php:7
collectActionsForTargetUser($a_target_user)
Collect user actions.
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.