function toggle($table)
{
    jpimport('models.dbef', true);
    $model = new JoomlapackModelDbef();
    $model->toggleFilter($table);
    return true;
}
Example #2
0
    /**
     * Returns the HTML for the table pane
     *
     * @return string The HTML
     */
    function getTablePane()
    {
        // Get the "backup method"
        jpimport('models.registry', true);
        $profile =& JoomlapackModelRegistry::getInstance();
        $method = $profile->get('backupMethod');
        // Load the model
        if (!class_exists('JoomlapackModelDbef')) {
            jpimport('models.dbef', true);
        }
        $model = new JoomlapackModelDbef();
        // Get tables of the current database
        $tables = $model->getTableList();
        $prefix = JApplication::getCfg('dbprefix');
        // Initialize output
        $txt_tables = JText::_('DBEF_LABEL_TABLES');
        $out = <<<ENDHTML
<table class="adminlist">
\t<thead>
\t\t<tr>
\t\t\t<th>{$txt_tables}</th>
\t\t</tr>
\t</thead>
\t<tbody>
ENDHTML;
        // Do we have tables?
        if (empty($tables)) {
            // No, warn user
            $out .= "<tr><td><p>" . JText::_('DBEF_ERROR_NOTABLES') . '</p></td></tr>';
        } else {
            $urlbase = JURI::base() . '/index.php?option=com_joomlapack&view=dbef&task=toggle&table=';
            foreach ($tables as $tableName) {
                $table = str_replace($prefix, '#__', $tableName);
                // Get abstract name
                if ($method == 'ajax') {
                    $href = 'javascript:toggle(\'' . addslashes($table) . '\');';
                } else {
                    $href = $urlbase . urlencode($table);
                }
                $htmlTable = htmlentities($tableName);
                // Make excluded table red and bold
                if ($excluded = $model->isSetFor($table)) {
                    $style = 'style="color:red; font-weight: bold; text-decoration: none"';
                } else {
                    $style = 'style="text-decoration: none"';
                }
                $out .= <<<ENDHTML
\t\t<tr>
\t\t\t<td>
\t\t\t\t<a href="{$href}" {$style}>{$htmlTable}</a>
\t\t\t</td>
\t\t</tr>
ENDHTML;
            }
        }
        $out .= <<<ENDHTML
\t</tbody>
</table>
ENDHTML;
        return $out;
    }