MailTemplateList.php
authorEdward <edward@roojs.com>
Wed, 19 Feb 2014 07:46:31 +0000 (15:46 +0800)
committerEdward <edward@roojs.com>
Wed, 19 Feb 2014 07:46:31 +0000 (15:46 +0800)
MailTemplateList.php

index 516eb49..acf8a31 100644 (file)
@@ -16,8 +16,31 @@ class Pman_Core_MailTemplateList extends Pman
 
     function get()
     {
-        $this->jdata(array(array('name' => 'aa', 'body'=> 'test')));
         $fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy;
+        
+        $templateDir = explode(PATH_SEPARATOR, $fopts->templateDir);
+        
+        foreach ($templateDir as $dir){
+            if(!file_exists($dir . '/mail')){
+                continue;
+            }
+            
+            if ($handle = opendir($dir . '/')) {
+                while (false !== ($entry = readdir($handle))) {
+                    if ($entry == "." || $entry == "..") {
+                        continue;
+                    }
+                    
+                    echo "$entry\n";
+                }
+                
+                closedir($handle);
+            }
+            
+        }
+        exit;
+        $this->jdata(array(array('name' => 'aa', 'body'=> 'test')));
+        
         print_r(array_unique($fopts->templateDir));
         exit;
     }