24include_once(
'./Services/Object/classes/class.ilObjectGUI.php');
55 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
58 parent::__construct($a_data, $a_id,$a_call_by_reference,$a_prepare_output);
60 $lng->loadLanguageModule(
'objref');
76 if(isset(
$_GET[
'creation_mode']) &&
$_GET[
'creation_mode'] == self::MODE_CREATE)
81 $next_class =
$ilCtrl->getNextClass($this);
88 case "ilpropertyformgui":
89 $form = $this->
initForm($this->creation_mode ? self::MODE_CREATE : self::MODE_EDIT);
90 $this->ctrl->forwardCommand(
$form);
93 case 'ilpermissiongui':
94 $ilTabs->setTabActive(
'perm_settings');
95 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
119 if($this->
object instanceof
ilObject)
121 $ilLocator->addItem($this->object->getPresentationTitle(),$this->ctrl->getLinkTarget($this));
133 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->object->getTargetRefId());
134 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
146 $new_type = $_REQUEST[
"new_type"];
147 if(!$ilAccess->checkAccess(
"create_".$this->getReferenceType(),
'',
$_GET[
"ref_id"], $new_type))
149 $ilErr->raiseError($this->lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
152 $this->tpl->setContent(
$form->getHTML());
167 if(!(
int) $_REQUEST[
'target_id'])
173 if(!$ilAccess->checkAccess(
'visible',
'',(
int) $_REQUEST[
'target_id']))
180 parent::saveObject();
185 return $this->
initForm(self::MODE_CREATE);
194 $a_new_object->setTargetId($target_obj_id);
196 $a_new_object->setTitleType($this->form->getInput(
'title_type'));
199 $a_new_object->
setTitle($this->form->getInput(
'title'));
205 $this->ctrl->setParameter($this,
'ref_id',$a_new_object->
getRefId());
206 $this->ctrl->setParameter($this,
'creation_mode',0);
207 $this->ctrl->redirect($this,
'firstEdit');
232 $ilTabs->setTabActive(
'settings');
246 protected function initForm($a_mode = self::MODE_EDIT)
248 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
249 include_once
'./Services/ContainerReference/classes/class.ilContainerReference.php';
252 if ($a_mode == self::MODE_CREATE) {
253 $form->setTitle($this->lng->txt($this->getReferenceType().
'_new' ));
255 $this->ctrl->setParameter($this,
'creation_mode', $a_mode);
256 $this->ctrl->setParameter($this,
'new_type', $_REQUEST[
'new_type']);
260 $form->setTitle($this->lng->txt(
'edit'));
263 $form->setFormAction($this->ctrl->getFormAction($this));
264 if ($a_mode == self::MODE_CREATE)
266 $form->addCommandButton(
'save', $this->lng->txt(
'create'));
267 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
271 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
276 if ($a_mode == self::MODE_EDIT)
278 $ttype->setValue($this->object->getTitleType());
285 $reuse =
new ilRadioOption($this->lng->txt(
'objref_reuse_title'));
287 $ttype->addOption($reuse);
289 $custom =
new ilRadioOption($this->lng->txt(
'objref_custom_title'));
296 $title->setRequired(
true);
298 if($a_mode == self::MODE_EDIT)
300 $title->setValue($this->object->getTitle());
303 $custom->addSubItem(
$title);
304 $ttype->addOption($custom);
305 $form->addItem($ttype);
307 include_once(
"./Services/Form/classes/class.ilRepositorySelector2InputGUI.php");
310 $repo->setRequired(
true);
311 $repo->getExplorerGUI()->setSelectableTypes(array($this->
getTargetType()));
312 $repo->getExplorerGUI()->setTypeWhiteList(array_merge(
314 array(
"root",
"cat",
"grp",
"fold",
"crs"))
316 $repo->setInfo($this->lng->txt($this->getReferenceType().
'_edit_info'));
318 if($a_mode == self::MODE_EDIT)
320 $repo->getExplorerGUI()->setPathOpen($this->object->getTargetRefId());
321 $repo->setValue($this->object->getTargetRefId());
324 $form->addItem($repo);
336 if(
$form->checkInput())
338 $this->
object->setTitleType(
$form->getInput(
'title_type'));
341 $this->
object->setTitle(
$form->getInput(
'title'));
344 if(!$ilAccess->checkAccess(
'visible',
'',(
int)
$form->getInput(
'target_id')) ||
354 $this->
object->setTargetId($target_obj_id);
357 $this->
object->update();
359 $this->ctrl->redirect($this,
'edit');
361 $form->setValuesByPost();
An exception for terminatinating execution or to throw for unit testing.
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.