Exemple #1
0
 function generate_template_forms()
 {
     //remove module if woocommerce not installed
     if (!class_exists('Woocommerce')) {
         unset($this->rt_modules["woo_products_box"]);
     }
     //remove module if layerslider not installed
     if (!rt_check_layer_slider()) {
         unset($this->rt_modules["layerslider_box"]);
     }
     //remove module if revslider not installed
     if (!class_exists('RevSlider')) {
         unset($this->rt_modules["revslider_box"]);
     }
     // Pages
     $rt_getpages = RTTheme::rt_get_pages();
     // Categories
     $rt_getcat = RTTheme::rt_get_categories();
     // Product Categories
     $rt_product_getcat = RTTheme::rt_get_product_categories();
     // Woo Product Categories
     if (class_exists('Woocommerce')) {
         $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories();
     }
     // reset query
     wp_reset_query();
     // get saved tempalates list
     $savedTemplatesList = get_option(RT_THEMESLUG . '_template_names_array');
     // costruct form arrays
     $options = array();
     //template builder info text
     array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a build-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create as many new templates as you wish. In order to use the templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page. To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info"));
     if ($savedTemplatesList) {
         foreach ($savedTemplatesList as $TemplateID => $templateData) {
             // get saved templates list
             $savedTemplates = get_option(RT_THEMESLUG . '_template_names_array');
             // get this tempalate data
             $thisTemplate = $this->get_template_data($TemplateID);
             if (is_object($thisTemplate)) {
                 // init the form
                 foreach ($thisTemplate->templates as $template) {
                     //tempalte name
                     $template_name = $templateData["name"];
                     //Start Form
                     array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => $template_name));
                     //Hidden Value
                     array_push($options, array("type" => "hidden", "id" => "templateBuilder", "value" => "true"));
                     //End Form
                     array_push($options, array("type" => "form_end"));
                 }
             }
         }
     }
     // New Template
     $randomnumber = rand(1000, 1000000);
     $TemplateID = 'templateid_' . $randomnumber;
     $templateName = $TemplateID . '_template_name';
     //Start Form
     array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => __("New Template #" . $randomnumber, 'rt_theme_admin')));
     //Start header row
     array_push($options, array("id" => "templateid_" . $TemplateID . "_1_grid", "options" => array('group_id' => 1, 'part' => 'full', 'header_purpose' => true, 'footer_purpose' => false, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //Start grid
     array_push($options, array("id" => "templateid_" . $TemplateID . "_2_grid", "options" => array('group_id' => 2, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => false), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //Start footer row
     array_push($options, array("id" => "templateid_" . $TemplateID . "_3_grid", "options" => array('group_id' => 3, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => true, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //End Form
     array_push($options, array("type" => "form_end"));
     //template builder list templates
     array_push($options, array("type" => "list_templates", "templateID" => $TemplateID));
     $this->rt_generate_form_page($options, 'template_builder', $TemplateID);
 }
Exemple #2
0
 function __construct()
 {
     // Pages
     $rt_getpages = RTTheme::rt_get_pages();
     // Posts
     $this->posts = query_posts('posts_per_page=-1&post_type=post&orderby=title&order=ASC');
     // Regular Posts
     $this->products = query_posts('posts_per_page=-1&post_type=products&orderby=title&order=ASC');
     // Products
     $this->portfolios = query_posts('posts_per_page=-1&post_type=portfolio&orderby=title&order=ASC');
     // Portfolios
     $rt_getposts = array();
     foreach ($this->posts as $post_list) {
         // add regular posts to the list
         $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title;
     }
     foreach ($this->products as $post_list) {
         // add product posts to the list
         $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title;
     }
     foreach ($this->portfolios as $post_list) {
         // add portfolio posts to the list
         $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title;
     }
     // Categories
     $rt_getcat = RTTheme::rt_get_categories();
     // Product Categories
     $rt_product_getcat = RTTheme::rt_get_product_categories();
     // Portfolio Categories
     $rt_portfolio_getcat = RTTheme::rt_get_portfolio_categories();
     // reset query
     wp_reset_query();
     // get saved values
     $savedSidebars = get_option('rt_sidebar_options');
     // create new sidebar array
     $savedSidebars_array = array();
     // Count Sidebars
     $savedSidebars_IDs = array();
     $sidebar_count = 0;
     if ($savedSidebars) {
         foreach ($savedSidebars as $key => $value) {
             if (!is_array($value)) {
                 if (stristr($key, '_sidebar_name') == TRUE) {
                     array_push($savedSidebars_IDs, $key);
                     $sidebar_count++;
                 }
             }
         }
     }
     // costruct saved array
     foreach ($savedSidebars_IDs as $id) {
         //sidebar
         $sidebar_name = $savedSidebars[$id];
         $sidebar_id = str_replace("_sidebar_name", "", $id);
         $sidebar_pages = isset($savedSidebars[$sidebar_id . '_pages']) ? $savedSidebars[$sidebar_id . '_pages'] : "";
         $sidebar_posts = isset($savedSidebars[$sidebar_id . '_posts']) ? $savedSidebars[$sidebar_id . '_posts'] : "";
         $sidebar_categories = isset($savedSidebars[$sidebar_id . '_categories']) ? $savedSidebars[$sidebar_id . '_categories'] : "";
         $sidebar_product_categories = isset($savedSidebars[$sidebar_id . '_productcategories']) ? $savedSidebars[$sidebar_id . '_productcategories'] : "";
         $sidebar_portfolio_categories = isset($savedSidebars[$sidebar_id . '_portfoliocategories']) ? $savedSidebars[$sidebar_id . '_portfoliocategories'] : "";
         //sidebar array
         array_push($savedSidebars_array, array("name" => $sidebar_name, "id" => $sidebar_id, "options" => array('pages' => $sidebar_pages, 'posts' => $sidebar_posts, 'categories' => $sidebar_categories, 'productcategories' => $sidebar_product_categories, 'portfoliocategories' => $sidebar_portfolio_categories)));
     }
     // costruct form arrays
     $options = array();
     //template builder info text
     array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('If you need a new sidebar widget area for specified contents, you can create one by using Sidebar Creator. When you create a sidebar go to Appearence → <a href="widgets.php">Widgets</a> to drag&drop widgets into it.', 'rt_theme_admin'), "hr" => "true", "type" => "info"));
     foreach ($savedSidebars_array as $sidebar_v) {
         $sidebarID = $sidebar_v["id"];
         //Sidebar Div
         array_push($options, array("id" => "div_" . $sidebarID, "name" => $sidebar_v["name"], "type" => "div"));
         //Sidebar Names
         array_push($options, array("name" => __("Sidebar Name", 'rt_theme_admin'), "value" => $sidebar_v["name"], "id" => $sidebarID . "_sidebar_name", "class" => "sidebar_name saved", "type" => "text"));
         //For Pages
         array_push($options, array("name" => __("Select Pages", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_pages[]", "options" => $rt_getpages, "default" => $sidebar_v["options"]["pages"], "purpose" => "sidebar", "type" => "selectmultiple"));
         //For Posts
         array_push($options, array("name" => __("Select Posts", 'rt_theme_admin'), "desc" => __("Regular Posts, Products, Portfolio", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_posts[]", "options" => $rt_getposts, "default" => $sidebar_v["options"]["posts"], "purpose" => "sidebar", "class" => "postlist", "type" => "selectmultiple"));
         //For Categories
         array_push($options, array("name" => __("Select Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_categories[]", "options" => $rt_getcat, "default" => $sidebar_v["options"]["categories"], "purpose" => "sidebar", "type" => "selectmultiple"));
         //For Product Categories
         array_push($options, array("name" => __("Select Product Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_productcategories[]", "options" => $rt_product_getcat, "default" => $sidebar_v["options"]["productcategories"], "purpose" => "sidebar", "type" => "selectmultiple"));
         //For Portfolio Categories
         array_push($options, array("name" => __("Select Portfolio Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_portfoliocategories[]", "options" => $rt_portfolio_getcat, "default" => $sidebar_v["options"]["portfoliocategories"], "purpose" => "sidebar", "type" => "selectmultiple"));
         //Button
         array_push($options, array("name" => __("Delete Sidebar", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_delete", "class" => "deleteButton", "purpose" => "sidebar", "type" => "button"));
         //Sidebar Divend
         array_push($options, array("id" => "", "type" => "divend"));
     }
     // New Sidebar
     $sidebarID = 'sidebarid_' . rand(1, 100000);
     $sidebarName = $sidebarID . '_sidebar_name';
     //Sidebar Div
     array_push($options, array("name" => __("Create New Sidebar", 'rt_theme_admin'), "id" => "div_" . $sidebarID, "class" => "new_sidebar", "type" => "div"));
     //Sidebar Names
     array_push($options, array("name" => __("Sidebar Name", 'rt_theme_admin'), "value" => "", "class" => "sidebar_name", "id" => $sidebarName, "type" => "text"));
     //For Pages
     array_push($options, array("name" => __("Select Pages", 'rt_theme_admin'), "id" => $sidebarID . "_pages[]", "options" => $rt_getpages, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple"));
     //For Posts
     array_push($options, array("name" => __("Select Posts", 'rt_theme_admin'), "id" => $sidebarID . "_posts[]", "options" => $rt_getposts, "desc" => __("Regular Posts, Products, Portfolio", 'rt_theme_admin'), "default" => "", "class" => "postlist", "purpose" => "sidebar", "type" => "selectmultiple"));
     //For Categories
     array_push($options, array("name" => __("Select Categories", 'rt_theme_admin'), "id" => $sidebarID . "_categories[]", "options" => $rt_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple"));
     //For Product Categories
     array_push($options, array("name" => __("Select Product Categories", 'rt_theme_admin'), "id" => $sidebarID . "_productcategories[]", "options" => $rt_product_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple"));
     //For Portfolio Categories
     array_push($options, array("name" => __("Select Portfolio Categories", 'rt_theme_admin'), "id" => $sidebarID . "_portfoliocategories[]", "options" => $rt_portfolio_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple"));
     //Send button
     array_push($options, array("name" => __("Create Sidebar", 'rt_theme_admin'), "id" => $sidebarID . "_send_button", "class" => "create_button sidebarCreate", "purpose" => "page_layouts", "type" => "send_button"));
     //Sidebar Divend
     array_push($options, array("id" => "", "type" => "divend"));
     $this->rt_generate_form_page($options);
 }
 function __construct()
 {
     // Items
     $rt_items = array("slider_box" => "Slider", "revolution_box" => "Revolution Slider", "blog_box" => "Blog Posts", "contact_info_box" => "Contact Info", "contact_form" => "Contact Form", "google_map" => "Google Map", "all_content_boxes" => "Home Page Content", "portfolio_box" => "Portfolio", "product_box" => "Product", "woo_products_box" => "WooCommerce Products", "sidebar_box" => "Widget Area - Sidebar", "default_content" => "Default Content + Page Title", "banner_box" => "Banner Box", "heading_bar" => "Heading Bar", "code_box" => "Code Box");
     //remove module if woocommerce not installed
     if (!class_exists('Woocommerce')) {
         unset($rt_items["woo_products_box"]);
     }
     // Pages
     $rt_getpages = RTTheme::rt_get_pages();
     // Categories
     $rt_getcat = RTTheme::rt_get_categories();
     // Product Categories
     $rt_product_getcat = RTTheme::rt_get_product_categories();
     // Woo Product Categories
     if (class_exists('Woocommerce')) {
         $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories();
     }
     // reset query
     wp_reset_query();
     // get saved values
     $savedTemplates = get_option('rt_page_layouts');
     // costruct form arrays
     $options = array();
     //template builder info text
     array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a built-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create a new one as you wish. In order to use this templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page.  To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info"));
     if ($savedTemplates) {
         foreach ($savedTemplates->templates as $template) {
             $TemplateID = $template->templateID;
             $template_name = $template->templateName;
             $lineUp = isset($template->lineup) ? $template->lineup : "";
             //Temlates Div
             array_push($options, array("id" => "div_" . $TemplateID, "name" => $template_name, "type" => "div"));
             //Template Name
             array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => $template_name, "id" => $TemplateID . "_template_name", "class" => "sidebar_name saved", "hr" => "true", "type" => "text"));
             //Sidebar selection
             array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $TemplateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => $template->sidebar, "purpose" => "page_layouts", "hr" => "true", "class" => "layout_selector", "type" => "radio"));
             //Create Item Select List
             array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $TemplateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select"));
             //Heading
             array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $TemplateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading"));
             //Create Grid First Part
             array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "first"));
             if (isset($template->contents) && is_array($template->contents)) {
                 foreach ($template->contents as $templateContents) {
                     //possible empty values - fix php warnings
                     $templateContents->categories = isset($templateContents->categories) ? $templateContents->categories : "";
                     $templateContents->thumbs_width = isset($templateContents->thumbs_width) ? $templateContents->thumbs_width : "";
                     $templateContents->thumbs_height = isset($templateContents->thumbs_height) ? $templateContents->thumbs_height : "";
                     $templateContents->filterable = isset($templateContents->filterable) ? $templateContents->filterable : "";
                     $templateContents->list_order = isset($templateContents->list_order) ? $templateContents->list_order : "";
                     //Call Home Page Box
                     if ($templateContents->content_type == "home_page_box") {
                         array_push($options, array("id" => $TemplateID . "_home_page_contents", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id), "purpose" => "page_layouts", "content_type" => "home_page_box", "type" => "template_item"));
                     }
                     //Call Portfolio Posts
                     if ($templateContents->content_type == "portfolio_box") {
                         array_push($options, array("id" => $TemplateID . "_portfolio_posts", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'categories' => @$templateContents->categories, 'pagination' => $templateContents->pagination, 'item_width' => $templateContents->item_width, 'portf_list_orderby' => $templateContents->portf_list_orderby, 'portf_list_order' => $templateContents->portf_list_order, 'item_per_page' => $templateContents->item_per_page, 'filterable' => $templateContents->filterable), "purpose" => "page_layouts", "content_type" => "portfolio_box", "type" => "template_item"));
                     }
                     //Call Sidebar Box
                     if ($templateContents->content_type == "sidebar_box") {
                         array_push($options, array("id" => $TemplateID . "_sidebar_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'sidebar_id' => $templateContents->sidebar_id, 'widget_box_width' => $templateContents->widget_box_width), "purpose" => "page_layouts", "content_type" => "sidebar_box", "type" => "template_item"));
                     }
                     //Call Default Content Box
                     if ($templateContents->content_type == "default_content") {
                         array_push($options, array("id" => $TemplateID . "_default_content", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => $templateContents->heading), "purpose" => "page_layouts", "content_type" => "default_content", "type" => "template_item"));
                     }
                     //Call All content boxes
                     if ($templateContents->content_type == "all_content_boxes") {
                         array_push($options, array("id" => $TemplateID . "_all_content_boxes", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order), "purpose" => "page_layouts", "content_type" => "all_content_boxes", "type" => "template_item"));
                     }
                     //Call banner boxes
                     if ($templateContents->content_type == "banner_box") {
                         array_push($options, array("id" => $TemplateID . "_banner_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'text' => stripslashes($templateContents->text), 'button_text' => $templateContents->button_text, 'button_link' => $templateContents->button_link), "purpose" => "page_layouts", "content_type" => "banner_box", "type" => "template_item"));
                     }
                     //Call slider boxes
                     if ($templateContents->content_type == "slider_box") {
                         array_push($options, array("id" => $TemplateID . "_slider_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_script' => $templateContents->slider_script, 'content_id' => $templateContents->content_id, 'slider_timeout' => $templateContents->slider_timeout, 'slider_height' => $templateContents->slider_height, 'image_resize' => $templateContents->image_resize, 'image_crop' => $templateContents->image_crop, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'slider_buttons' => $templateContents->slider_buttons, 'slider_thumbs' => $templateContents->slider_thumbs, 'thumbs_width' => $templateContents->thumbs_width, 'thumbs_height' => $templateContents->thumbs_height, 'slider_effect' => $templateContents->slider_effect), "purpose" => "page_layouts", "content_type" => "slider_box", "type" => "template_item"));
                     }
                     //Call revolution slider boxes
                     if ($templateContents->content_type == "revolution_box") {
                         array_push($options, array("id" => $TemplateID . "_revolution_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_id' => $templateContents->slider_id), "purpose" => "page_layouts", "content_type" => "revolution_box", "type" => "template_item"));
                     }
                     //Call product boxes
                     if ($templateContents->content_type == "product_box") {
                         array_push($options, array("id" => $TemplateID . "_product_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'ajax_scroller' => @$templateContents->ajax_scroller, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "product_box", "type" => "template_item"));
                     }
                     if (class_exists('Woocommerce')) {
                         //Call woo product boxes
                         if ($templateContents->content_type == "woo_products_box") {
                             array_push($options, array("id" => $TemplateID . "_woo_products_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "woo_products_box", "type" => "template_item"));
                         }
                     }
                     //Call blog boxes
                     if ($templateContents->content_type == "blog_box") {
                         array_push($options, array("id" => $TemplateID . "_blog_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => @$templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "blog_box", "type" => "template_item"));
                     }
                     //Call google map
                     if ($templateContents->content_type == "google_map") {
                         array_push($options, array("id" => $TemplateID . "_google_map", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'map_url' => stripslashes($templateContents->map_url), 'height' => $templateContents->height), "purpose" => "page_layouts", "content_type" => "google_map", "type" => "template_item"));
                     }
                     //Call contact form
                     if ($templateContents->content_type == "contact_form") {
                         array_push($options, array("id" => $TemplateID . "_contact_form", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'title' => stripslashes($templateContents->title), 'email' => $templateContents->email, 'shortcode' => stripslashes($templateContents->shortcode), 'description' => stripslashes($templateContents->description)), "purpose" => "page_layouts", "content_type" => "contact_form", "type" => "template_item"));
                     }
                     //Call contact info box
                     if ($templateContents->content_type == "contact_info_box") {
                         array_push($options, array("id" => $TemplateID . "_contact_info_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'contact_title' => stripslashes($templateContents->contact_title), 'contact_text' => stripslashes($templateContents->contact_text), 'address' => stripslashes($templateContents->address), 'phone' => stripslashes($templateContents->phone), 'email' => stripslashes($templateContents->email), 'support_email' => stripslashes($templateContents->support_email), 'fax' => stripslashes($templateContents->fax)), "purpose" => "page_layouts", "content_type" => "contact_info_box", "type" => "template_item"));
                     }
                     //Call heading bar
                     if ($templateContents->content_type == "heading_bar") {
                         array_push($options, array("id" => $TemplateID . "_heading_bar", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading)), "purpose" => "page_layouts", "content_type" => "heading_bar", "type" => "template_item"));
                     }
                     //Call code box
                     if ($templateContents->content_type == "code_box") {
                         array_push($options, array("id" => $TemplateID . "_code_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading), 'code_space' => stripslashes($templateContents->code_space), 'transparent' => stripslashes($templateContents->transparent), 'no_padding' => stripslashes($templateContents->no_padding)), "purpose" => "page_layouts", "content_type" => "code_box", "type" => "template_item"));
                     }
                 }
             }
             //Create Grid Second Part
             array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "second"));
             //Delete Button
             if ($TemplateID != "templateid_001" && $TemplateID != "templateid_002" && $TemplateID != "templateid_003" && $TemplateID != "templateid_004" && $TemplateID != "templateid_005") {
                 array_push($options, array("name" => __("Delete Template", 'rt_theme_admin'), "id" => $TemplateID . "_delete", "class" => "deleteButton deteleTemplateButton", "purpose" => "sidebar", "type" => "button"));
             }
             //Sidebar Divend
             array_push($options, array("id" => "", "type" => "divend"));
         }
     }
     // New Sidebar
     $templateID = 'templateid_' . rand(1000, 1000000);
     $templateName = $templateID . '_template_name';
     //Sidebar Div
     array_push($options, array("name" => __("Create New Template", 'rt_theme_admin'), "id" => "div_" . $templateID, "class" => "new_sidebar", "type" => "div"));
     //Template Names
     array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => "", "class" => "sidebar_name", "hr" => "true", "id" => $templateName, "type" => "text"));
     //Sidebar selection
     array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $templateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => "full", "purpose" => "page_layouts", "class" => "layout_selector", "hr" => "true", "type" => "radio"));
     //Create Item Select List
     array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $templateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select"));
     //Heading
     array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $templateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading"));
     //Create Grid
     array_push($options, array("id" => $templateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "full"));
     //Send button
     array_push($options, array("name" => __("Create Template", 'rt_theme_admin'), "id" => $templateID . "_send_button", "class" => "create_button", "purpose" => "page_layouts", "type" => "send_button"));
     //Sidebar Divend
     array_push($options, array("id" => "", "type" => "divend"));
     $this->rt_generate_form_page($options);
 }