ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclTableViewGUI Class Reference

Class ilDclTableViewGUI. More...

+ Collaboration diagram for ilDclTableViewGUI:

Public Member Functions

 __construct (ilDclTableListGUI $a_parent_obj, $table_id=0)
 Constructor. More...
 
 executeCommand ()
 
 show ()
 
 doTableSwitch ()
 
 confirmDeleteTableviews ()
 Confirm deletion of multiple fields. More...
 
 checkViewsLeft ($delete_count)
 redirects if there are no tableviews left after deletion of {$delete_count} tableviews More...
 
 saveTableViewOrder ()
 invoked by ilDclTableViewTableGUI More...
 

Protected Member Functions

 checkAccess ()
 
 deleteTableviews ()
 

Protected Attributes

 $ctrl
 
 $lng
 
 $toolbar
 
 $tpl
 
 $tabs
 
 $table
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclTableViewGUI::__construct ( ilDclTableListGUI  $a_parent_obj,
  $table_id = 0 
)

Constructor.

Parameters
ilDclTableListGUI$a_parent_obj
int$table_id

Definition at line 46 of file class.ilDclTableViewGUI.php.

References $_GET, $DIC, $ilCtrl, $lng, $tpl, checkAccess(), ilDclCache\getTableCache(), and ilUtil\sendFailure().

