/**
  * themeple_adminpages_gen::view_html()
  * 
  * @return
  */
 function view_html()
 {
     $current_slug = $_GET['page'];
     $firstactive = 'active_section';
     foreach ($this->controller->admin_pages as $key => $data_set) {
         if ($data_set['parent'] == $data_set['slug'] && $data_set['slug'] == $current_slug) {
             $this->controller->current['title'] = $data_set['title'];
             break;
         }
     }
     $this->controller->current['slug'] = $current_slug;
     $view = new themeple_viewgen($this->controller);
     echo $view->page_option_header();
     foreach ($this->controller->admin_pages as $option_page) {
         if ($current_slug == $option_page['parent']) {
             echo $view->generate_base_container($option_page, $firstactive);
             $firstactive = "";
         }
     }
     echo $view->page_option_footer();
 }
Ejemplo n.º 2
0
 /**
  * themeple_ajax_create_dynamic_options()
  * 
  * @return
  */
 function themeple_ajax_create_dynamic_options()
 {
     if (function_exists('check_ajax_referer')) {
         check_ajax_referer('themeple_admin_save_data');
     }
     $options = new themeple_database_options_sets();
     if ($_POST['method'] == 'add_option_page') {
         $result = $options->add_option_page($_POST);
         if (is_array($result)) {
             $html = new themeple_viewgen();
             $new_slug = $result['slug'];
             $result = "{themeple_ajax_option_page}" . $html->generate_base_container($result) . "{/themeple_ajax_option_page}";
             if (isset($_POST['default_elements'])) {
                 $elements = unserialize(base64_decode($_POST['default_elements']));
                 $result .= "{themeple_ajax_element}";
                 foreach ($elements as &$element) {
                     $element['id'] = $new_slug . $element['id'];
                     $element['slug'] = $new_slug;
                     $result .= $html->generate_element($element);
                     $options->add_element_to_db($element, $_POST);
                 }
                 $result .= "{/themeple_ajax_element}";
             }
         }
     }
     die($result);
 }