MailTemplateList.php
[Pman.Core] / MailTemplateList.php
index dfaf8e3..eb30358 100644 (file)
@@ -1,17 +1,49 @@
 <?php
 
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
+require_once 'Pman.php';
 
-/**
- * Description of MailTemplateList
- *
- * @author edward
- */
-class MailTemplateList {
-    //put your code here
-}
+class Pman_Core_MailTemplateList extends Pman
+{
+    function getAuth()
+    {
+        $au = $this->getAuthUser();
+        if (!$au) {
+            die("NOT authenticated");
+        }
+        $this->authUser = $au;
+        return true;
+    }
 
-?>
+    function get()
+    {
+        $fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy;
+        
+        $templateDir = explode(PATH_SEPARATOR, $fopts['templateDir']);
+        
+        foreach ($templateDir as $dir){
+            echo "$dir <br/>";
+            if(!file_exists($dir . '/mail')){
+                continue;
+            }
+            
+            if ($handle = opendir($dir . '/mail')) {
+                while (false !== ($entry = readdir($handle))) {
+                    if ($entry == "." || $entry == "..") {
+                        continue;
+                    }
+                    
+                    echo "$entry <br/>";
+                }
+                
+                closedir($handle);
+            }
+            
+        }
+        exit;
+        $this->jdata(array(array('name' => 'aa', 'body'=> 'test')));
+        
+        print_r(array_unique($fopts->templateDir));
+        exit;
+    }
+     
+}