system/modules/DocumentManagementSystem/modules/ModuleDmsManagement.php
private function manageEditDocumentEnterProperties(&$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);
      
      // load existing documents for file name
      $params->loadCategory = true; // need the category of existing documents
      $existingDocuments = $dmsLoader->loadDocuments($document->fileName, $document->fileType, $params);
      $params->loadCategory = false;
      
      $existingDocuments = array();
      $blnCategoriesDiffer = false; // check if an existing document is in another category
      foreach ($existingDocuments as $existingDocument)
      {
        if ($existingDocument->id != $documentId)
        {
          $existingDocuments[] = $existingDocument;
          // will be true, if one is true (keep true status, if once set)
          $blnCategoriesDiffer = $blnCategoriesDiffer || ($category->id != $existingDocument->categoryId);
        }
      }
      if ($blnCategoriesDiffer)
      {
        $arrMessages['warnings'][] = $GLOBALS['TL_LANG']['DMS']['WARN']['edit_existing_document_in_another_catagory'];
      }
      
      $this->Template = new \FrontendTemplate("mod_dms_mgmt_manage_document_edit");
      $this->Template->setData($this->arrData);
      
      $this->Template->category = $category;
      $this->Template->document = $document;
      $this->Template->existingDocuments = $existingDocuments;
      
      if (!$category->isPublishableForCurrentMember())
      {
        $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['publish_document_not_allowed'];
      }
      
      $blnShowStart = false;
    }
  }
private function manageEditDocumentEnterProperties(&$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);
      
      // load existing documents for file name
      $params->loadCategory = true; // need the category of existing documents
      $existingDocuments = $dmsLoader->loadDocuments($document->fileName, $document->fileType, $params);
      $params->loadCategory = false;
      
      $existingDocuments = array();
      $blnCategoriesDiffer = false; // check if an existing document is in another category
      foreach ($existingDocuments as $existingDocument)
      {
        if ($existingDocument->id != $documentId)
        {
          $existingDocuments[] = $existingDocument;
          // will be true, if one is true (keep true status, if once set)
          $blnCategoriesDiffer = $blnCategoriesDiffer || ($category->id != $existingDocument->categoryId);
        }
      }
      if ($blnCategoriesDiffer)
      {
        $arrMessages['warnings'][] = $GLOBALS['TL_LANG']['DMS']['WARN']['edit_existing_document_in_another_catagory'];
      }
      
      $this->Template = new \FrontendTemplate("mod_dms_mgmt_manage_document_edit");
      $this->Template->setData($this->arrData);
      
      $this->Template->category = $category;
      $this->Template->document = $document;
      $this->Template->existingDocuments = $existingDocuments;
      
      if (!$category->isPublishableForCurrentMember())
      {
        $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['publish_document_not_allowed'];
      }
      
      $blnShowStart = false;
    }
  }
private function manageEditDocumentEnterProperties ( & $ 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 ) ; // load existing documents for file name $ params -> loadCategory = true ; // need the category of existing documents $ existingDocuments = $ dmsLoader -> loadDocuments ( $ document -> fileName , $ document -> fileType , $ params ) ; $ params -> loadCategory = false ; $ existingDocuments = array ( ) ; $ blnCategoriesDiffer = false ; // check if an existing document is in another category foreach ( $ existingDocuments as $ existingDocument ) { if ( $ existingDocument -> id != $ documentId ) { $ existingDocuments [ ] = $ existingDocument ; // will be true, if one is true (keep true status, if once set) $ blnCategoriesDiffer = $ blnCategoriesDiffer || ( $ category -> id != $ existingDocument -> categoryId ) ; } } if ( $ blnCategoriesDiffer ) { $ arrMessages [ 'warnings' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'WARN' ] [ 'edit_existing_document_in_another_catagory' ] ; } $ this -> Template = new \ FrontendTemplate ( "mod_dms_mgmt_manage_document_edit" ) ; $ this -> Template -> setData ( $ this -> arrData ) ; $ this -> Template -> category = $ category ; $ this -> Template -> document = $ document ; $ this -> Template -> existingDocuments = $ existingDocuments ; if ( ! $ category -> isPublishableForCurrentMember ( ) ) { $ arrMessages [ 'infos' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'INFO' ] [ 'publish_document_not_allowed' ] ; } $ blnShowStart = false ; } }
Edit a document
Edit a document