summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2019-12-07 13:52:54 +0100
committerSimon Rettberg2019-12-07 13:52:54 +0100
commit3e45ec44d22f03ca6642e08f695c6d7274cecfaf (patch)
treea71b2ec81895b198757d8ec7272548b42ee074b8 /inc
parent[apis/cron] Simple logging function for debugging (diff)
downloadslx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.tar.gz
slx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.tar.xz
slx-admin-3e45ec44d22f03ca6642e08f695c6d7274cecfaf.zip
[statistics/rebootcontrol] Add WOL button to statistics module
* Overhauled task display in rebootcontrol module * Can only add subnets by CIDR now instead of start and end
Diffstat (limited to 'inc')
-rw-r--r--inc/arrayutil.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/arrayutil.inc.php b/inc/arrayutil.inc.php
new file mode 100644
index 00000000..ec6e2a5f
--- /dev/null
+++ b/inc/arrayutil.inc.php
@@ -0,0 +1,24 @@
+<?php
+
+class ArrayUtil
+{
+
+ /**
+ * Take an array of arrays, take given key from each sub-array and return
+ * new array with just those corresponding values.
+ * @param array $list
+ * @param string $key
+ * @return array
+ */
+ public static function flattenByKey($list, $key)
+ {
+ $ret = [];
+ foreach ($list as $item) {
+ if (array_key_exists($key, $item)) {
+ $ret[] = $item[$key];
+ }
+ }
+ return $ret;
+ }
+
+} \ No newline at end of file