ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjectMetaDataGUI Class Reference

Class ilObjectMetaDataGUI. More...

+ Collaboration diagram for ilObjectMetaDataGUI:

Public Member Functions

 __construct (ilObject $a_object=null, $a_sub_type=null, $a_sub_id=null)
 Construct. More...
 
 executeCommand ()
 
 addMDObserver ($a_class, $a_method, $a_section)
 
 getTab ($a_base_class=null)
 
 getBlockHTML (array $a_cmds=null, $a_callback=null)
 

Protected Member Functions

 getLOMType ()
 
 isAdvMDAvailable ()
 
 isLOMAvailable ()
 
 hasAdvancedMDSettings ()
 
 hasActiveRecords ()
 
 canEdit ()
 
 setSubTabs ($a_active)
 
 initEditForm ()
 
 edit (ilPropertyFormGUI $a_form=null)
 
 update ()
 

Protected Attributes

 $object
 
 $obj_id
 
 $obj_type
 
 $sub_type
 
 $sub_id
 
 $md_observers
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjectMetaDataGUI::__construct ( ilObject  $a_object = null,
  $a_sub_type = null,
  $a_sub_id = null 
)

Construct.

Parameters
ilObject$a_object
string$a_sub_type
Returns
self

Definition at line 28 of file class.ilObjectMetaDataGUI.php.

29 {
30 global $lng;
31
32 if($a_object)
33 {
34 $this->object = $a_object;
35 $this->obj_id = $a_object->getId();
36 $this->obj_type = $a_object->getType();
37 }
38 $this->sub_type = $a_sub_type;
39 $this->sub_id = $a_sub_id;
40
41 if(!$this->sub_type)
42 {
43 $this->sub_type = "-";
44 }
45
46 $lng->loadLanguageModule("meta");
47 }
getType()
get object type @access public
getId()
get object id @access public
global $lng
Definition: privfeed.php:40

References $lng.

Member Function Documentation

◆ addMDObserver()

ilObjectMetaDataGUI::addMDObserver (   $a_class,
  $a_method,
  $a_section 
)

Definition at line 93 of file class.ilObjectMetaDataGUI.php.

94 {
95 $this->md_observers[] = array(
96 "class" => $a_class,
97 "method" => $a_method,
98 "section" => $a_section
99 );
100 }

◆ canEdit()

ilObjectMetaDataGUI::canEdit ( )
protected

Definition at line 174 of file class.ilObjectMetaDataGUI.php.

175 {
176 if($this->hasActiveRecords() &&
177 $this->obj_id)
178 {
179 if($this->sub_type == "-" ||
180 $this->sub_id)
181 {
182 return true;
183 }
184 }
185 return false;
186 }

References hasActiveRecords().

Referenced by getTab(), and setSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilObjectMetaDataGUI::edit ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 289 of file class.ilObjectMetaDataGUI.php.

290 {
291 global $tpl;
292
293 if(!$a_form)
294 {
295 $a_form = $this->initEditForm();
296 }
297
298 $tpl->setContent($a_form->getHTML());
299 }
global $tpl
Definition: ilias.php:8

References $tpl, and initEditForm().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectMetaDataGUI::executeCommand ( )

Definition at line 49 of file class.ilObjectMetaDataGUI.php.

50 {
51 global $ilCtrl;
52
53 $next_class = $ilCtrl->getNextClass($this);
54 $cmd = $ilCtrl->getCmd("edit");
55
56 switch($next_class)
57 {
58 case 'ilmdeditorgui':
59 $this->setSubTabs("lom");
60 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
61 $md_gui = new ilMDEditorGUI((int)$this->obj_id, (int)$this->sub_id, $this->getLOMType());
62 // custom observers?
63 if(is_array($this->md_observers))
64 {
65 foreach($this->md_observers as $observer)
66 {
67 $md_gui->addObserver($observer["class"], $observer["method"], $observer["section"]);
68 }
69 }
70 // "default" repository object observer
71 else if(!$this->sub_id &&
72 $this->object)
73 {
74 $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
75 }
76 $ilCtrl->forwardCommand($md_gui);
77 break;
78
79 case 'iladvancedmdsettingsgui':
80 $this->setSubTabs("advmddef");
81 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDSettingsGUI.php';
82 $advmdgui = new ilAdvancedMDSettingsGUI($this->obj_id, $this->obj_type, $this->sub_type);
83 $ilCtrl->forwardCommand($advmdgui);
84 break;
85
86 default:
87 $this->setSubTabs("advmd");
88 $this->$cmd();
89 break;
90 }
91 }
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35

References $cmd, $ilCtrl, getLOMType(), and setSubTabs().

+ Here is the call graph for this function:

◆ getBlockHTML()

