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);
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->returnToParent($this);
159 $ilTabs->setTabActive(
'edit');
200 if(!$ilAccess->checkAccess(
'visible',
'',(
int) $_REQUEST[
'target_id']))
209 $this->
object->setTargetId($target_obj_id);
210 $this->
object->update();
213 $this->ctrl->redirect($this,
'edit');
226 $this->tpl->setContent($this->form->getHTML());
238 if(is_object($this->form))
242 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
245 $this->form->setFormAction($this->ctrl->getFormAction($this));
246 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_new'));
250 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
251 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
252 $select->setInfo($this->lng->txt(
$_POST[
'new_type'].
'_edit_info'));
253 $this->form->addItem($select);
255 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
256 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
267 if(is_object($this->form))
271 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
273 $this->form->setFormAction($this->ctrl->getFormAction($this));
274 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_edit'));
278 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
279 $select->setValue($this->object->getTargetRefId());
280 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
281 $select->setInfo($this->lng->txt($this->object->getType().
'_edit_info'));
282 $this->form->addItem($select);
284 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
285 #$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
310 return $this->reference_type;
325 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
326 "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
327 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
328 "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
329 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
330 "WHERE ".$ilDB->in(
'child',$a_ref_ids,
false,
'integer').
' '.
331 "ORDER BY obj_data.title ";
334 $options[0] = $lng->txt(
'obj_'.$a_target_type.
'_select');
341 if(strlen(
$path =
$row->path_title) > 40)
345 $options[
$row->child] = (
$title.
' ('.$lng->txt(
'path').
': '.
$path.
')');
347 return $options ? $options : array();
366 if($a_mode == self::MODE_CREATE)
368 $target = (int)
$_GET[
'ref_id'];
372 $target = (int) $this->object->getTargetRefId();
375 $path = $tree->getPathId($target);
376 foreach((array)
$path as $node_id)
378 if(!in_array($node_id,
$_SESSION[
'ref_repexpand']))
397 include_once
'./Services/ContainerReference/classes/class.ilContainerSelectionExplorer.php';
400 if(
$_SESSION[
'ref_mode'] == self::MODE_CREATE)
402 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
408 $ilTabs->setTabActive(
'edit');
413 if(isset(
$_GET[
'ref_repexpand']))
419 $explorer->setExpand(ROOT_FOLDER_ID);
421 $explorer->setFrameTarget(
'_self');
422 $explorer->setExpandTarget($this->ctrl->getLinkTarget($this,
'showTargetSelectionTree'));
423 $explorer->setTargetGet(
'target_id');
425 $explorer->setOutput(0);
426 $this->tpl->setContent($explorer->getOutput());