diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 2dc429d..1e5a450 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -9,11 +9,11 @@ public function __construct() { $this->load->module($module->module); } } - protected function _invoke($method = NULL) { + protected function _invoke($method = NULL, $params = NULL) { if($method) { foreach ($this->db->select('module')->from('modules')->where('active', 1)->get()->result() as $module) { if(method_exists($this->{$module->module}, $method)) { - Modules::run($module->module.'/'.$method); + Modules::run($module->module.'/'.$method, $params); } } } diff --git a/application/core/MY_Model.php b/application/core/MY_Model.php new file mode 100644 index 0000000..8d97854 --- /dev/null +++ b/application/core/MY_Model.php @@ -0,0 +1,13 @@ +db->select('module')->from('modules')->where('active', 1)->get()->result() as $module) { + if(method_exists($this->{$module->module}, $method)) { + Modules::run($module->module.'/'.$method, $params); + } + } + } + } +} \ No newline at end of file diff --git a/application/helpers/ui_helper.php b/application/helpers/ui_helper.php index c92895a..997320e 100644 --- a/application/helpers/ui_helper.php +++ b/application/helpers/ui_helper.php @@ -182,3 +182,31 @@ function isJson($string) { } } // ------------------------------------------------------------------------ + +/** + * Generates a valid html stylesheet link + * + * @param string $styles + * @param string $stylesheet + * @param string $media + */ +if(!function_exists('add_style')) { + function add_style(&$styles, $stylesheet, $media = 'screen') { + $styles .= ''."\n"; + } +} +// ------------------------------------------------------------------------ + +/** + * Generates a valid html output for rendering JS + * + * @param string $scripts + * @param string $script + * @param string $content + */ +if(!function_exists('add_script')) { + function add_script(&$scripts, $script, $content = '') { + $scripts .= ''."\n"; + } +} +// ------------------------------------------------------------------------ diff --git a/application/models/mdl_content.php b/application/models/mdl_content.php index f7bcbb5..4bc9c5c 100644 --- a/application/models/mdl_content.php +++ b/application/models/mdl_content.php @@ -1,6 +1,6 @@ '; $head[] = ''; $head[] = ''; + $this->_invoke('_head_alter', $head); return implode("\n\x20\x20\x20\x20", $head); } protected function _prepare_head_title() { @@ -50,6 +51,7 @@ protected function _prepare_head_styles() { $rendered_styles .= "\x20\x20\x20\x20".''."\n"; } } + $this->_invoke('_styles_alter', $rendered_styles); } else { $rendered_styles .= ''; @@ -117,6 +119,7 @@ protected function _prepare_scripts() { if($this->config->config['load_wysiwyg'] == TRUE) { $this->wysiwyg->implement($rendered_jscripts); } + $rendered_jscripts .= $this->_invoke('_scripts_alter', $rendered_jscripts); } else { $rendered_jscripts .= ''; diff --git a/application/modules/cookies/controllers/cookies.php b/application/modules/cookies/controllers/cookies.php index cfeb015..65d01f9 100644 --- a/application/modules/cookies/controllers/cookies.php +++ b/application/modules/cookies/controllers/cookies.php @@ -5,17 +5,25 @@ class Cookies extends MY_Controller { public function __construct() { parent::__construct(); } - function _head_alter() { + function _head_alter(&$head) { + //add items to the header + } + function _styles_alter(&$styles) { //add necessary css to page header + return add_style($styles, base_url().'frontend/core/css/cookies.css'); } - function _scripts_alter() { + function _scripts_alter(&$scripts) { //add necessary JS + return add_script($scripts, base_url().'/frontend/core/js/cookiebanner.min.js'); } function _widget() { //contains information about the widget generated by this module - return '
Cookie compliance goes here
'; + $uri_segment = $this->uri->segment(1); + $data = array(); + + return ($uri_segment != 'admin') ? $this->load->view('view_cookies', $data, TRUE) : ''; } function _install() { @@ -25,4 +33,8 @@ function _install() { function _config() { return 'This is the cookies module configuration page'; } + + function accept() { + //Save the users choice to accept cookies + } } \ No newline at end of file diff --git a/application/modules/cookies/views/login_form.php b/application/modules/cookies/views/login_form.php deleted file mode 100644 index 32180dd..0000000 --- a/application/modules/cookies/views/login_form.php +++ /dev/null @@ -1,12 +0,0 @@ -