/** * @return jpWotApp */ public static function getInstance() { if (self::$_appInstance === null) { self::$_appInstance = new self(); } return self::$_appInstance; }
/** * Invokes the model and view loading. */ public function index() { $app = jpWotApp::getInstance(); $model = null; if (!empty($this->_request[$app->getPageKey()])) { $model = $app->getModelInstance($app->getPageKey()); $model->setRequestData($this->_request[$app->getPageKey()]); $model->load(); } $view = new jpWotView($this, $model); $view->render(); }
/** * @param string $path * @param array $data (optional) default empty array * @param string $extension (optional) default ".php" */ public static function render($path, $data = array(), $extension = 'php') { $parts = explode('.', $path); $path = BPATH . '/app/view/templates/' . implode('/', $parts) . '.' . $extension; if (is_file($path)) { if (!isset($data['page'])) { $app = jpWotApp::getInstance(); $data['page'] = $app->getPageKey(); } require_once $path; } }
/** * Loads the nessecarry templates and invokes the html generating. */ public function render() { $app = jpWotApp::getInstance(); jpWotTemplate::render('main.navigation'); ?> <div id="main" role="main"> <?php jpWotTemplate::render($app->getPageKey() . '.filterarea', $this->_controller->getRequestData($app->getPageKey())); if (!empty($this->_model)) { jpWotTemplate::render($app->getPageKey() . '.' . $this->_model->getApiCall(), array('result' => $this->_model->getData())); } ?> </div> <?php }
error_reporting(0); /** * Contains the base path of the app. * * @var string */ define('BPATH', __DIR__); require_once BPATH . '/inc/autoload.php'; require_once BPATH . '/inc/function.php'; require_once BPATH . '/inc/wot.class.php'; require_once BPATH . '/config.php'; if (jpWotConfig::$debug) { error_reporting(E_ALL ^ E_STRICT); } jpWotSession::start(); $app = jpWotApp::getInstance(); ?> <!DOCTYPE html> <html> <head> <title>wot-sse</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="./assets/css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="./assets/css/bootstrap-theme.min.css" /> <link rel="stylesheet" type="text/css" href="./assets/css/bootstrap-override.css" /> <link rel="stylesheet" type="text/css" href="./assets/css/style.css" /> <script src="./assets/js/jquery-1.10.2.min.js" type="text/javascript"></script> <script src="./assets/js/jquery.form.js" type="text/javascript"></script> <script src="./assets/js/bootstrap.min.js" type="text/javascript"></script> <script>