Пример #1
0
 private static function doMailAction($request)
 {
     require_once 'mail/MailManager.php';
     if (isset(self::$currentID) && self::$currentID != null) {
         self::$currentObject = MailManager::loadMail(self::$currentID);
     }
     switch (self::$requestedAction) {
         case "Edit":
             //una mail non si può modificare...
             break;
         case "Move":
             require_once 'mail/MailPage.php';
             MailPage::showMoveToForm(self::$currentObject);
             break;
         case "Delete":
             $dir = MailManager::directoryForMail(self::$currentObject, self::$user);
             MailManager::moveToTrash(self::$currentObject, $dir);
             header("location: " . FileManager::appendToRootPath("Directory/" . $dir->getID()));
             break;
         case "Spam":
             $dir = MailManager::directoryForMail(self::$currentObject, self::$user);
             MailManager::moveToSpam(self::$currentObject, $dir);
             header("location: " . FileManager::appendToRootPath("Directory/" . $dir->getID()));
             break;
         case "Answer":
             self::$currentObject = MailManager::loadMail(self::$currentID);
         case "New":
             if (!isset(self::$currentObject)) {
                 self::$currentObject = null;
             }
             require_once 'mail/MailPage.php';
             MailPage::showNewForm(self::$currentObject);
             break;
         case "EmptyTrash":
             MailManager::emptyTrash(self::$user);
             header("location: " . FileManager::appendToRootPath("User/" . self::$user->getID() . "/Mails"));
             break;
         case "Read":
             require_once 'mail/MailPage.php';
             MailPage::showMail(self::$currentObject);
             break;
         case "Search":
         default:
             require_once 'search/SearchPage.php';
             SearchPage::showMailSearchForm();
             break;
     }
 }