aboutsummaryrefslogtreecommitdiffstats
path: root/packages/cg2/sample/sample.inc
diff options
context:
space:
mode:
authorFernando Lemos <fernandotcl@pfsense.org>2006-08-02 19:24:37 +0000
committerFernando Lemos <fernandotcl@pfsense.org>2006-08-02 19:24:37 +0000
commitfe0ca0756af0ae0ccf08b5b5215026e385f243e5 (patch)
tree74b9f41e3f7a6bfa71bace245af4fc69affd75dc /packages/cg2/sample/sample.inc
parentb281e3f765f49ea1afb0db5ece2b8aa3c288b246 (diff)
downloadpfsense-packages-fe0ca0756af0ae0ccf08b5b5215026e385f243e5.tar.gz
pfsense-packages-fe0ca0756af0ae0ccf08b5b5215026e385f243e5.tar.bz2
pfsense-packages-fe0ca0756af0ae0ccf08b5b5215026e385f243e5.zip
Sample cg2 files, used as reference for the implementation. Feel free to send me suggestions. Those are also not complete yet.
Diffstat (limited to 'packages/cg2/sample/sample.inc')
-rw-r--r--packages/cg2/sample/sample.inc30
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/cg2/sample/sample.inc b/packages/cg2/sample/sample.inc
new file mode 100644
index 00000000..9f53c8de
--- /dev/null
+++ b/packages/cg2/sample/sample.inc
@@ -0,0 +1,30 @@
+<?php
+var_dump('BEING INCLUDED');
+
+function sample_on_load_event(&$widgets)
+{
+ /* Called when the form is just loaded. You receive the array widgets as
+ * argument, and can modify it to alter the behavior of the form. */
+ var_dump('BEING LOADED');
+ //$widget =& $widgets[2];
+ $widget =& get_widget($widgets, 'mytextarea');
+ $widget->value='This example shows how to change the text inside a text box from within the include file, when the form is loaded.';
+}
+
+function sample_on_sync_event()
+{
+ /* This is called when the form is posted. You generally want to sync the
+ * configurations in the XML file to settings in files spread across the file
+ * system or maybe restart a service here. */
+ var_dump('BEING SYNCED');
+}
+
+function sample_on_submit_event()
+{
+ /* This allows you to perform an action when an specific submit button is
+ * clicked. This should only be used when you have more than one submit
+ * button in the same form. Otherwise, <on_load_event> performs better and
+ * is cleaner. */
+ var_dump('BEING SUBMITTED');
+}
+?>