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') {
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) {
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) {
329 $custom->addSubItem(
$title);
330 $ttype->addOption($custom);
331 $form->addItem($ttype);
333 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
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();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
addLocatorItems()
Add locator item ilLocatorGUI $ilLocator.
redirectObject()
redirect to target
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
firstEditObject()
show edit screen without info message
Create new PHPExcel object
obj_idprivate
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