ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
29 
36  function __construct()
37  {
38  global $DIC;
39 
40  $this->ctrl = $DIC->ctrl();
41  $this->lng = $DIC->language();
42  $this->tpl = $DIC["tpl"];
43 
44  $this->lng->loadLanguageModule("usr");
45 
46  }
47 
51  function executeCommand()
52  {
53  $next_class = $this->ctrl->getNextClass($this);
54  $cmd = $this->ctrl->getCmd("show");
55 
56  switch ($next_class)
57  {
58  default:
59  if (in_array($cmd, array("show", "save")))
60  {
61  $this->$cmd();
62  }
63  }
64  }
65 
72  function show()
73  {
74  ilUtil::sendInfo($this->lng->txt("user_actions_activation_info"));
75 
76  include_once("./Services/User/Actions/classes/class.ilUserActionAdminTableGUI.php");
77  $tab = new ilUserActionAdminTableGUI($this, "show", $this->getActions());
78  $this->tpl->setContent($tab->getHTML());
79  }
80 
84  function save()
85  {
86  //var_dump($_POST); exit;
87  include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
88  foreach ($this->getActions() as $a)
89  {
90  ilUserActionAdmin::activateAction("awrn", "toplist", $a["action_comp_id"], $a["action_type_id"],
91  (int)$_POST["active"][$a["action_comp_id"] . ":" . $a["action_type_id"]]);
92  }
93  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
94  $this->ctrl->redirect($this, "show");
95  }
96 
103  function getActions()
104  {
105  include_once("./Services/User/Actions/classes/class.ilUserActionProviderFactory.php");
106  include_once("./Services/User/Actions/classes/class.ilUserActionAdmin.php");
107  $data = array();
109  {
110  foreach ($p->getActionTypes() as $id => $name)
111  {
112  $data[] = array(
113  "action_comp_id" => $p->getComponentId(),
114  "action_type_id" => $id,
115  "action_type_name" => $name,
116  "active" => ilUserActionAdmin::lookupActive("awrn", "toplist", $p->getComponentId(), $id)
117  );
118  }
119  }
120  //var_dump($data); exit;
121  return $data;
122  }
123 
124 
125 }
126 
127 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
User action administration GUI class.
static getAllProviders()
Get all action providers.
$cmd
Definition: sahs_server.php:35
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.
save()
Save !!!! note in the future this must depend on the context, currently we only have one...
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.
global $DIC
$_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...