I made this module because i get bored to make error while converting form to a report form used by eform.
installation :
1 go to module -> manage module and create a new module
2 module name : Form2report
3 description : <strong>1.0</strong> Convert a form to a report
4 module source code : copy the code below
// list all chunks
$display = '<h2>Please choose a chunk to convert to a report :</h2><form method="post"><select name="chunkname">';
$result=$modx->db->query('SELECT * FROM '.$modx->getFullTableName('site_htmlsnippets').' ORDER BY id ASC');
while( $row=$modx->db->getRow($result)){
$display .='<option value="'.$row['name'].'" >'.$row['name'].'</option>';
}
$display .='</select><br /><input name="sent" type="hidden" value="1"><input name="send" id="send" value="convert" type="submit"></form>';
echo $display;
// convert chunk
if(isset($_POST['sent'])){
$chunk=$_POST['chunkname'];
$text = $modx->getChunk($chunk);
echo ('<hr><strong>Original Chunk :</strong>'.$text);
// drop unused
$text=preg_replace('#\[\+validationmessage\+\]#isU', ' ', $text);
// convert
$text=preg_replace('#<input.*name=\"(.[a-z0-9A-Z-_]+)\".*>#isU', '[+$1+]', $text);
$text=preg_replace('#<select.*name=\"(.[a-z0-9A-Z-_]+)\".*</select>#isU', '[+$1+]', $text);
$text=preg_replace('#<textarea.*name=\"(.[a-z0-9A-Z-_]+)\".*</textarea>#isU', '[+$1+]', $text);
echo ('<hr><strong>Converted Chunk :</strong>'.$text.'<hr><strong>Source Code :</strong><p>'.htmlspecialchars($text).'</p>');
}
it work fine on Modx 1.0.0
feel free to modify enhance or whatever
regards