system/modules/DocumentManagementSystem/modules/ModuleDmsManagement.php
private function managePublishDocument(&$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->isPublishableForCurrentMember())
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_allowed'];
      $blnShowStart = true;
    }
    else
    {
      $document = $dmsLoader->loadDocument($documentId, $params);
      
      if ($document != null)
      {
        if (!$document->isPublished())
        {
          $document->lasteditMemberId = $this->Member->id;
          $document->lasteditDate = time();
          $document->published = true;
          
          $dmsWriter = \DmsWriter::getInstance();
          $document = $dmsWriter->updateDocument($document);
          $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_successfully_published'];
        }
        else
        {
          $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['document_already_published'];
        }
      }
      else
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_found'];
      }
      $this->manageSelectDocument($params, $dmsLoader, $manageCategory, $arrMessages, $blnShowStart);
    }
  }
private function managePublishDocument(&$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->isPublishableForCurrentMember())
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_allowed'];
      $blnShowStart = true;
    }
    else
    {
      $document = $dmsLoader->loadDocument($documentId, $params);
      
      if ($document != null)
      {
        if (!$document->isPublished())
        {
          $document->lasteditMemberId = $this->Member->id;
          $document->lasteditDate = time();
          $document->published = true;
          
          $dmsWriter = \DmsWriter::getInstance();
          $document = $dmsWriter->updateDocument($document);
          $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_successfully_published'];
        }
        else
        {
          $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['document_already_published'];
        }
      }
      else
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_found'];
      }
      $this->manageSelectDocument($params, $dmsLoader, $manageCategory, $arrMessages, $blnShowStart);
    }
  }
private function managePublishDocument ( & $ 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 -> isPublishableForCurrentMember ( ) ) { $ arrMessages [ 'errors' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'ERR' ] [ 'manage_document_not_allowed' ] ; $ blnShowStart = true ; } else { $ document = $ dmsLoader -> loadDocument ( $ documentId , $ params ) ; if ( $ document != null ) { if ( ! $ document -> isPublished ( ) ) { $ document -> lasteditMemberId = $ this -> Member -> id ; $ document -> lasteditDate = time ( ) ; $ document -> published = true ; $ dmsWriter = \ DmsWriter :: getInstance ( ) ; $ document = $ dmsWriter -> updateDocument ( $ document ) ; $ arrMessages [ 'successes' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'SUCCESS' ] [ 'document_successfully_published' ] ; } else { $ arrMessages [ 'infos' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'INFO' ] [ 'document_already_published' ] ; } } else { $ arrMessages [ 'errors' ] [ ] = $ GLOBALS [ 'TL_LANG' ] [ 'DMS' ] [ 'ERR' ] [ 'manage_document_not_found' ] ; } $ this -> manageSelectDocument ( $ params , $ dmsLoader , $ manageCategory , $ arrMessages , $ blnShowStart ) ; } }
Execute publishing documents
Execute publishing documents