ilObjectMetaDataGUI::getBlockHTML ( array  $a_cmds = null,
  $a_callback = null 
)

Definition at line 332 of file class.ilObjectMetaDataGUI.php.

333 {
334 global $lng;
335
336 $html = "";
337
338 include_once "Services/Object/classes/class.ilObjectMetaDataBlockGUI.php";
339 include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php";
340 include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
341 foreach(ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type) as $record)
342 {
343 $block = new ilObjectMetaDataBlockGUI($record, $a_callback);
344 $block->setValues(new ilAdvancedMDValues($record->getRecordId(), $this->obj_id, $this->sub_type, $this->sub_id));
345 if($a_cmds)
346 {
347 foreach($a_cmds as $caption => $url)
348 {
349 $block->addBlockCommand($url, $lng->txt($caption), "_top");
350 }
351 }
352 $html.= $block->getHTML();
353 }
354
355 return $html;
356 }
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
$html
Definition: example_001.php:87
$url
Definition: shib_logout.php:72

References $html, $lng, $url, and ilAdvancedMDRecord\_getSelectedRecordsByObject().

+ Here is the call graph for this function:

◆ getLOMType()

ilObjectMetaDataGUI::getLOMType ( )
protected

Definition at line 102 of file class.ilObjectMetaDataGUI.php.

103 {
104 if($this->sub_type != "-" &&
105 $this->sub_id)
106 {
107 return $this->sub_type;
108 }
109 else
110 {
111 return $this->obj_type;
112 }
113 }

References $obj_type, and $sub_type.

Referenced by executeCommand(), and isLOMAvailable().

+ Here is the caller graph for this function:

◆ getTab()

ilObjectMetaDataGUI::getTab (   $a_base_class = null)

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

189 {
190 global $ilCtrl;
191
192 if(!$a_base_class)
193 {
194 $path = array();
195 }
196 else
197 {
198 $path = array($a_base_class);
199 }
200 $path[] = "ilobjectmetadatagui";
201
202 $link = null;
203 if($this->isLOMAvailable())
204 {
205 $path[] = "ilmdeditorgui";
206 $link = $ilCtrl->getLinkTargetByClass($path, "listSection");
207 }
208 else if($this->isAdvMDAvailable())
209 {
210 if($this->canEdit())
211 {
212 $link = $ilCtrl->getLinkTarget($this, "edit");
213 }
214 else if($this->hasAdvancedMDSettings())
215 {
216 $path[] = "iladvancedmdsettingsgui";
217 $link = $ilCtrl->getLinkTargetByClass($path, "showRecords");
218 }
219 }
220 return $link;
221 }
$path
Definition: index.php:22

References $ilCtrl, $path, canEdit(), hasAdvancedMDSettings(), isAdvMDAvailable(), and isLOMAvailable().

+ Here is the call graph for this function:

◆ hasActiveRecords()

ilObjectMetaDataGUI::hasActiveRecords ( )
protected

Definition at line 168 of file class.ilObjectMetaDataGUI.php.

169 {
170 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
171 return (bool)sizeof(ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type));
172 }

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

Referenced by canEdit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAdvancedMDSettings()

ilObjectMetaDataGUI::hasAdvancedMDSettings ( )
protected

Definition at line 152 of file class.ilObjectMetaDataGUI.php.

153 {
154 if($this->sub_id)
155 {
156 return false;
157 }
158
159 include_once 'Services/Container/classes/class.ilContainer.php';
160 include_once 'Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
161
163 $this->obj_id,
165 false);
166 }
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.

References ilContainer\_lookupContainerSetting(), and ilObjectServiceSettingsGUI\CUSTOM_METADATA.

Referenced by getTab(), and setSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEditForm()

ilObjectMetaDataGUI::initEditForm ( )
protected

Definition at line 264 of file class.ilObjectMetaDataGUI.php.

265 {
266 global $ilCtrl, $lng;
267
268 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
269 $form = new ilPropertyFormGUI();
270 $form->setFormAction($ilCtrl->getFormAction($this, "update"));
271 $form->setTitle($lng->txt("meta_tab_advmd"));
272
273 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
274 $this->record_gui = new ilAdvancedMDRecordGUI(
276 $this->obj_type,
277 $this->obj_id,
278 $this->sub_type,
279 $this->sub_id
280 );
281 $this->record_gui->setPropertyForm($form);
282 $this->record_gui->parse();
283
284 $form->addCommandButton("update", $lng->txt("save"));
285
286 return $form;
287 }
This class represents a property form user interface.

References $ilCtrl, $lng, and ilAdvancedMDRecordGUI\MODE_EDITOR.

Referenced by edit(), and update().

+ Here is the caller graph for this function:

◆ isAdvMDAvailable()

ilObjectMetaDataGUI::isAdvMDAvailable ( )
protected

