bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
|
1
by Gustav Hartvigsson
* initial code |
1 |
<?php
|
2 |
||
3 |
abstract class AbstractController { |
|
|
5
by Gustav Hatvigsson
* changed a few small things |
4 |
protected function |
5 |
__contructor () { |
|
|
7
by Gustav Hartvigsson
* a few more functions... |
6 |
|
|
1
by Gustav Hartvigsson
* initial code |
7 |
}
|
|
7
by Gustav Hartvigsson
* a few more functions... |
8 |
|
|
5
by Gustav Hatvigsson
* changed a few small things |
9 |
public function |
10 |
default_method ($args) { |
|
|
1
by Gustav Hartvigsson
* initial code |
11 |
echo "<h1>It Works!</h1>"; |
|
3
by Gustav Hatvigsson
* Made the router a class |
12 |
echo "<b> You should add default_method () to your class. </b>"; |
|
1
by Gustav Hartvigsson
* initial code |
13 |
}
|
|
7
by Gustav Hartvigsson
* a few more functions... |
14 |
|
|
1
by Gustav Hartvigsson
* initial code |
15 |
/**
|
16 |
* This should return a list of method names.
|
|
|
7
by Gustav Hartvigsson
* a few more functions... |
17 |
*
|
|
1
by Gustav Hartvigsson
* initial code |
18 |
* @code{.php}
|
19 |
function get_methods () {
|
|
20 |
$ret_val = [
|
|
21 |
"method_one",
|
|
22 |
"method_two",
|
|
23 |
...
|
|
24 |
];
|
|
|
7
by Gustav Hartvigsson
* a few more functions... |
25 |
|
|
1
by Gustav Hartvigsson
* initial code |
26 |
return ret_val;
|
27 |
}
|
|
28 |
* @endcode
|
|
29 |
*/
|
|
|
5
by Gustav Hatvigsson
* changed a few small things |
30 |
abstract public function |
31 |
get_methods (); |
|
|
7
by Gustav Hartvigsson
* a few more functions... |
32 |
|
|
3
by Gustav Hatvigsson
* Made the router a class |
33 |
/*
|
|
1
by Gustav Hartvigsson
* initial code |
34 |
* Get the custom rout definitions.
|
35 |
*/
|
|
|
3
by Gustav Hatvigsson
* Made the router a class |
36 |
//abstract public function get_routes ();
|
|
7
by Gustav Hartvigsson
* a few more functions... |
37 |
|
|
1
by Gustav Hartvigsson
* initial code |
38 |
/**
|
39 |
* load a view class.
|
|
40 |
*/
|
|
|
5
by Gustav Hatvigsson
* changed a few small things |
41 |
public function |
42 |
load_view ($view, $user_data) { |
|
43 |
require (APP_DIR . "Views" . DS . $view . ".php"); |
|
44 |
$_view = new $view (); |
|
45 |
$_view->render ($user_data); |
|
|
1
by Gustav Hartvigsson
* initial code |
46 |
}
|
|
7
by Gustav Hartvigsson
* a few more functions... |
47 |
|
|
1
by Gustav Hartvigsson
* initial code |
48 |
/**
|
49 |
* Returns a model object
|
|
50 |
*/
|
|
|
5
by Gustav Hatvigsson
* changed a few small things |
51 |
public function |
52 |
load_model ($model) { |
|
53 |
require (APP_DIR . "Models " . DS . $model . ".php"); |
|
|
1
by Gustav Hartvigsson
* initial code |
54 |
$$model = new $model (); |
|
7
by Gustav Hartvigsson
* a few more functions... |
55 |
|
|
1
by Gustav Hartvigsson
* initial code |
56 |
return $$model; |
57 |
}
|
|
|
7
by Gustav Hartvigsson
* a few more functions... |
58 |
|
|
1
by Gustav Hartvigsson
* initial code |
59 |
}
|