Select Git revision
ModuleManagementInterface.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Closes #1230 Merge request studip/studip!741
Closes #1230 Merge request studip/studip!741
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
files.php 5.01 KiB
<?php
/**
* files.php - controller to display files in a course
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Moritz Strohm <strohm@data-quest.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
* @since 4.0
*/
class Institute_FilesController extends AuthenticatedController
{
protected $allow_nobody = true;
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
checkObject();
$this->studip_module = checkObjectModule('documents');
if (!Context::isInstitute()) {
throw new CheckObjectException(_('Es wurde keine passende Einrichtung gefunden.'));
}
$this->institute = Context::get();
object_set_visit_module($this->studip_module->getPluginId());
PageLayout::setHelpKeyword("Basis.Dateien");
PageLayout::setTitle($this->institute->getFullname() . " - " . _("Dateien"));
$this->last_visitdate = object_get_visit($this->institute->id, $this->studip_module->getPluginId());
Navigation::activateItem('/course/files');
if (is_object($GLOBALS['user']) && $GLOBALS['user']->id !== 'nobody') {
$constraints = FileManager::getUploadTypeConfig($this->institute->id);
PageLayout::addHeadElement('script', ['type' => 'text/javascript'], sprintf(
'STUDIP.Files.setUploadConstraints(%s);',
json_encode($constraints)
));
}
}
private function buildSidebar()
{
$sidebar = Sidebar::get();
$actions = new ActionsWidget();
if ($this->topFolder->isEditable($GLOBALS['user']->id) && $this->topFolder->parent_id) {
$actions->addLink(
_("Ordner bearbeiten"),
$this->url_for("file/edit_folder/".$this->topFolder->getId()),
Icon::create("edit", "clickable"),
['data-dialog' => 1]
);
}
if ($this->topFolder && $this->topFolder->isSubfolderAllowed($GLOBALS['user']->id)) {
$actions->addLink(
_('Neuer Ordner'),
URLHelper::getUrl(
'dispatch.php/file/new_folder/' . $this->topFolder ->getId()
),
Icon::create('folder-empty+add', 'clickable')