/** * Returns HTML code for an overview table showing all found tables and how many rows are in them. * * @global $LANG * @return string */ protected function getOverview() { global $LANG; $existingTables = $GLOBALS['TYPO3_DB']->admin_get_tables(); $code = Tx_Formhandler_StaticFuncs::getSubpart($this->templateCode, '###CLEAR_LOGS###'); $markers = array(); $markers['###URL###'] = $_SERVER['PHP_SELF']; $markers['###UID###'] = $this->id; $markers['###LLL:table###'] = $LANG->getLL('table'); $markers['###LLL:total_rows###'] = $LANG->getLL('total_rows'); $markers['###TABLES###'] = ''; foreach ($existingTables as $table => $tableSettings) { if (strpos($table, 'tx_formhandler_') > -1) { $res = $GLOBALS['TYPO3_DB']->sql_query('SELECT COUNT(*) as rowCount FROM ' . $table); if ($res) { $rowCode = Tx_Formhandler_StaticFuncs::getSubpart($this->templateCode, '###CLEAR_LOGS_TABLE###'); $tableMarkers = array(); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $tableMarkers['###TABLE###'] = $table; $tableMarkers['###ROW_COUNT###'] = $row['rowCount']; $GLOBALS['TYPO3_DB']->sql_free_result($res); $markers['###TABLES###'] .= Tx_Formhandler_StaticFuncs::substituteMarkerArray($rowCode, $tableMarkers); } } } $markers['###LLL:clear###'] = $LANG->getLL('clear_selected_tables'); return Tx_Formhandler_StaticFuncs::substituteMarkerArray($code, $markers); }
/** * 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); }