MailTemplateList.php
[Pman.Core] / MailTemplateList.php
index 6c556ad..955c7a5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once 'Pman.php';
+require_once 'ConvertStyle.php';
 
 class Pman_Core_MailTemplateList extends Pman
 {
@@ -20,30 +20,33 @@ class Pman_Core_MailTemplateList extends Pman
         
         $templateDir = explode(PATH_SEPARATOR, $fopts['templateDir']);
         
+        $ret = array();
+        
         foreach ($templateDir as $dir){
-            echo "$dir \n";
+            
             if(!file_exists($dir . '/mail')){
                 continue;
             }
             
-            if ($handle = opendir($dir . '/')) {
+            if ($handle = opendir($dir . '/mail')) {
                 while (false !== ($entry = readdir($handle))) {
-                    if ($entry == "." || $entry == "..") {
+                    if ($entry == "." || $entry == ".." || !preg_match('/\.html$/', $entry)) {
                         continue;
                     }
                     
-                    echo "$entry\n";
+                    $ret[] = array(
+                        'file' => $entry,
+                        'content' => file_get_contents("$dir/mail/$entry")
+                    );
                 }
                 
                 closedir($handle);
             }
             
         }
-        exit;
-        $this->jdata(array(array('name' => 'aa', 'body'=> 'test')));
         
-        print_r(array_unique($fopts->templateDir));
-        exit;
+        $this->jok($ret);
+        
     }
      
 }