Get all documents for the given category.

@param  category  $category  The category to get the access rights for.
@param  DmsLoaderParams  $params  The configured params to use while loading.
@return  arr  Returns array of documents.
975473
private function getDocuments(\Category $category, \DmsLoaderParams $params)
  {
    $whereClause = "WHERE d.pid = ? ";
    
    $whereParams = array();
    $whereParams[] = $category->id;
    
    if ($params->hasDocumentSearchText())
    {
      if ($params->documentSearchType == \DmsLoaderParams::DOCUMENT_SEARCH_LIKE)
      {
        $whereClause .= "AND (UPPER(d.name) LIKE ? OR UPPER(d.description) LIKE ? OR UPPER(d.keywords) LIKE ?) ";
        $seachText = "%" . $params->documentSearchText . "%";
      }
      else
      {
        $whereClause .= "AND (d.name = ? OR d.description = ? OR d.keywords = ?) ";
        $seachText = $params->documentSearchText;
      }
      
      // add the search text 3 times
      for ($i = 0; $i < 3; $i++)
      {
        $whereParams[] = $seachText;
      }
    }
    
    $objDocument = $this->Database->prepare("SELECT d.*, CONCAT(m1.firstname, ' ', m1.lastname) AS upload_member_name, CONCAT(m2.firstname, ' ', m2.lastname) AS lastedit_member_name "
                        . "FROM tl_dms_documents d "
                        . "LEFT JOIN tl_member m1 ON m1.id = d.upload_member "
                        . "LEFT JOIN tl_member m2 ON m2.id = d.lastedit_member "
                        . $whereClause
                        . "ORDER BY d.name, d.version_major, d.version_minor, d.version_patch")
                    ->execute($whereParams);
    $arrDocuments = array();
    while ($objDocument->next())
    {
      $document = $this->buildDocument($objDocument);
      $document->category = $category;
      $arrDocuments[$document->id] = $document;
    }
    return $arrDocuments;
  }
933180
public function edit(Category $category)
    {
        return view('dashboard.sections.categories.edit', [
            'hasParent' => ! is_null($category->parent),
            'parents' => Category::parents()->get(),
            'category' => $category->load('parent'),
        ]);
    }
425140
public function findAllByFilters($category, Array $options, $getResults = true)
    {
        $qb = $this->getQueryBuilder()
            ->select('p');

        if (is_null($category) && array_key_exists('s-with-dashes', $options)) {
            // searching
            $orX = $qb->expr()->orX();
            $orX->add('p.name LIKE :searchWithDashes')
                ->add('p.name LIKE :searchWithSpaces');
            $qb->andWhere($orX)
                ->setParameter('searchWithDashes', '%'.$options['s-with-dashes'].'%')
                ->setParameter('searchWithSpaces', '%'.$options['s-with-spaces'].'%');
        } elseif (!is_null($category)) {
            if (!is_null($category->getParentCategory())) {
                // listing by subcategory (put in 'where' as it is)
                $qb->andWhere('p.category = :category')
                    ->setParameter('category', $category);
            } else {
                // listing by category (put its subcategories in a chained 'or')
                $orX = $qb->expr()->orX();

                foreach ($category->getSubcategories() as $subcategory) {
                    $orX->add('IDENTITY(p.category) = '.$subcategory->getId());
                }

                $qb->andWhere($orX);
            }
        }

        // sort filter
        if (false === array_key_exists('sort', $options)) {
            $options['sort'] = 'price-asc';
        }

        switch ($options['sort']) {
            case 'newest':
                $qb->orderBy('p.createdAt', 'desc');
                break;
            case 'oldest':
                $qb->orderBy('p.createdAt', 'asc');
                break;
            case 'price-asc':
                $qb->orderBy('p.price', 'asc');
                break;
            case 'price-desc':
                $qb->orderBy('p.price', 'desc');
                break;
        }

        // brands filter
        if (array_key_exists('brands', $options)) {
            $orX = $qb->expr()->orX();

            foreach ($options['brands'] as $brand) {
                $orX->add('IDENTITY(p.brand) = '.$brand);
            }

            $qb->andWhere($orX);
        }

        // attributes filter
        if (array_key_exists('attributes', $options)) {
            $qb->join('p.attributeValues', 'av');

            $orX = $qb->expr()->orX();

            foreach ($options['attributes'] as $attribute) {
                $orX->add('av.id = '.$attribute);
            }

            $qb->andWhere($orX);
        }

        // features filter
        if (array_key_exists('features', $options)) {
            $qb->join('p.featureValues', 'fv');

            $orX = $qb->expr()->orX();

            foreach ($options['features'] as $feature) {
                $orX->add('fv.id = '.$feature);
            }

            $qb->andWhere($orX);
            $qb->having('count(p.id) >= :num_features');
            $numFeatures = count($options['features']);
            $qb->setParameter('num_features', $numFeatures);
        }
        $qb->groupBy('p.id');

        // attribute ranges filter
/*        if (array_key_exists('attribute-min', $options) && array_key_exists('attribute-max', $options)) {
            if (false === array_key_exists('attributes', $options)) {
                $qb->join('p.attributeValues', 'av');
            }

            $andX = $qb->expr()->andX();

            foreach ($options['attribute-min'] as $value) {
                $andX->add('av.name >= '.$value);
            }

            foreach ($options['attribute-max'] as $value) {
                $andX->add('av.name <= '.$value);
            }

            $qb->andWhere($andX);
        }*/

        // feature ranges filter
/*        if (array_key_exists('feature-min', $options) && array_key_exists('feature-max', $options)) {
            if (false === array_key_exists('features', $options)) {
                $qb->join('p.featureValues', 'fv');
            }

            $andX = $qb->expr()->andX();

            foreach ($options['feature-min'] as $value) {
                $andX->add('fv.name >= '.$value);
            }

            foreach ($options['feature-max'] as $value) {
                $andX->add('fv.name <= '.$value);
            }

            $qb->andWhere($andX);
        }*/

        $query = $qb->getQuery();

        return $getResults ? $query->getResult() : $query;
    }
