DataObjects/Core_domain.php
[Pman.Core] / MessagePreview.php
index 4e3af08..ad9e17e 100644 (file)
@@ -20,7 +20,7 @@ class Pman_Core_MessagePreview extends Pman
     
     function get()
     {
-        if(empty($_REQUEST['_id'])){
+        if(empty($_REQUEST['_id']) || empty($_REQUEST['_table'])){
             $this->jerr('Missing Options');
         }
         
@@ -33,4 +33,30 @@ class Pman_Core_MessagePreview extends Pman
         $this->showHtml = isset($_REQUEST['_as_html']) ? true : false;
         
     }
+    
+    function post()
+    {
+        if(empty($_REQUEST['_id']) || empty($_REQUEST['_table'])){
+            $this->jerr('Missing Options');
+        }
+        
+        $mid = $_REQUEST['_id'];
+        
+        $mlq = DB_DataObject::factory($_REQUEST['_table']);
+        
+        $mlq->get($_REQUEST['_id']);
+        
+        $content = array(
+            'template' => $mlq->name,
+            'person' => $this->authUser
+        );
+        
+        $sent = DB_DataObject::factory($_REQUEST['_table'])->send($content);
+        
+        if(!is_object($sent)){
+            $this->jok('SUCCESS');
+        }
+        $this->jerr('error!!:' . $sent->toString());
+        
+    }
 }