47  {
48  global $DIC;
49  $ilCtrl = $DIC['ilCtrl'];
50  $lng = $DIC['lng'];
51  $ilToolbar = $DIC['ilToolbar'];
52  $tpl = $DIC['tpl'];
53  $ilTabs = $DIC['ilTabs'];
54  $locator = $DIC['ilLocator'];
55 
56  if ($table_id == 0) {
57  $table_id = $_GET['table_id'];
58  }
59 
60  $this->parent_obj = $a_parent_obj;
61  $this->ctrl = $ilCtrl;
62  $this->lng = $lng;
63  $this->tpl = $tpl;
64  $this->tabs = $ilTabs;
65  $this->toolbar = $ilToolbar;
66  $this->table = ilDclCache::getTableCache($table_id);
67 
68  $this->ctrl->saveParameterByClass('ilDclTableEditGUI', 'table_id');
69  $locator->addItem($this->table->getTitle(), $this->ctrl->getLinkTargetByClass('ilDclTableEditGUI', 'edit'));
70  $this->tpl->setLocator();
71 
72  if (!$this->checkAccess()) {
73  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
74  $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
75  }
76  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static getTableCache($table_id=0)
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclTableViewGUI::checkAccess ( )
protected
Returns
bool

Definition at line 108 of file class.ilDclTableViewGUI.php.

References ilObjDataCollectionAccess\hasAccessToEditTable().

Referenced by __construct().

109  {
110  return ilObjDataCollectionAccess::hasAccessToEditTable($this->parent_obj->getDataCollectionObject()->getRefId(), $this->table->getId());
111  }
static hasAccessToEditTable($ref_id, $table_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkViewsLeft()

ilDclTableViewGUI::checkViewsLeft (   $delete_count)

redirects if there are no tableviews left after deletion of {$delete_count} tableviews

Parameters
$delete_countnumber of tableviews to delete

Definition at line 204 of file class.ilDclTableViewGUI.php.

References ilUtil\sendFailure().

Referenced by confirmDeleteTableviews().

205  {
206  if ($delete_count >= count($this->table->getTableViews())) {
207  ilUtil::sendFailure($this->lng->txt('dcl_msg_tableviews_delete_all'), true);
208  $this->ctrl->redirect($this, 'show');
209  }
210  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteTableviews()

ilDclTableViewGUI::confirmDeleteTableviews ( )

Confirm deletion of multiple fields.

Definition at line 164 of file class.ilDclTableViewGUI.php.

References $_POST, and checkViewsLeft().

165  {
166  //at least one view must exist
167  $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
168  $this->checkViewsLeft(count($tableviews));
169 
170  $this->tabs->clearSubTabs();
171  $conf = new ilConfirmationGUI();
172  $conf->setFormAction($this->ctrl->getFormAction($this));
173  $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete'));
174 
175  foreach ($tableviews as $tableview_id) {
176  $conf->addItem('dcl_tableview_ids[]', $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
177  }
178  $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews');
179  $conf->setCancel($this->lng->txt('cancel'), 'show');
180  $this->tpl->setContent($conf->getHTML());
181  }
checkViewsLeft($delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews ...
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteTableviews()

ilDclTableViewGUI::deleteTableviews ( )
protected

Definition at line 187 of file class.ilDclTableViewGUI.php.

References $_POST.

188  {
189  $tableviews = isset($_POST['dcl_tableview_ids']) ? $_POST['dcl_tableview_ids'] : array();
190  foreach ($tableviews as $tableview_id) {
191  ilDclTableView::find($tableview_id)->delete();
192  }
193  $this->table->sortTableViews();
194  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_deleted'), true);
195  $this->ctrl->redirect($this, 'show');
196  }
$_POST["username"]

◆ doTableSwitch()

ilDclTableViewGUI::doTableSwitch ( )

Definition at line 154 of file class.ilDclTableViewGUI.php.

References $_POST.

155  {
156  $this->ctrl->setParameterByClass("ilDclTableViewGUI", "table_id", $_POST['table_id']);
157  $this->ctrl->redirectByClass("ilDclTableViewGUI", "show");
158  }
$_POST["username"]

◆ executeCommand()

ilDclTableViewGUI::executeCommand ( )

Definition at line 82 of file class.ilDclTableViewGUI.php.

References $_GET, and ActiveRecord\findOrGetInstance().

83  {
84  $this->ctrl->saveParameter($this, 'table_id');
85  $cmd = $this->ctrl->getCmd("show");
86  $next_class = $this->ctrl->getNextClass($this);
87 
88  switch ($next_class) {
89  case 'ildcltablevieweditgui':
90  $edit_gui = new ilDclTableViewEditGUI($this, $this->table, ilDclTableView::findOrGetInstance($_GET['tableview_id']));
91  $this->ctrl->saveParameter($edit_gui, 'tableview_id');
92  $this->ctrl->forwardCommand($edit_gui);
93  break;
94  default:
95  switch ($cmd) {
96  default:
97  $this->$cmd();
98  break;
99  }
100  break;
101  }
102  }
Class ilDclTableViewEditGUI.
$_GET["client_id"]
static findOrGetInstance($primary_key, array $add_constructor_args=array())
+ Here is the call graph for this function:

◆ saveTableViewOrder()

ilDclTableViewGUI::saveTableViewOrder ( )

invoked by ilDclTableViewTableGUI

Definition at line 216 of file class.ilDclTableViewGUI.php.

References $_POST.

217  {
218  $orders = $_POST['order'];
219  asort($orders);
220  $tableviews = array();
221  foreach (array_keys($orders) as $tableview_id) {
222  $tableviews[] = ilDclTableView::find($tableview_id);
223  }
224  $this->table->sortTableViews($tableviews);
225  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableviews_order_updated'));
226  $this->ctrl->redirect($this);
227  }
$_POST["username"]

◆ show()

ilDclTableViewGUI::show ( )

Definition at line 117 of file class.ilDclTableViewGUI.php.

References PHPMailer\PHPMailer\$options, $table, ilSubmitButton\getInstance(), and ilLinkButton\getInstance().

118  {
119  $add_new = ilLinkButton::getInstance();
120  $add_new->setPrimary(true);
121  $add_new->setCaption("dcl_add_new_view");
122  $add_new->setUrl($this->ctrl->getLinkTargetByClass('ilDclTableViewEditGUI', 'add'));
123  $this->toolbar->addStickyItem($add_new);
124 
125  $this->toolbar->addSeparator();
126 
127  // Show tables
128  $tables = $this->parent_obj->getDataCollectionObject()->getTables();
129 
130  foreach ($tables as $table) {
131  $options[$table->getId()] = $table->getTitle(); //TODO order tables
132  }
133  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
134  $table_selection = new ilSelectInputGUI('', 'table_id');
135  $table_selection->setOptions($options);
136  $table_selection->setValue($this->table->getId());
137 
138  $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDclTableViewGUI", "doTableSwitch"));
139  $this->toolbar->addText($this->lng->txt("dcl_select"));
140  $this->toolbar->addInputItem($table_selection);
141  $button = ilSubmitButton::getInstance();
142  $button->setCommand("doTableSwitch");
143  $button->setCaption('change');
144  $this->toolbar->addButtonInstance($button);
145 
146  $table_gui = new ilDclTableViewTableGUI($this, 'show', $this->table);
147  $this->tpl->setContent($table_gui->getHTML());
148  }
This class represents a selection list property in a property form.
Class ilDclTableViewTableGUI.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDclTableViewGUI::$ctrl
protected

Definition at line 17 of file class.ilDclTableViewGUI.php.

◆ $lng

ilDclTableViewGUI::$lng
protected

Definition at line 21 of file class.ilDclTableViewGUI.php.

Referenced by __construct().

◆ $table

ilDclTableViewGUI::$table
protected

Definition at line 37 of file class.ilDclTableViewGUI.php.

Referenced by show().

◆ $tabs

ilDclTableViewGUI::$tabs
protected

Definition at line 33 of file class.ilDclTableViewGUI.php.

◆ $toolbar

ilDclTableViewGUI::$toolbar
protected

Definition at line 25 of file class.ilDclTableViewGUI.php.

◆ $tpl

ilDclTableViewGUI::$tpl
protected

Definition at line 29 of file class.ilDclTableViewGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: