ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataCollectionFieldListGUI Class Reference

Class ilDataCollectionFieldListGUI. More...

+ Collaboration diagram for ilDataCollectionFieldListGUI:

Public Member Functions

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

Protected Member Functions

 checkAccess ()

Protected Attributes

 $ctrl
 $lng
 $toolbar
 $tpl
 $tabs

Detailed Description

Constructor & Destructor Documentation

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

Constructor.

Parameters
ilObjDataCollectionGUI$a_parent_obj
int$table_id

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

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

{
global $ilCtrl, $lng, $ilToolbar, $tpl, $ilTabs;
$this->main_table_id = $a_parent_obj->object->getMainTableId();
$this->table_id = $table_id;
$this->parent_obj = $a_parent_obj;
$this->obj_id = $a_parent_obj->obj_id;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->tpl = $tpl;
$this->tabs = $ilTabs;
$this->toolbar = $ilToolbar;
if ( ! $this->checkAccess()) {
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionFieldListGUI::checkAccess ( )
protected
Returns
bool

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

References $ref_id, and ilObjDataCollection\_hasWriteAccess().

Referenced by __construct().

{
$ref_id = $this->parent_obj->getDataCollectionObject()->getRefId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionFieldListGUI::deleteFields ( )

Delete multiple fields.

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

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

{
$field_ids = isset($_POST['dcl_field_ids']) ? $_POST['dcl_field_ids'] : array();
$table = ilDataCollectionCache::getTableCache($this->table_id);
foreach ($field_ids as $field_id) {
$table->deleteField($field_id);
}
ilUtil::sendSuccess($this->lng->txt('dcl_msg_fields_deleted'), true);
$this->ctrl->redirect($this, 'listFields');
}

+ Here is the call graph for this function:

ilDataCollectionFieldListGUI::doTableSwitch ( )

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

References $_POST.

{
$this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
$this->ctrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields");
}
ilDataCollectionFieldListGUI::executeCommand ( )

execute command

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

References $cmd.

{
$cmd = $this->ctrl->getCmd();
switch($cmd) {
default:
$this->$cmd();
break;
}
}
ilDataCollectionFieldListGUI::listFields ( )

list fields

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

References $options.

Referenced by save().

{
// Show tables
require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
$tables = $this->parent_obj->object->getTables();
foreach($tables as $table)
{
$options[$table->getId()] = $table->getTitle();
}
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
$table_selection = new ilSelectInputGUI('', 'table_id');
$table_selection->setOptions($options);
$table_selection->setValue($this->table_id);
$this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
$this->toolbar->addText($this->lng->txt("dcl_table"));
$this->toolbar->addInputItem($table_selection);
$this->toolbar->addFormButton($this->lng->txt('change'),'doTableSwitch');
$this->toolbar->addSeparator();
$this->toolbar->addButton($this->lng->txt("dcl_add_new_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
$this->toolbar->addSeparator();
$this->ctrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
$this->toolbar->addButton($this->lng->txt("dcl_table_settings"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
$this->toolbar->addButton($this->lng->txt("dcl_delete_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
$this->toolbar->addButton($this->lng->txt("dcl_add_new_field"), $this->ctrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
// requested not to implement this way...
// $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
require_once('./Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php');
$list = new ilDataCollectionFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
$this->tpl->setContent($list->getHTML());
}

+ Here is the caller graph for this function:

ilDataCollectionFieldListGUI::save ( )

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

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

{
$fields = $table->getFields();
foreach($fields as $field)
{
$field->setVisible($_POST['visible'][$field->getId()] == "on");
$field->setEditable($_POST['editable'][$field->getId()] == "on");
$field->setFilterable($_POST['filterable'][$field->getId()] == "on");
$field->setLocked($_POST['locked'][$field->getId()] == "on");
$field->setExportable($_POST['exportable'][$field->getId()] == "on");
$field->setOrder($_POST['order'][$field->getId()]);
$field->doUpdate();
}
$table->buildOrderFields();
ilUtil::sendSuccess($this->lng->txt("dcl_table_settings_saved"));
$this->listFields();
}

+ Here is the call graph for this function:

Field Documentation

ilDataCollectionFieldListGUI::$ctrl
protected

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

ilDataCollectionFieldListGUI::$lng
protected

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

Referenced by __construct().

ilDataCollectionFieldListGUI::$tabs
protected

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

ilDataCollectionFieldListGUI::$toolbar
protected

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

ilDataCollectionFieldListGUI::$tpl
protected

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

Referenced by __construct().


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