-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataModel.php
More file actions
executable file
·110 lines (87 loc) · 1.84 KB
/
DataModel.php
File metadata and controls
executable file
·110 lines (87 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
define('MODEL_DIR', dirname(__FILE__).'/../models/');
set_include_path(get_include_path().PATH_SEPARATOR.MODEL_DIR);
spl_autoload_extensions('.model.php');
spl_autoload_register();
class Controler
{
var $model;
var $returnArray;
function __construct ()
{
}
function setReturnArray ($key, $value)
{
$this->returnArray[$key] = $value;
}
function getReturnArray ()
{
return $this->returnArray;
}
function setDataModel ($datamodel)
{
$this->model = $datamodel;
}
function getDataModel ()
{
return $this->model;
}
function processDataModel ()
{
foreach ($this->model as $arr)
{
$inspector = new PreProcessor;
$values = serialize($arr);
$returnArray = call_user_func_array(array($inspector, "inspect"), $values);
if ($returnArray)
{
$this->setReturnArray($arr[0], $returnArray);
}
}
}
}
class PreProcessor
{
// Inspect data before processing
function inspect ($arg)
{
$argArray = unserialize($arg);
// this will give the abbility to inspect and act on the data passed.
// to implement roles, users, validation, etc..
$returnArray = call_user_func_array(array('ProcessClass', 'process'), $arg);
return $returnArray;
}
}
class ProcessClass
{
static function process ($arg)
{
$argArray = unserialize($arg);
// this will take the 1e as the class 2e as a function of that class and
//then pass everything as an argument to that function.
$returnArray = call_user_func_array(array($argArray[2], "$argArray[3]"), $arg);
$postArray = call_user_func_array(array('PostProcessor', 'process'), $returnArray);
return $postArray;
}
}
class PostProcessor
{
static function process ($arg)
{
// post process array
return $returnArray;
}
}
class dataObject
{
var $object;
function setValue ($value)
{
$this->object = $value;
}
function getValue ()
{
return $this->object;
}
}
?>