/**
  * This function fills the default markers:
  *
  * ###PRINT_LINK###
  * ###PDF_LINK###
  * ###CSV_LINK###
  *
  * @return string Template with replaced markers
  */
 protected function fillDefaultMarkers()
 {
     parent::fillDefaultMarkers();
     if (Tx_Formhandler_Globals::$formValuesPrefix) {
         $params[Tx_Formhandler_Globals::$formValuesPrefix] = $this->gp;
     } else {
         $params = $this->gp;
     }
     $params['type'] = 98;
     $label = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'print');
     if (strlen($label) == 0) {
         $label = 'print';
     }
     $markers['###PRINT_LINK###'] = $this->cObj->getTypolink($label, $GLOBALS['TSFE']->id, $params);
     unset($params['type']);
     if ($this->componentSettings['actions.']) {
         foreach ($this->componentSettings['actions.'] as $action => $options) {
             $sanitizedAction = str_replace('.', '', $action);
             $class = $options['class'];
             if ($class) {
                 $class = Tx_Formhandler_StaticFuncs::prepareClassName($class);
                 $generator = $this->componentManager->getComponent($class);
                 $generator->init($this->gp, $options['config.']);
                 $markers['###' . strtoupper($sanitizedAction) . '_LINK###'] = $generator->getLink($params);
             }
         }
     }
     $this->fillFEUserMarkers($markers);
     $this->fillFileMarkers($markers);
     $this->template = $this->cObj->substituteMarkerArray($this->template, $markers);
 }
 protected function translateFields($options)
 {
     $key = $options['langKey'];
     $field = $options['field'];
     if ($field) {
         $key = str_replace('|', $this->gp[$field], $key);
     }
     return Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, $key);
 }
 /**
  * improved copy from dam_index
  * 
  * Returns HTML of a box with a step counter and "back" and "next" buttons
  * Use label "next"/"prev" or "next_[stepnumber]"/"prev_[stepnumber]" for specific step in language file as button text.
  * 
  * <code>
  * #set background color
  * plugin.Tx_Formhandler.settings.stepbar_color = #EAEAEA
  * #use default CSS, written to temp file
  * plugin.Tx_Formhandler.settings.useDefaultStepBarStyles = 1
  * </code>
  * 
  * @author Johannes Feustel
  * @param	integer	$currentStep current step (begins with 1)
  * @param	integer	$lastStep last step
  * @param	string	$buttonNameBack name attribute of the back button
  * @param	string	$buttonNameFwd name attribute of the forward button
  * @return 	string	HTML code
  */
 protected function createStepBar($currentStep, $lastStep, $buttonNameBack = '', $buttonNameFwd = '')
 {
     //colors
     $bgcolor = '#EAEAEA';
     $bgcolor = $this->settings['stepbar_color'] ? $this->settings['stepbar_color'] : $bgcolor;
     $nrcolor = t3lib_div::modifyHTMLcolor($bgcolor, 30, 30, 30);
     $errorbgcolor = '#dd7777';
     $errornrcolor = t3lib_div::modifyHTMLcolor($errorbgcolor, 30, 30, 30);
     $classprefix = Tx_Formhandler_Globals::$formValuesPrefix . '_stepbar';
     $css = array();
     $css[] = '.' . $classprefix . ' { background:' . $bgcolor . '; padding:4px;}';
     $css[] = '.' . $classprefix . '_error { background: ' . $errorbgcolor . ';}';
     $css[] = '.' . $classprefix . '_steps { margin-left:50px; margin-right:25px; vertical-align:middle; font-family:Verdana,Arial,Helvetica; font-size:22px; font-weight:bold; }';
     $css[] = '.' . $classprefix . '_steps span { color:' . $nrcolor . '; margin-left:5px; margin-right:5px; }';
     $css[] = '.' . $classprefix . '_error .' . $classprefix . '_steps span { color:' . $errornrcolor . '; margin-left:5px; margin-right:5px; }';
     $css[] = '.' . $classprefix . '_steps .' . $classprefix . '_currentstep { color:  #000;}';
     $css[] = '#stepsFormButtons { margin-left:25px;vertical-align:middle;}';
     $content = '';
     $buttons = '';
     for ($i = 1; $i <= $lastStep; $i++) {
         $class = '';
         if ($i == $currentStep) {
             $class = 'class="' . $classprefix . '_currentstep"';
         }
         $stepName = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'step-' . $i);
         if (strlen($stepName) === 0) {
             $stepName = $i;
         }
         $content .= '<span ' . $class . ' >' . $stepName . '</span>';
     }
     $content = '<span class="' . $classprefix . '_steps' . '">' . $content . '</span>';
     //if not the first step, show back button
     if ($currentStep > 1) {
         //check if label for specific step
         $buttonvalue = '';
         $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'prev_' . $currentStep);
         if (strlen($message) === 0) {
             $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'prev');
         }
         $buttonvalue = $message;
         $buttons .= '<input type="submit" name="' . $buttonNameBack . '" value="' . trim($buttonvalue) . '" class="button_prev" style="margin-right:10px;" />';
     }
     $buttonvalue = '';
     $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'next_' . $currentStep);
     if (strlen($message) === 0) {
         $message = Tx_Formhandler_StaticFuncs::getTranslatedMessage($this->langFiles, 'next');
     }
     $buttonvalue = $message;
     $buttons .= '<input type="submit" name="' . $buttonNameFwd . '" value="' . trim($buttonvalue) . '" class="button_next" />';
     $content .= '<span id="stepsFormButtons">' . $buttons . '</span>';
     //wrap
     $classes = $classprefix;
     if ($this->errors) {
         $classes = $classes . ' ' . $classprefix . '_error';
     }
     $content = '<div class="' . $classes . '" >' . $content . '</div>';
     //add default css to page
     if ($this->settings['useDefaultStepBarStyles']) {
         $css = implode("\n", $css);
         $css = TSpagegen::inline2TempFile($css, 'css');
         if (version_compare(TYPO3_version, '4.3.0') >= 0) {
             $css = '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($css) . '" />';
         }
         $GLOBALS['TSFE']->additionalHeaderData[$this->extKey . '_' . $classprefix] .= $css;
     }
     return $content;
 }