]> git.mxchange.org Git - shipsimu.git/blobdiff - application/selector/class_ApplicationSelector.php
Application selector (demo app!) fixed
[shipsimu.git] / application / selector / class_ApplicationSelector.php
index b0866dcb8e97d37b00fa69def9d9ce0eaa822e0a..9a8357da5075c8ea0e29bd94b3b5f7bda20d46b0 100644 (file)
@@ -22,7 +22,7 @@
  * 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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ApplicationSelector extends BaseFrameworkSystem {
        /**
@@ -46,23 +46,24 @@ class ApplicationSelector extends BaseFrameworkSystem {
        private $dirIgnoreList = array(
                ".",
                "..",
-               ".htaccess"
+               ".htaccess",
+               ".svn"
        );
 
        /**
-        * The private constructor. No direct instances can be created from this.
+        * The protected constructor. No direct instances can be created from this.
         *
         * @return      void
         */
-       private function __construct() {
+       protected function __construct() {
                // Call parent constructor
-               parent::constructor(__CLASS__);
+               parent::__construct(__CLASS__);
 
                // Set description
-               $this->setPartDescr("Applikationswechsler");
+               $this->setObjectDescription("Applikationswechsler");
 
                // Create unique ID number
-               $this->createUniqueID();
+               $this->generateUniqueId();
 
                // Remove system array and thousand seperator
                $this->removeSystemArray();
@@ -80,7 +81,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         * @param               $fileIOInstance The file I/O instance
         * @return              $selInstance            An instance of ApplicationSelector
         */
-       public final static function createApplicationSelector (ManageableLanguage $langInstance, FileIOHandler $fileIOInstance) {
+       public final static function createApplicationSelector (ManageableLanguage $langInstance, FileIoHandler $fileIOInstance) {
                // Get a new instance
                $selInstance = new ApplicationSelector();
 
@@ -89,7 +90,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                // Set language and file I/O instances
                $selInstance->setLanguageInstance($langInstance);
-               $selInstance->setFileIOInstance($fileIOInstance);
+               $selInstance->setFileIoInstance($fileIOInstance);
 
                // Return the prepared instance
                return $selInstance;
@@ -101,7 +102,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         * @return      void
         */
        private function initializeAppsList () {
-               $this->foundApps = new FrameworkArrayObject();
+               $this->foundApps = new FrameworkArrayObject("FakedFoundApplications");
        }
 
        /**
@@ -110,7 +111,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         * @return      void
         */
        private function initializeTemplatesList () {
-               $this->loadedTemplates = new FrameworkArrayObject();
+               $this->loadedTemplates = new FrameworkArrayObject("FakedLoadedTemplates");
        }
 
        /**
@@ -141,9 +142,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
                        } elseif (!is_object($app)) {
                                // Not an object
                                throw new NoObjectException($app, self::EXCEPTION_IS_NO_OBJECT);
-                       } elseif (!method_exists($app, $this->getConfigInstance()->readConfig("entry_method"))) {
+                       } elseif (!method_exists($app, $this->getConfigInstance()->readConfig('entry_method'))) {
                                // Method not found!
-                               throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig("entry_method")), self::EXCEPTION_MISSING_METHOD);
+                               throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig('entry_method')), self::EXCEPTION_MISSING_METHOD);
                        }
 
                        // Add the current instance to the list
@@ -157,7 +158,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *
         * @param               $tplEngine      An instance of TemplateEngine
         */
-       private function setSelectorTemplateEngine (CompileableTemplate $tplEngine) {
+       private final function setSelectorTemplateEngine (CompileableTemplate $tplEngine) {
                $this->selectorTplEngine = $tplEngine;
        }
 
@@ -166,7 +167,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *
         * @return      $selectTplEngine        The selector's template engine
         */
-       private function getSelectorTemplateEngine () {
+       private final function getSelectorTemplateEngine () {
                return $this->selectorTplEngine;
        }
 
@@ -176,7 +177,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         * @return      $loadedTemplates        An array object holding all loaded
         *                                                      application templates
         */
-       private function getLoadedTemplates () {
+       private final function getLoadedTemplates () {
                return $this->loadedTemplates;
        }
 
@@ -186,7 +187,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         * @return      $shortName      This selector's short name
         */
        public function getAppShortName() {
-               $shortName = $this->getConfigInstance()->readConfig("selector_path");
+               $shortName = $this->getConfigInstance()->readConfig('selector_path');
                return $shortName;
        }
 
@@ -212,11 +213,11 @@ class ApplicationSelector extends BaseFrameworkSystem {
                // Generate the base path for all applications
                $appBasePath = sprintf("%s%s/",
                        PATH,
-                       $this->getConfigInstance()->readConfig("application_path")
+                       $this->getConfigInstance()->readConfig('application_path')
                );
 
                // Add the selector path to the ignore list
-               $this->addDirIgnoreList($this->getConfigInstance()->readConfig("selector_path"));
+               $this->addDirIgnoreList($this->getConfigInstance()->readConfig('selector_path'));
 
                // Get a directory pointer for the application path
                $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath);
@@ -233,7 +234,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
                        // Is this a readable directory? (files will be ignored silently)
                        if ((is_dir($fqfn)) && (is_readable($fqfn))) {
                                // Then get the init.php script for analyzing
-                               $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig("php_extension"));
+                               $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig('php_extension'));
 
                                // Load the application's init.php script and append the
                                // application to the ArrayObject
@@ -266,7 +267,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                        // Try to load the web template
                        $tplEngine->loadWebTemplate(sprintf("%s_%s",
-                               $this->getConfigInstance()->readConfig("tpl_selector_prefix"),
+                               $this->getConfigInstance()->readConfig('tpl_selector_prefix'),
                                strtolower($appInstance->getAppShortName())
                        ));
 
@@ -286,7 +287,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       public function removeDirIgnoreList () {
+       public final function removeDirIgnoreList () {
                unset($this->dirIgnoreList);
        }
 
@@ -301,7 +302,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
                $tplEngine = $this->prepareTemplateEngine($this);
 
                // Load the selector's template
-               $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_main_tpl"));
+               $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_main_tpl'));
 
                // Now store it in the class
                $this->setSelectorTemplateEngine($tplEngine);
@@ -323,7 +324,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
                $tplEngine = $this->prepareTemplateEngine($this);
 
                // Load template which shall later hold all application templates
-               $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_apps_tpl"));
+               $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_apps_tpl'));
 
                // Add all loaded application templates together
                $dummy = "";
@@ -349,16 +350,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                } // END - for
        }
-
-       /**
-        * Stub!
-        */
-       public function saveObjectToDatabase () {
-               $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
-                       $this->__toString(),
-                       __FUNCTION__
-               ));
-       }
 }
 
 // [EOF]