open(1); echo "
-> opened Folder
"; } catch (FolderNotAvailableException $e) { // CREATE $myFolder->create("INBOX","1"); echo "
-> created Folder
"; } catch (SQLiteException $e) { // DIE BECAUSE OF SQL-ERROR die($e->getMessage()); } /** * SOME TESTs * * SiteMessageFolder::getName() * SiteMessageFolder::getDate() * SiteMessageFolder::hasSubfolder() * SiteMessageFolder::hasMessage() **/ echo "
Foldername: 	".$myFolder->getName()."
"; echo "
created: 	".date("H:i:s d.m.Y", $myFolder->getDate())."
"; echo "
Subfolders: 	".$myFolder->hasSubfolder()."
"; echo "
Messages: 	".$myFolder->hasMessage()."
"; /** * SOME TESTs * * SiteMessageFolder::setName() **/ try { switch($myFolder->getName()) { case "INBOX": echo "
-> renaming folder from INBOX to OUTBOX...
"; $myFolder->setName("OUTBOX"); break; case "OUTBOX": echo "
-> renaming folder from OUTBOX to INBOX...
"; $myFolder->setName("INBOX"); break; } } catch (SQLiteException $e) { die($e->getMessage()); } /** * SOME TESTs * * SiteMessageFolder::getName() **/ echo "
Foldername: 	".$myFolder->getName()."
"; /** * Create a Subfolder of Folder #1 */ echo "
-> creating subfolder
"; $myFolder->create("SUB1",1,1); $myFolder->open(1); /** * SOME TESTs * * SiteMessageFolder::hasSubfolder() **/ echo "
Subfolders: 	".$myFolder->hasSubfolder()."
"; $mySubFolder = $myFolder->getSubfolder(1); /** * SOME TESTs ON SUBFOLDER * * SiteMessageFolder::getName() * SiteMessageFolder::getDate() * SiteMessageFolder::hasSubfolder() * SiteMessageFolder::hasMessage() **/ echo "
-> showing subfolder-infos
"; echo "
Foldername: 	".$mySubFolder->getName()."
"; echo "
created: 	".date("H:i:s d.m.Y", $mySubFolder->getDate())."
"; echo "
Subfolders: 	".$mySubFolder->hasSubfolder()."
"; echo "
Messages: 	".$mySubFolder->hasMessage()."
"; /** * SOME TESTs * * SiteMessage::create() * SiteMessageFolder::hasMessage() **/ $myMessage = new SiteMessage($db); try { if($myMessage->create(1,1,"This is the subject","This is the text")) { echo "
-> creating a message
"; } } catch (SQLiteException $e) { // DIE BECAUSE OF SQL-ERROR die($e->getMessage()); } /** * SOME TESTs * Move the newly created message into INBOX-Folder (id:1) */ echo "
-> moving message to folder INBOX.
"; $myMessage->setFolder(1); /** * SOME TESTs * SiteMessageFolder::hasMessage() **/ echo "
Messages: 	".$myFolder->hasMessage()."
"; /** * SOME TESTs * * SiteMessage::getSender() * SiteMessage::getReceiver() * SiteMessage::getSubject() * SiteMessage::getText() * SiteMessage::getDate() **/ echo "
-> show Message-Informations
"; echo "
Sender(id):	".$myMessage->getSender()."
"; echo "
Receiver(id):	".$myMessage->getReceiver()."
"; echo "
Folder(id): 	".$myMessage->getFolder()."
"; echo "
Date: 		".date("H:i:s d.m.Y", $myMessage->getDate())."
"; echo "
Subject: 	".$myMessage->getSubject()."
"; echo "
Text: 		".$myMessage->getText()."
"; /** * SOME TESTs * Deleting Folder #1 * comment out, to keep all messages, folders, etc. */ echo "
-> Deleting Folder (id:1) and all Subfolders/Messages
"; $myFolder->delete(); echo "
That's it. All Messages and Folders have been deleted.
			

Be inspired

Have fun!

- Cornelius -

"; ?>