32 include_once(
'Services/Table/classes/class.ilTable2GUI.php');
33 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
58 $ilCtrl = $DIC[
'ilCtrl'];
61 $this->ctrl = $ilCtrl;
62 $this->permissions = $a_permissions;
63 $this->may_edit_pos = (bool) $a_may_edit_pos;
68 $this->
addColumn($this->lng->txt(
'position'),
'position',
"5%");
69 $this->
addColumn($this->lng->txt(
'title'),
'title',
"30%");
70 $this->
addColumn($this->lng->txt(
'md_adv_field_fields'),
'fields',
"35%");
71 $this->
addColumn($this->lng->txt(
'options'),
'obj_types',
"30%");
73 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
74 $this->
setRowTemplate(
"tpl.edit_fields_row.html",
"Services/AdvancedMetaData");
76 #$this->setDefaultOrderDirection("desc"); 81 if ($a_field ===
'position') {
96 $this->tpl->setVariable(
'TXT_SEARCHABLE', $this->lng->txt(
'md_adv_searchable'));
97 $this->tpl->setVariable(
'ASS_ID', $a_set[
'id']);
98 if ($a_set[
'searchable']) {
99 $this->tpl->setVariable(
'ASS_CHECKED',
'checked="checked"');
102 !(
bool) $a_set[
'supports_search']) {
103 $this->tpl->setVariable(
'ASS_DISABLED',
' disabled="disabled"');
106 $this->tpl->setVariable(
'VAL_POS', $a_set[
'position']);
107 if (!$this->may_edit_pos) {
108 $this->tpl->setVariable(
'POS_DISABLED',
' disabled="disabled"');
111 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
112 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
113 if (strlen($a_set[
'description'])) {
114 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
117 $this->tpl->setVariable(
'FIELD_TYPE', $a_set[
'type']);
119 foreach ((array) $a_set[
'properties'] as $key => $value) {
120 $this->tpl->setCurrentBlock(
'field_value');
121 $this->tpl->setVariable(
'FIELD_KEY', $key);
122 $this->tpl->setVariable(
'FIELD_VAL', $value);
123 $this->tpl->parseCurrentBlock();
127 $this->ctrl->setParameter($this->parent_obj,
'field_id', $a_set[
'id']);
128 $this->tpl->setVariable(
'EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj,
'editField'));
129 $this->tpl->setVariable(
'TXT_EDIT_RECORD', $this->lng->txt(
'edit'));
144 foreach ($a_definitions as $definition) {
148 $tmp_arr[
'position'] = ++$counter * 10;
149 $tmp_arr[
'id'] = $definition->getFieldId();
150 $tmp_arr[
'title'] = $field_translations->getTitleForLanguage($definition->getFieldId(),
$this->active_language);
151 $tmp_arr[
'description'] = $field_translations->getDescriptionForLanguage($definition->getFieldId(),
$this->active_language);
152 $tmp_arr[
'fields'] = array();
153 $tmp_arr[
'searchable'] = $definition->isSearchable();
154 $tmp_arr[
'type'] = $this->lng->txt($definition->getTypeTitle());
155 $tmp_arr[
'properties'] = $definition->getFieldDefinitionForTableGUI($this->active_language);
156 $tmp_arr[
'supports_search'] = $definition->isSearchSupported();
158 $tmp_arr[
'perm'] = $this->permissions->hasPermissions(
160 $definition->getFieldId(),
168 $defs_arr[] = $tmp_arr;
172 $this->
setData($defs_arr ? $defs_arr : array());
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
numericOrdering($a_field)
const ACTION_FIELD_EDIT_PROPERTY
parseDefinitions($a_definitions)
parese field data
const SUBACTION_FIELD_SEARCHABLE
Advanced metadata permission helper.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static getInstanceByRecordId(int $record_id)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd='', ilAdvancedMDPermissionHelper $a_permissions, $a_may_edit_pos, string $active_language)
Constructor.
__construct(Container $dic, ilPlugin $plugin)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.