Select Git revision
ForumHelpers.php
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 33.86 KiB
<?php
/**
* files.php - controller to display personal files of a user
*
* The FilesController controller provides actions for the personal file area.
*
* 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 FilesController extends AuthenticatedController
{
public function validate_args(&$args, $types = NULL)
{
reset($args);
}
/**
* Create a link to a folder's range.
* @param \FolderType $folder the folder
* @return string the link to the folder's range
*/
public static function getRangeLink($folder)
{
return FileManager::getFolderLink($folder);
}
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
PageLayout::setHelpKeyword('Basis.Dateien');
$this->user = User::findCurrent();
$this->last_visitdate = time();
//Actions in this controller are not accessible for nobody.
if ($GLOBALS['user']->id == 'nobody') {
throw new AccessDeniedException();
}
$constraints = FileManager::getUploadTypeConfig($this->user->id);
PageLayout::addHeadElement('script', ['type' => 'text/javascript'], sprintf(
'STUDIP.Files.setUploadConstraints(%s);',
json_encode($constraints)
));
}
/**
* Helper method for filling the sidebar with actions.
*/
private function buildSidebar(FolderType $folder, $view = true)
{
$sidebar = Sidebar::get();
$sources = new LinksWidget();
$sources->setTitle(_("Dateiquellen"));
$sources->addLink(
_("Stud.IP-Dateien"),
$this->url_for("files/index"),
Icon::create("files", "clickable")
);