4 include_once(
"./classes/class.ilObjectGUI.php");
41 $this->creation_forms = array(
49 $this->tabs_gui =& $ilTabs;
66 $params = array(
"ref_id");
68 if (!$a_call_by_reference)
70 $params = array(
"ref_id",
"obj_id");
73 $this->ctrl->saveParameter($this, $params);
77 $this->call_by_reference = $a_call_by_reference;
78 $this->creation_mode =
false;
79 $this->ref_id = ($this->call_by_reference) ? $this->
id :
$_GET[
"ref_id"];
80 $this->obj_id = ($this->call_by_reference) ?
$_GET[
"obj_id"] : $this->
id;
86 if (is_object($this->
object))
88 if ($this->call_by_reference && $this->ref_id =
$_GET[
"ref_id"])
90 $this->ctrl->setContext($this->object->getId(),
91 $this->
object->getType());
111 $next_class = $this->ctrl->getNextClass($this);
112 $cmd = $this->ctrl->getCmd();
197 final protected function getReturnLocation() { die(
"ilObject2GUI::getReturnLocation() is deprecated."); }
198 final protected function setReturnLocation() { die(
"ilObject2GUI::setReturnLocation() is deprecated."); }
199 final protected function showActions() { die(
"ilObject2GUI::showActions() is deprecated."); }
200 final public function getTemplateFile() {mk(); die(
"ilObject2GUI::getTemplateFile() is deprecated."); }
201 final protected function getTitlesByRefId() { die(
"ilObject2GUI::getTitlesByRefId() is deprecated."); }
202 final protected function getTabs() {nj(); die(
"ilObject2GUI::getTabs() is deprecated."); }
203 final protected function __showButton() { die(
"ilObject2GUI::__showButton() is deprecated."); }
204 final protected function hitsperpageObject() { die(
"ilObject2GUI::hitsperpageObject() is deprecated."); }
205 final protected function __initTableGUI() { die(
"ilObject2GUI::__initTableGUI() is deprecated."); }
207 final protected function __showClipboardTable() { die(
"ilObject2GUI::__showClipboardTable() is deprecated."); }
243 foreach ($this->creation_forms as $k => $v)
247 unset($this->creation_forms[$k]);
260 $this->creation_forms[] = array(
"header" => $a_header,
274 $ilCtrl->setParameter($this,
"new_type", $new_type);
277 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
279 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
313 $lng->loadLanguageModule($new_type);
314 if (count($this->creation_forms) == 1)
316 $cf = $this->creation_forms[0];
319 return $cf[
"form"]->getHTML();
324 return $this->form->getHTML();
334 return $this->form->getHTML();
337 else if (count($this->creation_forms) > 1)
339 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
345 foreach ($this->creation_forms as $cf)
355 $html.= $cf[
"form"]->getHTML().
"<br />";
362 $html.= $this->form->getHTML().
"<br />";
375 $html.= $this->form->getHTML().
"<br />";
398 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
400 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
402 $this->ctrl->setParameter($this,
"new_type", $new_type);
404 if ($this->form->checkInput())
407 $location = $objDefinition->getLocation($new_type);
410 $class_name =
"ilObj".$objDefinition->getClassName($new_type);
411 include_once(
$location.
"/class.".$class_name.
".php");
412 $newObj =
new $class_name();
413 $newObj->setType($new_type);
417 $newObj->createReference();
418 $newObj->putInTree(
$_GET[
"ref_id"]);
419 $newObj->setPermissions(
$_GET[
"ref_id"]);
421 $this->afterSave($newObj);
425 $this->form->setValuesByPost();
426 $tpl->setContent($this->form->getHtml());
438 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
440 $this->form->setTarget(
"_top");
446 $ti->setRequired(
true);
447 $this->form->addItem($ti);
453 $this->form->addItem($ta);
456 if ($a_mode ==
"create")
458 $this->form->addCommandButton(
"save", $lng->txt($a_new_type.
"_add"));
459 $this->form->addCommandButton(
"cancelCreation", $lng->txt(
"cancel"));
460 $this->form->setTitle($lng->txt($a_new_type.
"_new"));
464 $this->form->addCommandButton(
"update", $lng->txt(
"save"));
465 $this->form->addCommandButton(
"cancelUpdate", $lng->txt(
"cancel"));
466 $this->form->setTitle($lng->txt(
"edit"));
469 $this->form->setFormAction($ilCtrl->getFormAction($this));
478 $values[
"title"] = $this->
object->getTitle();
479 $values[
"desc"] = $this->
object->getDescription();
480 $this->form->setValuesByArray($values);
490 $this->ctrl->returnToParent($this);
514 $tpl->setContent($this->form->getHTML());
524 $this->ctrl->redirect($this);
537 if ($this->form->checkInput())
539 $this->
object->setTitle(
$_POST[
"title"]);
540 $this->
object->setDescription(
$_POST[
"desc"]);
541 $this->update = $this->
object->update();
546 $this->form->setValuesByPost();
547 $tpl->setContent($this->form->getHtml());
552 $this->ctrl->redirect($this);
564 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
566 $this->form->setTarget(
"_top");
569 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
572 $this->form->addItem($fi);
574 $this->form->addCommandButton(
"importFile", $lng->txt(
"import"));
575 $this->form->addCommandButton(
"cancelCreation", $lng->txt(
"cancel"));
576 $this->form->setTitle($lng->txt($a_new_type.
"_import"));
578 $this->form->setFormAction($ilCtrl->getFormAction($this));
593 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
595 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
597 $this->ctrl->setParameter($this,
"new_type", $new_type);
599 if ($this->form->checkInput())
602 include_once(
"./Services/Export/classes/class.ilImport.php");
604 $new_id = $imp->importObject($newObj, $_FILES[
"importfile"][
"tmp_name"],
605 $_FILES[
"importfile"][
"name"], $new_type);
611 $newObj->createReference();
612 $newObj->putInTree($_GET[
"ref_id"]);
613 $newObj->setPermissions($_GET[
"ref_id"]);
615 $this->afterSave($newObj);
620 $this->form->setValuesByPost();
621 $tpl->setContent($this->form->getHtml());