1254430
public function getCategories()
    {
        $apiCategories = [];
        $fileVersion = $this->getFileVersion();
        $categories = $fileVersion->getCategories();

        return array_map(function(CategoryEntity $category) {
            return $category->getId();
        }, $categories->toArray());
    }
1138774
private function getCategoryForId($intId, $blnLoadRootCategory, $blnLoadDocuments)
  {
    $params = new \DmsLoaderParams();
    $params->loadRootCategory = $blnLoadRootCategory;
    $params->loadDocuments = $blnLoadDocuments;

    $dmsLoader = \DmsLoader::getInstance();
    return $dmsLoader->loadCategory($intId, $params);
  }
289020
public static function getAllSubcategoriesIds($category)
    {
        $ids = Database::getInstance()->getChildRecords($category, static::$strTable, false, (array) $category, (!BE_USER_LOGGED_IN ? 'published=1' : ''));
        $ids = \array_map('intval', $ids);

        return $ids;
    }
1318954
public function categoryDataAccess($params, &$smarty)
    {
        $categoryId = $this->getRequest()->get('category_id');

        if ($categoryId === null) {
            $productId = $this->getRequest()->get('product_id');

            if ($productId !== null) {
                if (null !== $product = ProductQuery::create()->findPk($productId)) {
                    $categoryId = $product->getDefaultCategoryId();
                }
            }
        }

        if ($categoryId !== null) {
            return $this->dataAccessWithI18n(
                "Category",
                $params,
                CategoryQuery::create()->filterByPrimaryKey($categoryId)
            );
        }

        return '';
    }
1237070
public function getSubCategories($category)
    {
        $ds = DIRECTORY_SEPARATOR;
        $categoryPath = str_replace('/', $ds, $category);

        $basePath = app_path().$ds.'lablog'.$ds;

        $path = $basePath.$categoryPath;

        if (!$this->exists($category)) {
            return array();
        }

        $categories = $this->fs->directories($path);

        $allCategories = array();

        foreach ($categories as $category) {
            $cat = str_replace($basePath, '', $category);
            $allCategories[] = $this->getCategory($cat);
        }

        return $allCategories;
    }
