public function before_filter(&$action, &$args) { parent::before_filter($action, $args); // Lock context to user id $this->owner = $GLOBALS['user']; $this->context_id = $this->owner->id; $this->full_access = true; if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) { $username = Request::username('username', $GLOBALS['user']->username); $user = User::findByUsername($username); if ($user && $user->id !== $GLOBALS['user']->id) { $this->owner = $user; $this->context_id = $user->id; $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root'; URLHelper::bindLinkParam('username', $username); } } $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE; $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id); if ($this->userConfig['area_close'] == 1) { $this->redirect('document/closed/index'); } if (Request::isPost()) { CSRFProtection::verifySecurityToken(); } if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) { $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.'); PageLayout::postMessage(MessageBox::error($message)); $this->redirect('document/files/index'); } }
/** * Displays the files in a speicfic folder. * * @param mixed $dir_id Directory entry id of the folder (default to root) */ public function index_action($dir_id = null, $page = 1) { $dir_id = $dir_id ?: $this->context_id; try { $directory = new DirectoryEntry($dir_id); $this->directory = $directory->file; $this->parent_id = FileHelper::getParentId($directory->id) ?: $this->context_id; $this->folder_id = $directory->parent_id; $parent_index = $directory->indexInParent(); } catch (Exception $e) { $this->directory = new RootDirectory($GLOBALS['perm']->have_perm('root') ? $dir_id : $this->context_id); $this->parent_id = null; $this->folder_id = $this->context_id; $parent_index = false; } $this->directory->checkAccess(); $this->filecount = $this->directory->countFiles(); $this->maxpages = ceil($this->filecount / $this->limit); $this->page = min($page, $this->maxpages); $this->parent_page = $this->getPageForIndex($parent_index); $this->files = $this->directory->listFiles(($this->page - 1) * $this->limit, $this->limit); $this->dir_id = $dir_id; $this->marked = $this->flash['marked-ids'] ?: array(); $this->breadcrumbs = FileHelper::getBreadCrumbs($dir_id); $config = DocUsergroupConfig::getUserConfig($this->context_id); $this->space_used = DiskFileStorage::getQuotaUsage($this->context_id); $this->space_total = $config['quota']; $this->setupSidebar($dir_id, $this->directory->id, $this->page); }
public function before_filter(&$action, &$args) { parent::before_filter($action, $args); //Configurations for the Documentarea for this user $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id); $this->set_layout($GLOBALS['template_factory']->open('layouts/base')); PageLayout::setTitle(_('Dateiverwaltung')); PageLayout::setHelpKeyword('Basis.Dateien'); Navigation::activateItem('/document/files'); }
public function setConfig($data) { if (!empty($data)) { $config = array_pop(DocUsergroupConfig::findById($data['id'])); if (empty($config)) { $config = new DocUsergroupConfig(); $config->setData($data); } else { $config->setData(array('quota' => $data['quota'], 'upload_quota' => $data['upload_quota'], 'upload_unit' => $data['upload_unit'], 'quota_unit' => $data['quota_unit'])); } $log[] = $config->store(); $db = DBManager::get(); DocFileTypeForbidden::deleteBySQL('usergroup = ' . $db->quote($config['usergroup'])); foreach ($data['datetype_id'] as $file) { $filetype = new DocFileTypeForbidden(); $filetype->setData(array('usergroup' => $config['usergroup'], 'dateityp_id' => $file)); $log[] = $filetype->store(); } return true; } else { return false; } }
public function individual_action($user_id = null) { $users = array(); if ($user_id != null) { $users = DocUsergroupConfig::searchForUser(array('user_id' => $user_id)); } if (Request::submitted('search')) { $data['username'] = Request::get('userName'); $data['Vorname'] = Request::get('userVorname'); $data['Nachname'] = Request::get('userNachname'); $data['Email'] = Request::get('userMail'); if (Request::get('userGroup') != 'alle') { $data['perms'] = Request::get('userGroup'); } $users = DocUsergroupConfig::searchForUser($data); } $userSetting = array(); foreach ($users as $u) { $config = DocUsergroupConfig::getGroupConfig($u['user_id']); $foo = array(); foreach ($u as $key => $value) { $foo[$key] = $value; } if (empty($config)) { $foo['upload'] = 'keine individuelle Einstellung'; $foo['upload_unit'] = ''; $foo['quota'] = 'keine individuelle Einstellung'; $foo['quota_unit'] = ''; $foo['forbidden'] = 0; $foo['area_close'] = 0; $foo['types'] = array(); $foo['deleteIcon'] = 0; $userSetting[] = $foo; } else { $foo['config_id'] = $config['id']; $foo['upload'] = $this->sizeInUnit($config['upload_quota'], $config['upload_unit']); $foo['upload_unit'] = $config['upload_unit']; $foo['quota'] = $this->sizeInUnit($config['quota'], $config['quota_unit']); $foo['quota_unit'] = $config['quota_unit']; $foo['forbidden'] = $config['forbidden']; $foo['area_close'] = $config['area_close']; $foo['types'] = $config['types']; $foo['deleteIcon'] = 1; $userSetting[] = $foo; } } $viewData['users'] = $userSetting; $this->viewData = $viewData; }