76 $this->ctrl =
$DIC->ctrl();
77 $this->tpl =
$DIC->ui()->mainTemplate();
78 $this->tabs =
$DIC->tabs();
79 $this->
http = $DIC->http();
80 $this->lng =
$DIC->language();
81 $this->ref_id = (int) $this->
http->request()->getQueryParams()[
'ref_id'];
82 $this->toolbar =
$DIC->toolbar();
83 $this->access =
$DIC->access();
93 $this->ctrl->returnToParent($this);
95 $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
136 $add_version->setCaption(
'file_new_version');
137 $add_version->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD_NEW_VERSION));
138 $this->toolbar->addButtonInstance($add_version);
141 $replace_version->setCaption(
'replace_file');
142 $replace_version->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD_REPLACING_VERSION));
143 $this->toolbar->addButtonInstance($replace_version);
146 $this->tpl->setContent(
$table->getHTML());
155 $this->tabs->clearTargets();
156 $this->tabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT));
160 $this->tpl->setContent(
$form->getHTML());
173 if (
$form->saveObject()) {
174 ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'),
true);
175 $this->ctrl->redirect($this, self::CMD_DEFAULT);
177 $form->setValuesByPost();
178 $this->tpl->setContent(
$form->getHTML());
196 if (count($version_ids) < 1) {
198 $this->ctrl->redirect($this, self::CMD_DEFAULT);
204 $conf_gui->setFormAction($this->ctrl->getFormAction($this, self::CMD_DEFAULT));
205 $conf_gui->setCancel($this->lng->txt(
"cancel"), self::CMD_CANCEL_DELETE);
207 $icon = ilObject::_getIcon($this->file->getId(),
"small", $this->file->getType());
208 $alt = $this->lng->txt(
"icon") .
" " . $this->lng->txt(
"obj_" . $this->file->getType());
210 if (count($versions_to_keep) < 1) {
214 $conf_gui->setConfirm($this->lng->txt(
"confirm"), self::CMD_CONFIRMED_DELETE_FILE);
218 $this->file->getTitle(),
226 $conf_gui->setConfirm($this->lng->txt(
"confirm"), self::CMD_CONFIRMED_DELETE_VERSIONS);
241 foreach ($this->file->getVersions($version_ids) as
$version) {
245 $version[
'filename'] ?? $this->file->getTitle(),
252 $this->tpl->setContent($conf_gui->getHTML());
262 if (count($version_ids) != 1) {
264 $this->ctrl->redirect($this, self::CMD_DEFAULT);
268 $new_version = $this->file->rollback($version_ids[0]);
270 ilUtil::sendSuccess(sprintf($this->lng->txt(
"file_rollback_done"), $new_version[
"rollback_version"]),
true);
271 $this->ctrl->redirect($this, self::CMD_DEFAULT);
278 if (is_array(
$_POST[self::HIST_ID]) && count(
$_POST[self::HIST_ID]) > 0) {
279 $this->file->deleteVersions(
$_POST[self::HIST_ID]);
280 ilUtil::sendSuccess($this->lng->txt(
"file_versions_deleted"),
true);
283 $this->ctrl->setParameter($this, self::HIST_ID,
"");
284 $this->ctrl->redirect($this, self::CMD_DEFAULT);
292 $parent_id =
$DIC->repositoryTree()->getParentId($this->ref_id);
295 $ru->deleteObjects($parent_id, array($this->ref_id));
298 $this->ctrl->setParameterByClass(ilRepositoryGUI::class,
"ref_id", $parent_id);
299 $this->ctrl->redirectByClass(ilRepositoryGUI::class);
322 if (isset(
$request->getQueryParams()[self::HIST_ID])) {
324 } elseif (isset(
$request->getParsedBody()[self::HIST_ID])) {
339 $versions_to_keep = array_udiff($this->file->getVersions(), $version_ids, function ($v1, $v2) {
341 $v1 = (int) $v1[
"hist_entry_id"];
349 $v2 = (int) $v2[
"hist_entry_id"];
359 return $versions_to_keep;
375 if (isset(
$_GET[
'wsp_id'])) {
377 if ($this->wsp_access->checkAccess($a_permission,
"", $this->ref_id)) {
382 if ($this->access->checkAccess($a_permission,
'', $this->ref_id)) {
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
Provides an interface to the ILIAS HTTP services.
Class FileNotFoundException.
Confirmation screen class.
const CMD_DELETE_VERSIONS
const CMD_CREATE_REPLACING_VERSION
const CMD_CONFIRMED_DELETE_FILE
getVersionsToKeep(array $version_ids)
const CMD_ROLLBACK_VERSION
hasPermission($a_permission)
bugfix mantis 26007: this function was created to ensure that the access check not only works for rep...
const CMD_CREATE_NEW_VERSION
saveVersion($mode=ilFileVersionFormGUI::MODE_ADD)
const CMD_DOWNLOAD_VERSION
getVersionIdsFromRequest()
const CMD_ADD_REPLACING_VERSION
addVersion($mode=ilFileVersionFormGUI::MODE_ADD)
const CMD_CONFIRMED_DELETE_VERSIONS
const CMD_ADD_NEW_VERSION
__construct(ilObjFile $file)
ilFileVersionsGUI constructor.
Class ilFileVersionsTableGUI.
Repository GUI Utilities.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Access handler for personal workspace.
static http()
Fetches the global http state from ILIAS.
if(empty($password)) $table
if(isset($_POST['submit'])) $form