/** * Loads the advanced modules config file * * @access public * @param string Name of config file. Default is the name of the advanced module (optional) * @return void */ public function load_config($config = NULL) { if (empty($config)) { $config = $this->name; } // last parameter tells it to fail gracefully // check application directory for overwrites $this->CI->load->module_config('app', $config, FALSE, TRUE); $app_config = $this->CI->config->item($this->name); // now get the blog configuration $this->CI->load->module_config($this->folder(), $config, FALSE, TRUE); $module_config = $this->CI->config->item($this->name); // if app config exists then merge if (!empty($app_config)) { $this->_config = array_merge($module_config, $app_config); } else { $this->_config = $module_config; } // special case for tables so that they are loaded into the static Base_module_model variable if ($this->CI->config->item('tables')) { if (!class_exists('Base_module_model')) { require_once BASEPATH . 'core/Model.php'; require_once FUEL_PATH . 'models/base_module_model.php'; } Base_module_model::$tables = array_merge(Base_module_model::$tables, $this->CI->config->item('tables')); } }
/** * Constructor * * @access public * @param string The table name * @param mixed If an array, it will assume they are initialization properties. If a string, it will assume it's the name of the module the module exists in * @return void */ public function __construct($table = NULL, $params = NULL) { $CI =& get_instance(); $CI->load->module_language(FUEL_FOLDER, 'fuel'); // initialize parameters to pass to parent model // if it is a string, then we assume it's a module name, if it is an array, then we extract the module name from it' if (is_array($params)) { if (isset($params['module'])) { $module = $params['module']; } } else { $module = $params; $params = array(); } if (!isset($module)) { $module = FUEL_FOLDER; } $fuel_tables = array(); $module_tables = array(); $config_tables = array(); // first load the FUEL config so that we can get the tables $CI->config->module_load(FUEL_FOLDER, 'fuel', TRUE); $fuel_tables = $CI->config->item('tables', 'fuel'); // load in the module configuration file if (!empty($module) and $module != FUEL_FOLDER) { // fail gracefully is last parameter $CI->config->module_load($module, $module, FALSE, TRUE); if ($CI->config->item('tables')) { $module_tables = $CI->config->item('tables'); } } // look in the generic configuration space if ($CI->config->item('tables')) { $config_tables = $CI->config->item('tables'); } // create master list of tables self::$tables = array_merge(self::$tables, $config_tables, $module_tables, $fuel_tables); $this->set_tables(self::$tables); // set the table to the configuration mapping if it is in array if ($this->tables($table)) { $table = $this->tables($table); } // if no configuration mapping is found then we will assume it is just the straight up table name parent::__construct($table, $params); // table name and params // load additional helpers here $this->load->helper('typography'); $this->load->helper('text'); $this->load->helper('markdown'); $this->load->helper('format'); // set formatters if (!empty($this->_formatters) and !empty($this->formatters)) { $this->formatters = array_merge_recursive($this->_formatters, $this->formatters); } else { $this->formatters = $this->_formatters; } }