24 include_once(
'./Services/Object/classes/class.ilObjectGUI.php');
85 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
89 $this->lng = $DIC->language();
90 $this->ctrl = $DIC->ctrl();
91 $this->tabs = $DIC->tabs();
92 $this->locator = $DIC[
"ilLocator"];
93 $this->
user = $DIC->user();
94 $this->access = $DIC->access();
95 $this->error = $DIC[
"ilErr"];
97 $lng = $DIC->language();
98 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
100 $lng->loadLanguageModule(
'objref');
117 if (isset(
$_GET[
'creation_mode']) &&
$_GET[
'creation_mode'] == self::MODE_CREATE) {
121 $next_class =
$ilCtrl->getNextClass($this);
126 switch ($next_class) {
127 case "ilpropertyformgui":
128 $form = $this->
initForm($this->creation_mode ? self::MODE_CREATE : self::MODE_EDIT);
129 $this->ctrl->forwardCommand(
$form);
132 case 'ilpermissiongui':
133 $ilTabs->setTabActive(
'perm_settings');
134 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
139 if (!$cmd || $cmd ==
'view') {
156 if ($this->
object instanceof
ilObject) {
157 $ilLocator->addItem($this->object->getPresentationTitle(), $this->ctrl->getLinkTarget($this));
169 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->object->getTargetRefId());
170 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
185 $new_type = $_REQUEST[
"new_type"];
186 if (!$ilAccess->checkAccess(
"create_" . $this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type)) {
187 $ilErr->raiseError($this->lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
190 $this->tpl->setContent(
$form->getHTML());
205 if (!(
int) $_REQUEST[
'target_id']) {
210 if (!$ilAccess->checkAccess(
'visible',
'', (
int) $_REQUEST[
'target_id'])) {
216 parent::saveObject();
221 return $this->
initForm(self::MODE_CREATE);
230 $a_new_object->setTargetId($target_obj_id);
232 $a_new_object->setTitleType($this->form->getInput(
'title_type'));
234 $a_new_object->
setTitle($this->form->getInput(
'title'));
239 ilUtil::sendSuccess($this->lng->txt(
"object_added"),
true);
240 $this->ctrl->setParameter($this,
'ref_id', $a_new_object->
getRefId());
241 $this->ctrl->setParameter($this,
'creation_mode', 0);
242 $this->ctrl->redirect($this,
'firstEdit');
267 $main_tpl = $DIC->ui()->mainTemplate();
271 $ilTabs->setTabActive(
'settings');
276 $main_tpl->setContent(
$form->getHTML());
284 protected function initForm($a_mode = self::MODE_EDIT)
286 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
287 include_once
'./Services/ContainerReference/classes/class.ilContainerReference.php';
290 if ($a_mode == self::MODE_CREATE) {
291 $form->setTitle($this->lng->txt($this->getReferenceType() .
'_new'));
293 $this->ctrl->setParameter($this,
'creation_mode', $a_mode);
294 $this->ctrl->setParameter($this,
'new_type', $_REQUEST[
'new_type']);
296 $form->setTitle($this->lng->txt(
'edit'));
299 $form->setFormAction($this->ctrl->getFormAction($this));
300 if ($a_mode == self::MODE_CREATE) {
301 $form->addCommandButton(
'save', $this->lng->txt(
'create'));
302 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
304 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
309 if ($a_mode == self::MODE_EDIT) {
310 $ttype->
setValue($this->object->getTitleType());
315 $reuse =
new ilRadioOption($this->lng->txt(
'objref_reuse_title'));
317 $ttype->addOption($reuse);
319 $custom =
new ilRadioOption($this->lng->txt(
'objref_custom_title'));
326 $title->setRequired(
true);
328 if ($a_mode == self::MODE_EDIT) {
329 $title->setValue($this->object->getTitle());
332 $custom->addSubItem(
$title);
333 $ttype->addOption($custom);
334 $form->addItem($ttype);
336 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
340 $repo->getExplorerGUI()->setSelectableTypes(array($this->
getTargetType()));
341 $repo->getExplorerGUI()->setTypeWhiteList(
344 array(
"root",
"cat",
"grp",
"fold",
"crs")
347 $repo->setInfo($this->lng->txt($this->getReferenceType() .
'_edit_info'));
349 if ($a_mode == self::MODE_EDIT) {
350 $repo->getExplorerGUI()->setPathOpen($this->object->getTargetRefId());
351 $repo->setValue($this->object->getTargetRefId());
354 $form->addItem($repo);
366 if (
$form->checkInput()) {
367 $this->
object->setTitleType(
$form->getInput(
'title_type'));
369 $this->
object->setTitle(
$form->getInput(
'title'));
372 if (!$ilAccess->checkAccess(
'visible',
'', (
int)
$form->getInput(
'target_id')) ||
381 $this->
object->setTargetId($target_obj_id);
384 $this->
object->update();
385 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
386 $this->ctrl->redirect($this,
'edit');
388 $form->setValuesByPost();
This class represents an option in a radio group.
executeCommand()
Execute command.
const MAX_SELECTION_ENTRIES
getTargetType()
get target type
initForm($a_mode=self::MODE_EDIT)
Init title form.
const TITLE_LENGTH
max length of object title
createObject()
Create object.
afterSave(ilObject $a_new_object)
initCreateForm($a_new_type)
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! ...
setTitle($a_title)
set object title
prepareOutput($a_show_subobjects=true)
prepare output
editObject(ilPropertyFormGUI $form=null)
edit title
setValue($a_value)
Set Value.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor.
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
This class represents a text property in a property form.
static _lookupType($a_id, $a_reference=false)
lookup object type
addLocatorItems()
Add locator item.
redirectObject()
redirect to target
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
firstEditObject()
show edit screen without info message
getRefId()
get reference id public
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
updateObject()
update title
update()
update object in db
getReferenceType()
get reference type