24include_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"];
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') {
157 if ($this->
object instanceof
ilObject) {
158 $ilLocator->addItem($this->object->getPresentationTitle(), $this->ctrl->getLinkTarget($this));
170 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->object->getTargetRefId());
171 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
186 $new_type = $_REQUEST[
"new_type"];
187 if (!$ilAccess->checkAccess(
"create_" . $this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type)) {
188 $ilErr->raiseError($this->lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
191 $this->tpl->setContent(
$form->getHTML());
206 if (!(
int) $_REQUEST[
'target_id']) {
211 if (!$ilAccess->checkAccess(
'visible',
'', (
int) $_REQUEST[
'target_id'])) {
217 parent::saveObject();
222 return $this->
initForm(self::MODE_CREATE);
231 $a_new_object->setTargetId($target_obj_id);
233 $a_new_object->setTitleType($this->form->getInput(
'title_type'));
235 $a_new_object->
setTitle($this->form->getInput(
'title'));
241 $this->ctrl->setParameter($this,
'ref_id', $a_new_object->
getRefId());
242 $this->ctrl->setParameter($this,
'creation_mode', 0);
243 $this->ctrl->redirect($this,
'firstEdit');
268 $ilTabs->setTabActive(
'settings');
281 protected function initForm($a_mode = self::MODE_EDIT)
283 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
284 include_once
'./Services/ContainerReference/classes/class.ilContainerReference.php';
287 if ($a_mode == self::MODE_CREATE) {
288 $form->setTitle($this->lng->txt($this->getReferenceType() .
'_new'));
290 $this->ctrl->setParameter($this,
'creation_mode', $a_mode);
291 $this->ctrl->setParameter($this,
'new_type', $_REQUEST[
'new_type']);
293 $form->setTitle($this->lng->txt(
'edit'));
296 $form->setFormAction($this->ctrl->getFormAction($this));
297 if ($a_mode == self::MODE_CREATE) {
298 $form->addCommandButton(
'save', $this->lng->txt(
'create'));
299 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
301 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
306 if ($a_mode == self::MODE_EDIT) {
307 $ttype->setValue($this->object->getTitleType());
312 $reuse =
new ilRadioOption($this->lng->txt(
'objref_reuse_title'));
314 $ttype->addOption($reuse);
316 $custom =
new ilRadioOption($this->lng->txt(
'objref_custom_title'));
323 $title->setRequired(
true);
325 if ($a_mode == self::MODE_EDIT) {
326 $title->setValue($this->object->getTitle());
329 $custom->addSubItem(
$title);
330 $ttype->addOption($custom);
331 $form->addItem($ttype);
333 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
336 $repo->setRequired(
true);
337 $repo->getExplorerGUI()->setSelectableTypes(array($this->
getTargetType()));
338 $repo->getExplorerGUI()->setTypeWhiteList(
341 array(
"root",
"cat",
"grp",
"fold",
"crs")
344 $repo->setInfo($this->lng->txt($this->getReferenceType() .
'_edit_info'));
346 if ($a_mode == self::MODE_EDIT) {
347 $repo->getExplorerGUI()->setPathOpen($this->object->getTargetRefId());
348 $repo->setValue($this->object->getTargetRefId());
351 $form->addItem($repo);
363 if (
$form->checkInput()) {
364 $this->
object->setTitleType(
$form->getInput(
'title_type'));
366 $this->
object->setTitle(
$form->getInput(
'title'));
369 if (!$ilAccess->checkAccess(
'visible',
'', (
int)
$form->getInput(
'target_id')) ||
378 $this->
object->setTargetId($target_obj_id);
381 $this->
object->update();
383 $this->ctrl->redirect($this,
'edit');
385 $form->setValuesByPost();
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
firstEditObject()
show edit screen without info message
executeCommand()
Execute command.
initForm($a_mode=self::MODE_EDIT)
Init title form.
redirectObject()
redirect to target
getReferenceType()
get reference type
addLocatorItems()
Add locator item @global ilLocatorGUI $ilLocator.
updateObject()
update title
editObject(ilPropertyFormGUI $form=null)
edit title
const MAX_SELECTION_ENTRIES
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor.
afterSave(ilObject $a_new_object)
createObject()
Create object.
initCreateForm($a_new_type)
Init object creation form.
getTargetType()
get target type
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
setCreationMode($a_mode=true)
if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class!...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
update()
update object in db
setTitle($a_title)
set object title
getRefId()
get reference id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents an option in a radio group.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.