first cut of feature/techlevel merge
This commit is contained in:
parent
6ce3ca1ce0
commit
e0255c0dc4
@ -11,7 +11,13 @@ class Features {
|
|||||||
// Build list of features and check which are set
|
// Build list of features and check which are set
|
||||||
// We will not create any settings for features that are above our techlevel
|
// We will not create any settings for features that are above our techlevel
|
||||||
|
|
||||||
$features = get_features();
|
if(intval($_REQUEST['techlevel']))
|
||||||
|
$level = intval($_REQUEST['techlevel']);
|
||||||
|
else {
|
||||||
|
$level = get_account_techlevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$features = get_features(true,$level);
|
||||||
$all_features = array();
|
$all_features = array();
|
||||||
foreach($features as $k => $v) {
|
foreach($features as $k => $v) {
|
||||||
foreach($v as $f)
|
foreach($v as $f)
|
||||||
@ -28,9 +34,21 @@ class Features {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
$arr = array();
|
|
||||||
$features = get_features();
|
$arr = [];
|
||||||
|
if(intval($_REQUEST['techlevel']))
|
||||||
|
$level = intval($_REQUEST['techlevel']);
|
||||||
|
else {
|
||||||
|
$level = get_account_techlevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
$techlevels = \Zotlabs\Lib\Techlevels::levels();
|
||||||
|
|
||||||
|
$def_techlevel = \App::$account['account_level'];
|
||||||
|
$techlock = get_config('system','techlevel_lock');
|
||||||
|
|
||||||
|
$features = get_features(true,$level);
|
||||||
|
|
||||||
foreach($features as $fname => $fdata) {
|
foreach($features as $fname => $fdata) {
|
||||||
$arr[$fname] = array();
|
$arr[$fname] = array();
|
||||||
$arr[$fname][0] = $fdata[0];
|
$arr[$fname][0] = $fdata[0];
|
||||||
@ -43,6 +61,8 @@ class Features {
|
|||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$form_security_token' => get_form_security_token("settings_features"),
|
'$form_security_token' => get_form_security_token("settings_features"),
|
||||||
'$title' => t('Additional Features'),
|
'$title' => t('Additional Features'),
|
||||||
|
'$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
|
||||||
|
'$techlock' => $techlock,
|
||||||
'$features' => $arr,
|
'$features' => $arr,
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
));
|
));
|
||||||
|
@ -44,7 +44,7 @@ function feature_level($feature,$def) {
|
|||||||
return $def;
|
return $def;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_features($filtered = true) {
|
function get_features($filtered = true, $level = (-1)) {
|
||||||
|
|
||||||
$account = \App::get_account();
|
$account = \App::get_account();
|
||||||
|
|
||||||
@ -499,7 +499,7 @@ function get_features($filtered = true) {
|
|||||||
|
|
||||||
$arr = $x['features'];
|
$arr = $x['features'];
|
||||||
|
|
||||||
$techlevel = get_account_techlevel();
|
$techlevel = (($level >= 0) ? $level : get_account_techlevel());
|
||||||
|
|
||||||
// removed any locked features and remove the entire category if this makes it empty
|
// removed any locked features and remove the entire category if this makes it empty
|
||||||
|
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<form action="settings/features" method="post" autocomplete="off">
|
<form action="settings/features" method="post" autocomplete="off">
|
||||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||||
|
{{if ! $techlock}}
|
||||||
|
<div class="section-content-tools-wrapper">
|
||||||
|
{{include file="field_select.tpl" field=$techlevel}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<input type="hidden" name="techlevel" value="{{$techlevel.2}}" />
|
||||||
|
{{/if}}
|
||||||
<div class="panel-group" id="settings" role="tablist" aria-multiselectable="true">
|
<div class="panel-group" id="settings" role="tablist" aria-multiselectable="true">
|
||||||
{{foreach $features as $g => $f}}
|
{{foreach $features as $g => $f}}
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
|
Reference in New Issue
Block a user