1: <?php
2: namespace Define\Core;
3: use Define\Utilities\Session;
4: use Define\Utilities\Localization;
5:
6: if(!defined('DIRECT_ACCESS')) {
7: die("Direct access is forbidden.");
8: }
9:
10: /**
11: * BASE CONTROLLER
12: *
13: * Base controller class. This will have the most commonly used objects
14: * initialized for use in corresponding controller classes.
15: *
16: * @category Define
17: * @package Core
18: * @author Nitesh Apte <me@niteshapte.com>
19: * @copyright 2015 Nitesh Apte
20: * @version 1.0.0
21: * @since 1.0.0
22: * @license https://www.gnu.org/licenses/gpl.txt GNU General Public License v3
23: *
24: * This program is free software: you can redistribute it and/or modify
25: * it under the terms of the GNU General Public License as published by
26: * the Free Software Foundation, either version 3 of the License, or
27: * (at your option) any later version.
28: *
29: * This program is distributed in the hope that it will be useful,
30: * but WITHOUT ANY WARRANTY; without even the implied warranty of
31: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32: * GNU General Public License for more details.
33: *
34: * You should have received a copy of the GNU General Public License
35: * along with this program. If not, see <http://www.gnu.org/licenses/>.
36: */
37: abstract class BaseController implements IDefine {
38:
39: /**
40: * View object
41: * @var View $view
42: */
43: protected $view;
44:
45: /**
46: * Session object
47: * @var Session $session
48: */
49: protected $session;
50:
51: /**
52: * Localiztion language
53: * @var Localization $lang
54: */
55: protected $lang;
56:
57: /**
58: * Object container instance
59: * @var ObjectContainer $container
60: */
61: protected $container = null;
62:
63: /**
64: * Get the instances of the object that were stored in container.
65: *
66: * @param none
67: * @return void
68: */
69: public function __construct() {
70: $this->view = new View();
71: $this->container = ObjectContainer::getInstance();
72: $this->session = $this->container->offsetGet('SESSION');
73: $this->lang = $this->container->offsetGet('LOCALIZATION');
74: }
75: }