ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjExerciseAdministrationGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Object/classes/class.ilObjectGUI.php");
5 
17 {
23  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
24  {
25  $this->type = "excs";
26  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
27 
28  $this->lng->loadLanguageModule("exercise");
29  }
30 
37  public function executeCommand()
38  {
39  $next_class = $this->ctrl->getNextClass($this);
40  $cmd = $this->ctrl->getCmd();
41 
42  $this->prepareOutput();
43 
44  switch($next_class)
45  {
46  case 'ilpermissiongui':
47  $this->tabs_gui->setTabActive('perm_settings');
48  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
49  $perm_gui = new ilPermissionGUI($this);
50  $this->ctrl->forwardCommand($perm_gui);
51  break;
52 
53  default:
54  if(!$cmd || $cmd == 'view')
55  {
56  $cmd = "editSettings";
57  }
58 
59  $this->$cmd();
60  break;
61  }
62  return true;
63  }
64 
71  public function getAdminTabs()
72  {
73  if ($this->checkPermissionBool("visible,read"))
74  {
75  $this->tabs_gui->addTarget("settings",
76  $this->ctrl->getLinkTarget($this, "editSettings"),
77  array("editSettings", "view"));
78  }
79 
80  if ($this->checkPermissionBool('edit_permission'))
81  {
82  $this->tabs_gui->addTarget("perm_settings",
83  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
84  array(),'ilpermissiongui');
85  }
86  }
87 
88 
92  public function editSettings($a_form = null)
93  {
94  global $lng, $ilSetting;
95 
96  $this->tabs_gui->setTabActive('settings');
97 
98  if(!$a_form)
99  {
100  $a_form = $this->initFormSettings();
101  }
102  $this->tpl->setContent($a_form->getHTML());
103  return true;
104  }
105 
109  public function saveSettings()
110  {
111  global $ilCtrl;
112 
113  $this->checkPermission("write");
114 
115  $form = $this->initFormSettings();
116  if($form->checkInput())
117  {
118  $exc_set = new ilSetting("excs");
119  $exc_set->set("add_to_pd", (bool)$form->getInput("pd"));
120 
121  ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
122  $ilCtrl->redirect($this, "editSettings");
123  }
124 
125  $form->setValuesByPost();
126  $this->editSettings($form);
127  }
128 
132  public function cancel()
133  {
134  global $ilCtrl;
135 
136  $ilCtrl->redirect($this, "view");
137  }
138 
144  protected function initFormSettings()
145  {
146  global $lng, $ilAccess;
147 
148  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
149  $form = new ilPropertyFormGUI();
150  $form->setFormAction($this->ctrl->getFormAction($this));
151  $form->setTitle($this->lng->txt('exc_admin_settings'));
152 
153  if ($this->checkPermissionBool("write"))
154  {
155  $form->addCommandButton('saveSettings',$this->lng->txt('save'));
156  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
157  }
158 
159  $exc_set = new ilSetting("excs");
160 
161  $pd = new ilCheckboxInputGUI($lng->txt("to_desktop"), "pd");
162  $pd->setInfo($lng->txt("exc_to_desktop_info"));
163  $pd->setChecked($exc_set->get("add_to_pd", true));
164  $form->addItem($pd);
165 
166  return $form;
167  }
168 }
169 
170 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
ILIAS Setting Class.
This class represents a property form user interface.
$cmd
Definition: sahs_server.php:35
This class represents a checkbox property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
prepareOutput($a_show_subobjects=true)
prepare output
Class ilObjectGUI Basic methods of all Output classes.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.