From 6e149a2dd350d4037fb89f5bfa2246c5f9a94800 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 6 Sep 2016 20:10:56 -0700 Subject: turn Settings page into sub-modules --- Zotlabs/Module/Settings/Features.php | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Zotlabs/Module/Settings/Features.php (limited to 'Zotlabs/Module/Settings/Features.php') diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php new file mode 100644 index 000000000..2d9bc0c88 --- /dev/null +++ b/Zotlabs/Module/Settings/Features.php @@ -0,0 +1,53 @@ + $v) { + foreach($v as $f) + $all_features[] = $f[0]; + } + foreach($all_features as $k) { + if(x($_POST,"feature_$k")) + set_pconfig(local_channel(),'feature',$k, 1); + else + set_pconfig(local_channel(),'feature',$k, 0); + } + build_sync_packet(); + return; + } + + function get() { + $arr = array(); + $features = get_features(); + + foreach($features as $fname => $fdata) { + $arr[$fname] = array(); + $arr[$fname][0] = $fdata[0]; + foreach(array_slice($fdata,1) as $f) { + $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On'))); + } + } + + $tpl = get_markup_template("settings_features.tpl"); + $o .= replace_macros($tpl, array( + '$form_security_token' => get_form_security_token("settings_features"), + '$title' => t('Additional Features'), + '$features' => $arr, + '$submit' => t('Submit'), + )); + + return $o; + } + +} \ No newline at end of file -- cgit v1.2.3