ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilUserActionGUI.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{
17 protected $tpl;
18
23
27 protected $init_done = false;
28
33
41 protected function __construct(
42 ilUserActionContext $a_user_action_context,
43 ilGlobalTemplateInterface $a_global_tpl,
44 $a_current_user_id
45 ) {
46 $this->tpl = $a_global_tpl;
47 $this->user_action_context = $a_user_action_context;
48 $this->current_user_id = $a_current_user_id;
49 }
50
59 public static function getInstance(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, $a_current_user_id)
60 {
61 return new ilUserActionGUI($a_user_action_context, $a_global_tpl, $a_current_user_id);
62 }
63
67 public function init()
68 {
70
71 include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
72 include_once("./Services/User/Actions/classes/class.ilUserActionProviderFactory.php");
74 foreach ($prov->getActionTypes() as $act_type => $txt) {
76 $this->user_action_context->getComponentId(),
77 $this->user_action_context->getContextId(),
78 $prov->getComponentId(),
79 $act_type
80 )) {
81 foreach ($prov->getJsScripts($act_type) as $script) {
82 $tpl->addJavascript($script);
83 }
84 }
85 }
86 }
87 }
88
95 public function renderDropDown($a_target_user_id)
96 {
97 if (!$this->init_done) {
98 $this->init();
99 }
100 include_once("./Services/User/Gallery/classes/class.ilGalleryUserActionContext.php");
101 include_once("./Services/User/Actions/classes/class.ilUserActionCollector.php");
102 $act_collector = ilUserActionCollector::getInstance($this->current_user_id, $this->user_action_context);
103 $action_collection = $act_collector->getActionsForTargetUser($a_target_user_id);
104 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
105 $list = new ilAdvancedSelectionListGUI();
106 $list->setListTitle("");
107 foreach ($action_collection->getActions() as $action) {
108 $list->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
109 }
110 return $list->getHTML();
111 }
112}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
Is activated?
static getInstance($a_user_id, ilUserActionContext $a_context)
Get instance (for a user)
A context where user actions are used (e.g.
A class that provides a collection of actions on users.
init()
Add requried js for an action context.
renderDropDown($a_target_user_id)
Render drop down.
__construct(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, $a_current_user_id)
Constructor.
static getInstance(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, $a_current_user_id)
Get instance.
static getAllProviders()
Get all action providers.
$txt
Definition: error.php:13