* Copyright (C) 2016 Amiel Elboim * * LICENSE: This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see ;. * * @package OpenEMR * @author Shachar Zilbershlag * @author Amiel Elboim * @link http://www.open-emr.org */ class BaseController { const VIEW_FOLDER = 'therapy_groups_views'; const MODEL_FOLDER = 'therapy_groups_models'; /** * @param $template view name * @param array $data variables for injection into view */ protected function loadView($template, $data = array()) { $template = dirname(__FILE__) . '/../' . self::VIEW_FOLDER . '/' . $template . '.php'; extract($data); ob_start(); require($template); echo ob_get_clean(); exit(); } protected function loadModel($name) { if (!isset($this->$name)) { require(dirname(__FILE__) . '/../' . self::MODEL_FOLDER . '/' . strtolower($name) . '_model.php'); $this->$name = new $name(); } return $this->$name; } }