ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 protected $user_id;
21
27 protected function __construct($a_user_id)
28 {
29 $this->user_id = $a_user_id;
30 }
31
32
39 static function getInstance($a_user_id)
40 {
41 if (!isset(self::$instances[$a_user_id]))
42 {
43 self::$instances[$a_user_id] = new ilUserActionCollector($a_user_id);
44 }
45
46 return self::$instances[$a_user_id];
47 }
48
54 public function getActionsForTargetUser($a_target_user, $a_context_component_id, $a_context_id)
55 {
56 // overall collection of users
57 include_once("./Services/User/Actions/classes/class.ilUserActionCollection.php");
58 $this->collection = ilUserActionCollection::getInstance();
59
60 include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
61
62 include_once("./Services/User/Actions/classes/class.ilUserActionProviderFactory.php");
64 {
65 $prov->setUserId($this->user_id);
66 $coll = $prov->collectActionsForTargetUser($a_target_user);
67 foreach ($coll->getActions() as $action)
68 {
69 if (ilUserActionAdmin::lookupActive($a_context_component_id, $a_context_id, $prov->getComponentId(), $action->getType()))
70 {
71 $this->collection->addAction($action);
72 }
73 }
74 }
75
76 return $this->collection;
77 }
78
79
80}
81
82?>
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, $a_context_component_id, $a_context_id)
Collect actions.
__construct($a_user_id)
Constructor.
static getInstance($a_user_id)
Get instance (for a user)
static getAllProviders()
Get all action providers.
$a_context_id
Definition: workflow.php:98