13 include_once(
'Services/Table/classes/class.ilTable2GUI.php');
14 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
35 $this->permissions = $a_permissions;
37 parent::__construct($a_parent_obj, $a_parent_cmd);
39 $this->
addColumn($this->lng->txt(
'title'),
'title');
40 $this->
addColumn($this->lng->txt(
'md_fields'),
'fields');
41 $this->
addColumn($this->lng->txt(
'md_adv_scope'),
'scope');
42 $this->
addColumn($this->lng->txt(
'md_obj_types'),
'obj_types');
43 $this->
addColumn($this->lng->txt(
'md_adv_active'),
'active');
45 $this->
addColumn($this->lng->txt(
'actions'));
47 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
48 $this->
setRowTemplate(
"tpl.show_records_row.html",
"Services/AdvancedMetaData");
65 0 => $this->lng->txt(
"meta_obj_type_inactive"),
66 1 => $this->lng->txt(
"meta_obj_type_mandatory"),
67 2 => $this->lng->txt(
"meta_obj_type_optional")
70 $do_select = (!$a_set[
"readonly"] && !$a_set[
"local"]);
73 foreach ($a_set[
'obj_types'] as
$t) {
74 if ($obj_type[
"obj_type"] == $t[
"obj_type"] &&
75 $obj_type[
"sub_type"] == $t[
"sub_type"]) {
78 $obj_type[
"text"] =
'<span class="il_ItemAlertProperty">' . $obj_type[
"text"] .
'</span>';
81 $value = $t[
"optional"]
88 if (!$do_select && !$value) {
92 $this->tpl->setCurrentBlock(
'ass_obj_types');
93 $this->tpl->setVariable(
'VAL_OBJ_TYPE', $obj_type[
"text"]);
97 switch ($obj_type[
"obj_type"]) {
100 unset($type_options[1]);
104 unset($type_options[1]);
108 unset($type_options[2]);
113 "obj_types[" . $a_set[
'id'] .
"][" . $obj_type[
"obj_type"] .
":" . $obj_type[
"sub_type"] .
"]",
119 array(
"style"=>
"min-width:125px"),
122 $this->tpl->setVariable(
'VAL_OBJ_TYPE_STATUS', $select);
125 $this->tpl->parseCurrentBlock();
129 if (!$a_set[
'local'] && count($record->getScopeRefIds())) {
130 $this->tpl->setCurrentBlock(
'scope_txt');
131 $this->tpl->setVariable(
'LOCAL_OR_GLOBAL', $this->lng->txt(
'md_adv_scope_list_header'));
132 $this->tpl->parseCurrentBlock();
134 foreach ($record->getScopeRefIds() as $ref_id) {
135 $this->tpl->setCurrentBlock(
'scope_entry');
138 $this->tpl->parseCurrentBlock();
141 $this->tpl->setCurrentBlock(
'scope_txt');
142 $this->tpl->setVariable(
'LOCAL_OR_GLOBAL', $a_set[
'local'] ? $this->lng->txt(
'meta_local') : $this->lng->txt(
'meta_global'));
143 $this->tpl->parseCurrentBlock();
146 if (!$a_set[
"readonly"] || $a_set[
"local"]) {
147 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
150 $this->tpl->setVariable(
'VAL_TITLE', $a_set[
'title']);
151 if (strlen($a_set[
'description'])) {
152 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
156 $this->tpl->setVariable(
'TXT_FIELDS', $this->lng->txt(
'md_adv_no_fields'));
158 foreach ($defs as $definition_obj) {
159 $this->tpl->setCurrentBlock(
'field_entry');
160 $this->tpl->setVariable(
'FIELD_NAME', $definition_obj->getTitle() .
161 ": " . $this->lng->txt($definition_obj->getTypeTitle()));
162 $this->tpl->parseCurrentBlock();
165 $this->tpl->setVariable(
'ACTIVE_CHECKED', $a_set[
'active'] ?
' checked="checked" ' :
'');
166 $this->tpl->setVariable(
'ACTIVE_ID', $a_set[
'id']);
168 if (($a_set[
"readonly"] && !$a_set[
"optional"]) ||
170 $this->tpl->setVariable(
'ACTIVE_DISABLED',
'disabled="disabled"');
173 if (!$a_set[
"readonly"]) {
174 $this->ctrl->setParameter($this->parent_obj,
'record_id', $a_set[
'id']);
177 $this->tpl->setVariable(
'EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj,
'editRecord'));
178 $this->tpl->setVariable(
'TXT_EDIT_RECORD', $this->lng->txt(
'edit'));
181 $this->tpl->setVariable(
'EDIT_FIELDS_LINK', $this->ctrl->getLinkTarget($this->parent_obj,
'editFields'));
182 $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.
Create styles array
The data for the language used.
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="")
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options