ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataCollectionRecordListGUI Class Reference

Class ilDataCollectionField. More...

+ Collaboration diagram for ilDataCollectionRecordListGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_parent_obj, $table_id)
 Constructor.
 executeCommand ()
 execute command
 listRecords ()
 List Records.
 exportExcel ()
 doTableSwitch ()
 doTableSwitch
 applyFilter ()
 resetFilter ()
 sendFile ()

Private Member Functions

 recordBelongsToCollection (ilDataCollectionRecord $record)

Private Attributes

 $table_obj

Detailed Description

Constructor & Destructor Documentation

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

Constructor.

Parameters
object$a_parent_obj
int$table_id

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

References $_GET, $ilCtrl, and ilDataCollectionCache\getTableCache().

{
global $ilCtrl;
$this->main_table_id = $a_parent_obj->object->getMainTableId();
$this->table_id = $table_id;
if($this->table_id == NULL)
$this->table_id = $_GET["table_id"];
$this->obj_id = $a_parent_obj->obj_id;
$this->parent_obj = $a_parent_obj;
$this->table_obj = ilDataCollectionCache::getTableCache($table_id);
$ilCtrl->setParameterByClass("ildatacollectionrecordeditgui", "table_id", $table_id);
return;
}

+ Here is the call graph for this function:

Member Function Documentation

ilDataCollectionRecordListGUI::applyFilter ( )

Definition at line 162 of file class.ilDataCollectionRecordListGUI.php.

References $ilCtrl, and listRecords().

{
global $ilCtrl;
$table = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj);
$table->resetOffset();
$table->writeFilterToSession();
$this->listRecords();
}

+ Here is the call graph for this function:

ilDataCollectionRecordListGUI::doTableSwitch ( )

doTableSwitch

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

References $_POST, and $ilCtrl.

{
global $ilCtrl;
$ilCtrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']);
$ilCtrl->redirect($this, "listRecords");
}
ilDataCollectionRecordListGUI::executeCommand ( )

execute command

Definition at line 47 of file class.ilDataCollectionRecordListGUI.php.

References $cmd, $ilCtrl, and $tpl.

{
global $tpl, $ilCtrl;
$cmd = $ilCtrl->getCmd();
switch($cmd)
{
default:
$this->$cmd();
break;
}
}
ilDataCollectionRecordListGUI::exportExcel ( )

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

References $ilCtrl, $lng, $table_obj, exit, ilTable2GUI\EXPORT_EXCEL, and ilDataCollectionRecordListTableGUI\setRecordData().

{
global $ilCtrl, $lng;
if(!($this->table_obj->getExportEnabled() || $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id))){
echo $lng->txt("access_denied");
}
require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordListTableGUI.php');
$list = new ilDataCollectionRecordListTableGUI($this, $ilCtrl->getCmd(), $this->table_obj);
$list->setRecordData($this->table_obj->getRecordsByFilter($list->getFilter()));
$list->setExternalSorting(true);
$list->exportData(ilTable2GUI::EXPORT_EXCEL, true);
}

+ Here is the call graph for this function:

ilDataCollectionRecordListGUI::listRecords ( )

List Records.

Definition at line 66 of file class.ilDataCollectionRecordListGUI.php.

References $data, $ilCtrl, $lng, $total, $tpl, ilObjDataCollection\_hasWriteAccess(), and ilUtil\sendInfo().

Referenced by applyFilter(), and resetFilter().

