ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjStudyProgrammeAdminGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 include_once('./Services/Object/classes/class.ilObjectGUI.php');
4 include_once('./Modules/StudyProgramme/classes/types/class.ilStudyProgrammeTypeGUI.php');
5 require_once('./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeAdmin.php');
6 
23  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true) {
24  global $DIC;
25  $ilCtrl = $DIC['ilCtrl'];
26  $ilAccess = $DIC['ilAccess'];
27  $ilSetting = $DIC['ilSetting'];
28  $this->ctrl = $ilCtrl;
29  $this->ilAccess = $ilAccess;
30  $this->ilSetting = $ilSetting;
31  $this->type = 'prgs';
32  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
33  $this->lng->loadLanguageModule('prg');
34  //Check Permissions globally for all SubGUIs. We only check write permissions
35  $this->checkPermission('write');
36  }
37 
38 
43  public function executeCommand() {
44  $next_class = $this->ctrl->getNextClass($this);
45  $cmd = $this->ctrl->getCmd();
46  $this->prepareOutput();
47  switch ($next_class) {
48  case 'ilpermissiongui':
49  $this->tabs_gui->setTabActive('perm_settings');
50  include_once('Services/AccessControl/classes/class.ilPermissionGUI.php');
51  $perm_gui = new ilPermissionGUI($this);
52  $this->ctrl->forwardCommand($perm_gui);
53  break;
54  case 'ilstudyprogrammetypegui':
55  $this->tabs_gui->setTabActive('prg_subtypes');
56  $type_gui = new ilStudyProgrammeTypeGUI($this);
57  $this->ctrl->forwardCommand($type_gui);
58  break;
59  default:
60  if(!$cmd || $cmd == "view")
61  {
62  $cmd = "editSettings";
63  }
64  $this->$cmd();
65  break;
66  }
67  }
68 
69  public function editSettings() {
70  $this->tabs_gui->setTabActive('settings');
71 
72  if(!$a_form)
73  {
74  $a_form = $this->initFormSettings();
75  }
76  $this->tpl->setContent($a_form->getHTML());
77  return true;
78  }
79 
80  public function initFormSettings(ilPropertyFormGUI $a_form = null) {
81 
82  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
83  $form = new ilPropertyFormGUI();
84  $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
85  $form->setTitle($this->lng->txt("settings"));
86 
87  $radio_grp = new ilRadioGroupInputGUI($this->lng->txt("prg_show_programmes"),"visible_on_personal_desktop");
88  $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_always"),ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS));
89  $radio_grp->addOption(new ilRadioOption($this->lng->txt("prg_show_programmes_on_pd_only_read"),ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_READ));
91  $value = ($value) ? $value : ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_READ;
92  $radio_grp->setValue($value);
93  $form->addItem($radio_grp);
94 
95  if ($this->ilAccess->checkAccess("write", "", $this->object->getRefId()))
96  {
97  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
98  $form->addCommandButton("view", $this->lng->txt("cancel"));
99  }
100 
101  return $form;
102  }
103 
104  public function saveSettings()
105  {
106  $this->checkPermission("write");
107 
108  $form = $this->initFormSettings();
109  if($form->checkInput())
110  {
111  if($this->save($form))
112  {
114  $form->getInput('visible_on_personal_desktop'));
115 
116  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
117  $this->ctrl->redirect($this, "editSettings");
118  }
119  }
120 
121  $form->setValuesByPost();
122  $this->editSettings($form);
123  }
124 
125  public function getAdminTabs() {
126  global $DIC;
127  $rbacsystem = $DIC['rbacsystem'];
132  if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
133  $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilObjStudyProgrammeAdminGUI', 'view'));
134 
135  $this->tabs_gui->addTarget('prg_subtypes', $this->ctrl->getLinkTargetByClass(array(
136  'ilObjStudyProgrammeAdminGUI',
137  'ilStudyProgrammeTypeGUI'
138  ), 'listTypes'));
139  }
140  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
141  $this->tabs_gui->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass('ilpermissiongui', 'perm'), array(), 'ilpermissiongui');
142  }
143  }
144 
145  public function _goto($ref_id) {
146  $this->ctrl->initBaseClass("ilAdministrationGUI");
147  $this->ctrl->setTargetScript("ilias.php");
148  $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "ref_id", $ref_id);
149  $this->ctrl->setParameterByClass("ilObjStudyProgrammeAdminGUI", "admin_mode", "settings");
150  $this->ctrl->redirectByClass(array( "ilAdministrationGUI", "ilObjStudyProgrammeAdminGUI" ), "view");
151  }
152 
153  protected function save(ilPropertyFormGUI $a_form) {
154  return true;
155  }
156 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
set($a_key, $a_val)
write one value to db-table settings public
This class represents an option in a radio group.
ILIAS Setting Class.
This class represents a property form user interface.
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
Class ilStudyProgrammeTypeGUI.
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property in a property form.
addOption($a_option)
Add Option.
Class ilObjectGUI Basic methods of all Output classes.
initFormSettings(ilPropertyFormGUI $a_form=null)
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Create styles array
The data for the language used.
get($a_keyword, $a_default_value=false)
get setting
StudyProgramme Administration Settings.
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.
global $DIC
getAdminTabs()
administration tabs show only permissions and trash folder