summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-05-23 13:43:01 -0300
committerRenato Botelho <renato@netgate.com>2017-05-23 13:54:13 -0300
commit6e0474ed68e2787d7ebe3ee3f22f5d458232f8b3 (patch)
tree9be6399c09adfc106cb910462b6e471a662a4129 /src/etc/inc/pfsense-utils.inc
parentf7a72733f8c482e230e0042a6c65f4935a2b723a (diff)
parentf0dc8b688c2b7d973bc18769579ee8cc6d3d2dad (diff)
downloadpfsense-6e0474ed68e2787d7ebe3ee3f22f5d458232f8b3.zip
pfsense-6e0474ed68e2787d7ebe3ee3f22f5d458232f8b3.tar.gz
Merge pull request #3732 from phil-davis/rule-created-updated
Diffstat (limited to 'src/etc/inc/pfsense-utils.inc')
-rw-r--r--src/etc/inc/pfsense-utils.inc41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index d9b0925..5da6c07 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -457,6 +457,47 @@ function gen_requirestatefilter_field(&$section, $value) {
'before the states are displayed. Useful for systems with large state tables.');
}
+/****f* pfsense-utils/gen_created_updated_fields
+ * NAME
+ * gen_created_updated_fields
+ * INPUTS
+ * Pointer to form object
+ * Array of created time and username
+ * Array of updated time and username
+ * RESULT
+ * no return value, section object is added to form if needed
+ ******/
+function gen_created_updated_fields(&$form, $created, $updated) {
+ $has_created_time = (isset($created['time']) && isset($created['username']));
+ $has_updated_time = (isset($updated['time']) && isset($updated['username']));
+
+ if ($has_created_time || $has_updated_time) {
+ $section = new Form_Section('Rule Information');
+
+ if ($has_created_time) {
+ $section->addInput(new Form_StaticText(
+ 'Created',
+ sprintf(
+ gettext('%1$s by %2$s'),
+ date(gettext("n/j/y H:i:s"), $created['time']),
+ $created['username'])
+ ));
+ }
+
+ if ($has_updated_time) {
+ $section->addInput(new Form_StaticText(
+ 'Updated',
+ sprintf(
+ gettext('%1$s by %2$s'),
+ date(gettext("n/j/y H:i:s"), $updated['time']),
+ $updated['username'])
+ ));
+ }
+
+ $form->add($section);
+ }
+}
+
function hardware_offloading_applyflags($iface) {
global $config;
OpenPOWER on IntegriCloud