Definition at line 115 of file class.ilObjectMetaDataGUI.php.

116 {
117 include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
118 foreach(ilAdvancedMDRecord::_getAssignableObjectTypes(false) as $item)
119 {
120 if($item["obj_type"] == $this->obj_type)
121 {
122 return ((!$item["sub_type"] && $this->sub_type == "-") ||
123 ($item["sub_type"] == $this->sub_type));
124 }
125 }
126 return false;
127 }
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.

References ilAdvancedMDRecord\_getAssignableObjectTypes().

Referenced by getTab(), and setSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLOMAvailable()

ilObjectMetaDataGUI::isLOMAvailable ( )
protected

Definition at line 129 of file class.ilObjectMetaDataGUI.php.

130 {
131 $type = $this->getLOMType();
132 if($type == $this->sub_type)
133 {
134 $type = $this->obj_type.":".$type;
135 }
136
137 return (($this->obj_id || !$this->obj_type) &&
138 in_array($type, array(
139 "crs",
140 "file",
141 "glo", "glo:gdf",
142 "svy", "spl",
143 "tst", "qpl",
144 ":mob",
145 "webr",
146 "htlm",
147 "lm", "lm:st", "lm:pg",
148 "sahs", "sahs:sco", "sahs:page"
149 )));
150 }

References getLOMType().

Referenced by getTab(), and setSubTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilObjectMetaDataGUI::setSubTabs (   $a_active)
protected

Definition at line 223 of file class.ilObjectMetaDataGUI.php.

224 {
225 global $ilTabs, $lng, $ilCtrl;
226
227 if($this->isLOMAvailable())
228 {
229 $ilTabs->addSubTab("lom",
230 $lng->txt("meta_tab_lom"),
231 $ilCtrl->getLinkTargetByClass("ilmdeditorgui", "listSection")
232 );
233 }
234
235 if($this->isAdvMDAvailable())
236 {
237 if($this->canEdit())
238 {
239 $ilTabs->addSubTab("advmd",
240 $lng->txt("meta_tab_advmd"),
241 $ilCtrl->getLinkTarget($this, "edit"));
242 }
243
244 if($this->hasAdvancedMDSettings())
245 {
246 $ilTabs->addSubTab("advmddef",
247 $lng->txt("meta_tab_advmd_def"),
248 $ilCtrl->getLinkTargetByClass("iladvancedmdsettingsgui", "showRecords"));
249
250 $ilTabs->addSubTab("md_adv_file_list",
251 $lng->txt("md_adv_file_list"),
252 $ilCtrl->getLinkTargetByClass("iladvancedmdsettingsgui", "showFiles"));
253 }
254 }
255
256 $ilTabs->activateSubTab($a_active);
257 }

References $ilCtrl, $lng, canEdit(), hasAdvancedMDSettings(), isAdvMDAvailable(), and isLOMAvailable().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilObjectMetaDataGUI::update ( )
protected

Definition at line 301 of file class.ilObjectMetaDataGUI.php.

302 {
303 global $lng, $ilCtrl;
304
305 $form = $this->initEditForm();
306 if($form->checkInput() &&
307 $this->record_gui->importEditFormPostValues())
308 {
309 $this->record_gui->writeEditForm();
310
311 // Update ECS content
312 if($this->obj_type == "crs")
313 {
314 include_once "Modules/Course/classes/class.ilECSCourseSettings.php";
315 $ecs = new ilECSCourseSettings($this->object);
316 $ecs->handleContentUpdate();
317 }
318
319 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
320 $ilCtrl->redirect($this, "edit");
321 }
322
323 $form->setValuesByPost();
324 $this->edit($form);
325 }
Class ilECSCourseSettings.
edit(ilPropertyFormGUI $a_form=null)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $ilCtrl, $lng, edit(), initEditForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $md_observers

ilObjectMetaDataGUI::$md_observers
protected

Definition at line 19 of file class.ilObjectMetaDataGUI.php.

◆ $obj_id

ilObjectMetaDataGUI::$obj_id
protected

Definition at line 15 of file class.ilObjectMetaDataGUI.php.

◆ $obj_type

ilObjectMetaDataGUI::$obj_type
protected

Definition at line 16 of file class.ilObjectMetaDataGUI.php.

Referenced by getLOMType().

◆ $object

ilObjectMetaDataGUI::$object
protected

Definition at line 14 of file class.ilObjectMetaDataGUI.php.

◆ $sub_id

ilObjectMetaDataGUI::$sub_id
protected

Definition at line 18 of file class.ilObjectMetaDataGUI.php.

◆ $sub_type

ilObjectMetaDataGUI::$sub_type
protected

Definition at line 17 of file class.ilObjectMetaDataGUI.php.

Referenced by getLOMType().


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