861486
public function getList($params = array())
    {
        $resource = 'category.json';
        $resource .= '?' . $this->buildQueryString($params);
        $response = $this->getServiceResponse($resource);

        $getCategoriesResponse = new Models\ResponseCategoryGetList($response);

        return $getCategoriesResponse;
    }
1088156
private function uploadStoreProperties(&$params, &$dmsLoader, &$uploadCategory, &$arrMessages, &$blnShowStart)
  {
    $tempFileName = $this->Input->post('tempFileName');
    $tempFileNameCleaned = strtr(utf8_romanize($tempFileName), $GLOBALS['TL_DMS']['SPECIALCHARS']); // only to ensure that the transmitted value from hidden field is clean
    $arrTempFileParts = \Document::splitFileName($tempFileNameCleaned, false);
    $intFileSize = (int) $this->Input->post('fileSize');
    
    $documentName = $this->Input->post('documentName');
    $documentDescription = $this->Input->post('documentDescription');
    $documentKeywords = $this->Input->post('documentKeywords');
    $documentVersionMajor = $this->Input->post('documentVersionMajor');
    $documentVersionMinor = $this->Input->post('documentVersionMinor');
    $documentVersionPatch = $this->Input->post('documentVersionPatch');
    $documentPublish = (bool) $this->Input->post('documentPublish');
    
    $params->loadRootCategory = true; // get complete path to root, for checking inherited access rights
    $params->loadAccessRights = true;
    $params->loadDocuments = false;
    $category = $dmsLoader->loadCategory($uploadCategory, $params);
    
    if (!$category->isPublishableForCurrentMember())
    {
      // if current member is not allowed to publish, set the default behavior from the settings (in case the field was modified manually via dom manipulation)
      if ($documentPublish)
      {
        $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['publish_document_not_allowed'];
      }
      $documentPublish = \DmsUtils::publishDocumentsPerDefault($this, $this->Member, $category);
      
    }

    if (!$category->isUploadableForCurrentMember())
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['upload_document_not_allowed'];
      $blnShowStart = true;
    }
    else if (!file_exists(TL_ROOT . '/' . \DmsConfig::getTempDirectory(true) . $tempFileNameCleaned))
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['upload_temp_file_not_found'];
      $blnShowStart = false;
      $this->uploadSelectFile($params, $dmsLoader, $uploadCategory, $arrMessages, $blnShowStart);
    }
    else
    {
      // load possible documents for file name
      $params->loadCategory = true; // need the category of existing documents
      $existingDocuments = $dmsLoader->loadDocuments($arrTempFileParts['fileName'], $arrTempFileParts['fileType'], $params);
      $params->loadCategory = false;
      
      if (strlen($documentName) == 0)
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['upload_no_name_set'];
        if (count($existingDocuments) > 0)
        {
        // the list of documents is ordered by version, so the highest should be at end
          $lastDocument = end($existingDocuments);
          $documentName = $lastDocument->name;
        }
      }
      if (strlen($documentVersionMajor) == 0 || !is_numeric($documentVersionMajor) ||
        strlen($documentVersionMinor) == 0 || !is_numeric($documentVersionMinor) ||
        strlen($documentVersionPatch) == 0 || !is_numeric($documentVersionPatch))
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['upload_no_version_set'];
      }
      
      foreach ($existingDocuments as $existingDocument)
      {
        // will be true, if one is true (keep true status, if once set)
        if ($existingDocument->versionMajor == $documentVersionMajor &&
          $existingDocument->versionMinor == $documentVersionMinor &&
          $existingDocument->versionPatch == $documentVersionPatch)
        {
          $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['upload_version_already_used'];
        }
      }
      
      // HOOK: verify the uploaded document from frontend
      if (isset($GLOBALS['TL_HOOKS']['dmsVerifyUploadedDocument']) && is_array($GLOBALS['TL_HOOKS']['dmsVerifyUploadedDocument']))
      {
        foreach ($GLOBALS['TL_HOOKS']['dmsVerifyUploadedDocument'] as $callback)
        {
          $this->import($callback[0]);
          $arrMessages = $this->{$callback[0]}->{$callback[1]}($arrMessages, $existingDocuments, $this->Input);
        }
      }
      
      if (count($arrMessages['errors']) > 0)
      {
        $this->Template = new \FrontendTemplate("mod_dms_mgmt_upload_enter_properties");
        $this->Template->setData($this->arrData);
        
        $this->Template->documentName = $documentName;
        $this->Template->documentDescription = $documentDescription;
        $this->Template->documentKeywords = $documentKeywords;
        $this->Template->documentVersionMajor = $documentVersionMajor;
        $this->Template->documentVersionMinor = $documentVersionMinor;
        $this->Template->documentVersionPatch = $documentVersionPatch;
        $this->Template->documentPublish = $documentPublish;
      }
      else
      {
        $documentVersion = \Document::buildVersionForFileName($documentVersionMajor, $documentVersionMinor, $documentVersionPatch);
        $fileFileNameVersioned = \Document::buildFileNameVersioned($arrTempFileParts['fileName'], $documentVersion, $arrTempFileParts['fileType']);
        
        // move the temp file to dms dir and append version
        rename(\DmsConfig::getTempDirectory(true) . $tempFileNameCleaned, \DmsConfig::getDocumentFilePath($fileFileNameVersioned));
        \Dbafs::addResource(\DmsConfig::getDocumentFilePath($fileFileNameVersioned));
        
        // store document
        $document = new \Document(-1, $documentName);
        $document->categoryId = $category->id;
        $document->description = $documentDescription;
        $document->keywords = $documentKeywords;
        $document->fileName = $arrTempFileParts['fileName'];
        $document->fileType = $arrTempFileParts['fileType'];
        $document->fileSize = $intFileSize;
        $document->filePreview = null; // TODO: maybe filled in #12
        $document->versionMajor = $documentVersionMajor;
        $document->versionMinor = $documentVersionMinor;
        $document->versionPatch = $documentVersionPatch;
        $document->uploadMemberId = $this->Member->id;
        $document->uploadDate = time();
        $document->lasteditMemberId = 0;
        $document->lasteditDate = '';
        $document->published = $documentPublish;
        
        // HOOK: modify the uploaded document from frontend
        if (isset($GLOBALS['TL_HOOKS']['dmsModifyUploadedDocument']) && is_array($GLOBALS['TL_HOOKS']['dmsModifyUploadedDocument']))
        {
          foreach ($GLOBALS['TL_HOOKS']['dmsModifyUploadedDocument'] as $callback)
          {
            $this->import($callback[0]);
            $document = $this->{$callback[0]}->{$callback[1]}($document, $this->Input);
          }
        }
        
        $dmsWriter = \DmsWriter::getInstance();
        $document = $dmsWriter->storeDocument($document);
        
        $this->Template = new \FrontendTemplate("mod_dms_mgmt_upload_processed");
        $this->Template->setData($this->arrData);
        
        $this->Template->document = $document;
        
        $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_successfully_uploaded'];
      }
      
      $this->Template->category = $category;
      $this->Template->tempFileName = $tempFileNameCleaned;
      $this->Template->fileName = $this->Input->post('fileName');
      $this->Template->fileType = $this->Input->post('fileType');
      $this->Template->fileSize = $intFileSize;
      $this->Template->fileSizeByteFormatted = \Document::formatFileSize($intFileSize, \Document::FILE_SIZE_UNIT_BYTE);
      $this->Template->fileSizeKbFormatted = \Document::formatFileSize(\Document::convertFileSize($intFileSize, \Document::FILE_SIZE_UNIT_BYTE, \Document::FILE_SIZE_UNIT_KB), \Document::FILE_SIZE_UNIT_KB);
      $this->Template->fileSizeMbFormatted = \Document::formatFileSize(\Document::convertFileSize($intFileSize, \Document::FILE_SIZE_UNIT_BYTE, \Document::FILE_SIZE_UNIT_MB), \Document::FILE_SIZE_UNIT_MB);
      $this->Template->fileSizeGbFormatted = \Document::formatFileSize(\Document::convertFileSize($intFileSize, \Document::FILE_SIZE_UNIT_BYTE, \Document::FILE_SIZE_UNIT_GB), \Document::FILE_SIZE_UNIT_GB);
      $this->Template->existingDocuments = $existingDocuments;
      
      $blnShowStart = false;
    }
  }
