コード例 #1
0
 /**
  * Main module operation
  *
  * @return void
  */
 public function main()
 {
     $body = '';
     // Begin edit:
     if (is_array($this->editconf)) {
         /** @var FormResultCompiler formResultCompiler */
         $this->formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
         // Creating the editing form, wrap it with buttons, document selector etc.
         $editForm = $this->makeEditForm();
         if ($editForm) {
             $this->firstEl = reset($this->elementsData);
             // Checking if the currently open document is stored in the list of "open documents" - if not, add it:
             if (($this->docDat[1] !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
                 $this->docHandler[$this->storeUrlMd5] = [$this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl];
                 $this->getBackendUser()->pushModuleData('FormEngine', [$this->docHandler, $this->storeUrlMd5]);
                 BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
             }
             // Module configuration
             $this->modTSconfig = $this->viewId ? BackendUtility::getModTSconfig($this->viewId, 'mod.xMOD_alt_doc') : [];
             $body = $this->formResultCompiler->addCssFiles();
             $body .= $this->compileForm($editForm);
             $body .= $this->formResultCompiler->printNeededJSFunctions();
             $body .= '</form>';
         }
     }
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = BackendUtility::readPageAccess($this->viewId, $this->perms_clause);
     if ($this->pageinfo) {
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     }
     // Setting up the buttons and markers for docheader
     $this->getButtons();
     $this->languageSwitch($this->firstEl['table'], $this->firstEl['uid'], $this->firstEl['pid']);
     $this->moduleTemplate->setContent($body);
 }