ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilDataCollectionRecordListViewdefinitionGUI Class Reference

Class ilDataCollectionField. More...

+ Collaboration diagram for ilDataCollectionRecordListViewdefinitionGUI:

Public Member Functions

 __construct ($a_parent_obj, $table_id)
 
 executeCommand ()
 execute command More...
 
 edit ()
 createRecordListViewdefinition More...
 
 initForm ()
 initRecordListViewdefinitionForm More...
 
 save ($a_mode="create")
 saveRecordListViewdefinition More...
 
 doTableSwitch ()
 doTableSwitch More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionRecordListViewdefinitionGUI::__construct (   $a_parent_obj,
  $table_id 
)

Definition at line 23 of file class.ilDataCollectionRecordListViewdefinitionGUI.php.

24  {
25  $this->main_table_id = $a_parent_obj->object->getMainTableId();
26  $this->table_id = $table_id;
27  $this->obj_id = $a_parent_obj->obj_id;
28 
29  if(isset($view_id))
30  {
31  //TODO
32  //$this->field_obj = new ilDataCollectionField($field_id);
33  }
34  else
35  {
36  $this->view_obj = new ilDataCollectionRecordListViewdefinition();
37  $this->view_obj->setTableId($table_id);
38  }
39 
40  return;
41  }

Member Function Documentation

◆ doTableSwitch()

ilDataCollectionRecordListViewdefinitionGUI::doTableSwitch ( )

doTableSwitch

Definition at line 211 of file class.ilDataCollectionRecordListViewdefinitionGUI.php.

References $_POST, and $ilCtrl.

212  {
213  global $ilCtrl;
214 
215  $ilCtrl->setParameterByClass("ilObjDataCollectionGUI","table_id", $_POST['table_id']);
216  $ilCtrl->redirect($this, "edit");
217 
218  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

◆ edit()

ilDataCollectionRecordListViewdefinitionGUI::edit ( )

createRecordListViewdefinition

Definition at line 71 of file class.ilDataCollectionRecordListViewdefinitionGUI.php.

References $tpl, and initForm().

72  {
73  global $tpl;
74 
75  $this->initForm();
76  $this->getFormValues();
77 
78  $tpl->setContent($this->form->getHTML());
79  }
global $tpl
Definition: ilias.php:8
+ Here is the call graph for this function:

◆ executeCommand()

ilDataCollectionRecordListViewdefinitionGUI::executeCommand ( )

execute command

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

References $cmd, and $ilCtrl.

47  {
48  global $ilCtrl;
49 
50  $cmd = $ilCtrl->getCmd();
51 
52  switch($cmd)
53  {
54  default:
55  $this->$cmd();
56  break;
57  }
58 
59  return true;
60  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ initForm()

ilDataCollectionRecordListViewdefinitionGUI::initForm ( )

initRecordListViewdefinitionForm

Definition at line 85 of file class.ilDataCollectionRecordListViewdefinitionGUI.php.

References $ilCtrl, $lng, $options, ilSubEnabledFormPropertyGUI\addSubItem(), and ilDataCollectionTable\getAll().

Referenced by edit(), and save().

86  {
87  global $lng, $ilCtrl, $ilToolbar;
88 
89  // Show tables
90  require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
91  $arrTables = ilDataCollectionTable::getAll($this->obj_id);
92  foreach($arrTables as $table)
93  {
94  $options[$table['id']] = $table['title'];
95  }
96  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
97  $table_selection = new ilSelectInputGUI(
98  '',
99  'table_id'
100  );
101  $table_selection->setOptions($options);
102  $table_selection->setValue($this->table_id);
103  $ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionRecordListViewdefinitionGUI", "doTableSwitch"));
104  $ilToolbar->addInputItem($table_selection);
105  $ilToolbar->addFormButton($lng->txt('change'),'doTableSwitch');
106 
107  // Form
108  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
109  $this->form = new ilPropertyFormGUI();
110 
111  $this->form->setFormAction($ilCtrl->getFormAction($this),"save");
112  $this->form->addCommandButton('save', $lng->txt('dcl_listviewdefinition_update'));
113  $this->form->addCommandButton('cancel', $lng->txt('cancel'));
114 
115  //Table-ID
116  $hidden_prop = new ilHiddenInputGUI("table_id");
117  $hidden_prop->setValue($this->table_id);
118  $this->form->addItem($hidden_prop);
119 
120  //Get fields
121  require_once("./Modules/DataCollection/classes/class.ilDataCollectionField.php");
122  $fields = ilDataCollectionField::getAll($this->table_id);
123 
124  $tabledefinition = array(
125  "id" => array("title" => $lng->txt("id")),
126  "table_id" => array("title" => $lng->txt("dcl_table_id")),
127  "create_date" => array("title" => $lng->txt("create_date")),
128  "last_update" => array("title" => $lng->txt("last_update")),
129  "owner" => array("title" => $lng->txt("owner"))
130  );
131 
132  //Array zusammenführen
133  foreach($fields as $key => $value)
134  {
135  $tabledefinition[$key] = $value;
136  }
137 
138  foreach($tabledefinition as $key => $field)
139  {
140  $chk_prop = new ilCheckboxInputGUI($field['title'],'visible_'.$key);
141  $chk_prop->setOptionTitle($lng->txt('visible'));
142 
143  $text_prop = new ilTextInputGUI($lng->txt('dcl_field_ordering'), 'order_'.$key);
144  $chk_prop->addSubItem($text_prop);
145 
146  $this->form->addItem($chk_prop);
147  }
148 
149  $this->form->setTitle($lng->txt('dcl_view_viewdefinition'));
150 
151  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
if(!is_array($argv)) $options
This class represents a text property in a property form.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDataCollectionRecordListViewdefinitionGUI::save (   $a_mode = "create")

saveRecordListViewdefinition

Parameters
string$a_modevalues: create | update

Definition at line 158 of file class.ilDataCollectionRecordListViewdefinitionGUI.php.

References $ilCtrl, $lng, initForm(), and ilUtil\sendSuccess().

159  {
160  global $ilCtrl, $lng;
161 
162  $this->initForm();
163 
164  if($this->form->checkInput())
165  {
166  //Get fields
167  require_once("./Modules/DataCollection/classes/class.ilDataCollectionField.php");
168  $fields = ilDataCollectionField::getAll($this->table_id);
169 
170  //TODO tabledefs global definieren
171  $tabledefinition = array(
172  "id" => array("title" => $lng->txt("id")),
173  "table_id" => array("title" => $lng->txt("dcl_table_id")),
174  "create_date" => array("title" => $lng->txt("create_date")),
175  "last_update" => array("title" => $lng->txt("last_update")),
176  "owner" => array("title" => $lng->txt("owner"))
177  );
178  // Array zusammenführen TODO
179  foreach($fields as $key => $value)
180  {
181  $tabledefinition[$key] = $value;
182  }
183 
184  foreach($tabledefinition as $key => $field)
185  {
186  if($this->form->getInput("visible_".$key))
187  {
188  $this->view_obj->setArrFieldOrder($this->form->getInput("order_".$key),$key);
189  }
190  }
191 
192  $this->view_obj->doCreate();
193 
194  ilUtil::sendSuccess($lng->txt("msg_obj_modified"),true);
195 
196  $ilCtrl->redirect($this, "edit");
197  }
198  else
199  {
200  ilUtil::sendSuccess($lng->txt("msg_obj_modified"),false);
201  $this->form_gui->setValuesByPost();
202  $this->tpl->setContent($this->form_gui->getHTML());
203  }
204  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
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: