24 include_once(
'./Services/Object/classes/class.ilObjectGUI.php');
49 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
54 $lng->loadLanguageModule(
'objref');
65 if($this->
object instanceof
ilObject)
67 $ilLocator->addItem($this->object->getPresentationTitle(),$this->ctrl->getLinkTarget($this));
80 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->object->getTargetRefId());
81 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
94 if(!$ilAccess->checkAccess(
"create_".$this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type))
96 $ilErr->raiseError($this->lng->txt(
"permission_denied"),$ilErr->MESSAGE);
121 if(!$ilAccess->checkAccess(
'visible',
'',(
int) $_REQUEST[
'target_id']))
133 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
141 $a_new_object->setTargetId($target_obj_id);
145 $this->ctrl->setParameter($this,
'ref_id',$a_new_object->
getRefId());
146 $this->ctrl->redirect($this,
'firstEdit');
169 $ilTabs->setTabActive(
'edit');
170 $ilTabs->addSubTab(
'edit',$this->lng->txt(
'objref_edit_ref'),$this->ctrl->getLinkTarget($this,
'edit'));
171 $ilTabs->addSubTab(
'editTitle',$this->lng->txt(
'objref_edit_title'),$this->ctrl->getLinkTarget($this,
'editTitle'));
172 $ilTabs->setTabActive(
'edit');
173 $ilTabs->activateSubTab(
'edit');
176 if($a_show_info_message)
194 $ilTabs->addSubTab(
'edit',$this->lng->txt(
'objref_edit_ref'),$this->ctrl->getLinkTarget($this,
'edit'));
195 $ilTabs->addSubTab(
'editTitle',$this->lng->txt(
'objref_edit_title'),$this->ctrl->getLinkTarget($this,
'editTitle'));
196 $ilTabs->setTabActive(
'edit');
197 $ilTabs->activateSubTab(
'editTitle');
203 $GLOBALS[
'tpl']->setContent($form->getHTML());
212 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
214 $form->setTitle($this->lng->txt(
'objref_title_settings'));
215 $form->setFormAction($this->ctrl->getFormAction($this));
216 $form->addCommandButton(
'updateTitle', $this->lng->txt(
'save'));
220 $ttype->
setValue($this->object->getTitleType());
221 $reuse =
new ilRadioOption($this->lng->txt(
'objref_reuse_title'));
223 $ttype->addOption($reuse);
225 $custom =
new ilRadioOption($this->lng->txt(
'objref_custom_title'));
230 $title->setMaxLength(128);
232 $title->setRequired(
true);
233 $title->setValue($this->object->getTitle());
234 $custom->addSubItem(
$title);
236 $ttype->addOption($custom);
238 $form->addItem($ttype);
249 if($form->checkInput())
251 $this->
object->setTitleType($form->getInput(
'title_type'));
254 $this->
object->setTitle($form->getInput(
'title'));
256 $this->
object->update();
258 $this->ctrl->redirect($this,
'editTitle');
260 $form->setValuesByPost();
282 if(!$ilAccess->checkAccess(
'visible',
'',(
int) $_REQUEST[
'target_id']))
291 $this->
object->setTargetId($target_obj_id);
292 $this->
object->update();
295 $this->ctrl->redirect($this,
'edit');
308 $this->tpl->setContent($this->form->getHTML());
320 if(is_object($this->form))
324 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
327 $this->form->setFormAction($this->ctrl->getFormAction($this));
328 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_new'));
332 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
333 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
334 $select->setInfo($this->lng->txt(
$_POST[
'new_type'].
'_edit_info'));
335 $this->form->addItem($select);
337 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
338 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
349 if(is_object($this->form))
353 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
355 $this->form->setFormAction($this->ctrl->getFormAction($this));
356 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_edit'));
360 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
361 $select->setValue($this->object->getTargetRefId());
362 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
363 $select->setInfo($this->lng->txt($this->object->getType().
'_edit_info'));
364 $this->form->addItem($select);
366 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
367 #$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
392 return $this->reference_type;
407 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
408 "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
409 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
410 "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
411 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
412 "WHERE ".$ilDB->in(
'child',$a_ref_ids,
false,
'integer').
' '.
413 "ORDER BY obj_data.title ";
416 $options[0] = $lng->txt(
'obj_'.$a_target_type.
'_select');
423 if(strlen(
$path =
$row->path_title) > 40)
427 $options[
$row->child] = (
$title.
' ('.$lng->txt(
'path').
': '.
$path.
')');
429 return $options ? $options : array();
448 if($a_mode == self::MODE_CREATE)
450 $target = (int)
$_GET[
'ref_id'];
454 $target = (int) $this->object->getTargetRefId();
457 $path = $tree->getPathId($target);
458 foreach((array)
$path as $node_id)
460 if(!in_array($node_id,
$_SESSION[
'ref_repexpand']))
479 include_once
'./Services/ContainerReference/classes/class.ilContainerSelectionExplorer.php';
481 if(
$_SESSION[
'ref_mode'] == self::MODE_CREATE)
483 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
489 $ilTabs->setTabActive(
'edit');
494 if(isset(
$_GET[
'ref_repexpand']))
500 $explorer->setExpand(ROOT_FOLDER_ID);
502 $explorer->setFrameTarget(
'_self');
503 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this,
'showTargetSelectionTree'));
504 $explorer->setTargetGet(
'target_id');
506 $explorer->setOutput(0);
507 $this->tpl->setContent($explorer->getOutput());