Skip to content
Snippets Groups Projects
Select Git revision
  • eccec27f081020f42f20508b88ad420c0f489907
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

ModuleManagementInterface.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    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')