/+junk/StupidMVC

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
1 by Gustav Hartvigsson
* initial code
1
<?php
2
3
abstract class AbstractController {
10 by Gustav Hartvigsson
* __contructor -> __construct
4
  public function
5
  __construct () {
6
  
1 by Gustav Hartvigsson
* initial code
7
  }
10 by Gustav Hartvigsson
* __contructor -> __construct
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
  }
10 by Gustav Hartvigsson
* __contructor -> __construct
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
      ];
10 by Gustav Hartvigsson
* __contructor -> __construct
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
11 by Gustav Hartvigsson
* changed how AbstractController->load_view_raw () works
42
  load_view ($view, $user_data = NULL) {
5 by Gustav Hatvigsson
* changed a few small things
43
    require (APP_DIR . "Views" . DS . $view . ".php");
44
    $_view = new $view ();
45
    $_view->render ($user_data);
1 by Gustav Hartvigsson
* initial code
46
  }
10 by Gustav Hartvigsson
* __contructor -> __construct
47
  
11 by Gustav Hartvigsson
* changed how AbstractController->load_view_raw () works
48
  public function
49
  load_view_raw ($view, $user_data = NULL) {
50
    $file_path = APP_DIR . DS . "Views" . DS . $view;
51
    include ($file_path);
52
  }
53
  
1 by Gustav Hartvigsson
* initial code
54
  /**
55
   * Returns a model object
56
   */
5 by Gustav Hatvigsson
* changed a few small things
57
  public function
58
  load_model ($model) {
59
    require (APP_DIR . "Models " . DS . $model . ".php");
1 by Gustav Hartvigsson
* initial code
60
    $$model = new $model ();
10 by Gustav Hartvigsson
* __contructor -> __construct
61
    
1 by Gustav Hartvigsson
* initial code
62
    return $$model;
63
  }
7 by Gustav Hartvigsson
* a few more functions...
64
1 by Gustav Hartvigsson
* initial code
65
}