annotate develop/classes/basecontroller.php @ 14:ac77748bb813

- Load regex files based on current topic. Only show the regex in this topic. To do that, it needs to lookup a table called 'topic_regex_relation' which has the relation of topic and regex filename in filesystem. - Extractapp UI with some layout modification: button, popup window, responsive (by bootstrap now). It was just for quick prototyping.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 19 Feb 2015 11:07:27 +0100
parents 63e08b98032f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 <?php
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
2 // an instance of the BaseController class can't be created directly;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 // it can only be extended/inherited by other classes
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 abstract class BaseController {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
5
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
6 protected $urlvalues;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 protected $action;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
8
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 public function __construct($action, $urlvalues, $postdata) {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 $this->action = $action;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 $this->urlvalues = $urlvalues;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
12 $this->postdata = $postdata;
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 }
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
14
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
15 public function ExecuteAction() {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 return $this->{$this->action}();
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
17 }
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
18
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
19 protected function ReturnView($viewmodel, $fullview) {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
21 if ($fullview) {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
22 require('views/maintemplate.php');
14
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
23 require($viewloc);
6
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 } else {
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
25 require($viewloc);
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
26 }
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
27 }
14
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
28
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
29 protected function ReturnView_localtest($viewmodel, $fullview) {
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
30 $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
31 if ($fullview) {
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
32 require('views/maintemplate_local.php');
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
33 require($viewloc);
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
34 } else {
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
35 require($viewloc);
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
36 }
ac77748bb813 - Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 6
diff changeset
37 }
6
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
38 }
63e08b98032f rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
39 ?>