public static function removeTable($table_name)
 {
     $table = rex_xform_manager_table::get($table_name);
     $t = rex_sql::factory();
     $t->debugsql = self::$debug;
     $t->setQuery('delete from ' . rex_xform_manager_table::table() . ' where table_name="' . mysql_real_escape_string($table_name) . '"');
     if ($table) {
         foreach ($table->getFields() as $remove_field) {
             self::removeTablefield($table_name, $remove_field->getName());
         }
     }
 }
 static function checkMediaInUse($params)
 {
     global $REX, $I18N;
     $warning = $params['subject'];
     $sql = rex_sql::factory();
     $sql->setQuery('SELECT `table_name`, `type_name`, `name` FROM `' . rex_xform_manager_field::table() . '` WHERE `type_id`="value" AND `type_name` IN("be_medialist","be_mediapool","mediafile")');
     $rows = $sql->getRows();
     if ($rows == 0) {
         return $warning;
     }
     $where = array();
     $filename = addslashes($params['filename']);
     while ($sql->hasNext()) {
         $table = $sql->getValue('table_name');
         switch ($sql->getValue('type_name')) {
             case 'be_mediapool':
             case 'mediafile':
                 $where[$table][] = $sql->getValue('name') . '="' . $filename . '"';
                 break;
             case 'be_medialist':
                 $where[$table][] = 'FIND_IN_SET("' . $filename . '", ' . $sql->getValue('name') . ')';
                 break;
             default:
                 trigger_error('Unexpected fieldtype "' . $sql->getValue('type_name') . '"!', E_USER_ERROR);
         }
         $sql->next();
     }
     $tupel = '';
     foreach ($where as $table => $cond) {
         $sql->setQuery('SELECT id FROM ' . $table . ' WHERE ' . implode(' OR ', $cond));
         while ($sql->hasNext()) {
             $sql_tupel = rex_sql::factory();
             $sql_tupel->setQuery('SELECT name FROM `' . rex_xform_manager_table::table() . '` WHERE `table_name`="' . $table . '"');
             $tupel .= '<li><a href="javascript:openPage(\'index.php?page=xform&amp;subpage=manager&amp;tripage=data_edit&amp;table_name=' . $table . '&amp;data_id=' . $sql->getValue('id') . '&amp;func=edit\')">' . $sql_tupel->getValue('name') . ' [id=' . $sql->getValue('id') . ']</a></li>';
             $sql->next();
         }
     }
     if ($tupel != '') {
         $warning[] = 'Tabelle<br /><ul>' . $tupel . '</ul>';
     }
     return $warning;
 }
     global $I18N;
     $list = $params['list'];
     return $list->getValue('hidden') == 1 ? '<span style="color:grey;">' . $I18N->msg('xform_hidden') . '</span>' : '<span>' . $I18N->msg('xform_visible') . '</span>';
 }
 function rex_xform_list_translate($params)
 {
     return rex_translate($params['subject']);
 }
 $table_echo = '<b>';
 $table_echo .= $I18N->msg('xform_manager_table') . ': <a href=index.php?page=' . $page . '&subpage=' . $subpage . '&func=add>' . $I18N->msg('xform_manager_create') . '</a>';
 $table_echo .= ' | <a href=index.php?page=' . $page . '&subpage=' . $subpage . '&func=migrate><b>' . $I18N->msg('xform_manager_migrate') . '</a>';
 $table_echo .= ' ' . $I18N->msg('xform_manager_tableset') . ':</b> <a href=index.php?page=' . $page . '&subpage=' . $subpage . '&func=tableset_export>' . $I18N->msg('xform_manager_export') . '</a>';
 $table_echo .= ' | <a href=index.php?page=' . $page . '&subpage=' . $subpage . '&func=tableset_import>' . $I18N->msg('xform_manager_import') . '</a>';
 $table_echo .= '</b>';
 echo rex_content_block($table_echo);
 $sql = 'select id, prio, name, table_name, status, hidden from `' . rex_xform_manager_table::table() . '` order by prio,table_name';
 $list = rex_list::factory($sql, 30);
 $list->addParam('start', rex_request('start', 'int'));
 $list->removeColumn('id');
 $list->setColumnLabel('prio', $I18N->msg('xform_manager_table_prio_short'));
 $list->setColumnLabel('name', $I18N->msg('xform_manager_name'));
 $list->setColumnFormat('name', 'custom', 'rex_xform_list_translate');
 $list->setColumnLabel('table_name', $I18N->msg('xform_manager_table_name'));
 $list->setColumnParams('table_name', array('table_id' => '###id###', 'func' => 'edit'));
 $list->setColumnLabel('status', $I18N->msg('xform_manager_table_status'));
 $list->setColumnFormat('status', 'custom', 'rex_xform_status_col');
 $list->setColumnLabel('hidden', $I18N->msg('xform_manager_table_hidden'));
 $list->setColumnFormat('hidden', 'custom', 'rex_xform_hidden_col');
 $list->addColumn($I18N->msg('xform_edit'), $I18N->msg('xform_edit'));
 $list->setColumnParams($I18N->msg('xform_edit'), array('table_id' => '###id###', 'func' => 'edit'));
 $list->addColumn($I18N->msg('xform_delete'), $I18N->msg('xform_delete'));