ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataCollectionFieldListGUI Class Reference

Class ilDataCollectionFieldListGUI. More...

+ Collaboration diagram for ilDataCollectionFieldListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj, $table_id)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 save ()
 
 listFields ()
 list fields More...
 
 doTableSwitch ()
 

Protected Member Functions

 checkAccess ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionFieldListGUI::__construct ( ilObjDataCollectionGUI  $a_parent_obj,
  $table_id 
)

Constructor.

Parameters
object$a_parent_obj
int$table_id

Definition at line 30 of file class.ilDataCollectionFieldListGUI.php.

References $ilCtrl, $lng, checkAccess(), and ilUtil\sendFailure().

31  {
32  global $ilCtrl, $lng;
33 
34  $this->main_table_id = $a_parent_obj->object->getMainTableId();
35  $this->table_id = $table_id;
36  $this->parent_obj = $a_parent_obj;
37  $this->obj_id = $a_parent_obj->obj_id;
38  if ( ! $this->checkAccess()) {
39  ilUtil::sendFailure($lng->txt('permission_denied'), true);
40  $ilCtrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
41  }
42  }
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDataCollectionFieldListGUI::checkAccess ( )
protected
Returns
bool

Definition at line 142 of file class.ilDataCollectionFieldListGUI.php.

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

143  {
144  $ref_id = $this->parent_obj->getDataCollectionObject()->getRefId();
146  }
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doTableSwitch()

ilDataCollectionFieldListGUI::doTableSwitch ( )

Definition at line 131 of file class.ilDataCollectionFieldListGUI.php.

References $_POST, and $ilCtrl.

132  {
133  global $ilCtrl;
134 
135  $ilCtrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
136  $ilCtrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
137  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

◆ executeCommand()

ilDataCollectionFieldListGUI::executeCommand ( )

execute command

Definition at line 48 of file class.ilDataCollectionFieldListGUI.php.

References $cmd, $ilCtrl, and $tpl.

49  {
50  global $tpl, $ilCtrl;
51 
52  $cmd = $ilCtrl->getCmd();
53 
54  switch($cmd)
55  {
56  default:
57  $this->$cmd();
58  break;
59  }
60  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

◆ listFields()

ilDataCollectionFieldListGUI::listFields ( )

list fields

Definition at line 89 of file class.ilDataCollectionFieldListGUI.php.

References $ilCtrl, $lng, $options, and $tpl.

Referenced by save().

90  {
91  global $tpl, $lng, $ilCtrl, $ilToolbar;
92 
93  // Show tables
94  require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
95  $tables = $this->parent_obj->object->getTables();
96 
97  foreach($tables as $table)
98  {
99  $options[$table->getId()] = $table->getTitle();
100  }
101  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
102  $table_selection = new ilSelectInputGUI('', 'table_id');
103  $table_selection->setOptions($options);
104  $table_selection->setValue($this->table_id);
105 
106  $ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
107  $ilToolbar->addText($lng->txt("dcl_table"));
108  $ilToolbar->addInputItem($table_selection);
109  $ilToolbar->addFormButton($lng->txt('change'),'doTableSwitch');
110  $ilToolbar->addSeparator();
111  $ilToolbar->addButton($lng->txt("dcl_add_new_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
112  $ilToolbar->addSeparator();
113  $ilCtrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
114  $ilToolbar->addButton($lng->txt("dcl_table_settings"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
115  $ilToolbar->addButton($lng->txt("dcl_delete_table"), $ilCtrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
116  $ilToolbar->addButton($lng->txt("dcl_add_new_field"), $ilCtrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
117 
118  // requested not to implement this way...
119 // $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
120 
121  require_once('./Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php');
122  $list = new ilDataCollectionFieldListTableGUI($this, $ilCtrl->getCmd(), $this->table_id);
123 
124  $tpl->setContent($list->getHTML());
125 
126  }
This class represents a selection list property in a property form.
Class ilDataCollectionFieldListTableGUI.
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ save()

ilDataCollectionFieldListGUI::save ( )

Definition at line 65 of file class.ilDataCollectionFieldListGUI.php.

References $_GET, $_POST, $lng, ilDataCollectionCache\getTableCache(), listFields(), and ilUtil\sendSuccess().

66  {
67  global $lng;
68  $table = ilDataCollectionCache::getTableCache($_GET['table_id']);
69  $fields = &$table->getFields();
70 
71  foreach($fields as &$field)
72  {
73  $field->setVisible($_POST['visible'][$field->getId()] == "on");
74  $field->setEditable($_POST['editable'][$field->getId()] == "on");
75  $field->setFilterable($_POST['filterable'][$field->getId()] == "on");
76  $field->setLocked($_POST['locked'][$field->getId()] == "on");
77  $field->setExportable($_POST['exportable'][$field->getId()] == "on");
78  $field->setOrder($_POST['order'][$field->getId()]);
79  $field->doUpdate();
80  }
81  $table->buildOrderFields();
82  ilUtil::sendSuccess($lng->txt("dcl_table_settings_saved"));
83  $this->listFields();
84  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

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