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'] = "

{CATNAME}

"; +$USERSETTINGS_TEMPLATE['extended-field'] = "
+ +
+ {FIELDVAL} {HIDEFIELD} +
+
+ "; diff --git a/e107_core/xml/user_extended.xml b/e107_core/xml/user_extended.xml index 9b77ff694..296b242a3 100644 --- a/e107_core/xml/user_extended.xml +++ b/e107_core/xml/user_extended.xml @@ -17,42 +17,42 @@ text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 @@ -66,7 +66,7 @@ text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' #^[a-z0-9]+://#si 253 253 diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 67ff55c3c..fd5bd7563 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -890,7 +890,7 @@ class e_form } else { - $text .= ""; + $text .= ""; } // $text .= "ValueFormat: ".$dateFormat." Value: ".$value; diff --git a/e107_handlers/user_extended_class.php b/e107_handlers/user_extended_class.php index 51a000911..61641f923 100644 --- a/e107_handlers/user_extended_class.php +++ b/e107_handlers/user_extended_class.php @@ -675,10 +675,11 @@ class e107_user_extended $regex = $tp->toText($parms[1]); $regexfail = $tp->toText($parms[2]); $fname = "ue[user_".$struct['user_extended_struct_name']."]"; + $required = vartrue($struct['user_extended_struct_required']) ? "required" : ""; if(strpos($include, 'class') === FALSE) { - $include .= " class='tbox' "; + $include .= " class='form-control tbox' "; } @@ -686,7 +687,8 @@ class e107_user_extended { case EUF_TEXT : //textbox case EUF_INTEGER : //integer - $ret = ""; + $ret = ""; + return $ret; break; @@ -715,12 +717,12 @@ class e107_user_extended if(deftrue('BOOTSTRAP')) { - $ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label)); + $ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required'])); } else { $chk = ($curval == $val)? " checked='checked' " : ""; - $ret .= " {$label}"; + $ret .= " {$label}"; } } @@ -751,7 +753,7 @@ class e107_user_extended if(deftrue('BOOTSTRAP')) { - $ret .= $frm->checkbox($fname,$val,($curval == $val),array('label'=>$label)); + $ret .= $frm->checkbox($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required'])); } else { @@ -764,7 +766,7 @@ class e107_user_extended break; case EUF_DROPDOWN : //dropdown - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($choices as $choice) { @@ -788,7 +790,7 @@ class e107_user_extended if (!method_exists($className, 'getValue')) return '???-???'; $temp->pointerReset(); - $ret = "\n"; $ret .= "\n"; // ensures that the user chooses it. while (FALSE !== ($row = $temp->getValue(0, 'next'))) { @@ -808,7 +810,7 @@ class e107_user_extended if($sql->db_Select($tp -> toDB($choices[0], true), $tp -> toDB($choices[1], true).",".$tp -> toDB($choices[2], true), "1 $order")){ $choiceList = $sql->db_getList('ALL',FALSE); - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($choiceList as $cArray) { @@ -825,7 +827,7 @@ class e107_user_extended break; case EUF_TEXTAREA : //textarea - return ""; + return ""; break; case EUF_DATE : //date @@ -839,11 +841,10 @@ class e107_user_extended break; case EUF_LANGUAGE : // language - require_once(e_HANDLER."file_class.php"); - $fl = new e_file; - $lanlist = $fl->get_dirs(e_LANGUAGEDIR); + $lanlist = e107::getLanguage()->installed(); sort($lanlist); - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($lanlist as $choice) { @@ -852,6 +853,7 @@ class e107_user_extended $ret .= "\n"; } $ret .= "\n"; + break; } diff --git a/e107_themes/bootstrap3/style.css b/e107_themes/bootstrap3/style.css index 7a15abacd..b6eea70da 100644 --- a/e107_themes/bootstrap3/style.css +++ b/e107_themes/bootstrap3/style.css @@ -112,7 +112,7 @@ img.featurebox { border-radius: 5px } .btn-featurebox, .btn-cpage { margin-top:10px } - +.tab-pane { padding-top:15px } /* CUSTOM Responsive Styles */