From 7a2e087f13840b73ad526c552ecfab4659449382 Mon Sep 17 00:00:00 2001 From: Blair2004 Date: Sat, 23 Jan 2016 19:29:19 +0100 Subject: [PATCH] Merge Theme Mod to Core Merge Theme Mod to Core --- .gitignore | 1 + application/modules/theme_mod/config.xml | 12 ++ application/modules/theme_mod/manifest.json | 1 + application/modules/theme_mod/theme_mod.php | 115 ++++++++++ .../modules/theme_mod/views/mainscript.php | 203 ++++++++++++++++++ .../modules/theme_mod/views/menu_builder.php | 16 ++ .../theme_mod/views/menu_builder_output.php | 91 ++++++++ .../theme_mod/views/menulocation-script.php | 4 + 8 files changed, 443 insertions(+) create mode 100644 application/modules/theme_mod/config.xml create mode 100644 application/modules/theme_mod/manifest.json create mode 100644 application/modules/theme_mod/theme_mod.php create mode 100644 application/modules/theme_mod/views/mainscript.php create mode 100644 application/modules/theme_mod/views/menu_builder.php create mode 100644 application/modules/theme_mod/views/menu_builder_output.php create mode 100644 application/modules/theme_mod/views/menulocation-script.php diff --git a/.gitignore b/.gitignore index 2b466815..691def34 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ application/modules/* !application/modules/post_type/ !application/modules/blog/ !application/modules/pingback_trackback/ +!application/modules/theme_mod/ vendor/ composer.lock app.yaml diff --git a/application/modules/theme_mod/config.xml b/application/modules/theme_mod/config.xml new file mode 100644 index 00000000..22b3fb22 --- /dev/null +++ b/application/modules/theme_mod/config.xml @@ -0,0 +1,12 @@ + + +
+ Theme Manager + theme_mod + This module add theme support for Tendoo CMS + Blair Jersyer + 1.0 + /language +
theme_mod.php
+
+
\ No newline at end of file diff --git a/application/modules/theme_mod/manifest.json b/application/modules/theme_mod/manifest.json new file mode 100644 index 00000000..dcb249bb --- /dev/null +++ b/application/modules/theme_mod/manifest.json @@ -0,0 +1 @@ +["D:\/xampp\/htdocs\/tendoo-cms\/application\/libraries\/Themes.php","D:\/xampp\/htdocs\/tendoo-cms\/application\/libraries\/Theme_Mod.php"] \ No newline at end of file diff --git a/application/modules/theme_mod/theme_mod.php b/application/modules/theme_mod/theme_mod.php new file mode 100644 index 00000000..fce2af51 --- /dev/null +++ b/application/modules/theme_mod/theme_mod.php @@ -0,0 +1,115 @@ +events->add_action( 'setup_theme', array( $this, 'test' ), 10 ); + $this->events->add_action( 'after_app_init', array( $this, 'init' ), 1 ); + + $this->events->add_action( 'load_dashboard', array( $this, 'dashboard' ) ); + $this->events->add_action( 'load_frontend', array( $this, 'frontend' ) ); + $this->events->add_action( 'tendoo_settings_table', function(){ + Modules::enable( 'theme_mod' ); + }); + } + + function test() + { + Theme::Register_Nav_Location( 'header', __( 'Header Menu' ) ); + Theme::Register_Nav_Location( 'footer', __( 'Footer Menu' ) ); + Theme::Register_Nav_Location( 'bottom', __( 'Bottom Menu' ) ); + } + /** + * Init + * After APP init + * Browse Theme Folder + * + * @access public + * @return void + **/ + + function init() + { + $this->load->library( 'theme' ); + $this->load->helper( 'text' ); + $this->events->do_action( 'setup_theme' ); + } + + /** + * Creating a Dashboard Page + **/ + + function dashboard() + { + // Save Menu + $this->events->add_filter( 'admin_menus', array( $this, 'create_menus' ) ); + // Register Page + $this->gui->register_page( 'menu_builder', array( $this, 'menu_builder_controller' ) ); + } + + /** + * Controller : menu_builder_controller + **/ + + function menu_builder_controller() + { + $this->enqueue->css( css_url( 'theme_mod' ) . 'style', '' ); + + $this->enqueue->js( js_url( 'theme_mod' ) . 'jquery.nestable', '' ); + $this->enqueue->js( js_url( 'theme_mod' ) . 'sha1', '' ); + + $this->gui->set_title( sprintf( __( 'Menu Builder — %s' ) , get( 'core_signature' ) ) ); + + $this->load->view( '../modules/theme_mod/views/menu_builder' ); + } + + /** + * Create Menu + **/ + + function create_menus( $menu ) + { + $splited_1 = array_slice( $menu, 0, 2 ); + $splited_2 = array_slice( $menu, 2 ); + $thismenu = array( + 'theme_mod' => array( + array( + 'title' => __( 'Themes' ), + 'href' => site_url( array( 'dashboard', 'menu_builder' ) ), + 'disable' => true + ), + array( + 'title' => __( 'Menu' ), + 'href' => site_url( array( 'dashboard', 'menu_builder' ) ) + ) + ) + ); + + $menu = array_merge( $splited_1, $thismenu, $splited_2 ); + $menu[ 'visit_blog' ] = array( + array( + 'title' => __( 'Get to blog' ), + 'href' => site_url(), + 'icon' => 'fa fa-home' + ) + ); + return $menu; + } + + /** + * Load Frontend with parser + **/ + + function frontend( $params ) + { + Theme::Run_Theme( $params ); + } +} +new Theme_Mod; \ No newline at end of file diff --git a/application/modules/theme_mod/views/mainscript.php b/application/modules/theme_mod/views/mainscript.php new file mode 100644 index 00000000..2c89fd4c --- /dev/null +++ b/application/modules/theme_mod/views/mainscript.php @@ -0,0 +1,203 @@ + \ No newline at end of file diff --git a/application/modules/theme_mod/views/menu_builder.php b/application/modules/theme_mod/views/menu_builder.php new file mode 100644 index 00000000..f6b5d644 --- /dev/null +++ b/application/modules/theme_mod/views/menu_builder.php @@ -0,0 +1,16 @@ +gui->col_width( 1, 4 ); + +$this->gui->add_meta( array( + 'col_id' => 1, + 'namespace' => 'menu_builder', + 'type' => 'unwrapped', + 'title' => __( 'Menu' ) +) ); + +$this->gui->add_item( array( + 'type' => 'dom', + 'content' => $this->load->view( '../modules/theme_mod/views/menu_builder_output', array(), true ) +), 'menu_builder', 1 ); + +$this->gui->output(); \ No newline at end of file diff --git a/application/modules/theme_mod/views/menu_builder_output.php b/application/modules/theme_mod/views/menu_builder_output.php new file mode 100644 index 00000000..17ce2383 --- /dev/null +++ b/application/modules/theme_mod/views/menu_builder_output.php @@ -0,0 +1,91 @@ +
+
+
+
+ + + + +
+
+
+
+ + + + + + + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+

+ + + +

+
+
+
+
+
+ + +
+
+
+ + +
+
+ +
+ +
+
+
+
+
+

+ + + +

+
+ +
+
+
+ + +
+ +
+
+ \ No newline at end of file diff --git a/application/modules/theme_mod/views/menulocation-script.php b/application/modules/theme_mod/views/menulocation-script.php new file mode 100644 index 00000000..c217373f --- /dev/null +++ b/application/modules/theme_mod/views/menulocation-script.php @@ -0,0 +1,4 @@ + \ No newline at end of file