{
global $ilTabs, $tpl, $lng, $ilCtrl, $ilToolbar;
// Show tables
require_once("./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
if(ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id))
$tables = $this->parent_obj->object->getTables();
else
$tables = $this->parent_obj->object->getVisibleTables();
foreach($tables as $table)
{
$options[$table->getId()] = $table->getTitle();
}
if(count($options) > 0){
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
$table_selection = new ilSelectInputGUI('', 'table_id');
$table_selection->setOptions($options);
$table_selection->setValue($this->table_id);
$ilToolbar->setFormAction($ilCtrl->getFormActionByClass("ilDataCollectionRecordListGUI", "doTableSwitch"));
$ilToolbar->addText($lng->txt("dcl_table"));
$ilToolbar->addInputItem($table_selection);
$ilToolbar->addFormButton($lng->txt('change'),'doTableSwitch');
$ilToolbar->addSeparator();
}
if(($this->table_obj->getExportEnabled() || $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)) && count($this->table_obj->getRecordFields()))
$ilToolbar->addButton($lng->txt('dcl_export_table_excel'), $ilCtrl->getFormActionByClass("ildatacollectionrecordlistgui", "exportExcel"));
if($this->table_obj->hasPermissionToAddRecord($this->parent_obj->ref_id) && $this->table_obj->hasCustomFields()){
$ilCtrl->setParameterByClass("ildatacollectionrecordeditgui","record_id", null);
// $ilToolbar->addButton($lng->txt("dcl_import_records .xls"), $ilCtrl->getFormActionByClass("ildatacollectionrecordlistgui", "showImportExcel"));
$ilToolbar->addButton($lng->txt("dcl_add_new_record"), $ilCtrl->getFormActionByClass("ildatacollectionrecordeditgui", "create"));
}
// requested not to implement this way...
//$tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
if(count($this->table_obj->getRecordFields()) == 0){
ilUtil::sendInfo($lng->txt("dcl_no_fields_yet")." ".($this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)?$lng->txt("dcl_create_fields"):""));
}
$list = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj);
$list->setExternalSegmentation(true);
$list->setExternalSorting(true);
$list->determineLimit();
$list->determineOffsetAndOrder();
$data = $this->table_obj->getPartialRecords($list->getOrderField(), $list->getOrderDirection(), $list->getLimit(), $list->getOffset(), $list->getFilter());
$records = $data['records'];
$total = $data['total'];
$list->setMaxCount($total);
$list->setRecordData($records);
$tpl->getStandardTemplate();
$tpl->setPermanentLink("dcl", $this->parent_obj->ref_id);
$tpl->setContent($list->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecordListGUI::recordBelongsToCollection ( ilDataCollectionRecord  $record)
private

Definition at line 209 of file class.ilDataCollectionRecordListGUI.php.

References ilDataCollectionRecord\getTable().

Referenced by sendFile().

{
$table = $record->getTable();
$obj_id = $this->parent_obj->object->getId();
$obj_id_rec = $table->getCollectionObject()->getId();
return $obj_id == $obj_id_rec;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDataCollectionRecordListGUI::resetFilter ( )

Definition at line 175 of file class.ilDataCollectionRecordListGUI.php.

References $ilCtrl, and listRecords().

{
global $ilCtrl;
$table = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj);
$table->resetOffset();
$table->resetFilter();
$this->listRecords();
}

+ Here is the call graph for this function:

ilDataCollectionRecordListGUI::sendFile ( )

Definition at line 188 of file class.ilDataCollectionRecordListGUI.php.

References $_GET, ilUtil\deliverFile(), ilDataCollectionCache\getRecordCache(), and recordBelongsToCollection().

{
global $ilAccess;
//need read access to receive file
if($ilAccess->checkAccess("read", "", $this->parent_obj->ref_id))
{
$rec_id = $_GET['record_id'];
$field_id = $_GET['field_id'];
$file_obj = new ilObjFile($record->getRecordFieldValue($field_id), false);
if(!$this->recordBelongsToCollection($record, $this->parent_obj->ref_id))
{
return;
}
ilUtil::deliverFile($file_obj->getFile(), $file_obj->getTitle());
}
}

+ Here is the call graph for this function:

Field Documentation

ilDataCollectionRecordListGUI::$table_obj
private

Definition at line 22 of file class.ilDataCollectionRecordListGUI.php.

Referenced by exportExcel().


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