コード例 #1
0
 /**
  * Main method called by the controller.
  *
  * @param array $gp The current GET/POST parameters
  * @param array $errors In this class the second param is used to pass information about the email mode (HTML|PLAIN)
  * @return string content
  */
 public function render($gp, $errors)
 {
     //set GET/POST parameters
     $this->gp = array();
     $this->gp = $gp;
     //set template
     $this->template = $this->subparts['template'];
     //set settings
     $this->settings = $this->parseSettings();
     //set language file
     if (!$this->langFiles) {
         $this->langFiles = Tx_Formhandler_Globals::$langFiles;
     }
     $componentSettings = $this->getComponentSettings();
     if ($componentSettings[$errors['mode']][$errors['suffix'] . '.']['arrayValueSeparator']) {
         $this->settings['arrayValueSeparator'] = $componentSettings[$errors['mode']][$errors['suffix'] . '.']['arrayValueSeparator'];
         $this->settings['arrayValueSeparator.'] = $componentSettings[$errors['mode']][$errors['suffix'] . '.']['arrayValueSeparator.'];
     }
     if ($errors['suffix'] != 'plain') {
         $this->sanitizeMarkers();
     }
     //read master template
     if (!$this->masterTemplates) {
         $this->readMasterTemplates();
     }
     if (!empty($this->masterTemplates)) {
         $this->replaceMarkersFromMaster();
     }
     //substitute ISSET markers
     $this->substituteIssetSubparts();
     //fill TypoScript markers
     if (is_array($this->settings['markers.'])) {
         $this->fillTypoScriptMarkers();
     }
     //fill default markers
     $this->fillDefaultMarkers();
     if (intval($this->settings['fillValueMarkersBeforeLangMarkers']) === 1) {
         //fill value_[fieldname] markers
         $this->fillValueMarkers();
     }
     //fill LLL:[language_key] markers
     $this->fillLangMarkers();
     $this->fillSelectedMarkers();
     if (intval($this->settings['fillValueMarkersBeforeLangMarkers']) !== 1) {
         //fill value_[fieldname] markers
         $this->fillValueMarkers();
     }
     //remove markers that were not substituted
     $content = Tx_Formhandler_StaticFuncs::removeUnfilledMarkers($this->template);
     return trim($content);
 }
コード例 #2
0
 /**
  * Main method called by the controller.
  *
  * @param array $gp The current GET/POST parameters
  * @param array $errors The errors occurred in validation
  * @return string content
  */
 public function render($gp, $errors)
 {
     //set GET/POST parameters
     $this->gp = $gp;
     //set template
     $this->template = $this->subparts['template'];
     if (!$this->template) {
         Tx_Formhandler_StaticFuncs::throwException('no_template_file');
     }
     $this->errors = $errors;
     //set language file
     if (!$this->langFiles) {
         $this->langFiles = Tx_Formhandler_Globals::$langFiles;
     }
     //fill Typoscript markers
     if (is_array($this->settings['markers.'])) {
         $this->fillTypoScriptMarkers();
     }
     //read master template
     if (!$this->masterTemplates) {
         $this->readMasterTemplates();
     }
     if (!empty($this->masterTemplates)) {
         $this->replaceMarkersFromMaster();
     }
     if (Tx_Formhandler_Globals::$ajaxHandler) {
         $markers = array();
         Tx_Formhandler_Globals::$ajaxHandler->fillAjaxMarkers($markers);
         $this->template = $this->cObj->substituteMarkerArray($this->template, $markers);
     }
     //fill Typoscript markers
     if (is_array($this->settings['markers.'])) {
         $this->fillTypoScriptMarkers();
     }
     $this->substituteHasTranslationSubparts();
     if (!$this->gp['submitted']) {
         $this->storeStartEndBlock();
     } elseif (intval(Tx_Formhandler_Globals::$session->get('currentStep')) !== 1) {
         $this->fillStartEndBlock();
     }
     if (intval($this->settings['fillValueMarkersBeforeLangMarkers']) === 1) {
         //fill value_[fieldname] markers
         $this->fillValueMarkers();
     }
     //fill LLL:[language_key] markers
     $this->fillLangMarkers();
     //substitute ISSET markers
     $this->substituteIssetSubparts();
     //fill default markers
     $this->fillDefaultMarkers();
     if (intval($this->settings['fillValueMarkersBeforeLangMarkers']) !== 1) {
         //fill value_[fieldname] markers
         $this->fillValueMarkers();
     }
     //fill selected_[fieldname]_value markers and checked_[fieldname]_value markers
     $this->fillSelectedMarkers();
     //fill LLL:[language_key] markers again to make language markers in other markers possible
     $this->fillLangMarkers();
     //fill error_[fieldname] markers
     if (!empty($errors)) {
         $this->fillIsErrorMarkers($errors);
         $this->fillErrorMarkers($errors);
     }
     //remove markers that were not substituted
     $content = Tx_Formhandler_StaticFuncs::removeUnfilledMarkers($this->template);
     return $this->pi_wrapInBaseClass($content);
 }
