示例#1
0
 /**
  * {@inheritdoc}
  */
 protected function outputSlice(rex_sql $artDataSql, $moduleIdToAdd)
 {
     if ($this->mode != 'edit') {
         // ----- wenn mode nicht edit
         $slice_content = parent::outputSlice($artDataSql, $moduleIdToAdd);
     } else {
         $sliceId = $artDataSql->getValue(rex::getTablePrefix() . 'article_slice.id');
         $sliceCtype = $artDataSql->getValue(rex::getTablePrefix() . 'article_slice.ctype_id');
         $moduleInput = $artDataSql->getValue(rex::getTablePrefix() . 'module.input');
         $moduleOutput = $artDataSql->getValue(rex::getTablePrefix() . 'module.output');
         $moduleId = $artDataSql->getValue(rex::getTablePrefix() . 'module.id');
         $slice_content = '';
         // ----- add select box einbauen
         if ($this->function == 'add' && $this->slice_id == $sliceId) {
             $slice_content .= $this->addSlice($sliceId, $moduleIdToAdd);
         } else {
             // ----- BLOCKAUSWAHL - SELECT
             $slice_content .= $this->getModuleSelect($sliceId);
         }
         $panel = '';
         if ($this->function != 'add' && $this->slice_id == $sliceId) {
             $msg = '';
             if ($this->warning != '') {
                 $msg .= rex_view::warning($this->warning);
             }
             if ($this->info != '') {
                 $msg .= rex_view::success($this->info);
             }
             $panel .= $msg;
         }
         // ----- EDIT/DELETE BLOCK - Wenn Rechte vorhanden
         if (rex::getUser()->getComplexPerm('modules')->hasPerm($moduleId)) {
             if ($this->function == 'edit' && $this->slice_id == $sliceId) {
                 // **************** Aktueller Slice
                 // ----- PRE VIEW ACTION [EDIT]
                 $action = new rex_article_action($moduleId, 'edit', $artDataSql);
                 if (rex_request_method() == 'post' && rex_request('function', 'string') == 'edit') {
                     $action->setRequestValues();
                 }
                 $action->exec(rex_article_action::PREVIEW);
                 // ----- / PRE VIEW ACTION
                 $moduleInput = $this->replaceVars($artDataSql, $moduleInput);
                 return $this->editSlice($sliceId, $moduleInput, $sliceCtype, $moduleId, $artDataSql);
             } else {
                 // Modulinhalt ausgeben
                 $moduleOutput = $this->replaceVars($artDataSql, $moduleOutput);
                 $panel .= $this->getWrappedModuleOutput($moduleId, $moduleOutput);
             }
         } else {
             // ----- hat keine rechte an diesem modul, einfach ausgeben
             $moduleOutput = $this->replaceVars($artDataSql, $moduleOutput);
             $panel .= $this->getWrappedModuleOutput($moduleId, $moduleOutput);
         }
         $fragment = new rex_fragment();
         $fragment->setVar('title', $this->getSliceHeading($artDataSql), false);
         $fragment->setVar('options', $this->getSliceMenu($artDataSql), false);
         $fragment->setVar('body', $panel, false);
         $slice_content .= '<li class="rex-slice rex-slice-output">' . $fragment->parse('core/page/section.php') . '</li>';
     }
     return $slice_content;
 }