1359886
public function getPostsByCategory($category)
    {
        if (false === array_key_exists($category, $this->categoryIndex)) {
            return [];
        }

        $postNames = $this->categoryIndex[$category];

        return $this->getPostsByName($postNames);
    }
119335
public function loadCategory($categoryId, \DmsLoaderParams $params)
  {
    $objCategory = $this->Database->prepare("SELECT * FROM tl_dms_categories WHERE id = ?")
                    ->limit(1)
                    ->execute($categoryId);
    
    $category = null;
    if ($objCategory->numRows)
    {
      $category = $this->buildCategory($objCategory);
      if ($params->loadAccessRights)
      {
        $category->accessRights = $this->getAccessRights($category, $params);
      }
      if ($params->loadDocuments)
      {
        $category->documents = $this->getDocuments($category, $params);
      }
      if ($params->loadRootCategory)
      {
        $category->parentCategory = $this->loadCategory($category->parentCategoryId, $params);
      }
    }

    return $category;
  }
873665
protected function getCategoryLevel($parentCategoryId, \Category $parentCategory=null, \DmsLoaderParams $params)
  {
    $arrCategories = array();
    $objCategory = $this->Database->prepare("SELECT * FROM tl_dms_categories WHERE pid = ? ORDER BY sorting")
                    ->execute($parentCategoryId);
    
    $category = null;
    while ($objCategory->next())
    {
      $category = $this->buildCategory($objCategory);
      $category->parentCategory = $parentCategory;
      $category->subCategories = $this->getCategoryLevel($category->id, $category, $params);
      if ($params->loadAccessRights)
      {
        $category->accessRights = $this->getAccessRights($category, $params);
      }
      if ($params->loadDocuments)
      {
        $category->documents = $this->getDocuments($category, $params);
      }
      $arrCategories[$category->id] = $category;
    }

    return $arrCategories;
  }