コード例 #3
0
    /**
     * This function returns the index table.
     *
     * @param array &$records The records to show in table
     * @return string HTML
     * @author Reinhard Führicht <*****@*****.**>
     */
    protected function getTable(&$records)
    {
        global $LANG;
        //get filter
        $table = $this->getFilterSection();
        if (count($records) == 0) {
            return $table . '<div>' . $LANG->getLL('no_records') . '</div>';
        }
        //init gp params
        $params = t3lib_div::_GP('formhandler');
        $table .= $this->getFunctionArea();
        $tableCode = Tx_Formhandler_StaticFuncs::getSubpart($this->templateCode, '###LIST_TABLE###');
        $tableMarkers = array();
        $tableMarkers['###LLL:PAGE_ID###'] = $LANG->getLL('page_id');
        $tableMarkers['###LLL:SUBMISSION_DATE###'] = $LANG->getLL('submission_date');
        $tableMarkers['###LLL:IP###'] = $LANG->getLL('ip_address');
        $tableMarkers['###LLL:DETAIL_VIEW###'] = '';
        $tableMarkers['###LLL:EXPORT###'] = $LANG->getLL('export');
        $count = 1;
        $tableMarkers['###ROWS###'] = '';
        //add records
        foreach ($records as $record) {
            if ($count % 2 == 0) {
                $style = 'class="bgColor3-20"';
            } else {
                $style = 'class="bgColor3-40"';
            }
            if ($record['is_spam'] == 1) {
                $style = 'style="background-color:#dd7777"';
            }
            $rowCode = Tx_Formhandler_StaticFuncs::getSubpart($this->templateCode, '###LIST_TABLE_ROW###');
            $markers = array();
            $markers['###UID###'] = $this->id;
            $markers['###ROW_STYLE###'] = $style;
            $markers['###PID###'] = $record['pid'];
            $markers['###SUBMISSION_DATE###'] = date('Y/m/d H:i', $record['crdate']);
            $markers['###IP###'] = $record['ip'];
            $markers['###DETAIL_LINK###'] = '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $this->id . '&formhandler[detailId]=' . $record['uid'] . '"><img ' . t3lib_iconWorks::skinImg('../../../../../../typo3/', 'gfx/zoom.gif') . '/></a>';
            $markers['###EXPORT_LINKS###'] = '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $this->id . '&formhandler[detailId]=' . $record['uid'] . '&formhandler[renderMethod]=pdf">PDF</a>
						/<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $this->id . '&formhandler[detailId]=' . $record['uid'] . '&formhandler[renderMethod]=csv">CSV</a>';
            $checkbox = '<input type="checkbox" name="formhandler[markedUids][]" value="' . $record['uid'] . '" ';
            if (isset($params['markedUids']) && is_array($params['markedUids']) && in_array($record['uid'], $params['markedUids'])) {
                $checkbox .= 'checked="checked"';
            }
            $checkbox .= '/>';
            $markers['###CHECKBOX###'] = $checkbox;
            $count++;
            $tableMarkers['###ROWS###'] .= Tx_Formhandler_StaticFuncs::substituteMarkerArray($rowCode, $markers);
        }
        // add pagination
        $tableMarkers['###LLL:ENTRIES###'] = $LANG->getLL('pagination_show_entries');
        $tableMarkers['###WHICH_PAGEBROWSER###'] = $this->pageBrowser->displayBrowseBox();
        //add Export as option
        $table .= Tx_Formhandler_StaticFuncs::substituteMarkerArray($tableCode, $tableMarkers);
        $table .= Tx_Formhandler_StaticFuncs::getSubpart($this->templateCode, '###EXPORT_FIELDS###');
        $markers = array();
        $markers['###UID###'] = $this->id;
        $table = Tx_Formhandler_StaticFuncs::substituteMarkerArray($table, $markers);
        $table = $this->addCSS($table);
        return Tx_Formhandler_StaticFuncs::removeUnfilledMarkers($table);
    }