true, 'bootstrap5' => true, 'bootstrap3' => false, 'fontawesome6' => true, 'fontawesome4' => false, 'axios027' => true, 'customJSModules' => [ 'public/js/apps/Cis.js' ], 'customCSSs' => [ 'public/css/Cis4/Cis.css' ] ]; protected $coreOptions = null; protected $loader = null; public function __construct($params) { $this->loader = $params[1]; $this->coreOptions = ['menu' => $params[0]]; } /** * View Loader * * Loads "view" files. * * @param string $view View name * @param array $vars An associative array of data * to be extracted for use in the view * @param bool $return Whether to return the view output * or leave it to the Output class * @return object|string */ public function view($view, $vars = array(), $return = FALSE) { if ($view == 'templates/FHC-Header' || $view == 'templates/FHC-Footer') { $overwrittenParams = array_merge($vars, self::OVERWRITE_PARAMS); foreach (['customJSModules', 'customCSSs'] as $key) if (isset($vars[$key])) $overwrittenParams[$key] = array_merge(self::OVERWRITE_PARAMS[$key], $vars[$key]); if ($view == 'templates/FHC-Header') { $view1 = $view; $param1 = $overwrittenParams; $view2 = 'templates/CISHMVC-Header'; $param2 = $this->coreOptions; } else { $view1 = 'templates/CISHMVC-Footer'; $param1 = $this->coreOptions; $view2 = $view; $param2 = $overwrittenParams; } if ($return) return $this->loader->view($view1, $param1, $return) . $this->loader->view($view2, $param2, $return); $this->loader->view($view1, $param1, $return); $this->loader->view($view2, $param2, $return); } else { return $this->loader->view($view, $vars, $return); } } /** * Initializer * * @todo Figure out a way to move this to the constructor * without breaking *package_path*() methods. * @uses CI_Loader::_ci_autoloader() * @used-by CI_Controller::__construct() * @return void */ public function initialize() { $this->loader->initialize(); } // -------------------------------------------------------------------- /** * Is Loaded * * A utility method to test if a class is in the self::$_ci_classes array. * * @used-by Mainly used by Form Helper function _get_validation_object(). * * @param string $class Class name to check for * @return string|bool Class object name if loaded or FALSE */ public function is_loaded($class) { return $this->loader->is_loaded($class); } // -------------------------------------------------------------------- /** * Library Loader * * Loads and instantiates libraries. * Designed to be called from application controllers. * * @param mixed $library Library name * @param array $params Optional parameters to pass to the library class constructor * @param string $object_name An optional object name to assign to * @return object */ public function library($library, $params = NULL, $object_name = NULL) { $this->loader->library($library, $params, $object_name); return $this; } // -------------------------------------------------------------------- /** * Model Loader * * Loads and instantiates models. * * @param mixed $model Model name * @param string $name An optional object name to assign to * @param bool $db_conn An optional database connection configuration to initialize * @return object */ public function model($model, $name = '', $db_conn = FALSE) { $this->loader->model($model, $name, $db_conn); return $this; } // -------------------------------------------------------------------- /** * Database Loader * * @param mixed $params Database configuration options * @param bool $return Whether to return the database object * @param bool $query_builder Whether to enable Query Builder * (overrides the configuration setting) * * @return object|bool Database object if $return is set to TRUE, * FALSE on failure, CI_Loader instance in any other case */ public function database($params = '', $return = FALSE, $query_builder = NULL) { $res = $this->loader->database($params, $return, $query_builder); return $res == $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Load the Database Utilities Class * * @param object $db Database object * @param bool $return Whether to return the DB Utilities class object or not * @return object */ public function dbutil($db = NULL, $return = FALSE) { $res = $this->loader->dbutil($db, $return); return $res === $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Load the Database Forge Class * * @param object $db Database object * @param bool $return Whether to return the DB Forge class object or not * @return object */ public function dbforge($db = NULL, $return = FALSE) { $res = $this->loader->dbforge($db, $return); return $res === $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Generic File Loader * * @param string $path File path * @param bool $return Whether to return the file output * @return object|string */ public function file($path, $return = FALSE) { $res = $this->loader->file($path, $return); return $res === $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Set Variables * * Once variables are set they become available within * the controller class and its "view" files. * * @param array|object|string $vars * An associative array or object containing values * to be set, or a value's name if string * @param string $val Value to set, only used if $vars is a string * @return object */ public function vars($vars, $val = '') { $res = $this->loader->vars($vars, $val); return $res === $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Clear Cached Variables * * Clears the cached variables. * * @return CI_Loader */ public function clear_vars() { $this->loader->clear_vars(); return $this; } // -------------------------------------------------------------------- /** * Get Variable * * Check if a variable is set and retrieve it. * * @param string $key Variable name * @return mixed The variable or NULL if not found */ public function get_var($key) { return $this->loader->get_var($key); } // -------------------------------------------------------------------- /** * Get Variables * * Retrieves all loaded variables. * * @return array */ public function get_vars() { return $this->loader->get_vars(); } // -------------------------------------------------------------------- /** * Helper Loader * * @param string|string[] $helpers Helper name(s) * @return object */ public function helper($helpers = array()) { $this->loader->helper($helpers); return $this; } // -------------------------------------------------------------------- /** * Load Helpers * * An alias for the helper() method in case the developer has * written the plural form of it. * * @uses CI_Loader::helper() * @param string|string[] $helpers Helper name(s) * @return object */ public function helpers($helpers = array()) { return $this->helper($helpers); } // -------------------------------------------------------------------- /** * Language Loader * * Loads language files. * * @param string|string[] $files List of language file names to load * @param string Language name * @return object */ public function language($files, $lang = '') { $this->loader->language($files, $lang); return $this; } // -------------------------------------------------------------------- /** * Config Loader * * Loads a config file (an alias for CI_Config::load()). * * @uses CI_Config::load() * @param string $file Configuration file name * @param bool $use_sections Whether configuration values should be loaded into their own section * @param bool $fail_gracefully Whether to just return FALSE or display an error message * @return bool TRUE if the file was loaded correctly or FALSE on failure */ public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE) { return $this->loader->config($file, $use_sections, $fail_gracefully); } // -------------------------------------------------------------------- /** * Driver Loader * * Loads a driver library. * * @param string|string[] $library Driver name(s) * @param array $params Optional parameters to pass to the driver * @param string $object_name An optional object name to assign to * * @return object|bool Object or FALSE on failure if $library is a string * and $object_name is set. CI_Loader instance otherwise. */ public function driver($library, $params = NULL, $object_name = NULL) { $res = $this->loader->driver($library, $params, $object_name); return $res === $this->loader ? $this : $res; } // -------------------------------------------------------------------- /** * Add Package Path * * Prepends a parent path to the library, model, helper and config * path arrays. * * @see CI_Loader::$_ci_library_paths * @see CI_Loader::$_ci_model_paths * @see CI_Loader::$_ci_helper_paths * @see CI_Config::$_config_paths * * @param string $path Path to add * @param bool $view_cascade (default: TRUE) * @return object */ public function add_package_path($path, $view_cascade = TRUE) { $this->loader->add_package_path($path, $view_cascade); return $this; } // -------------------------------------------------------------------- /** * Get Package Paths * * Return a list of all package paths. * * @param bool $include_base Whether to include BASEPATH (default: FALSE) * @return array */ public function get_package_paths($include_base = FALSE) { return $this->loader->get_package_paths($include_base); } // -------------------------------------------------------------------- /** * Remove Package Path * * Remove a path from the library, model, helper and/or config * path arrays if it exists. If no path is provided, the most recently * added path will be removed removed. * * @param string $path Path to remove * @return object */ public function remove_package_path($path = '') { $this->remove_package_path($path); return $this; } }