Moritz Schmidt преди 10 години
родител
ревизия
79631f4d8c
променени са 11 файла, в които са добавени 317 реда и са изтрити 77 реда
  1. 3 2
      cron.php
  2. 5 0
      includes/controller.inc.php
  3. 1 0
      includes/database.inc.php
  4. 6 43
      includes/document.inc.php
  5. 4 11
      includes/functions.inc.php
  6. 225 0
      includes/mail.inc.php
  7. 1 0
      index.php
  8. 43 17
      sql_structure.sql
  9. 2 2
      templates/documentlist.php
  10. 6 2
      templates/label.php
  11. 21 0
      templates/maillist.php

+ 3 - 2
cron.php

@@ -9,13 +9,14 @@ include('includes/document.inc.php');
 include('includes/label.inc.php');
 include('includes/mailbox.inc.php');
 include('includes/mailboxfolder.inc.php');
+include('includes/mail.inc.php');
 
 $db = new Database($CONFIG['dbHost'], $CONFIG['dbUser'], $CONFIG['dbPassword'], $CONFIG['dbDatabase']);
 
 
-echo json_encode(scanDocuments($CONFIG['documentPath']));
+//echo json_encode(scanDocuments($CONFIG['documentPath'])); // Documents scan
 
-//searchMails(); // Mails -> eigene klasse
+searchMails(); // json status
 
 
 ?>

+ 5 - 0
includes/controller.inc.php

