Restructed component init system again.

This commit is contained in:
2009-08-21 12:38:54 +03:00
parent a0ff3832cd
commit 2755f35fd7
5 changed files with 54 additions and 20 deletions

View File

@@ -40,6 +40,7 @@ class ActionBase {
$view, // ActionView
$log, // ActiveLog
$locale, // ActiveLocale
$session, // ActiveSession
# Paths
$apps_path,
@@ -48,7 +49,10 @@ class ActionBase {
$public_path,
$tmp_path,
$cache_path,
$script_path;
$script_path,
# Misc.
$started = false;
function __construct () {
@@ -72,6 +76,7 @@ class ActionBase {
function init () {
$this->set_paths();
$this->started = true;
}
function set_paths () {

View File

@@ -41,11 +41,14 @@ class ActionEnvironment {
$root,
# Components
$session,
$session, // ActiveSession
# System
$is_windows,
$path_separator,
# Misc.
$is_windows,
$path_separator;
$started = false;
function __construct () {
@@ -55,6 +58,7 @@ class ActionEnvironment {
function init () {
$this->set_include_paths();
$this->load_environment_file();
$this->started = true;
}
function __wakeup () {

View File

@@ -33,12 +33,26 @@
class ActionView {
public
# Components
$env, // ActionEnvironment
$base, // ActionBase
$log, // ActiveLog
$locale, // ActiveLocale
$session, // ActiveSession
# Misc.
$started = false;
function __construct () {
}
function init () {
$this->started = true;
}
}

View File

@@ -87,14 +87,11 @@ class ActiveSession {
}
function start () {
session_start();
}
function init () {
$this->ini_setup(); // TODO get rid of the session settings, they don't seem to work
$this->ini_setup();
$this->validate();
$this->id = session_id();
session_start();
$this->started = true;
}

View File

@@ -50,24 +50,38 @@ class Zynapse {
require_once(ZNAP_LIB_ROOT."/action_view.php");
require_once(ZNAP_LIB_ROOT."/active_session.php");
// Enable PHP sessions
ActiveSession::start();
// Init the session control system (ActiveSession)
# Create component objects
self::$session = new ActiveSession();
self::$session->init();
// Init the environment system (ActionEnvironment)
self::$env = new ActionEnvironment();
self::$base = new ActionBase();
self::$view = new ActionView();
# Assign internal component references
self::$env->session =& self::$session;
self::$base->env =& self::$env;
self::$base->view =& self::$view;
// self::$base->log =& self::$log; //TODO Create ActionLog class
self::$base->locale =& self::$locale;
self::$base->session =& self::$session;
self::$view->env =& self::$env;
self::$view->base =& self::$base;
// self::$view->log =& self::$log; //TODO Create ActionLog class
self::$view->locale =& self::$locale;
self::$view->session =& self::$session;
# Init the environment system (ActionEnvironment)
self::$env->init();
// Init the core controller system (ActionBase)
self::$base = new ActionBase();
# Init the session control system (ActiveSession)
self::$session->init();
# Init the core controller system (ActionBase)
self::$base->init();
// Init the output and page rendering system (ActionView)
self::$view = new ActionView();
# Init the output and page rendering system (ActionView)
self::$view->init();
echo "hello world<br />\n";