13 include_once(
'Services/Table/classes/class.ilTable2GUI.php');
14 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
38 $this->permissions = $a_permissions;
40 parent::__construct($a_parent_obj, $a_parent_cmd);
42 $this->
addColumn($this->lng->txt(
'md_adv_col_presentation_ordering'),
'sort');
43 $this->
addColumn($this->lng->txt(
'title'),
'title');
44 $this->
addColumn($this->lng->txt(
'md_fields'),
'fields');
45 $this->
addColumn($this->lng->txt(
'md_adv_scope'),
'scope');
46 $this->
addColumn($this->lng->txt(
'md_obj_types'),
'obj_types');
47 $this->
addColumn($this->lng->txt(
'md_adv_active'),
'active');
49 $this->
addColumn($this->lng->txt(
'actions'));
51 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
52 $this->
setRowTemplate(
"tpl.show_records_row.html",
"Services/AdvancedMetaData");
69 0 => $this->lng->txt(
"meta_obj_type_inactive"),
70 1 => $this->lng->txt(
"meta_obj_type_mandatory"),
71 2 => $this->lng->txt(
"meta_obj_type_optional")
74 $do_select = (!$a_set[
"readonly"] && !$a_set[
"local"]);
77 foreach ($a_set[
'obj_types'] as
$t) {
78 if ($obj_type[
"obj_type"] == $t[
"obj_type"] &&
79 $obj_type[
"sub_type"] == $t[
"sub_type"]) {
82 $obj_type[
"text"] =
'<span class="il_ItemAlertProperty">' . $obj_type[
"text"] .
'</span>';
85 $value = $t[
"optional"]
92 if (!$do_select && !$value) {
98 $this->tpl->setCurrentBlock(
'ass_obj_types');
99 $this->tpl->setVariable(
'VAL_OBJ_TYPE', $obj_type[
"text"]);
102 switch ($obj_type[
"obj_type"]) {
105 unset($type_options[1]);
109 unset($type_options[1]);
113 unset($type_options[2]);
118 "obj_types[" . $a_set[
'id'] .
"][" . $obj_type[
"obj_type"] .
":" . $obj_type[
"sub_type"] .
"]",
124 array(
"style" =>
"min-width:125px"),
127 $this->tpl->setVariable(
'VAL_OBJ_TYPE_STATUS', $select);
128 $this->tpl->parseCurrentBlock();
131 $this->tpl->setCurrentBlock(
'ass_obj_only');
132 $this->tpl->setVariable(
'VAL_OBJ_TYPE', $obj_type[
"text"]);
133 $this->tpl->parseCurrentBlock();
138 if (!$a_set[
'local'] && count($record->getScopeRefIds())) {
139 $this->tpl->setCurrentBlock(
'scope_txt');
140 $this->tpl->setVariable(
'LOCAL_OR_GLOBAL', $this->lng->txt(
'md_adv_scope_list_header'));
141 $this->tpl->parseCurrentBlock();
143 foreach ($record->getScopeRefIds() as $ref_id) {
144 $this->tpl->setCurrentBlock(
'scope_entry');
147 $this->tpl->parseCurrentBlock();
150 $this->tpl->setCurrentBlock(
'scope_txt');
151 $this->tpl->setVariable(
'LOCAL_OR_GLOBAL', $a_set[
'local'] ? $this->lng->txt(
'meta_local') : $this->lng->txt(
'meta_global'));
152 $this->tpl->parseCurrentBlock();
155 if (!$a_set[
"readonly"] || $a_set[
"local"]) {
156 $this->tpl->setCurrentBlock(
'check_bl');
157 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
158 $this->tpl->parseCurrentBlock();
162 $this->tpl->setVariable(
'R_ID', $a_set[
'id']);
163 $this->tpl->setVariable(
'VAL_POS', $a_set[
'position']);
164 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
165 if (strlen($a_set[
'description'])) {
166 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
170 $this->tpl->setVariable(
'TXT_FIELDS', $this->lng->txt(
'md_adv_no_fields'));
172 foreach ($defs as $definition_obj) {
173 $this->tpl->setCurrentBlock(
'field_entry');
174 $this->tpl->setVariable(
'FIELD_NAME', $definition_obj->getTitle() .
175 ": " . $this->lng->txt($definition_obj->getTypeTitle()));
176 $this->tpl->parseCurrentBlock();
179 $this->tpl->setVariable(
'ACTIVE_CHECKED', $a_set[
'active'] ?
' checked="checked" ' :
'');
180 $this->tpl->setVariable(
'ACTIVE_ID', $a_set[
'id']);
182 if (($a_set[
"readonly"] && !$a_set[
"optional"]) ||
184 $this->tpl->setVariable(
'ACTIVE_DISABLED',
'disabled="disabled"');
187 if (!$a_set[
"readonly"]) {
188 $this->ctrl->setParameter($this->parent_obj,
'record_id', $a_set[
'id']);
191 $this->tpl->setVariable(
'EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj,
'editRecord'));
192 $this->tpl->setVariable(
'TXT_EDIT_RECORD', $this->lng->txt(
'edit'));
195 $this->tpl->setVariable(
'EDIT_FIELDS_LINK', $this->ctrl->getLinkTarget($this->parent_obj,
'editFields'));
196 $this->tpl->setVariable(
'TXT_EDIT_FIELDS', $this->lng->txt(
'md_adv_field_table'));
const ACTION_RECORD_EDIT_PROPERTY
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
static _lookupTitle($a_id)
lookup object title
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
Advanced metadata permission helper.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
const SUBACTION_RECORD_OBJECT_TYPES
static _lookupObjId($a_id)
const ACTION_RECORD_TOGGLE_ACTIVATION
setRowTemplate($a_template, $a_template_dir="")
Set row template.
const ACTION_RECORD_EDIT_FIELDS
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
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.
__construct($a_parent_obj, $a_parent_cmd='', ilAdvancedMDPermissionHelper $a_permissions, $a_in_object_context=false)
Constructor.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")