ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjBibliographicAdminLibrariesGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once("./Services/Object/classes/class.ilObjectGUI.php");
4 require_once("./Modules/Bibliographic/classes/Admin/class.ilObjBibliographicAdminLibrariesFormGUI.php");
5 require_once("./Modules/Bibliographic/classes/Admin/class.ilObjBibliographicAdminTableGUI.php");
6 require_once("./Modules/Bibliographic/classes/Admin/class.ilBibliographicSetting.php");
7 require_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
8 
18 
22  protected $parent_gui;
26  protected $ctrl;
30  protected $lng;
31 
32 
38  public function __construct($parent_gui) {
39  global $DIC;
40  $lng = $DIC['lng'];
41  $ilCtrl = $DIC['ilCtrl'];
42  $this->lng = $lng;
43  $this->ctrl = $ilCtrl;
44  $this->parent_gui = $parent_gui;
45  }
46 
47 
54  public function executeCommand() {
55  global $DIC;
56  $ilCtrl = $DIC['ilCtrl'];
57  $cmd = $ilCtrl->getCmd();
58  switch ($cmd) {
59  case 'view':
60  $this->view();
61  break;
62  case 'add':
63  $this->add();
64  break;
65  case 'edit':
66  $this->edit();
67  break;
68  case 'delete':
69  $this->delete();
70  break;
71  case 'create':
72  $this->create();
73  break;
74  case 'update':
75  $this->update();
76  break;
77  case 'cancel':
78  $this->cancel();
79  break;
80  }
81  }
82 
83 
89  public function view() {
90  global $DIC;
91  $ilToolbar = $DIC['ilToolbar'];
96  $b->setCaption('add');
97  $b->setUrl($this->ctrl->getLinkTarget($this, 'add'));
98  $b->setPrimary(true);
99  $ilToolbar->addButtonInstance($b);
100  $a_table = $this->initTable();
101  $this->parent_gui->tpl->setContent($a_table->getHTML());
102 
103  return true;
104  }
105 
106 
113  protected function initTable() {
114  $table = new ilObjBibliographicAdminTableGUI($this, 'library');
115  $settings = ilBibliographicSetting::getAll();
116  $result = array();
117  foreach ($settings as $set) {
118  $result[] = array(
119  "id" => $set->getId(),
120  "name" => $set->getName(),
121  "url" => $set->getUrl(),
122  "img" => $set->getImg()
123  );
124  }
125  $table->setData($result);
126 
127  return $table;
128  }
129 
130 
134  public function add() {
136  $this->parent_gui->tpl->setContent($form->getHTML());
137  $this->parent_gui->getTabsGui()->setTabActive('settings');
138  }
139 
140 
144  public function delete() {
145  $ilBibliographicSetting = new ilBibliographicSetting($_REQUEST["lib_id"]);
146  $ilBibliographicSetting->delete();
147  $this->ctrl->redirect($this, 'view');
148  }
149 
150 
154  public function cancel() {
155  $this->ctrl->redirect($this, 'view');
156  }
157 
158 
162  public function update() {
163  $form = new ilObjBibliographicAdminLibrariesFormGUI($this, new ilBibliographicSetting($_REQUEST["lib_id"]));
164  $form->setValuesByPost();
165  if ($form->saveObject()) {
166  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
167  $this->ctrl->redirect($this, 'view');
168  }
169  $this->parent_gui->tpl->setContent($form->getHTML());
170  }
171 
172 
176  public function create() {
178  $form->setValuesByPost();
179  if ($form->saveObject()) {
180  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
181  $this->ctrl->redirect($this, 'view');
182  }
183  $this->parent_gui->tpl->setContent($form->getHTML());
184  }
185 
186 
190  public function edit() {
191  $this->ctrl->saveParameter($this, 'lib_id');
192  $form = new ilObjBibliographicAdminLibrariesFormGUI($this, new ilBibliographicSetting($_REQUEST["lib_id"]));
193  $this->parent_gui->tpl->setContent($form->getHTML());
194  }
195 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilBibliographicSetting.
$result
$cmd
Definition: sahs_server.php:35
Bibliographic ilObjBibliographicAdminTableGUI.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
global $DIC