Well I started implementing my module manager, coming along fine
Here is some (untested) code since I'm a showoffy guy
<?php
// Some constants
define('VW_MAIN', 0);
define('VW_CREATE', 1);
define('VW_EDIT', 2);
define('VW_DELETE', 3);
// Some errors
define ('VW_NOERR', 0);
define ('VW_ERRACTN', 1);
define ('VW_BADMOD', 2);
class MMCore
{
var $DB;
var $ModuleName;
var $View;
var $ManagerCanvas;
function HandlePage($view, $name = NULL)
{
if ($name != NULL)
{
if (!$this->Exists($name))
return VW_BADMOD;
$view = VW_EDIT;
$this->ModuleName = $name
}
$this->DB = new DatabaseSystem;
$this->View = $view;
$usingSys = true;
$this->ManagerCanvas = new DisplaySystem($usingSys);
switch ($this->View)
{
case VW_MAIN:
$this->HandleMain();
break;
case VW_CREATE:
$this->HandleCreate();
break;
case VW_EDIT:
break;
case VW_DELETE:
break;
default:
break;
}
return VW_NOERR;
}
function HandleMain()
{
if (!empty($this->ModuleName))
{
$this->ManagerCanvas->assign("SingleModule", true);
// Display information about the module
if (is_array($result))
{
} else {
// Log an error about failing to fetch here
// Display "Unable to Fetch"
$this->ManagerCanvas->assign("ModuleName", $this->ModuleName);
$this->ManagerCanvas->assign("ModuleVersion", "Unable to Fetch");
$this->ManagerCanvas->assign("ModuleAuthor", "Unable to Fetch");
$this->ManagerCanvas->assign("ModuleDescription", "Unable to Fetch");
}
} else {
$this->ManagerCanvas->assign("SingleModule", false);
// Done
}
return VW_NOERR;
}
function HandleCreate()
{
if ($_POST)
{
// Been posted, use sLayer to check it's integrity
} else {
if (!empty($this->ModuleName))
{
// Dont display
} else {
// Display
}
}
return VW_NOERR;
}
}
?>