Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet committed Jun 22, 2008
1 parent f9de4b1 commit fc02f41
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
6 changes: 3 additions & 3 deletions MPTT.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ function is_valid_node()
*/
function has_parent()
{
return $this->is_valid_node(get_parent());
return $this->is_valid_node($this->get_parent());
}

/**
Expand All @@ -766,7 +766,7 @@ function has_parent()
*/
function has_prev_sibling()
{
return $this->is_valid_node(get_prev_sibling());
return $this->is_valid_node($this->get_prev_sibling());
}

/**
Expand All @@ -776,7 +776,7 @@ function has_prev_sibling()
*/
function has_next_sibling()
{
return $this->is_valid_node(get_next_sibling());
return $this->is_valid_node($this->get_next_sibling());
}

/**
Expand Down
40 changes: 22 additions & 18 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class Module_Core{
//Array of registered modules
protected static $modules=array();

public static $loaded_module;

//Module name
public $module_name;

Expand All @@ -19,9 +21,26 @@ public static function hook()
{
if(Router::$controller==null AND self::is_registered(Router::$rsegments[0]))
{
$module=self::get(Router::$rsegments[0]);
$module->route();
self::$loaded_module=self::get(Router::$rsegments[0]);
self::$loaded_module->route();
}

Event::run('module.post_loading');

$paths=array();
if(self::$load_registered_modules==true)
{
foreach(self::$modules as $module)
{
$paths[]=$module->module_path;
}
}
else
{
$paths[]=self::$loaded_module->module_path;
}
//Load triggered (or all) module into include paths so views, models and libraries can be loaded the normal way.
Config::set('core.modules',array_merge(Config::item('core.modules'),$paths));
}
//Register new modules
public static function register($name,$path)
Expand Down Expand Up @@ -67,23 +86,8 @@ public function route()
Router::$method = isset(Router::$rsegments[2]) ? Router::$rsegments[2] : 'index';
Router::$arguments = isset(Router::$rsegments[3]) ? array_slice(Router::$rsegments, 3) : array();

pr(Router::$controller);
Event::run('module.post_routing');

$paths=array();
if(self::$load_registered_modules==true)
{
foreach(self::$modules as $module)
{
$paths[]=$module->module_path;
}
}
else
{
$paths[]=$this->module_path;
}
//Load triggered (or all) module into include paths so views, models and libraries can be loaded the normal way.
Config::set('core.modules',array_merge(Config::item('core.modules'),$paths));

}
public function find_file($directory, $filename, $required = FALSE, $ext = FALSE, $use_cache = TRUE)
{
Expand Down

0 comments on commit fc02f41

Please sign in to comment.