@@ -57,15 +57,20 @@ class Controller {
 					break;
 				case 'label':
 					$documentView 	= new View();
+					$mailView		= new View();
 					$callView		= new View();
 					$documentView->setTemplate('documentlist');
+					$mailView->setTemplate('maillist');
 					$callView->setTemplate('calllist');
 					$callView->assign('calls', Call::getCallsByLabelID($this->request['labelId']));
 					$innerView->setTemplate('label');
 					$innerView->assign('label', Label::getLabelById($this->request['labelId']));
 					$documentView->assign('labelId', $this->request['labelId']);
 					$documentView->assign('documents', Document::getDocumentsByLabelId($this->request['labelId']));
+					$mailView->assign('labelID', $this->request['labelId']);
+					$mailView->assign('mails', Mail::getMailsByLabelID($this->request['labelId']));
 					$innerView->assign('documentlist', $documentView->loadTemplate());
+					$innerView->assign('maillist', $mailView->loadTemplate());
 					$innerView->assign('calllist', $callView->loadTemplate());
 					break;
 				case 'manage-labels':

+ 1 - 0
includes/database.inc.php

@@ -6,6 +6,7 @@ class Database {
 
 	public function __construct($host, $user, $password, $db) {
 		$this->handle = new mysqli($host, $user, $password, $db);
+		$this->handle->query("SET NAMES utf8;");
 	}
 
 	public function close() {

+ 6 - 43
includes/document.inc.php

@@ -8,10 +8,8 @@ class Document {
     private $draft      =   NULL;
     private $created    =   NULL;
     private $lastChange =   NULL;
-    private $type       =   NULL;
-    private $mailUid    =   NULL;
 
-    public function __construct($id, $fileName, $path, $labelId, $draft, $created, $lastChange, $type, $mailUid) {
+    public function __construct($id, $fileName, $path, $labelId, $draft, $created, $lastChange) {
         $this->id           = $id;
         $this->fileName     = $fileName;
         $this->path         = $path;
@@ -19,8 +17,6 @@ class Document {
         $this->draft        = $draft;
         $this->created      = $created;
         $this->lastChange   = $lastChange;
-        $this->type         = $type;
-        $this->mailUid      = $mailUid;
     }
 
     public function getId() {
@@ -51,14 +47,6 @@ class Document {
         return $this->lastChange;
     }
 
-    public function getType() {
-        return $this->type;
-    }
-
-    public function getMailUid() {
-        return $this->mailUid;
-    }
-
     /**
      * Get all Documents
      *
@@ -73,7 +61,7 @@ class Document {
          $documents = $db->selectQuery("SELECT * FROM `documents`;");
 
          foreach($documents as $document) {
-             $return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change, $document->type, $document->mail_uid);
+             $return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change);
          }
 
          return $return;
@@ -96,7 +84,7 @@ class Document {
         $documents = $db->selectQuery("SELECT * FROM `documents` WHERE `label_id` = " . $labelId . ";");
 
         foreach($documents as $document) {
-            $return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change, $document->type, $document->mail_uid);
+            $return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change);
         }
 
         return $return;
@@ -119,37 +107,12 @@ class Document {
     	$documents = $db->selectQuery("SELECT documents.* FROM `documents` JOIN `labels` ON labels.id = documents.label_id WHERE labels.path = '" . $path . "';");
 
     	foreach($documents as $document) {
-    		$return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change, $document->type, $document->mail_uid);
+    		$return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change);
     	}
 
     	return $return;
     }
 
-    /**
-     * Get Documents by Mail-Header-Info
-     *
-     *
-     * @param int $mailAcc  ID of wanted Mailaccount
-     * @param int $mailUid  UID of wanted Mail-Document
-     * @param int $labelId  ID fo wanted Label
-     *
-     * @return Array(Document)  Selected Document(s)
-     *
-     */
-
-    public static function getDocumentsByMailInfo($mailAcc, $mailUid, $labelId) {
-        global $db;
-
-        $return = array();
-        $documents = $db->selectQuery("SELECT * FROM `documents` WHERE `mail_uid` = " . $mailUid . " AND `label_id` = " . $labelId . " AND `mail_acc` = " . $mailAcc . ";");
-
-        foreach($documents as $document) {
-            $return[] = new Document($document->id, $document->filename, $document->path, $document->label_id, $document->draft, $document->created, $document->last_change, $document->type, $document->mail_uid);
-        }
-
-        return $return;
-    }
-
     /**
      * Insert new Document into DB
      *
@@ -168,10 +131,10 @@ class Document {
      *
      */
 
-    public static function addDocument($type, $fileName, $path, $labelId, $draft, $created, $lastChange, $mailUid = 0, $mailAcc = -1) {
+    public static function addDocument($type, $fileName, $path, $labelId, $draft, $created, $lastChange) {
         global $db;
 
-        $query = "INSERT INTO `documents`(`type`, `filename`, `path`, `label_id`, `draft`, `created`, `last_change`, `mail_uid`, `mail_acc`) VALUES ('" . $type . "', '" . $fileName . "', '" . $path . "', " . $labelId . ", '" . $draft . "', '" . $created . "', '" . $lastChange . "', " . $mailUid . ", " . $mailAcc . ");";
+        $query = "INSERT INTO `documents`(`type`, `filename`, `path`, `label_id`, `draft`, `created`, `last_change`) VALUES ('" . $type . "', '" . $fileName . "', '" . $path . "', " . $labelId . ", '" . $draft . "', '" . $created . "', '" . $lastChange . "');";
         $db->insertQuery($query);
     }
 

+ 4 - 11
includes/functions.inc.php

@@ -108,12 +108,9 @@ function searchMails() {
 	global $user;
 	$mailboxes = Mailbox::getAllMailBoxes();
 
-	foreach($mailboxes as $mailbox) {
-		$mailbox->listFolders();
-	}
-
 
 	foreach($mailboxes as $mailbox) {
+		$mailbox->listFolders();
 		foreach($mailbox->getFolders() as $folder) {
 			$mbFolder = MailboxFolder::getMailboxFolderByName($folder);
 			if($mbFolder != false) {
@@ -123,15 +120,11 @@ function searchMails() {
 
 				for($i = 1; $i <= $messageCount; ++$i) {
 				    $headers = imap_header($mailbox->getMailbox(), $i);
-					pa($headers);
-					//$uid = imap_msgno($mailbox->getMailbox(), imap_uid($mailbox->getMailbox(), $i));
-					//echo $uid;
-					$uid = imap_uid($mailbox->getMailbox(), $i);
 
-					$documents = Document::getDocumentsByMailInfo($mailbox->getId(), $uid, $mbFolder->getLabelId());
+					if(!Mail::getMailByMailInfo($mbFolder->getId(), $headers->Msgno)) {
+						$mail = new Mail(NULL, imap_utf8($headers->from[0]->mailbox . '@' . $headers->from[0]->host), imap_utf8($headers->subject), $mbFolder->getId(), $headers->Msgno);
 
-					if(sizeof($documents) < 1) {
-						Document::addDocument('mail', $headers->subject, $headers->from[0]->mailbox . '@' . $headers->from[0]->host, $mbFolder->getLabelId(), '', '\'' . $headers->date . '\'', '\'' . $headers->date . '\'', $uid, $mailbox->getId());
+						$mail->save();
 					}
 				}
 			}

+ 225 - 0
includes/mail.inc.php

@@ -0,0 +1,225 @@
+<?php
+
+class Mail {
+    private $id                 = NULL;
+    private $mailSender         = NULL;
+    private $subject            = NULL;
+    private $mailboxFolderID    = NULL;
+    private $mailUID            = NULL;
+
+
+    public function __construct($id, $mailSender, $subject, $mailboxFolderID, $mailUID) {
+        $this->id               = $id;
+        $this->mailSender       = $mailSender;
+        $this->subject          = $subject;
+        $this->mailboxFolderID  = $mailboxFolderID;
+        $this->mailUID          = $mailUID;
+
+    }
+
+    /**
+     * Get the value of ID
+     *
+     *
+     * @return int
+     *
+     */
+
+    public function getID() {
+        return $this->id;
+    }
+
+    /**
+     * Set the value of ID
+     *
+     *
+     * @param int id
+     *
+     */
+
+    public function setID($id) {
+        $this->id = $id;
+     }
+
+    /**
+     * Get the value of Mail Sender
+     *
+     *
+     * @return string
+     *
+     */
+
+    public function getMailSender() {
+        return $this->mailSender;
+    }
+
+    /**
+     * Set the value of Mail Sender
+     *
+     *
+     * @param string mailSender
+     *
+     */
+
+    public function setMailSender($mailSender) {
+        $this->mailSender = $mailSender;
+     }
+
+    /**
+     * Get the value of Subject
+     *
+     *
+     * @return string
+     *
+     */
+
+    public function getSubject() {
+        return $this->subject;
+    }
+
+    /**
+     * Set the value of Subject
+     *
+     *
+     * @param string subject
+     *
+     */
+
+    public function setSubject($subject) {
+        $this->subject = $subject;
+     }
+
+    /**
+     * Get the value of Mailbox Folder ID
+     *
+     *
+     * @return int
+     *
+     */
+
+    public function getMailboxFolderID() {
+        return $this->mailboxFolderID;
+    }
+
+    /**
+     * Set the value of Mailbox Folder ID
+     *
+     *
+     * @param int mailboxFolderID
+     *
+     */
+
+    public function setMailboxFolderID($mailboxFolderID) {
+        $this->mailboxFolderID = $mailboxFolderID;
+     }
+
+    /**
+     * Get the value of Mail UID
+     *
+     *
+     * @return int
+     *
+     */
+
+    public function getMailUID() {
+        return $this->mailUID;
+    }
+
+    /**
+     * Set the value of Mail
+     *
+     *
+     * @param int mailUID
+     *
+     */
+
+    public function setMailUID($mailUID) {
+        $this->mailUID = $mailUID;
+     }
+
+     public function getMailRecipient() {
+         global $db;
+
+         return $db->selectStringQuery("SELECT `mailboxes`.`username` FROM `mailboxes` WHERE `mailboxes`.`id` = (SELECT `mailbox-folders`.`mailbox_id` FROM `mailbox-folders`WHERE `mailbox-folders`.`id` = (SELECT `mails`.`mailbox_folder_id` FROM `mails` WHERE `mails`.`id` = " . $this->getID() . "));");
+     }
+
+     /**
+     * Save Mail to DB
+     *
+     *
+     * @return void
+     *
+     */
+
+     public function save() {
+         global $db;
+
+         if($this->getID() == NULL) {
+             $this->setID("'NULL'");
+         }
+
+         $db->insertQuery("INSERT INTO `mails` (`id`, `mail_sender`, `subject`, `mailbox_folder_id`, `mail_uid`) VALUES (" . $this->getID() . ", '" . $this->getMailSender() . "', '" . $this->getSubject() . "', " . $this->getMailboxFolderID() . ", " . $this->getMailUID() . ") ON DUPLICATE KEY UPDATE `mail_sender` = '" . $this->getMailSender() . "', `subject` = '" . $this->getSubject() . "', `mailbox_folder_id` = " . $this->getMailboxFolderID() . ", `mail_uid` = " . $this->getMailUID() . ";");
+
+         $this->setID(NULL); // get ID from DB
+
+         echo "<br><br>";
+     }
+
+     /**
+     * Get Mail by Mail information
+     *
+     * @param int $mailboxFolder  ID of mailbox-Folder
+     * @param int $mailUID  UID of Mail
+     *
+     * @return Mail/bool  Selected Mail, or false if not found
+     *
+     */
+
+     public static function getMailByMailInfo($mailboxFolder, $mailUID) {
+         global $db;
+
+         $mails = $db->selectQuery("SELECT * FROM `mails` WHERE `mailbox_folder_id` = " . $mailboxFolder . " AND `mail_uid` = " . $mailUID . ";");
+
+         $return = array();
+
+         if(!$mails) {
+             return false;
+         }
+
+         foreach($mails as $mail) {
+             $return[] = new Mail($mail->id, $mail->mail_sender, $mail->subject, $mail->mailbox_folder_id, $mail->mail_uid);
+         }
+
+         return $return[0];
+     }
+
+     /**
+     * Get Mails by Label ID
+     *
+     * @param int $labelID  ID of Label
+     *
+     * @return Array(Mail)  Array with selected Mails
+     *
+     */
+
+     public static function getMailsByLabelID($labelID) {
+         global $db;
+
+         $mails = $db->selectQuery("SELECT `mails`.* FROM `mails` JOIN `mailbox-folders` ON `mailbox-folders`.id = `mails`.mailbox_folder_id WHERE `mailbox-folders`.label_id = " . $labelID . ";");
+
+         if(!$mails) {
+             return false;
+         }
+
+         $return = array();
+
+         foreach($mails as $mail) {
+             $return[] = new Mail($mail->id, $mail->mail_sender, $mail->subject, $mail->mailbox_folder_id, $mail->mail_uid);
+         }
+
+         return $return;
+     }
+
+}
+
+?>

+ 1 - 0
index.php

@@ -13,6 +13,7 @@ include('includes/document.inc.php');
 include('includes/mailbox.inc.php');
 include('includes/mailboxfolder.inc.php');
 require('includes/call.inc.php');
+require('includes/mail.inc.php');
 
 $db = new Database($CONFIG['dbHost'], $CONFIG['dbUser'], $CONFIG['dbPassword'], $CONFIG['dbDatabase']);
 $user = new User(isset($_SESSION['username']) ? $_SESSION['username'] : NULL);

+ 43 - 17
sql_structure.sql

@@ -3,9 +3,9 @@
 -- http://www.phpmyadmin.net
 --
 -- Host: localhost
--- Generation Time: May 30, 2015 at 03:02 PM
+-- Generation Time: Jun 05, 2015 at 01:17 AM
 -- Server version: 5.5.42-1
--- PHP Version: 5.6.7-1
+-- PHP Version: 5.6.9-1
 
 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
 SET time_zone = "+00:00";
@@ -22,12 +22,13 @@ SET time_zone = "+00:00";
 
 CREATE TABLE IF NOT EXISTS `calls` (
   `id` int(11) NOT NULL,
+  `user_id` int(11) NOT NULL,
   `call_date` datetime NOT NULL,
   `caller_telnr` varchar(32) COLLATE utf8_bin NOT NULL,
   `label_id` int(11) NOT NULL,
   `notes` varchar(4096) COLLATE utf8_bin NOT NULL,
   `reminder_id` int(11) NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -46,7 +47,7 @@ CREATE TABLE IF NOT EXISTS `documents` (
   `last_change` datetime NOT NULL,
   `mail_uid` varchar(32) COLLATE utf8_bin NOT NULL,
   `mail_acc` int(11) NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -73,7 +74,7 @@ CREATE TABLE IF NOT EXISTS `labels` (
   `id` int(11) NOT NULL,
   `name` varchar(32) COLLATE utf8_bin NOT NULL,
   `path` varchar(256) COLLATE utf8_bin NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -86,7 +87,7 @@ CREATE TABLE IF NOT EXISTS `mailbox-folders` (
   `folder_name` varchar(64) COLLATE utf8_bin NOT NULL,
   `mailbox_id` int(11) NOT NULL,
   `label_id` int(11) NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -104,7 +105,21 @@ CREATE TABLE IF NOT EXISTS `mailboxes` (
   `user_id` int(11) NOT NULL,
   `use_ssl` tinyint(1) NOT NULL,
   `valid_ssl` tinyint(1) NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `mails`
+--
+
+CREATE TABLE IF NOT EXISTS `mails` (
+  `id` int(11) NOT NULL,
+  `mail_sender` varchar(256) COLLATE utf8_bin NOT NULL,
+  `subject` varchar(256) COLLATE utf8_bin NOT NULL,
+  `mailbox_folder_id` int(11) NOT NULL,
+  `mail_uid` int(11) NOT NULL
+) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -117,7 +132,7 @@ CREATE TABLE IF NOT EXISTS `reminders` (
   `user_id` int(11) NOT NULL,
   `reminder_date` datetime NOT NULL,
   `reminded_yet` tinyint(1) NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 -- --------------------------------------------------------
 
@@ -130,7 +145,7 @@ CREATE TABLE IF NOT EXISTS `users` (
   `username` varchar(32) COLLATE utf8_bin NOT NULL,
   `password` varchar(32) COLLATE utf8_bin NOT NULL,
   `mail` varchar(32) COLLATE utf8_bin NOT NULL
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 --
 -- Indexes for dumped tables
@@ -164,7 +179,7 @@ ALTER TABLE `labels`
 -- Indexes for table `mailbox-folders`
 --
 ALTER TABLE `mailbox-folders`
-  ADD PRIMARY KEY (`id`);
+  ADD PRIMARY KEY (`id`), ADD KEY `mailbox_id` (`mailbox_id`);
 
 --
 -- Indexes for table `mailboxes`
@@ -172,6 +187,12 @@ ALTER TABLE `mailbox-folders`
 ALTER TABLE `mailboxes`
   ADD PRIMARY KEY (`id`);
 
+--
+-- Indexes for table `mails`
+--
+ALTER TABLE `mails`
+  ADD PRIMARY KEY (`id`);
+
 --
 -- Indexes for table `reminders`
 --
@@ -192,12 +213,12 @@ ALTER TABLE `users`
 -- AUTO_INCREMENT for table `calls`
 --
 ALTER TABLE `calls`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16;
 --
 -- AUTO_INCREMENT for table `documents`
 --
 ALTER TABLE `documents`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=35;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=72;
 --
 -- AUTO_INCREMENT for table `drafts`
 --
@@ -207,24 +228,29 @@ ALTER TABLE `drafts`
 -- AUTO_INCREMENT for table `labels`
 --
 ALTER TABLE `labels`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=15;
 --
 -- AUTO_INCREMENT for table `mailbox-folders`
 --
 ALTER TABLE `mailbox-folders`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;
 --
 -- AUTO_INCREMENT for table `mailboxes`
 --
 ALTER TABLE `mailboxes`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
+--
+-- AUTO_INCREMENT for table `mails`
+--
+ALTER TABLE `mails`
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=20;
 --
 -- AUTO_INCREMENT for table `reminders`
 --
 ALTER TABLE `reminders`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8;
 --
 -- AUTO_INCREMENT for table `users`
 --
 ALTER TABLE `users`
-  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
+  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;

+ 2 - 2
templates/documentlist.php

@@ -1,7 +1,7 @@
 <table id="document-list" class="table table-striped">
     <thead>
         <tr>
-            <th>Typ</th>
+            <!--<th>Typ</th>-->
             <th>Name</th>
             <th>Vorlage</th>
             <th>Erstellt am</th>
@@ -12,7 +12,7 @@
 <?php
 foreach($this->_['documents'] as $document) {
     echo '<tr>';
-    echo '<td>' . $document->getType() . '</td>';
+    //echo '<td>' . $document->getType() . '</td>'; // type icon based on extension
     echo '<td>' . $document->getFileName() . '</td>';
     echo '<td>' . $document->getDraft() . '</td>';
     echo '<td>' . $document->getCreated() . '</td>';

+ 6 - 2
templates/label.php

@@ -16,7 +16,8 @@ foreach($this->_['entries'] as $entry){
         <div role="tabpanel">
             <!-- Nav tabs -->
             <ul class="nav nav-tabs" role="tablist">
-                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Dokumente</a></li>
+                <li role="presentation" class="active"><a href="#mails" aria-controls="mails" role="tab" data-toggle="tab">Mails</a></li>
+                <li role="presentation"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Dokumente</a></li>
                 <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
                 <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
                 <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
@@ -30,7 +31,10 @@ foreach($this->_['entries'] as $entry){
 
             <!-- Tab panes -->
             <div class="tab-content">
-                <div role="tabpanel" class="tab-pane active" id="home">
+                <div role="tabpanel" class="tab-pane active" id="mails">
+                    <?php echo $this->_['maillist']; ?>
+                </div>
+                <div role="tabpanel" class="tab-pane" id="home">
                     <?php echo $this->_['documentlist']; ?>
                 </div>
                 <div role="tabpanel" class="tab-pane" id="profile">PROFILE</div>

+ 21 - 0
templates/maillist.php

@@ -0,0 +1,21 @@
+<table id="mail-list" class="table table-striped">
+    <thead>
+        <tr>
+            <th>Absender</th>
+            <th>Empfänger</th>
+            <th>Betreff</th>
+            <th><a id="refresh-mails" href="#"><i class="fa fa-refresh"></i></a></th>
+        </tr>
+    </thead>
+<?php
+
+foreach($this->_['mails'] as $mail) {
+    echo '<tr>';
+    echo '<td>' . $mail->getMailSender() . '</td>';
+    echo '<td>' . $mail->getMailRecipient() . '</td>';
+    echo '<td>' . $mail->getSubject() . '</td>';
+    echo '<td></td>';
+    echo '</tr>';
+}
+?>
+</table>