embient.php

Go to the documentation of this file.
00001 <?php
00002 
00058 require_once("embient.util.php");
00059 
00067 class Embient
00068 {
00070   var $sysname  = '';
00071 
00073   var $config   = array();
00074 
00075   // ---------------------------------
00076 
00078   var $_plugins = array();
00079 
00081   var $_names   = array();
00082 
00083   // ---------------------------------
00084 
00094   function Embient($systemname)
00095   {
00096     global $embient_dir;
00097 
00098     $embient_dir = dirname(__FILE__);
00099 
00100     $this->sysname = $systemname;
00101 
00102     // load embient configuration
00103     $this->config = embient_load_config();
00104 
00105     // load plugins
00106     $this->_plugins = array();
00107     $this->_names   = array();
00108 
00109     // load the plugin
00110     foreach ( glob("$embient_dir/*.plugin.php") as $filename )
00111     {
00112       $pluginname = basename( $filename, ".plugin.php");
00113 
00114       // excluding the active system
00115       if ( $pluginname == $systemname || $pluginname == 'embient')
00116       {
00117         continue;
00118       }
00119 
00120       require_once($filename);
00121 
00122       // Initialise the plugin
00123       $this->_plugins[$pluginname] = call_user_func("embient_create_". $pluginname ."_plugin");
00124 
00125       array_push($this->_names, $pluginname);
00126     }
00127 
00128     // initialisation
00129     $notavailable = array();
00130     foreach ($this->_names as $system)
00131     {
00132       if ( ! $this->_plugins[$system]->Init($this->config[$system]) )
00133       {
00134         embient_error("cannot initialise $system");
00135         unset($this->_plugins[$system]);
00136         array_push($notavailable, $system);
00137       }
00138     }
00139 
00140     $this->_names = array_diff($this->_names, $notavailable);
00141   }
00142 
00149   function Login($username)
00150   {
00151     foreach ($this->_names as $system)
00152     {
00153       $this->_plugins[$system]->Login($username);
00154     }
00155   }
00156 
00160   function Logout($username)
00161   {
00162     foreach ($this->_names as $system)
00163     {
00164       $this->_plugins[$system]->Logout($username);
00165     }
00166   }
00167 
00176   function Add($user)
00177   {
00178     foreach ($this->_names as $system)
00179     {
00180       $this->_plugins[$system]->Add($user);
00181     }
00182   }
00183 
00194   function Update($username, $user)
00195   {
00196     foreach ($this->_names as $system)
00197     {
00198       $this->_plugins[$system]->Update($username, $user);
00199     }
00200   }
00201 
00211   function Delete($username)
00212   {
00213     foreach ($this->_names as $system)
00214     {
00215       $this->_plugins[$system]->Delete($username);
00216     }
00217   }
00218 }

Generated on Fri Feb 10 15:05:54 2006 for Embient by  doxygen 1.4.6-NO