diff classes/basecontroller.php @ 47:886f43b26ee2 extractapp

move/remove develop folder
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 17 Mar 2015 10:54:13 +0100
parents
children 97c1e5102a22
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/classes/basecontroller.php	Tue Mar 17 10:54:13 2015 +0100
@@ -0,0 +1,39 @@
+<?php
+// an instance of the BaseController class can't be created directly; 
+// it can only be extended/inherited by other classes
+abstract class BaseController {
+
+	protected $urlvalues;
+	protected $action;
+	
+	public function __construct($action, $urlvalues, $postdata) {
+		$this->action = $action;
+		$this->urlvalues = $urlvalues;
+		$this->postdata = $postdata;
+	}
+	
+	public function ExecuteAction() {
+		return $this->{$this->action}();
+	}
+	
+	protected function ReturnView($viewmodel, $fullview) {
+		$viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
+		if ($fullview) {
+			require('views/maintemplate.php');
+			require($viewloc);
+		} else {
+			require($viewloc);
+		}
+	}
+
+	protected function ReturnView_localtest($viewmodel, $fullview) {
+        $viewloc = 'views/' . get_class($this) . '/' . $this->action . '.php';
+        if ($fullview) {
+            require('views/maintemplate_local.php');
+            require($viewloc);
+        } else {
+            require($viewloc);
+        }
+    }
+}
+?>
\ No newline at end of file