5 require_once(
'./Services/Table/classes/class.ilTable2GUI.php');
6 require_once(
'class.ilDataCollectionRecordViewGUI.php');
7 require_once(
'class.ilDataCollectionField.php');
8 require_once(
'./Services/Tracking/classes/class.ilLPStatus.php');
9 require_once(
'./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php');
10 require_once(
'class.ilDataCollectionDatatype.php');
11 require_once(
'./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
12 require_once(
'./Services/Table/classes/class.ilTablePropertiesStorage.php');
58 $identifier =
'dcl_rl' . $table->
getId();
61 $this->
setId($identifier);
62 parent::__construct($a_parent_obj, $a_parent_cmd);
64 $this->parent_obj = $a_parent_obj;
65 $this->
setRowTemplate(
"tpl.record_list_row.html",
"Modules/DataCollection");
73 $this->
addMultiCommand(
"confirmDeleteRecords", $lng->txt(
'dcl_delete_records'));
80 $this->numeric_fields = array();
81 foreach ($this->table->getVisibleFields() as $field) {
82 $title = $field->getTitle();
84 if ($field->getId() ==
'comments') {
85 $sort_field =
'n_comments';
86 $this->numeric_fields[] =
$title;
97 if ($field->getLearningProgress()) {
98 $this->
addColumn($lng->txt(
"dcl_status"),
"_status_" . $field->getTitle());
101 $this->numeric_fields[] =
$title;
104 $this->
addColumn($lng->txt(
"actions"),
"",
"30px");
113 $default_sort_title =
'id';
114 if ($fieldId = $this->table->getDefaultSortField()) {
118 if ($stdField->getId() == $fieldId) {
119 $default_sort_title = $stdField->getTitle();
128 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj,
"applyFilter"));
130 $this->
setStyle(
'table', $this->
getStyle(
'table') .
' ' .
'dcl_record_list');
145 $this->object_data =
$data;
159 foreach ($this->table->getFields() as $field) {
160 if ($field->getExportable()) {
161 $worksheet->writeString(
$row, $col, $field->getTitle());
169 return in_array($field, $this->numeric_fields);
180 foreach ($this->object_data as $record) {
181 $record_data = array();
182 $record_data[
"_front"] = NULL;
183 $record_data[
'_record'] = $record;
185 foreach ($this->table->getVisibleFields() as $field) {
186 $title = $field->getTitle();
187 $record_data[
$title] = $record->getRecordFieldHTML($field->getId());
190 if ($field->getLearningProgress()) {
193 if ($field->getId() ==
'comments') {
194 $record_data[
'n_comments'] = count($record->getComments());
198 $ilCtrl->setParameterByClass(
"ildatacollectionfieldeditgui",
"record_id", $record->getId());
199 $ilCtrl->setParameterByClass(
"ildatacollectionrecordviewgui",
"record_id", $record->getId());
200 $ilCtrl->setParameterByClass(
"ildatacollectionrecordeditgui",
"record_id", $record->getId());
201 $ilCtrl->setParameterByClass(
"ildatacollectionrecordeditgui",
"mode", $this->mode);
204 $record_data[
"_front"] = $ilCtrl->getLinkTargetByClass(
"ildatacollectionrecordviewgui",
'renderRecord');
208 $alist->setId($record->getId());
209 $alist->setListTitle($lng->txt(
"actions"));
212 $alist->addItem($lng->txt(
'view'),
'view', $ilCtrl->getLinkTargetByClass(
"ildatacollectionrecordviewgui",
'renderRecord'));
215 if ($record->hasPermissionToEdit($this->parent_obj->parent_obj->ref_id)) {
216 $alist->addItem($lng->txt(
'edit'),
'edit', $ilCtrl->getLinkTargetByClass(
"ildatacollectionrecordeditgui",
'edit'));
219 if ($record->hasPermissionToDelete($this->parent_obj->parent_obj->ref_id)) {
220 $alist->addItem($lng->txt(
'delete'),
'delete', $ilCtrl->getLinkTargetByClass(
"ildatacollectionrecordeditgui",
'confirmDelete'));
223 if ($this->table->getPublicCommentsEnabled()) {
224 $alist->addItem($lng->txt(
'dcl_comments'),
'comment',
'',
'',
'',
'',
'',
'', $this->
getCommentsAjaxLink($record->getId()));
227 $record_data[
"_actions"] = $alist->getHTML();
228 $data[] = $record_data;
241 foreach ($this->table->getFields() as $field) {
242 if ($field->getExportable()) {
243 $worksheet->writeString(
$row, $col, $record[
"_record"]->getRecordFieldExportValue($field->getId()));
255 public function fillRow($record_data) {
257 $record_obj = $record_data[
'_record'];
263 foreach ($this->table->getVisibleFields() as $field) {
264 $title = $field->getTitle();
265 $this->tpl->setCurrentBlock(
"field");
266 $content = $record_data[
$title];
267 if ($content ===
false OR $content === NULL) {
271 switch ($field->getDatatypeId()) {
273 $this->tpl->setVariable(
"ADDITIONAL_CLASS",
'text-right');
277 $this->tpl->setVariable(
"CONTENT", $content);
278 $this->tpl->parseCurrentBlock();
279 if ($field->getLearningProgress()) {
280 $this->tpl->setCurrentBlock(
"field");
281 $this->tpl->setVariable(
"CONTENT", $record_data[
"_status_" .
$title]);
282 $this->tpl->parseCurrentBlock();
286 if ($record_data[
"_front"]) {
287 $this->tpl->setCurrentBlock(
'view');
288 $this->tpl->setVariable(
"VIEW_IMAGE_LINK", $record_data[
"_front"]);
290 $this->tpl->parseCurrentBlock();
292 $this->tpl->setVariable(
"ACTIONS", $record_data[
"_actions"]);
295 if ($record_obj->getOwner() == $ilUser->getId() OR $ilAccess->checkAccess(
'write',
'',
$_GET[
'ref_id'])) {
296 $this->tpl->setCurrentBlock(
'mode_manage');
297 $this->tpl->setVariable(
'RECORD_ID', $record_obj->getId());
298 $this->tpl->parseCurrentBlock();
300 $this->tpl->touchBlock(
'mode_manage_no_owner');
319 if ($status = $record_field->getStatus()) {
329 foreach ($this->table->getFilterableFields() as $field) {
331 $input->readFromSession();
332 $value = $input->getValue();
333 if (is_array($value)) {
334 if ($value[
'from'] || $value[
'to']) {
335 $this->filter[
"filter_" . $field->getId()] = $value;
339 $this->filter[
"filter_" . $field->getId()] = $value;
357 return $tab_prop->getProperty($this->
getId(), $ilUser->getId(), $type);
Class ilDataCollectionField.
setFormName($a_formname)
Set Form name.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
static _isStandardField($field_id)
Class ilDataCollectionRecordListGUI.
getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setStyle($a_element, $a_style)
static hasTableValidViewDefinition(ilDataCollectionTable $table)
setShowTemplates($a_value)
Toggle templates.
getStatus(ilDataCollectionRecord $record, ilDataCollectionField $field)
This adds the collumn for status.
static addFilterInputFieldToTable(ilDataCollectionField $field, ilTable2GUI &$table)
addFilterInputFieldToTable This function adds the according filter item to the table gui passed as ar...
_getImagePathForStatus($a_status)
Get image path for status.
Saves (mostly asynchronously) user properties of tables (e.g.
static _getStandardFields($table_id)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
Class ilDataCollectionRecord.
static getRecordFieldCache($record, $field)
static getFieldCache($field_id=0)
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
static buildAjaxHash($a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null)
Build ajax hash.
Class ilDataCollectionField.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getFilter()
Return array of fields that are currently stored in the filter.
fillRowExcel($worksheet, &$row, $record)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
writeFilterToSession()
Write filter values to session.
Class ilDataCollectionField.
User interface class for advanced drop-down selection lists.
fillHeaderExcel($worksheet, &$row)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
fillRow($a_set)
Standard Version of Fill Row.
buildData()
Parse data from record objects to an array that is then set to this table with ::setData() ...
getCommentsAjaxLink($recordId)
Get the ajax link for displaying the comments in the right panel (to be wrapped in an onclick attr) ...
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.