24 include_once(
'./classes/class.ilObjectGUI.php');
49 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
74 if(!$ilAccess->checkAccess(
"create_".$this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type))
76 $ilErr->raiseError($this->lng->txt(
"permission_denied"),$ilErr->MESSAGE);
113 global $ilAccess,
$tree;
121 if(!$ilAccess->checkAccess(
'read',
'',(
int) $_REQUEST[
'target_id']))
131 $ref->setTargetId($target_obj_id);
135 $parent = $tree->getParentId(
$ref_id);
150 $ilTabs->setTabActive(
'edit');
186 if(!$ilAccess->checkAccess(
'read',
'',(
int) $_REQUEST[
'target_id']))
195 $this->
object->setTargetId($target_obj_id);
196 $this->
object->update();
199 $this->ctrl->redirect($this,
'edit');
212 $this->tpl->setContent($this->form->getHTML());
224 if(is_object($this->form))
228 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
231 $this->form->setFormAction($this->ctrl->getFormAction($this));
232 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_new'));
236 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
237 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
238 $select->setInfo($this->lng->txt(
$_POST[
'new_type'].
'_edit_info'));
239 $this->form->addItem($select);
241 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
242 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
253 if(is_object($this->form))
257 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
259 $this->form->setFormAction($this->ctrl->getFormAction($this));
260 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_edit'));
264 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
265 $select->setValue($this->object->getTargetRefId());
266 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
267 $select->setInfo($this->lng->txt($this->object->getType().
'_edit_info'));
268 $this->form->addItem($select);
270 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
271 #$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
296 return $this->reference_type;
311 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
312 "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
313 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
314 "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
315 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
316 "WHERE ".$ilDB->in(
'child',$a_ref_ids,
false,
'integer').
' '.
317 "ORDER BY obj_data.title ";
320 $options[0] = $lng->txt(
'obj_'.$a_target_type.
'_select');
327 if(strlen(
$path =
$row->path_title) > 40)
331 $options[
$row->child] = (
$title.
' ('.$lng->txt(
'path').
': '.
$path.
')');
333 return $options ? $options : array();
352 if($a_mode == self::MODE_CREATE)
354 $target = (int)
$_GET[
'ref_id'];
358 $target = (int) $this->object->getTargetRefId();
361 $path = $tree->getPathId($target);
362 foreach((array)
$path as $node_id)
364 if(!in_array($node_id,
$_SESSION[
'ref_repexpand']))
383 include_once
'./Services/ContainerReference/classes/class.ilContainerSelectionExplorer.php';
386 if(
$_SESSION[
'ref_mode'] == self::MODE_CREATE)
388 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
394 $ilTabs->setTabActive(
'edit');
399 if(isset(
$_GET[
'ref_repexpand']))
405 $explorer->setExpand(ROOT_FOLDER_ID);
407 $explorer->setFrameTarget(
'_self');
408 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this,
'showTargetSelectionTree'));
409 $explorer->setTargetGet(
'target_id');
411 $explorer->setOutput(0);
412 $this->tpl->setContent($explorer->getOutput());