ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
32  protected $current_user_id;
33 
41  protected function __construct(
42  ilUserActionContext $a_user_action_context,
43  ilTemplate $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, ilTemplate $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  {
69  $tpl = $this->tpl;
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  foreach ($prov->getCssFiles($act_type) as $file) {
85  $tpl->addCss($file);
86  }
87  }
88  }
89  }
90  }
91 
98  public function renderDropDown($a_target_user_id)
99  {
100  if (!$this->init_done) {
101  $this->init();
102  }
103  include_once("./Services/User/Gallery/classes/class.ilGalleryUserActionContext.php");
104  include_once("./Services/User/Actions/classes/class.ilUserActionCollector.php");
105  $act_collector = ilUserActionCollector::getInstance($this->current_user_id, $this->user_action_context);
106  $action_collection = $act_collector->getActionsForTargetUser($a_target_user_id);
107  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
109  $list->setListTitle("");
110  foreach ($action_collection->getActions() as $action) {
111  $list->addItem($action->getText(), "", $action->getHref(), "", "", "", "", false, "", "", "", "", true, $action->getData());
112  }
113  return $list->getHTML();
114  }
115 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
$action
static getAllProviders()
Get all action providers.
static getInstance($a_user_id, ilUserActionContext $a_context)
Get instance (for a user)
A class that provides a collection of actions on users.
static lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
Is activated?
static getInstance(ilUserActionContext $a_user_action_context, ilTemplate $a_global_tpl, $a_current_user_id)
Get instance.
renderDropDown($a_target_user_id)
Render drop down.
A context where user actions are used (e.g.
special template class to simplify handling of ITX/PEAR
$txt
Definition: error.php:11
User interface class for advanced drop-down selection lists.
init()
Add requried js/css for an action context.
__construct(ilUserActionContext $a_user_action_context, ilTemplate $a_global_tpl, $a_current_user_id)
Constructor.