mirror of
https://github.com/e107inc/e107.git
synced 2025-08-26 15:54:43 +02:00
Fixes #592 Missing User-extended fields when using Bootstrap with usersettings page.
Closes #539 Tabs view of user-extended categories when using Bootstrap. Added missing css classes to extended-fields.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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'] = "
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
";
|
||||
|
||||
|
||||
$USERSETTINGS_TEMPLATE['extended-category'] = "<h3>{CATNAME}</h3>";
|
||||
$USERSETTINGS_TEMPLATE['extended-field'] = "<div class='form-group'>
|
||||
<label class='col-sm-3 control-label'>{FIELDNAME}</label>
|
||||
<div class='col-sm-9'>
|
||||
{FIELDVAL} {HIDEFIELD}
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
@@ -17,42 +17,42 @@
|
||||
</item>
|
||||
<item name="location">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="aim">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="icq">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="yahoo">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="msn">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
</item>
|
||||
<item name="skype">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
<write>253</write>
|
||||
@@ -66,7 +66,7 @@
|
||||
</item>
|
||||
<item name="homepage">
|
||||
<type>text</type>
|
||||
<include_text>class='tbox' size='40' maxlength='254'</include_text>
|
||||
<include_text>class='form-control tbox' size='40' maxlength='254'</include_text>
|
||||
<regex>#^[a-z0-9]+://#si</regex>
|
||||
<applicable>253</applicable>
|
||||
<read>253</read>
|
||||
|
Reference in New Issue
Block a user