function rt_generate_product_carousel($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Product Carousel", "rt_theme_admin"); $contet_type = "product_carousel"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = "one passive_module"; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = 'display: none;'; $values = isset($options['values']) ? $options['values'] : array(); $item_width = $max_item = $crop = $list_order = $list_orderby = $categories = $heading_icon = $heading = ""; extract($values); echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>'; echo $this->module_controls($isNewBox); echo '</div><div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays product items as a carousel following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Heading", 'rt_theme_admin'), "desc" => __('Enter a title to be displayed above the product carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][heading]", "value" => $heading, "type" => "text"), array("name" => __("Heading Icon", 'rt_theme_admin'), "desc" => __('Select and set a icon to precede the product carousel title.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][heading_icon]", "class" => "icon_selection", "value" => $heading_icon, "type" => "text"), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of product items presented in the carousel. If you don't select and set a category, this module will show all product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][categories][]", "options" => RTTheme::rt_get_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the product items within the product carousel by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("type" => "td_col"), array("name" => __("Crop Image", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][crop]", "check_desc" => __("Enable (if checked) cropping for product images", 'rt_theme_admin'), "type" => "checkbox", "class" => $randomClass, "value" => $crop, "default" => "on", "std" => "false"), array("name" => __("Carousel Style", 'rt_theme_admin'), "desc" => __('Select and set the carousel style.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][style]", "options" => array("plain_carousel" => "Plain Box", "rounded_carousel" => "With Borders"), "default" => "1", "value" => $item_width, "type" => "select"), array("name" => __("Maximum product", 'rt_theme_admin'), "desc" => __("Set the amount of product items to be displayed within the carousel.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][max_item]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $max_item, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for the carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_carousel[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "table_end")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
function rt_generate_product_box($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Product Posts", "rt_theme_admin"); $contet_type = "product_box"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = "one passive_module"; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = 'display: none;'; $values = isset($options['values']) ? $options['values'] : array(); $heading = $pagination = $item_width = $list_orderby = $list_orderby = $list_order = $item_per_page = $categories = $display_descriptions = $display_price = $display_titles = $with_borders = $with_effect = $no_top_border = $no_bottom_border = ""; extract($values); echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>'; echo $this->module_controls($isNewBox); echo '</div><div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays product items following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Embedded Heading", 'rt_theme_admin'), "desc" => __('Enter a title to be displayed as embedded to the grid.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][heading]", "value" => $heading, "type" => "text"), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of product items presented in the productlist. If you don't select and set a category, this module will list all product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][categories][]", "options" => RTTheme::rt_get_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the product items within the product list by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("Amount of product post per page", 'rt_theme_admin'), "desc" => __("Set the amount of product items to display at once per page.<br /><strong>Note</strong> : works in conjunction with the pagination settings.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for listing the product items. (<strong>Note</strong> : when used in a column module which is f.e. set to a 1/5 column it is better to set the content layout to a 1/1 layout.)', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "td_col"), array("name" => __("Pagination", 'rt_theme_admin'), "desc" => __("Enable (if checked) the pagination ability for the product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][pagination]", "type" => "checkbox2", "class" => $randomClass, "value" => $pagination, "default" => "off", "std" => "false"), array("name" => __("Display Titles", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][display_titles]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_titles, "default" => "on", "std" => "false"), array("name" => __("Display Descriptions", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][display_descriptions]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_descriptions, "default" => "on", "std" => "false"), array("name" => __("Display Prices", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][display_price]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_price, "default" => "on", "std" => "false"), array("name" => __("Display as Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) the list will be displayed in grid style.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][with_borders]", "type" => "checkbox2", "class" => $randomClass, "value" => $with_borders, "std" => "false"), array("name" => __("Enable Sliding Info", 'rt_theme_admin'), "desc" => __("Enable (if checked) the mouse over sliding info for the items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][with_effect]", "type" => "checkbox2", "class" => $randomClass, "value" => $with_effect, "default" => "off", "std" => "false"), array("name" => __("Remove Top Borders of the Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) to remove the top borders of the grid will be removed. In some cases you may need this option checked to make your design much beatuiful.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][no_top_border]", "type" => "checkbox2", "class" => $randomClass, "value" => $no_top_border, "std" => "false"), array("name" => __("Remove Bottom Borders of the Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) to remove the bottom borders of the grid will be removed. In some cases you may need this option checked to make your design much beatuiful.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[values][no_bottom_border]", "type" => "checkbox2", "class" => $randomClass, "value" => $no_bottom_border, "std" => "false"), array("type" => "table_end")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
function rt_generate_product_categories($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Product Categories", "rt_theme_admin"); $contet_type = "product_categories"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = "one passive_module"; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = 'display: none;'; $values = isset($options['values']) ? $options['values'] : array(); $parent = $ids = $orderby = $order = $item_width = $crop = $image_max_height = $display_titles = $display_descriptions = $display_thumbnails = ""; extract($values); echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>'; echo $this->module_controls($isNewBox); echo '</div><div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays product categories following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Select Parent Category", 'rt_theme_admin'), "desc" => __("(Optional) Select a parent category to list only the subcategories of the category.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][parent]", "options" => array_merge(array("" => "Select"), RTTheme::rt_get_product_categories()), "purpose" => "sidebar", "type" => "select", "class" => $randomClass, "default" => $parent), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("(Optional) List only selected categories. ", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][ids][]", "options" => RTTheme::rt_get_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $ids), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the product items within the product list by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][orderby]", "options" => array('id' => __('ID', 'rt_theme_admin'), 'name' => __('Name', 'rt_theme_admin'), 'slug' => __('Slug', 'rt_theme_admin'), 'count' => __('Count', 'rt_theme_admin')), "value" => $orderby, "default" => "name", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("List Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for listing list. ', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "td_col"), array("name" => __("Display Titles", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][display_titles]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_titles, "default" => "on", "std" => "false"), array("name" => __("Display Descriptions", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][display_descriptions]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_descriptions, "default" => "on", "std" => "false"), array("name" => __("Display Thumbnails", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][display_thumbnails]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_thumbnails, "default" => "on", "std" => "false"), array("name" => __("Crop Thumnails", 'rt_theme_admin'), "desc" => __("Enable (if checked) the the category thumbnails will be cropped according the 'Maximum Thumbnail Height' value.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][crop]", "type" => "checkbox2", "class" => $randomClass, "value" => $crop, "std" => "false"), array("name" => __("Maximum Thumbnail Height", 'rt_theme_admin'), "desc" => __("Maximum image height for the category thumbnails. 'Crop Thumbnails' option must be checked in order to use this option.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_categories[values][image_max_height]", "min" => "20", "max" => "2000", "class" => $randomClass, "value" => $image_max_height, "default" => "400", "dont_save" => true, "type" => "rangeinput"), array("type" => "table_end")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
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 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); }
function rt_generate_product_box($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Product Posts", "rt_theme_admin"); $contet_type = "product_box"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = $isNewBox ? 'full expanded"' : $options['layout']; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = $isNewBox ? '' : 'display: none;'; $pagination = $isNewBox ? '' : $options['pagination']; $item_width = $isNewBox ? '' : $options['item_width']; $categories = $isNewBox ? '' : @$options['categories']; $list_orderby = $isNewBox ? '' : $options['list_orderby']; $list_order = $isNewBox ? '' : $options['list_order']; $item_per_page = $isNewBox ? '' : $options['item_per_page']; $ajax_scroller = $isNewBox ? '' : $options['ajax_scroller']; echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"> <div class="Itemheader"><h5>' . $boxName . '</h5>'; echo '<div class="expand ' . $position . '"></div><div class="move"></div></div> <div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays product posts according the options below.", 'rt_theme_admin'), "hr" => "true", "type" => "info_text_only"), array("name" => __("Column Width", 'rt_theme_admin'), "desc" => __("Please select a column size for this module.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[layout]", "options" => array("one" => "Full Width", "two" => "1:2 - One Second", "three" => "1:3 - One Third", "four" => "1:4 - One Fourth", "five" => "1:5 - One Fifth", "two-three" => "2:3 - Second Third", "three-four" => "3:4 - Third Fourth", "four-five" => "4:5 - Four Fifth"), "default" => "one", "value" => $layout, "class" => "layout_selector", "hr" => "true", "type" => "select"), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("You can filter posts by selecting categories from this list. If you don't select one, all product posts will be displayed.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[categories][]", "options" => RTTheme::rt_get_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("sort products by this parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "hr" => true, "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Designates the ascending or descending order of the ORDERBY parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "hr" => true, "type" => "select"), array("name" => __("Amount of product post per page", 'rt_theme_admin'), "desc" => __("How many product do you want to display per page?", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "hr" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __("Please select a layout for the contents that will be displayed in this column.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "hr" => "true", "type" => "select"), array("name" => __("Pagination", 'rt_theme_admin'), "desc" => __("Adds page navigation under the product posts.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[pagination]", "type" => "checkbox", "class" => $randomClass, "value" => $pagination, "hr" => true, "default" => "off", "std" => "false"), array("name" => __("Ajax Product Sroller", 'rt_theme_admin'), "desc" => __("You can turn ON this option to activate ajax paginations. The pagination option above must be ON also to use this feature.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_product_box[ajax_scroller]", "type" => "checkbox", "class" => $randomClass, "value" => $ajax_scroller, "hr" => true, "default" => "off", "std" => "false"), array("name" => __("delete", 'rt_theme_admin'), "id" => "_delete", "class" => "deleteButton template_box_delete", "purpose" => "page_template", "type" => "button"), array("name" => __("close", 'rt_theme_admin'), "id" => "_close", "class" => "closeButton template_box_close", "purpose" => "page_template", "type" => "button")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
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); }