ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilObjContentPageAdministrationGUI Class Reference

ilObjContentPageAdministrationGUI: ilPermissionGUI More...

+ Inheritance diagram for ilObjContentPageAdministrationGUI:
+ Collaboration diagram for ilObjContentPageAdministrationGUI:

Public Member Functions

 __construct ($a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
 
 getAdminTabs ()
 
 executeCommand ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Private Member Functions

 getForm (array $values=[])
 
 show (array $components)
 
 edit ()
 
 save ()
 

Private Attributes

const string CMD_VIEW = 'view'
 
const string CMD_EDIT = 'edit'
 
const string CMD_SAVE = 'save'
 
const string F_READING_TIME = 'reading_time'
 
readonly Storage $settings_storage
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjContentPageAdministrationGUI::__construct (   $a_data,
int  $a_id,
bool  $a_call_by_reference = true,
bool  $a_prepare_output = true 
)

Definition at line 41 of file class.ilObjContentPageAdministrationGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

42  {
43  global $DIC;
44 
45  $this->type = 'cpad';
46  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
47  $this->lng->loadLanguageModule($this->type);
48 
49  $this->settings_storage = new StorageImpl($DIC->settings());
50  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ edit()

ilObjContentPageAdministrationGUI::edit ( )
private

Definition at line 147 of file class.ilObjContentPageAdministrationGUI.php.

References getForm(), and show().

Referenced by executeCommand().

147  : void
148  {
149  $values = [
150  self::F_READING_TIME => $this->settings_storage->getSettings()->isReadingTimeEnabled(),
151  ];
152 
153  $form = $this->getForm($values);
154 
155  $this->show([$form]);
156  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjContentPageAdministrationGUI::executeCommand ( )

Definition at line 68 of file class.ilObjContentPageAdministrationGUI.php.

References ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), ilObjectGUI\prepareOutput(), and save().

68  : void
69  {
70  if (!$this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
71  $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
72  }
73 
74  $nextClass = $this->ctrl->getNextClass($this) ?? '';
75  $cmd = $this->ctrl->getCmd() ?? '';
76  $this->prepareOutput();
77 
78  switch (strtolower($nextClass)) {
79  case strtolower(ilPermissionGUI::class):
80  $this->tabs_gui->setTabActive('perm_settings');
81  $perm_gui = new ilPermissionGUI($this);
82  $this->ctrl->forwardCommand($perm_gui);
83  break;
84 
85  default:
86  match ($cmd) {
87  self::CMD_VIEW, self::CMD_EDIT => $this->edit(),
88  self::CMD_SAVE => $this->save(),
89  default => throw new RuntimeException(__METHOD__ . ' :: Unknown command ' . $cmd),
90  };
91  }
92  }
prepareOutput(bool $show_sub_objects=true)
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjContentPageAdministrationGUI::getAdminTabs ( )

Definition at line 52 of file class.ilObjContentPageAdministrationGUI.php.

References ILIAS\Repository\ctrl().

52  : void
53  {
54  if ($this->rbac_system->checkAccess('visible,read', $this->object->getRefId())) {
55  $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass(self::class, self::CMD_EDIT));
56  }
57 
58  if ($this->rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
59  $this->tabs_gui->addTarget(
60  'perm_settings',
61  $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, 'perm'),
62  [],
63  ilPermissionGUI::class
64  );
65  }
66  }
+ Here is the call graph for this function:

◆ getForm()

ilObjContentPageAdministrationGUI::getForm ( array  $values = [])
private

Definition at line 94 of file class.ilObjContentPageAdministrationGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ILIAS\Repository\refinery().

Referenced by edit(), and save().

94  : Form
95  {
96  $may_write = $this->rbac_system->checkAccess('write', $this->object->getRefId());
97 
98  $action = $this->ctrl->getLinkTargetByClass(self::class, self::CMD_SAVE);
99  if (!$may_write) {
100  $action = $this->ctrl->getLinkTargetByClass(self::class, self::CMD_VIEW);
101  }
102 
103  $readingTimeStatus = $this->ui_factory
104  ->input()
105  ->field()
106  ->checkbox(
107  $this->lng->txt('cpad_reading_time_status'),
108  $this->lng->txt('cpad_reading_time_status_desc')
109  )
110  ->withDisabled(!$may_write);
111 
112  if (isset($values[self::F_READING_TIME])) {
113  $readingTimeStatus = $readingTimeStatus->withValue($values[self::F_READING_TIME]);
114  }
115 
116  $section = $this->ui_factory->input()->field()->section(
117  [self::F_READING_TIME => $readingTimeStatus],
118  $this->lng->txt('settings')
119  )->withDisabled(!$may_write);
120 
121  $form = $this->ui_factory
122  ->input()
123  ->container()
124  ->form()
125  ->standard($action, [$section])
126  ->withAdditionalTransformation($this->refinery->custom()->transformation(static function ($values): array {
127  return array_merge(...$values);
128  }));
129 
130  if (!$may_write) {
131  $form = $form->withSubmitLabel($this->lng->txt('refresh'));
132  }
133 
134  return $form;
135  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjContentPageAdministrationGUI::save ( )
private

Definition at line 158 of file class.ilObjContentPageAdministrationGUI.php.

References ilObjectGUI\$data, ilObjectGUI\$settings, ILIAS\Repository\ctrl(), getForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), null, and show().

Referenced by executeCommand().

158  : void
159  {
160  if (!$this->rbac_system->checkAccess('write', $this->object->getRefId())) {
161  $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
162  }
163 
164  $form = $this->getForm()->withRequest($this->http->request());
165  $data = $form->getData();
166 
167  if ($data === null || $this->request->getMethod() !== 'POST') {
168  $this->show([$form]);
169  return;
170  }
171 
172  $readingTime = $data[self::F_READING_TIME];
173  $settings = $this->settings_storage
174  ->getSettings()
175  ->withDisabledReadingTime();
176  if ($readingTime) {
177  $settings = $settings->withEnabledReadingTime();
178  }
179  $this->settings_storage->store($settings);
180 
181  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
182  $this->ctrl->redirect($this, self::CMD_EDIT);
183  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
ilSetting $settings
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show()

ilObjContentPageAdministrationGUI::show ( array  $components)
private
Parameters
list<Component>$components

Definition at line 140 of file class.ilObjContentPageAdministrationGUI.php.

Referenced by edit(), and save().

140  : void
141  {
142  $this->tpl->setContent(
143  $this->ui_renderer->render($components)
144  );
145  }
$components
+ Here is the caller graph for this function:

Field Documentation

◆ $settings_storage

readonly Storage ilObjContentPageAdministrationGUI::$settings_storage
private

Definition at line 39 of file class.ilObjContentPageAdministrationGUI.php.

◆ CMD_EDIT

const string ilObjContentPageAdministrationGUI::CMD_EDIT = 'edit'
private

Definition at line 35 of file class.ilObjContentPageAdministrationGUI.php.

◆ CMD_SAVE

const string ilObjContentPageAdministrationGUI::CMD_SAVE = 'save'
private

Definition at line 36 of file class.ilObjContentPageAdministrationGUI.php.

◆ CMD_VIEW

const string ilObjContentPageAdministrationGUI::CMD_VIEW = 'view'
private

Definition at line 34 of file class.ilObjContentPageAdministrationGUI.php.

◆ F_READING_TIME

const string ilObjContentPageAdministrationGUI::F_READING_TIME = 'reading_time'
private

Definition at line 37 of file class.ilObjContentPageAdministrationGUI.php.


The documentation for this class was generated from the following file: