19 declare(strict_types=1);
41 public function __construct($a_data,
int $a_id,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
46 $this->
lng = $DIC->language();
47 $this->
ctrl = $DIC->ctrl();
48 $this->
tabs = $DIC->tabs();
49 $this->
locator = $DIC[
"ilLocator"];
50 $this->
user = $DIC->user();
51 $this->
access = $DIC->access();
52 $this->error = $DIC[
"ilErr"];
54 $lng = $DIC->language();
58 $this->cont_request = $DIC
59 ->containerReference()
70 if ($this->cont_request->getCreationMode() === self::MODE_CREATE) {
74 $next_class = $ilCtrl->getNextClass($this);
75 $cmd = $ilCtrl->getCmd();
79 switch ($next_class) {
80 case "ilpropertyformgui":
81 $form = $this->
initForm($this->creation_mode ? self::MODE_CREATE : self::MODE_EDIT);
82 $this->
ctrl->forwardCommand($form);
85 case 'ilpermissiongui':
86 $ilTabs->setTabActive(
'perm_settings');
91 if ($cmd ===
null || $cmd ===
'' || $cmd ===
'view') {
104 if ($this->
object instanceof
ilObject) {
105 $ilLocator->addItem($this->
object->getPresentationTitle(), $this->
ctrl->getLinkTarget($this));
114 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
122 $new_type = $this->cont_request->getNewType();
123 if (!$ilAccess->checkAccess(
124 "create_" . $this->getReferenceType(),
126 $this->cont_request->getRefId(),
129 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
131 $this->
ctrl->saveParameter($this,
"crtptrefid");
132 $this->
ctrl->saveParameter($this,
"crtcb");
133 $form = $this->
initForm(self::MODE_CREATE);
134 $this->tpl->setContent($form->
getHTML());
141 if ($this->cont_request->getTargetId() === 0) {
142 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'));
146 if (!$ilAccess->checkAccess(
149 $this->cont_request->getTargetId()
151 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'));
157 $this->error->raiseError($this->
lng->txt(
"no_create_permission"), $this->error->MESSAGE);
160 $this->
lng->loadLanguageModule($this->requested_new_type);
161 $this->
ctrl->setParameter($this,
"new_type", $this->requested_new_type);
165 $this->
ctrl->setParameter($this,
"new_type",
"");
167 $class_name =
"ilObj" . $this->obj_definition->getClassName($this->requested_new_type);
168 $newObj =
new $class_name();
169 $newObj->setType($this->requested_new_type);
170 $newObj->setTitle($form->
getInput(
"title"));
171 $newObj->setDescription($form->
getInput(
"desc"));
172 $newObj->processAutoRating();
177 if ($this->
form->getInput(
'didactic_template')) {
180 $this->
form->checkInput();
181 $newObj->applyDidacticTemplate($dtpl);
188 $this->tpl->setContent($form->
getHTML());
193 return $this->
initForm(self::MODE_CREATE);
199 $new_object->setTargetId($target_obj_id);
200 $new_object->setTitleType((
int) $this->
form->getInput(
'title_type'));
210 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"object_added"),
true);
211 $this->
ctrl->setParameter($this,
'ref_id', $new_object->
getRefId());
212 $this->
ctrl->setParameter($this,
'creation_mode', 0);
213 $this->
ctrl->redirect($this,
'firstEdit');
230 $main_tpl = $DIC->ui()->mainTemplate();
239 $main_tpl->setContent($form->
getHTML());
246 if ($a_mode === self::MODE_CREATE) {
247 $form->
setTitle($this->
lng->txt($this->getReferenceType() .
'_new'));
249 $this->
ctrl->setParameter($this,
'creation_mode', $a_mode);
250 $this->
ctrl->setParameter(
253 $this->cont_request->getNewType()
256 $form->
setTitle($this->
lng->txt($this->reference_type .
'_settings'));
260 if ($a_mode === self::MODE_CREATE) {
270 if ($a_mode === self::MODE_EDIT) {
278 $ttype->addOption($reuse);
287 $title->setRequired(
true);
289 if ($a_mode === self::MODE_EDIT) {
290 $title->setValue($this->
object->getTitle());
293 $custom->addSubItem($title);
294 $ttype->addOption($custom);
298 $repo->setRequired(
true);
299 $repo->getExplorerGUI()->setSelectableTypes([$this->
getTargetType()]);
300 $repo->getExplorerGUI()->setTypeWhiteList(
303 [
"root",
"cat",
"grp",
"fold",
"crs"]
306 $repo->getExplorerGUI()->setClickablePermission(
'visible');
307 $repo->setInfo($this->
lng->txt($this->getReferenceType() .
'_edit_info'));
309 if ($a_mode === self::MODE_EDIT) {
310 $repo->getExplorerGUI()->setPathOpen($this->
object->getTargetRefId());
311 $repo->setValue($this->
object->getTargetRefId());
337 $this->
lng->txt(
'objref_failure_target_type') .
339 $this->
lng->txt(
'obj_' . $this->target_type)
343 $this->
object->setTargetId(
348 $this->
object->setTitleType((
int) $form->
getInput(
'title_type'));
350 $this->
object->setTitle($form->
getInput(
'title'));
367 $this->
object->update();
368 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
369 $this->
ctrl->redirect($this,
'edit');
372 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
390 $ilHelp = $DIC[
'ilHelp'];
393 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
394 $this->tabs_gui->addTarget(
396 $this->
ctrl->getLinkTarget($this,
"edit"),
401 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
402 $this->tabs_gui->addTarget(
404 $this->
ctrl->getLinkTargetByClass([get_class($this),
'ilpermissiongui'],
"perm"),
405 [
"perm",
"info",
"owner"],
This class represents an option in a radio group.
const MAX_SELECTION_ENTRIES
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadPropertiesFromSettingsForm(ilPropertyFormGUI $form)
StandardGUIRequest $cont_request
prepareOutput(bool $show_sub_objects=true)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
initForm(int $a_mode=self::MODE_EDIT)
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
loadLanguageModule(string $a_module)
Load language module.
editObject(?ilPropertyFormGUI $form=null)
setTabActive(string $a_id)
static _lookupObjId(int $ref_id)
setCreationMode(bool $mode=true)
If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
Class ilObjectGUI Basic methods of all Output classes.
setValue(string $a_value)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
form( $class_path, string $cmd, string $submit_caption="")
__construct(Container $dic, ilPlugin $plugin)
initCreateForm(string $new_type)
static _lookupType(int $id, bool $reference=false)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
afterSave(ilObject $new_object)