diff --git a/e107_core/shortcodes/batch/usersettings_shortcodes.php b/e107_core/shortcodes/batch/usersettings_shortcodes.php index d1864e105..d1075a0dc 100755 --- a/e107_core/shortcodes/batch/usersettings_shortcodes.php +++ b/e107_core/shortcodes/batch/usersettings_shortcodes.php @@ -17,6 +17,7 @@ if (!defined('e107_INIT')) { exit; } class usersettings_shortcodes extends e_shortcode { + private $extendedTabs = false; function sc_username($parm) // This is the 'display name' { @@ -262,8 +263,8 @@ class usersettings_shortcodes extends e_shortcode - function sc_userextended_all($parm) - { + function sc_userextended_all($parm='') + { $sql = e107::getDb(); $tp = e107::getParser(); @@ -276,28 +277,59 @@ class usersettings_shortcodes extends e_shortcode $ret=""; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $catList = $sql->db_getList(); } + else + { + e107::getMessage()->addDebug("No extended fields found"); + } $catList[] = array("user_extended_struct_id" => 0, "user_extended_struct_name" => LAN_USET_7); + $tabs = array(); + + if($parm == 'tabs') + { + $this->extendedTabs = true; + } + + foreach($catList as $cat) { cachevars("extendedcat_{$cat['user_extended_struct_id']}", $cat); - $ret .= $this->sc_userextended_cat($cat['user_extended_struct_id']); - // $ret .= $tp->parseTemplate("{USEREXTENDED_CAT={$cat['user_extended_struct_id']}}", TRUE, $usersettings_shortcodes); + $text = $this->sc_userextended_cat($cat['user_extended_struct_id']); + $ret .= $text; + $catName = vartrue($cat['user_extended_struct_text'], $cat['user_extended_struct_name']); + $tabs[] = array('caption'=>$catName, 'text'=>$text); } + + if($parm == 'tabs' && deftrue('BOOTSTRAP')) + { + return e107::getForm()->tabs($tabs); + } + + + return $ret; } - function sc_userextended_cat($parm) + function sc_userextended_cat($parm='') { - global $sql, $tp, $usersettings_shortcodes, $USER_EXTENDED_CAT, $extended_showed; + global $usersettings_shortcodes, $USER_EXTENDED_CAT, $extended_showed; + + if(deftrue('BOOTSTRAP')) + { + $USER_EXTENDED_CAT = e107::getCoreTemplate('usersettings','extended-category'); + } + + $sql = e107::getDb(); + $tp = e107::getParser(); + if(isset($extended_showed['cat'][$parm])) { return ""; @@ -312,9 +344,9 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_write IN (".USERCLASS_LIST.") AND user_extended_struct_id = ".intval($parm)." "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $catInfo = $sql->db_Fetch(); + $catInfo = $sql->fetch(); } } @@ -328,19 +360,20 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_type != 0 ORDER BY user_extended_struct_order ASC "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $fieldList = $sql->db_getList(); foreach($fieldList as $field) { cachevars("extendedfield_{$cat['user_extended_struct_name']}", $field); //TODO use $this instead of parseTemplate(); - $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes); + $ret .= $this->sc_userextended_field($field['user_extended_struct_name']); + // $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes); } } } - if($ret) + if($ret && $this->extendedTabs == false) { $catName = $catInfo['user_extended_struct_text'] ? $catInfo['user_extended_struct_text'] : $catInfo['user_extended_struct_name']; if(defined($catName)) $catName = constant($catName); @@ -353,13 +386,25 @@ class usersettings_shortcodes extends e_shortcode - function sc_userextended_field($parm) + function sc_userextended_field($parm='') { - global $sql, $tp, $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD; + global $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD; + + if(deftrue('BOOTSTRAP')) + { + $USEREXTENDED_FIELD = e107::getCoreTemplate('usersettings','extended-field'); + } + + if(isset($extended_showed['field'][$parm])) { return ""; } + + $sql = e107::getDb(); + $tp = e107::getParser(); + + $ret = ""; $fInfo = getcachedvars("extendeddata_{$parm}"); @@ -371,9 +416,9 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_write IN (".USERCLASS_LIST.") AND user_extended_struct_name = '".$tp -> toDB($parm, true)."' "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $fInfo = $sql->db_Fetch(); + $fInfo = $sql->fetch(); } } diff --git a/e107_core/templates/usersettings_template.php b/e107_core/templates/usersettings_template.php index 14fe71a8f..bb7260f60 100755 --- a/e107_core/templates/usersettings_template.php +++ b/e107_core/templates/usersettings_template.php @@ -295,7 +295,7 @@ $USERSETTINGS_TEMPLATE['edit'] = " {PHOTO_UPLOAD} {USERCLASSES} - {USEREXTENDED_ALL} + {USEREXTENDED_ALL=tabs} {SIGNATURE=cols=58&rows=4} @@ -308,11 +308,16 @@ $USERSETTINGS_TEMPLATE['edit'] = " - - "; - +$USERSETTINGS_TEMPLATE['extended-category'] = "