/+junk/StupidMVC

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/StupidMVC
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
<?php

abstract class AbstractController {
  public function
  __construct () {
  
  }
  
  public function
  default_method ($args) {
    echo "<h1>It Works!</h1>";
    echo "<b> You should add default_method () to your class. </b>";
  }
  
  /**
   * This should return a list of method names.
   *
   * @code{.php}
    function get_methods () {
      $ret_val = [
        "method_one",
        "method_two",
        ...
      ];
    
      return ret_val;
    }
   * @endcode
   */
  abstract public function
  get_methods ();

  /*
   * Get the custom rout definitions.
   */
  //abstract public function get_routes ();

  /**
   * load a view class.
   */
  public function
  load_view ($view, $user_data = NULL) {
    require (APP_DIR . "Views" . DS . $view . ".php");
    $_view = new $view ();
    $_view->render ($user_data);
  }
  
  public function
  load_view_raw ($view, $user_data = NULL) {
    $file_path = APP_DIR . DS . "Views" . DS . $view;
    include ($file_path);
  }
  
  /**
   * Returns a model object
   */
  public function
  load_model ($model) {
    require (APP_DIR . "Models " . DS . $model . ".php");
    $$model = new $model ();
    
    return $$model;
  }

}