24 include_once(
'./classes/class.ilObjectGUI.php');
44 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
69 if(!$ilAccess->checkAccess(
"create_".$this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type))
71 $ilErr->raiseError($this->lng->txt(
"permission_denied"),$ilErr->MESSAGE);
74 $max_entries = $ilSetting->get(
'search_max_hits',100);
83 if(count($this->existing_objs) >= $max_entries)
85 return $this->showSearchSelection();
103 global $ilAccess,
$tree;
105 if(!(
int)
$_POST[
'target_id'])
111 if(!$ilAccess->checkAccess(
'read',
'',(
int) $_POST[
'target_id']))
121 $ref->setTargetId($target_obj_id);
125 $parent = $tree->getParentId(
$ref_id);
140 $ilTabs->setTabActive(
'edit');
142 $max_entries = $ilSetting->get(
'search_max_hits',10000);
143 $max_entries = 10000;
151 $this->tpl->setContent($this->form->getHTML());
166 if(!(
int)
$_POST[
'target_id'])
172 if(!$ilAccess->checkAccess(
'edit',
'',(
int) $_POST[
'target_id']))
180 $this->
object->setTargetId($target_obj_id);
181 $this->
object->update();
197 $this->tpl->setContent($this->form->getHTML());
209 if(is_object($this->form))
213 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
216 $this->form->setFormAction($this->ctrl->getFormAction($this));
217 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_new'));
221 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
222 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
223 $select->setInfo($this->lng->txt(
$_POST[
'new_type'].
'_edit_info'));
224 $this->form->addItem($select);
226 $this->form->addCommandButton(
'save',$this->lng->txt(
'save'));
227 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
238 if(is_object($this->form))
242 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
244 $this->form->setFormAction($this->ctrl->getFormAction($this));
245 $this->form->setTitle($this->lng->txt($this->getReferenceType().
'_edit'));
249 $select =
new ilSelectInputGUI($this->lng->txt(
'objs_'.$this->getTargetType()),
'target_id');
250 $select->setValue($this->object->getTargetRefId());
251 $select->setOptions(self::_prepareSelection($this->existing_objects,$this->
getTargetType()));
252 $select->setInfo($this->lng->txt($this->object->getType().
'_edit_info'));
253 $this->form->addItem($select);
255 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
256 #$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
280 return $this->reference_type;
295 $query =
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
296 "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
297 "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
298 "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
299 "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
300 "WHERE ".$ilDB->in(
'child',$a_ref_ids,
false,
'integer').
' '.
301 "ORDER BY obj_data.title ";
304 $options[0] = $lng->txt(
'obj_'.$a_target_type.
'_select');
311 if(strlen($path =
$row->path_title) > 40)
313 $path = substr($path,0,40).
'...';
315 $options[
$row->child] = (
$title.
' ('.$lng->txt(
'path').
': '.$path.
')');
317 return $options ? $options : array();