]> git.mxchange.org Git - hub.git/blob - ship-simu/application/hub/class_ApplicationHelper.php
a626a0b21c8e4e663754273bc0d7a08a1b7a7b1a
[hub.git] / ship-simu / application / hub / class_ApplicationHelper.php
1 <?php
2 /**
3  * A class holding general data about the application and some methods for
4  * the management including the entry point.
5  *
6  * E.g.:
7  *
8  * index.php?app=my_app
9  *
10  * You need to create a folder in the folder "application" named "my_app"
11  * (without the quotes) and create a include file called
12  * class_ApplicationHelper.php. You have to write the same class for your
13  * application and implement the same interface called ManageableApplication
14  * because this class include file will be searched for.
15  *
16  * It is good when you avoid more GET parameters to keep URLs short and sweet.
17  * But sometimes you need some GET paramerers e.g. for your imprint or info page
18  * or other linked pages which you have to create and state some informations.
19  *
20  * Please remember that this include file is being loaded *before* the class
21  * loader is loading classes from "exceptions", "interfaces" and "main"!
22  *
23  * @author     Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
24  * @version    0.1
25  */
26 class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication {
27         /**
28          * The version number of this application
29          */
30         private $appVersion = "";
31
32         /**
33          * The human-readable name for this application
34          */
35         private $appName = "";
36
37         /**
38          * The short uni*-like name for this application
39          */
40         private $shortName = "";
41
42         /**
43          * An instance of this class
44          */
45         private static $thisInstance = null;
46
47         /**
48          * Private constructor
49          *
50          * @return      void
51          */
52         private function __construct () {
53                 // Call parent constructor
54                 parent::constructor(__CLASS__);
55
56                 // Set description
57                 $this->setPartDescr("Application-Helper");
58
59                 // Create an unique ID
60                 $this->createUniqueID();
61
62                 // Tidy up a little
63                 $this->removeSystemArray();
64         }
65
66         /**
67          * Getter for an instance of this class
68          *
69          * @return      $thisInstance           An instance of this class
70          */
71         public final static function getInstance () {
72                 // Is the instance there?
73                 if (is_null(self::$thisInstance)) {
74                         self::$thisInstance = new ApplicationHelper();
75                 }
76
77                 // Return the instance
78                 return self::$thisInstance;
79         }
80
81         /**
82          * Getter for the version number
83          *
84          * @return      $appVersion     The application's version number
85          */
86         public final function getAppVersion () {
87                 return $this->appVersion;
88         }
89         /**
90          * Setter for the version number
91          *
92          * @param               $appVersion     The application's version number
93          * @return      void
94          */
95         public final function setAppVersion ($appVersion) {
96                 // Cast and set it
97                 $appVersion = (string) $appVersion;
98                 $this->appVersion = $appVersion;
99         }
100
101         /**
102          * Getter for human-readable name
103          *
104          * @return      $appName        The application's human-readable name
105          */
106         public final function getAppName () {
107                 return $this->appName;
108         }
109
110         /**
111          * Setter for human-readable name
112          *
113          * @param               $appName        The application's human-readable name
114          * @return      void
115          */
116         public final function setAppName ($appName) {
117                 // Cast and set it
118                 $appName = (string) $appName;
119                 $this->appName = $appName;
120         }
121
122         /**
123          * Getter for short uni*-like name
124          *
125          * @return      $shortName      The application's short uni*-like name
126          */
127         public final function getAppShortName () {
128                 return $this->shortName;
129         }
130
131         /**
132          * Setter for short uni*-like name
133          *
134          * @param               $shortName      The application's short uni*-like name
135          * @return      void
136          */
137         public final function setAppShortName ($shortName) {
138                 // Cast and set it
139                 $shortName = (string) $shortName;
140                 $this->shortName = $shortName;
141         }
142
143         /**
144          * Launches the hub system
145          *
146          * @return      void
147          */
148         public final function entryPoint () {
149                 // Get a core loop instance
150                 $hubInstance = HubCoreLoop::createHubCoreLoop();
151
152                 // Output some text
153                 $hubInstance->outputIntro();
154
155                 // Contact the master hub
156                 $hubInstance->contactMasterHub();
157
158                 // The main loop begins here
159                 $hubInstance->coreLoop();
160
161                 // Shutdown the hub
162                 $hubInstance->shutdownHub();
163         }
164 }
165
166 // [EOF]
167 ?>