945092
protected function getModuleByTransCategory($category)
    {
        foreach(TranslationsBuilder::$transCatToModule as $pattern => $module) {
            if (0 === strpos($category, rtrim($pattern, '*'))) {
                return $module;
            }
        }
    }
2444
public function getCategorySearchQuery(
        ContainerConfigurationInterface $containerConfigurationInterface,
        CategoryInterface $category
    ) {
        $filters = array_merge(
            ['category' => $this->categoryFilterProvider->getQueryFilter($category)],
            $containerConfigurationInterface->getFilters()
        );

        $filterQuery  = $this->queryBuilder->createFilterQuery($containerConfigurationInterface, $filters);

        return $this->queryFactory->create(QueryInterface::TYPE_FILTER, ['filter' => $filterQuery]);
    }
44398
public function getCategoryUrls(string $category, array $criteria = [], $siteId = null): array
    {
        return RouteMap::$plugin->routes->getCategoryUrls($category, $criteria, $siteId);
    }
393394
private function manageEditDocumentStoreProperties(&$params, &$dmsLoader, &$manageCategory, &$arrMessages, &$blnShowStart, $documentId)
  {
    $params->loadRootCategory = true; // get complete path to root, for checking inherited access rights
    $params->loadAccessRights = true;
    $params->loadDocuments = false;
    $category = $dmsLoader->loadCategory($manageCategory, $params);
    
    if (!$category->isEditableForCurrentMember())
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_allowed'];
      $blnShowStart = true;
    }
    else
    {
      $document = $dmsLoader->loadDocument($documentId, $params);
      $documentOriginal = clone $document;
      
      // load existing documents for file name
      $params->loadCategory = true; // need the category of existing documents
      $arrDocuments = $dmsLoader->loadDocuments($document->fileName, $document->fileType, $params);
      $params->loadCategory = false;
      
      $existingDocuments = array();
      foreach ($arrDocuments as $existingDocument)
      {
        if ($existingDocument->id != $documentId)
        {
          $existingDocuments[] = $existingDocument;
        }
      }
      
      $documentVersionMajor = $this->Input->post('documentVersionMajor');
      $documentVersionMinor = $this->Input->post('documentVersionMinor');
      $documentVersionPatch = $this->Input->post('documentVersionPatch');
      
      $document->name = $this->Input->post('documentName');
      $document->description = $this->Input->post('documentDescription');
      $document->keywords = $this->Input->post('documentKeywords');
      $document->versionMajor = $documentVersionMajor;
      $document->versionMinor = $documentVersionMinor;
      $document->versionPatch = $documentVersionPatch;
      $document->lasteditMemberId = $this->Member->id;
      $document->lasteditDate = time();
      if ($category->isPublishableForCurrentMember())
      {
        $document->published = (bool) $this->Input->post('documentPublish');
      }
      
      $versionChanged = false;
      if ($documentVersionMajor != $documentOriginal->versionMajor ||
        $documentVersionMinor != $documentOriginal->versionMinor ||
        $documentVersionPatch != $documentOriginal->versionPatch)
      {
        $versionChanged = true;
      }
      
      if (strlen($document->name) == 0)
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['edit_no_name_set'];
        $document->name = $documentOriginal->name;
      }
      if ($versionChanged)
      {
        if (strlen($documentVersionMajor) == 0 || !is_numeric($documentVersionMajor) ||
          strlen($documentVersionMinor) == 0 || !is_numeric($documentVersionMinor) ||
          strlen($documentVersionPatch) == 0 || !is_numeric($documentVersionPatch))
        {
          $document->versionMajor = $documentOriginal->versionMajor;
          $document->versionMinor = $documentOriginal->versionMinor;
          $document->versionPatch = $documentOriginal->versionPatch;
          $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['edit_no_version_set'];
        }
        
        foreach ($existingDocuments as $existingDocument)
        {
          // will be true, if one is true (keep true status, if once set)
          if ($existingDocument->versionMajor == $documentVersionMajor &&
            $existingDocument->versionMinor == $documentVersionMinor &&
            $existingDocument->versionPatch == $documentVersionPatch)
          {
            $document->versionMajor = $documentOriginal->versionMajor;
            $document->versionMinor = $documentOriginal->versionMinor;
            $document->versionPatch = $documentOriginal->versionPatch;
            $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['edit_version_already_used'];
          }
        }
      }
      
      // HOOK: verify the edited document from frontend
      if (isset($GLOBALS['TL_HOOKS']['dmsVerifyEditedDocument']) && is_array($GLOBALS['TL_HOOKS']['dmsVerifyEditedDocument']))
      {
        foreach ($GLOBALS['TL_HOOKS']['dmsVerifyEditedDocument'] as $callback)
        {
          $this->import($callback[0]);
          $arrMessages = $this->{$callback[0]}->{$callback[1]}($arrMessages, $existingDocuments, $this->Input);
        }
      }
      
      if (count($arrMessages['errors']) > 0)
      {
        $this->Template = new \FrontendTemplate("mod_dms_mgmt_manage_document_edit");
        $this->Template->setData($this->arrData);
      }
      else
      {
        // HOOK: modify the edited document from frontend
        if (isset($GLOBALS['TL_HOOKS']['dmsModifyEditedDocument']) && is_array($GLOBALS['TL_HOOKS']['dmsModifyEditedDocument']))
        {
          foreach ($GLOBALS['TL_HOOKS']['dmsModifyEditedDocument'] as $callback)
          {
            $this->import($callback[0]);
            $document = $this->{$callback[0]}->{$callback[1]}($document, $this->Input);
          }
        }

        // update document
        $dmsWriter = \DmsWriter::getInstance();
        $document = $dmsWriter->updateDocument($document);
        
        $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_successfully_edited'];
        
        // rename the file if the version changed
        if ($versionChanged)
        {
          $filePath = \DmsConfig::getDocumentFilePath($documentOriginal->getFileNameVersioned());
          if (file_exists(TL_ROOT . '/' . $filePath))
          {
            rename($filePath, \DmsConfig::getDocumentFilePath($document->getFileNameVersioned()));
            $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_file_successfully_renamed'];
          }
          else
          {
            $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['edit_file_not_exists'];
          }
        }
        
        $this->Template = new \FrontendTemplate("mod_dms_mgmt_manage_document_edit_processed");
        $this->Template->setData($this->arrData);
      }
      
      $this->Template->category = $category;
      $this->Template->document = $document;
      $this->Template->existingDocuments = $existingDocuments;
      
      $blnShowStart = false;
    }
  }