Beispiel #1
0
 /**
  * Loads theme settings in an array named $FlutterThemeSettings 
  *
  */
 function PrepareThemeSettings()
 {
     global $FlutterThemeSettings;
     $moduleSettings = FlutterLayoutBlock::GetModuleSettings(-1);
     if (!empty($moduleSettings)) {
         $FlutterThemeSettings = $moduleSettings->GetProcessedVariables();
     }
 }
    /**
     * This function  is for add new element at the Flutter i
     * layout settings
     *
     * @author David Valdez <*****@*****.**>
     */
    function show_layout_settings()
    {
        global $flutter_domain, $wpdb;
        $template = get_option('template');
        $registered_layout = $wpdb->get_var("SELECT COUNT(*) FROM " . FLUTTER_TABLE_LAYOUT_MODULES . " WHERE theme = '{$template}'");
        if ($registered_layout == 0) {
            $wpdb->query("INSERT INTO " . FLUTTER_TABLE_LAYOUT_MODULES . " (module_id,theme,page,duplicate_id) VALUES (-1,'{$template}','-',0)");
        } else {
            $template_module_id = $wpdb->get_var("SELECT module_id  FROM " . FLUTTER_TABLE_LAYOUT_MODULES . " WHERE theme = '{$template}'");
        }
        if (!empty($_GET['flutter_action']) && $_GET['flutter_action'] == "create-layout-setting") {
            RCCWP_ThemeSettingsPage::create_layout_element();
            exit;
        }
        ?>

        
        <script type="text/javascript">
            jQuery('document').ready(function(){
                jQuery('.del_element').click(function(){ 
                    if(!confirm("<?php 
        echo _e("are you sure?", $flutter_domain);
        ?>
")){
                        return false;
                    }
                });
            });
        </script>
             

        <?php 
        $modules = FlutterLayoutBlock::GetModuleSettings($template_module_id);
        $table_header = "<table cellpadding='3' cellspacing='3' width='100%' class='widefat'>";
        $table_header .= "<thead><tr><th scope='col' width='70%'>" . __('Name', $flutter_domain) . "</th><th scope='col' colspan='2'>" . __('Actions', $flutter_domain) . "</th></tr></thead><tbody>";
        $table_body = "";
        $table_footer = "</tbody></table>";
        if (empty($modules->variables)) {
            echo "<h2>" . __("You don't have any setting created,  start creating one", $flutter_domain) . "</h2>";
            echo "<br /><a href='?page=RCCWP_ThemeSettingsPage&flutter_action=create-layout-setting'>Add new layout setting</a>";
            exit;
        }
        foreach ($modules->variables as $varkey => $variable) {
            if (empty($class)) {
                $class = "";
            }
            $class = $class == '' ? 'alternate' : '';
            $table_body .= "<tr class='{$class}'>";
            $table_body .= "<td>{$variable->variable_name}</td>";
            $table_body .= "<td></td>";
            $table_body .= "<td><a class='del_element' id='del_{$variable->variable_id}'  href='?page=RCCWP_ThemeSettingsPage&element_id={$variable->variable_id}&flutter_action=delete-theme-settings'>" . __("Delete", $flutter_domain) . "</a></td>";
            $table_body .= "</tr>";
        }
        echo $table_header . $table_body . $table_footer;
        echo "<br /><br /><a href='?page=RCCWP_ThemeSettingsPage&flutter_action=create-layout-setting'>" . __('add new template option', $flutter_domain) . "</a>";
        echo "<br /><br />";
        echo '<a href="http://flutter.freshout.us"><img src="' . FLUTTER_URI . '/images/flutter_logo.jpg" /></a>';
    }