ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilUserActionAdminGUI.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 $ctrl;
18 
22  protected $tpl;
23 
27  protected $lng;
28 
32  protected $action_context;
33 
40  public function __construct()
41  {
42  global $DIC;
43 
44  $this->ctrl = $DIC->ctrl();
45  $this->lng = $DIC->language();
46  $this->tpl = $DIC["tpl"];
47  $this->ref_id = (int) $_GET["ref_id"];
48  $this->rbabsystem = $DIC->rbac()->system();
49 
50  $this->lng->loadLanguageModule("usr");
51  }
52 
58  public function setActionContext(ilUserActionContext $a_val = null)
59  {
60  $this->action_context = $a_val;
61  }
62 
68  public function getActionContext()
69  {
70  return $this->action_context;
71  }
72 
76  public function executeCommand()
77  {
78  $next_class = $this->ctrl->getNextClass($this);
79  $cmd = $this->ctrl->getCmd("show");
80 
81  switch ($next_class) {
82  default:
83  if (in_array($cmd, array("show", "save"))) {
84  $this->$cmd();
85  }
86  }
87  }
88 
95  public function show()
96  {
97  ilUtil::sendInfo($this->lng->txt("user_actions_activation_info"));
98 
99  include_once("./Services/User/Actions/classes/class.ilUserActionAdminTableGUI.php");
101  $this,
102  "show",
103  $this->getActions(),
104  $this->rbabsystem->checkAccess("write", $this->ref_id)
105  );
106  $this->tpl->setContent($tab->getHTML());
107  }
108 
112  public function save()
113  {
114  if (!$this->rbabsystem->checkAccess("write", $this->ref_id)) {
115  $this->ctrl->redirect($this, "show");
116  }
117 
118  //var_dump($_POST); exit;
119  include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
120  foreach ($this->getActions() as $a) {
122  $this->action_context->getComponentId(),
123  $this->action_context->getContextId(),
124  $a["action_comp_id"],
125  $a["action_type_id"],
126  (int) $_POST["active"][$a["action_comp_id"] . ":" . $a["action_type_id"]]
127  );
128  }
129  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
130  $this->ctrl->redirect($this, "show");
131  }
132 
139  public function getActions()
140  {
141  include_once("./Services/User/Actions/classes/class.ilUserActionProviderFactory.php");
142  include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
143  $data = array();
145  foreach ($p->getActionTypes() as $id => $name) {
146  $data[] = array(
147  "action_comp_id" => $p->getComponentId(),
148  "action_type_id" => $id,
149  "action_type_name" => $name,
151  $this->action_context->getComponentId(),
152  $this->action_context->getContextId(),
153  $p->getComponentId(),
154  $id
155  )
156  );
157  }
158  }
159  //var_dump($data); exit;
160  return $data;
161  }
162 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setActionContext(ilUserActionContext $a_val=null)
Set action context.
global $DIC
Definition: saml.php:7
User action administration GUI class.
$_GET["client_id"]
static getAllProviders()
Get all action providers.
if(!array_key_exists('StateId', $_REQUEST)) $id
static lookupActive($a_context_comp, $a_context_id, $a_action_comp, $a_action_type)
Is activated?
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
A context where user actions are used (e.g.
if($format !==null) $name
Definition: metadata.php:146
save()
Save !!!! note in the future this must depend on the context, currently we only have one...
getActionContext()
Get action context.
Create styles array
The data for the language used.
static activateAction($a_context_comp, $a_context_id, $a_action_comp, $a_action_type, $a_active)
Activate action.
$_POST["username"]
TableGUI class for user action administration.
getActions()
Get actions, !!!! note in the future this must depend on the context, currently we only have one...