Mercurial > hg > extraction-interface
comparison classes/basecontroller.php @ 77:97c1e5102a22 extractapp
New: export table for a file from LGService
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 16 Apr 2015 14:53:22 +0200 |
parents | 886f43b26ee2 |
children | f1f849d31272 |
comparison
equal
deleted
inserted
replaced
76:c49192885290 | 77:97c1e5102a22 |
---|---|
1 <?php | 1 <?php |
2 // an instance of the BaseController class can't be created directly; | 2 /** |
3 // it can only be extended/inherited by other classes | 3 * An instance of the BaseController class can't be created directly. |
4 * It can only be extended/inherited by other classes. | |
5 */ | |
6 | |
4 abstract class BaseController { | 7 abstract class BaseController { |
5 | 8 |
6 protected $urlvalues; | 9 protected $urlvalues; |
7 protected $action; | 10 protected $action; |
8 | 11 |
9 public function __construct($action, $urlvalues, $postdata) { | 12 public function __construct($action, $urlvalues, $postdata) { |
10 $this->action = $action; | 13 $this->action = $action; |
15 public function ExecuteAction() { | 18 public function ExecuteAction() { |
16 return $this->{$this->action}(); | 19 return $this->{$this->action}(); |
17 } | 20 } |
18 | 21 |
19 protected function ReturnView($viewmodel, $fullview) { | 22 protected function ReturnView($viewmodel, $fullview) { |
23 /** | |
24 * Return the corresponding view in the views folder. | |
25 * We use the same class name as the folder's name and action name as the file's name in the folder hierarchy. | |
26 * In this design, we can require the corresponding views php code by defining controller and action in url. | |
27 * | |
28 * If you also require the maintemplate.php, which now only contains scripts that need to be inclued, set $fullview to be true; | |
29 * otherwise, the maintemplate.php will not be applied. | |
30 */ | |
31 | |
20 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php'; | 32 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php'; |
21 if ($fullview) { | 33 if ($fullview) { |
22 require('views/maintemplate.php'); | 34 require('views/maintemplate.php'); |
23 require($viewloc); | 35 require($viewloc); |
24 } else { | 36 } else { |
25 require($viewloc); | 37 require($viewloc); |
26 } | 38 } |
27 } | 39 } |
28 | 40 |
29 protected function ReturnView_localtest($viewmodel, $fullview) { | 41 protected function ReturnView_localtest($viewmodel, $fullview) { |
42 /** Return the corresponding view in the views folder. | |
43 * | |
44 * This is only been used when developing on local machine. | |
45 */ | |
30 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php'; | 46 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php'; |
31 if ($fullview) { | 47 if ($fullview) { |
32 require('views/maintemplate_local.php'); | 48 require('views/maintemplate_local.php'); |
33 require($viewloc); | 49 require($viewloc); |
34 } else { | 50 } else { |