ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilUserActionCollector.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14 protected static $instances = array();
15
19 protected $collection;
20
24 protected $user_id;
25
29 protected $action_context;
30
37 protected function __construct($a_user_id, ilUserActionContext $a_context)
38 {
39 $this->user_id = $a_user_id;
40 $this->action_context = $a_context;
41 }
42
43
51 public static function getInstance($a_user_id, ilUserActionContext $a_context)
52 {
53 if (!isset(self::$instances[$a_user_id])) {
54 self::$instances[$a_user_id] = new ilUserActionCollector($a_user_id, $a_context);
55 }
56
57 return self::$instances[$a_user_id];
58 }
59
65 public function getActionsForTargetUser($a_target_user)
66 {
67 // overall collection of users
68 include_once("./Services/User/Actions/classes/class.ilUserActionCollection.php");
69 $this->collection = ilUserActionCollection::getInstance();
70
71 include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
72
73 include_once("./Services/User/Actions/classes/class.ilUserActionProviderFactory.php");
75 $prov->setUserId($this->user_id);
76 $coll = $prov->collectActionsForTargetUser($a_target_user);
77 foreach ($coll->getActions() as $action) {
79 $this->action_context->getComponentId(),
80 $this->action_context->getContextId(),
81 $prov->getComponentId(),
82 $action->getType()
83 )) {
84 $this->collection->addAction($action);
85 }
86 }
87 }
88
89 return $this->collection;
90 }
91}
An exception for terminatinating execution or to throw for unit testing.
static lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
Is activated?
Collects actions from all action providers.
getActionsForTargetUser($a_target_user)
Collect actions.
__construct($a_user_id, ilUserActionContext $a_context)
Constructor.
static getInstance($a_user_id, ilUserActionContext $a_context)
Get instance (for a user)
A context where user actions are used (e.g.
static getAllProviders()
Get all action providers.
$action