function export($etempl)
 {
     if ($this->debug) {
         echo "<p>etempl->data = ";
         _debug_array($etempl->data);
     }
     $doc = new xmldoc();
     $doc->add_comment('$' . 'Id$');
     $xul_overlay = new xmlnode('overlay');
     $embeded_too = True;
     $this->etempl2grid($etempl, $xul_overlay, $embeded_too);
     $doc->add_root($xul_overlay);
     $xml = $doc->export_xml();
     echo "<pre>\n" . htmlentities($xml) . "\n</pre>\n";
     return $xml;
 }
 function export($name = '', $lang = '', $modified = 0)
 {
     if (!$name) {
         $name = $_GET['page'];
     }
     if (!$lang) {
         $lang = $_GET['lang'];
     }
     if (!is_array($lang)) {
         $lang = $lang ? explode(',', $lang) : False;
     }
     if (!$modified) {
         $modified = (int) $_GET['modified'];
     }
     header('Content-Type: text/xml; charset=utf-8');
     $xml_doc = new xmldoc();
     $xml_doc->add_comment('$' . 'Id$');
     // to be able to comit the file
     $xml_doc->add_comment("eGroupWare wiki-pages matching '{$name}%'" . ($lang ? " and lang in(" . implode(',', $lang) . ')' : '') . ($modified ? " modified since " . date('Y-m-d H:m:i', $modified) : '') . ", exported " . date('Y-m-d H:m:i', $exported = time()) . " from {$_SERVER['HTTP_HOST']}");
     $xml_wiki = new xmlnode('wiki');
     foreach ($this->find($name . '%', 'name') as $page) {
         if ($lang && !in_array($page['lang'], $lang)) {
             //echo "continue as page[lang]=$page[lang] not in ".print_r($lang,True)."<br>\n";
             continue;
             // wrong language or not modified since $modified
         }
         $page = $this->page($page);
         // read the complete page
         $page->read();
         $page = $page->as_array();
         unset($page['wiki_id']);
         // we dont export the wiki-id
         if ($modified && $modified > $page['time']) {
             //echo "continue as page[time]=$page[time] < $modified<br>\n";
             continue;
             // not modified since $modified
         }
         $page = $GLOBALS['phpgw']->translation->convert($page, $GLOBALS['phpgw']->translation->charset(), 'utf-8');
         $xml_page = new xmlnode('page');
         foreach ($page as $attr => $val) {
             if ($attr != 'text') {
                 $xml_page->set_attribute($attr, $val);
             } else {
                 $xml_page->set_value($val);
             }
         }
         $xml_wiki->add_node($xml_page);
     }
     $xml_wiki->set_attribute('exported', $exported);
     if ($lang) {
         $xml_wiki->set_attribute('languages', implode(',', $lang));
     }
     if ($name) {
         $xml_wiki->set_attribute('matching', $name . '%');
     }
     if ($modified) {
         $xml_wiki->set_attribute('modified', $modified);
     }
     $xml_doc->add_root($xml_wiki);
     $xml = $xml_doc->export_xml();
     //echo "<pre>\n" . htmlentities($xml) . "\n</pre>\n";
     echo $xml;
     return $xml;
 }