inc/classes/interfaces/criteria/.htaccess -text
inc/classes/interfaces/criteria/class_Criteria.php -text
inc/classes/interfaces/criteria/extended/.htaccess -text
-inc/classes/interfaces/criteria/extended/class_LocalCriteria.php -text
+inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php -text
+inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php -text
inc/classes/interfaces/database/.htaccess -text
inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text
inc/classes/interfaces/database/frontend/.htaccess -text
inc/classes/main/controller/form/.htaccess -text
inc/classes/main/controller/form/class_WebDoFormController.php -text
inc/classes/main/criteria/.htaccess -text
+inc/classes/main/criteria/class_DataSetCriteria.php -text
inc/classes/main/criteria/class_SearchCriteria.php -text
inc/classes/main/crypto/.htaccess -text
inc/classes/main/crypto/class_CryptoHelper.php -text
* @return void
*/
private function initializeAppsList () {
- $this->foundApps = new FrameworkArrayObject();
+ $this->foundApps = new FrameworkArrayObject("FakedFoundApplications");
}
/**
* @return void
*/
private function initializeTemplatesList () {
- $this->loadedTemplates = new FrameworkArrayObject();
+ $this->loadedTemplates = new FrameworkArrayObject("FakedLoadedTemplates");
}
/**
__LINE__,
$this->getMerchantName()
));
- $this->priceList = new FrameworkArrayObject();
+ $this->priceList = new FrameworkArrayObject("FakedPriceList");
}
// Setter for merchant name
__LINE__,
$this->getCompanyName()
));
- $this->employeeList = new FrameworkArrayObject();
+ $this->employeeList = new FrameworkArrayObject("FakedEmployeeList");
}
// Werftenliste erstellen
__LINE__,
$this->getCompanyName()
));
- $this->shipyardList = new FrameworkArrayObject();
+ $this->shipyardList = new FrameworkArrayObject("FakedShipyardList");
}
// Auftragsliste erstellen
__LINE__,
$this->getCompanyName()
));
- $this->contractList = new FrameworkArrayObject();
+ $this->contractList = new FrameworkArrayObject("FakedContractList");
}
// Setter-Methode fuer Firmennamen
if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Werft-Liste wird für den Hafen <strong>%s</strong> erstellt.<br />\n",
$this->getHarborName()
));
- $this->shipyardList = new FrameworkArrayObject();
+ $this->shipyardList = new FrameworkArrayObject("FakedShipyardList");
}
// Setter fuer Hafennamen
__LINE__,
$this->getShipyardName()
));
- $this->staffList = new FrameworkArrayObject();
+ $this->staffList = new FrameworkArrayObject("FakedStaffList");
}
// Create ship type list
__LINE__,
$this->getShipyardName()
));
- $this->shipTypeList = new FrameworkArrayObject();
+ $this->shipTypeList = new FrameworkArrayObject("FakedShipTypeList");
}
// Setter-Methode fuer Werft-Name
__CLASS__,
__LINE__
));
- $this->personellList = new FrameworkArrayObject();
+ $this->personellList = new FrameworkArrayObject("FakedPersonellList");
} else {
throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID);
}
$this->setCacheCond($serialized);
// Create cached list
- $this->setAllCacheList(new FrameworkArrayObject());
+ $this->setAllCacheList(new FrameworkArrayObject("FakedCacheList"));
// Search all unemployed personells
for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) {
* @return void
*/
public function registerNewUser () {
- $this->partialStub();
+ // Get a user database wrapper
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper');
+
+ // Use this instance to insert the whole registration instance
+ $wrapperInstance->insertRegistrationObject($this);
}
/**
// Array-Objekt anlegen
private function createStructuresArray () {
- $this->structures = new FrameworkArrayObject();
+ $this->structures = new FrameworkArrayObject("FakedShipStructures");
}
// Schiffsteil generieren (kann alles sein)
+++ /dev/null
-<?php
-/**
- * An interface for local criterias
- *
- * @author Roland Haeder <webmaster@mxchange.org>
- * @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-interface LocalCriteria extends Criteria {
-}
-
-//
-?>
--- /dev/null
+<?php
+/**
+ * An interface for local criterias
+ *
+ * @author Roland Haeder <webmaster@mxchange.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface LocalCriteria extends Criteria {
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for storeable data sets
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+interface StoreableCriteria extends Criteria {
+}
+
+// [EOF]
+?>
* @param $object An instance to the object we want to save
* @return void
* @see limitObject(ObjectLimits) limitObject
+ * @deprecated
*/
- function saveObject ($object);
+ function saveObject (FrameworkInterface $object);
/**
* Analyses if a unique ID has already been used or not. This method does
* @throws NoObjectException If $dbInstance is not an object
* @throws MissingMethodException If the required method
* isUniqueIdUsed() was not found
+ * @deprecated
*/
function getObjectFromCachedData ($idNumber);
}
*
* @return Object The fully re-created object or instance to
* ObjectContainer
+ * @deprecated
*/
function loadObject ();
* @throws SqlException If an SQL error occurs
*/
function querySelect ($resultType, $tableName, Criteria $criteriaInstance);
+
+ /**
+ * "Inserts" a data set instance into a local file database folder
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ function insertDataSet (StoreableCriteria $dataSetInstance);
}
// [EOF]
*/
protected function initCache () {
// Now create the "data cache"
- $this->dataCache = new FrameworkArrayObject();
+ $this->dataCache = new FrameworkArrayObject("FakedDataCache");
}
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class FrameworkArrayObject extends ArrayObject {
+ /**
+ * Real class name
+ */
+ private $realClass = "";
+
+ /**
+ * Public constructor for setting real class name
+ *
+ * @param $className Real class name
+ * @return void
+ */
+ public function __construct ($className) {
+ $this->realClass = (string) $className;
+ }
+
/**
* Get real class' name back
*
* @return $realClass The class' real name
*/
public function __toString () {
- return get_class($this);
+ return $this->realClass;
}
}
--- /dev/null
+<?php
+/**
+ * A set of data storeable in databases
+ *
+ * @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Storeable data set for databases");
+
+ // Create unique ID number
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this criteria
+ *
+ * @return $criteriaInstance An instance of this criteria
+ */
+ public final static function createDataSetCriteria () {
+ // Get a new instance
+ $criteriaInstance = new DataSetCriteria();
+
+ // Return the instance
+ return $criteriaInstance;
+ }
+
+ /**
+ * Add extra criteria
+ *
+ * @param $criteriaKey Criteria key
+ * @param $criteriaValue Criteria value
+ * @return void
+ */
+ public function addCriteria ($criteriaKey, $criteriaValue) {
+ die("STUB!");
+ }
+}
+
+// [EOF]
+?>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class SearchCriteria extends BaseFrameworkSystem implements LocalCriteria {
+class SearchCriteria extends BaseFrameworkSystem implements LocalSearchCriteria {
/**
* Criteria to handle
*/
*
* @return void
*/
- protected function __construct($class) {
+ protected function __construct($class = __CLASS__) {
// Call parent constructor
- parent::constructor(__CLASS__);
+ parent::__construct($class);
// Set part description
$this->setObjectDescription("");
* Saves a given object to the local file system by serializing and
* transparently compressing it
*
- * @param $object The object we shall save to the local file system
+ * @param $object The object we shall save to the local file system
* @return void
- * @throws NullPointerException If the object instance is null
- * @throws NoObjectException If the parameter $object is not
- * an object
*/
- public final function saveObject ($object) {
- // Some tests on the parameter...
- if (is_null($object)) {
- // Is null, throw exception
- throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($object)) {
- // Is not an object, throw exception
- throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($object, '__toString')) {
- // A highly required method was not found... :-(
- throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD);
- }
-
+ public final function saveObject (FrameworkInterface $object) {
// Get a string containing the serialized object. We cannot exchange
// $this and $object here because $object does not need to worry
// about it's limitations... ;-)
/**
* Get a serialized string from the given object
*
- * @param $object The object we want to serialize and transparently
- * compress
- * @return $serialized A string containing the serialzed/compressed object
+ * @param $object The object we want to serialize and transparently
+ * compress
+ * @return $serialized A string containing the serialzed/compressed object
* @see ObjectLimits An object holding limition information
* @see SerializationContainer A special container class for e.g.
- * attributes from limited objects
+ * attributes from limited objects
*/
- private function serializeObject ($object) {
+ private function serializeObject (FrameworkInterface $object) {
// If there is no limiter instance we serialize the whole object
// otherwise only in the limiter object (ObjectLimits) specified
// attributes summarized in a special container class
* Analyses if a unique ID has already been used or not by search in the
* local database folder.
*
- * @param $uniqueID A unique ID number which shall be checked
- * before it will be used
- * @param $inConstructor If we got called in a de/con-structor or
- * from somewhere else
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If we got called in a de/con-structor or
+ * from somewhere else
* @return $isUnused true = The unique ID was not found in the database,
- * false = It is already in use by an other object
- * @throws NoArrayCreatedException If explode() fails to create an array
+ * false = It is already in use by an other object
+ * @throws NoArrayCreatedException If explode() fails to create an array
* @throws InvalidArrayCountException If the array contains less or
* more than two elements
*/
$resultData = null;
// Is this criteria supported?
- if (!$criteriaInstance instanceof LocalCriteria) {
+ if (!$criteriaInstance instanceof LocalSearchCriteria) {
// Not supported by this database layer
throw new UnsupportedCriteriaException(array($this, $criteriaInstance), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
}
// Return the gathered result
return $resultData;
}
+
+ /**
+ * "Inserts" a data set instance into a local file database folder
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ public function insertDataSet (StoreableCriteria $dataSetInstance) {
+ // Create full path name
+ $fqfn = sprintf("%s%s/%s.%s",
+ $this->getSavePath(),
+ $dataSetInstance->getTableName(),
+ $dataSetInstance->getCombinedUniqueKey(),
+ $this->getFileExtension()
+ );
+ die($fqfn);
+
+ // Try to save the request away
+ try {
+ // Get a file pointer instance
+
+ // Reset last error message and exception
+ $this->resetLastError();
+ } catch (FrameworkException $e) {
+ // Catch all exceptions and store them in last error
+ $this->lastException = $e;
+ $this->lastError = $e->getMessage();
+ }
+ }
}
// [EOF]
// And return the instance
return $resultInstance;
}
+
+ /**
+ * Handles inserting the registration data from a registration instance into the database
+ *
+ * @param $registrationInstance An instance of a registration class
+ * @return void
+ */
+ public function insertRegistrationObject (UserRegister $registrationInstance) {
+ // Get the request instance which we use for saving
+ $requestInstance = $registrationInstance->getRequestInstance();
+
+ // Generate a data set for the request
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria');
+ $dataSetInstance->setTableName(self::DB_TABLE_USER);
+
+ // Add all needed request elements to the data set
+ $requestInstance->debugInstance();
+
+ // "Insert" this request instance completely into the database
+ $this->getDatabaseInstance()->insertDataSet($dataSetInstance);
+ }
}
// [EOF]
// Auto-initialization
if (is_null($this->limitArray)) {
// Initialize this array
- $this->limitArray = new FrameworkArrayObject();
+ $this->limitArray = new FrameworkArrayObject("FakedLimitArray");
}
// Add the object's name to it
// Auto-initialization
if (is_null($this->limitArray)) {
// Initialize this array
- $this->limitArray = new FrameworkArrayObject();
+ $this->limitArray = new FrameworkArrayObject("FakedLimitArray");
}
// Add the direct string to ArrayObject
* @return void
*/
public function initLanguageStrings () {
- $this->langStrings = new FrameworkArrayObject();
+ $this->langStrings = new FrameworkArrayObject("FakedLanguageStrings");
}
/**
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class HttpRequest extends BaseFrameworkSystem implements Requestable {
+class HttpRequest extends BaseFrameworkSystem implements Requestable, Iterateable {
/**
* Array for the request data
*/
* @return void
*/
public final function initVariableStack () {
- $this->varStack = new FrameworkArrayObject();
+ $this->varStack = new FrameworkArrayObject("FakedVariableStack");
}
/**
/**
* Save a whole object or parts of it to the database or local file
*
- * @param $object The object we shall save
+ * @param $object The object we shall save
* @return void
*/
- public function saveObject ($object) {
+ public function saveObject (FrameworkInterface $object) {
// Connect to the database
$this->dbLayer->connectToDatabase();
* Set a limitation for the saving process. This shall be done before
* saveObject() is called else saveObject() shall save the whole object.
*
- * @param $limitInstance An instance of ObjectLimits which contains
- * elements we shall exclusivly include in
- * saving process
+ * @param $limitInstance An instance of ObjectLimits which contains
+ * elements we shall exclusivly include in
+ * saving process
* @return void
*/
public function limitObject (ObjectLimits $limitInstance) {
$exceptionInstance = $this->dbLayer->getLastException();
return $exceptionInstance;
}
+
+ /**
+ * "Inserts" a data set instance into a local file database folder
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ public function insertDataSet (StoreableCriteria $dataSetInstance) {
+ // Connect to the database
+ $this->dbLayer->connectToDatabase();
+
+ // Ask the database layer
+ $this->dbLayer->insertDataSet($requestInstance);
+ }
}
// [EOF]
// CFG: SEARCH-CRITERIA
$cfg->setConfigEntry('search_criteria', "SearchCriteria");
+// CFG: DATASET-CRITERIA
+$cfg->setConfigEntry('dataset_criteria', "DataSetCriteria");
+
// CFG: FILE-IO-HANDLER
$cfg->setConfigEntry('file_io_handler', "FileIoHandler");