function makeEditForm($selfurl, $id = null) { // nice names for each field $formNames = array('frequency' => 'Frequency:', 'number' => 'To:<br/><font size="1">(number or group code, <br/>e.g., "admin")</font>', 'msg' => 'Message:'); $do = DB_DataObject::factory(playsms_featAutoSend); if ($id) { $do->get($id); } $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames)); $fb->enumFields = array('frequency'); $form = $fb->getForm("{$selfurl}&op=edit"); setupSmsCounting($form, 'msg', '__submit__'); if ($form->validate()) { $form->process(array(&$fb, 'processForm'), false); } $form->display(); ?> <a href="<?php echo $selfurl; ?> &op=list"><br><br>[back]</a> <?php }
function testAutoreply($selfurl) { $form = new HTML_QuickForm('autoreply_test', 'post', "{$selfurl}&op=test"); // Add some elements to the form $form->addElement('textarea', 'message', 'Test Message:'); setupSmsCounting($form, 'message', null); $form->addElement('submit', 'submit', 'Test'); if ($form->validate()) { $match = matchAutoreply($form->exportValue('message'), false); echo "<b>reply:</b> <br/>" . nl2br($match['autoreply_scenario_result']); exit; } $form->display(); }