Exemplo n.º 1
0
 private static function doDirectoryAction($request)
 {
     require_once 'mail/MailManager.php';
     if (isset(self::$currentID) && self::$currentID != null) {
         self::$currentObject = MailManager::loadDirectory(self::$currentID);
     }
     switch (self::$requestedAction) {
         case "Edit":
             require_once 'mail/MailPage.php';
             MailPage::showEditDirectoryForm(self::$currentObject);
             break;
         case "Mails":
             require_once 'mail/MailPage.php';
             foreach (self::$currentObject->getMails() as $mail) {
                 MailPage::showShortMail($mail);
             }
             break;
         case "Delete":
             MailManager::deleteDirectory(self::$currentObject);
             $inbox = MailManager::loadDirectoryFromName(MAILBOX, self::$currentObject->getUser());
             header("location: " . FileManager::appendToRootPath("Directory/" . $inbox->getID()));
             break;
         case "Sent":
             $mails = MailManager::getMailSent(self::$user);
             foreach ($mails->getMails() as $mail) {
                 MailPage::showShortMail($mail);
             }
             break;
         case "Unread":
             //@deprecated non ce n'è bisogno...
             $inbox = MailManager::loadDirectoryFromName(MAILBOX, self::$user);
             header("location: " . FileManager::appendToRootPath("Directory/" . $inbox->getID()));
             break;
         case "New":
             require_once 'mail/MailPage.php';
             MailPage::showNewDirectoryForm();
             break;
         case "Search":
         default:
             require_once 'search/SearchPage.php';
             SearchPage::showMailSearchForm();
             break;
     }
 }