view 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
line wrap: on
line source

<?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);
        }
    }
}
?>