Example #1
0
    ?>
<div class="profile-edit">
<div id="menu">
<ul class="nav nav-tabs">
		<li class="active"><a href="#edit-profile"><?php 
    echo JText::_('COM_BT_SOCIALCONNECT_PROFILE_DETAIL_CORE_LEGEND');
    ?>
</a></li>							
</ul>
</div>
<div class="tab-content">
	<div id="edit-profile" class="tab-pane active">
<fieldset id="users-profile-custom">
	<dl class="dl-horizontal">
		<?php 
    $groupList = Bt_SocialconnectHelper::getGroupList();
    foreach ($this->data->user_fields as $key => $value) {
        ?>
		
		<?php 
        if (!trim($value->value)) {
            continue;
        }
        switch ($value->type) {
            case 'usergroup':
                echo '<dt>' . Jtext::_($value->name) . '</dt>';
                echo '<span class="colon">:</span>';
                echo '<dd>';
                if (isset($groupList[$value->value])) {
                    echo $groupList[$value->value]->text;
                }
Example #2
0
 public static function loadFieldData($el, $required)
 {
     switch ($el->type) {
         case 'date':
             if ($el->value == '' || $el->value == '0000-00-00') {
                 $el->value = null;
             }
             echo JHTML::_('calendar', $el->value, 'user_fields[' . $el->alias . ']', 'user_fields_' . $el->alias, '%Y-%m-%d ', $el->required ? array('aria-required' => 'true', 'required' => 'required') : null);
             break;
         case 'string':
             echo '<input size="35" ' . $required . ' type="text" name="user_fields[' . $el->alias . ']" value="' . $el->value . '">';
             break;
         case 'text':
             // jimport('joomla.html.editor');
             // $wysiwyg = JEditor::getInstance();
             //echo $wysiwyg->display('user_fields[' . $el->alias . ']', strip_tags($el->value), '365', '140', '75', '20', false );
             echo '<textarea style="width:350px;" cols="40" rows="3" ' . $required . ' name="user_fields[' . $el->alias . ']">' . strip_tags($el->value) . '</textarea>';
             break;
         case 'dropdown':
             $options = array();
             $options[] = JHtml::_('select.option', '', $el->default_values['label']);
             if (!empty($el->default_values['value'])) {
                 foreach ($el->default_values['value'] as $value) {
                     $options[] = JHtml::_('select.option', $value, $value);
                 }
             }
             echo JHtml::_('select.genericlist', $options, 'user_fields[' . $el->alias . '][]', $required, 'value', 'text', $el->value);
             break;
         case 'image':
             if ($el->value != '') {
                 $pathImage = array();
                 $pathImage[$el->alias] = $el->value;
                 $session = JFactory::getSession();
                 $session->set('btimage', $pathImage);
                 $avatar = '<img src="' . JURI::root() . 'images/bt_socialconnect/avatar/' . $el->value . '"/>';
                 $html = '<div class=\'imageupload\'>';
                 $html .= '<span class="editlinktip hasTip" title="' . htmlspecialchars($avatar) . '">';
                 $html .= '<img src=' . JURI::root() . 'images/bt_socialconnect/avatar/' . $el->value . ' width=\'50\' />';
                 $html .= '<input type="hidden" name="user_fields[' . $el->alias . ']" value="' . $el->value . '" />';
                 $html .= '</span>';
                 $html .= '<span"><input type="file" name="user_fields[' . $el->alias . ']" style="width:202px;"  class="inputbox" size="14"/></span>';
                 $html .= '</div>';
                 $html .= '<input type="checkbox" class="textbook" name="user_fields[' . $el->alias . ']" value="">' . Jtext::_('COM_BT_SOCIALCONNECT_DELETE_IMAGE');
             } else {
                 $html = '<div class=\'inputupload\'>';
                 $html .= '<input type="file" name="user_fields[' . $el->alias . ']"  ' . $required . ' size="30"/>';
                 $html .= '</div>';
             }
             echo $html;
             break;
         case 'usergroup':
             $required = $el->required ? ' required aria-required="true"' : '';
             $html = '<fieldset class="btn-group radio" ' . $required . '>';
             $groupList = Bt_SocialconnectHelper::getGroupList();
             if (!empty($el->default_values['group'])) {
                 foreach ($el->default_values['group'] as $i => $group) {
                     $checked = '';
                     $fieldClass = array();
                     if ($el->value == $group) {
                         $checked = 'checked="checked"';
                     }
                     if (isset($el->default_values['field'][$i])) {
                         foreach ($el->default_values['field'][$i] as $alias) {
                             $fieldClass[] = '.field-' . $alias;
                         }
                     }
                     $fieldClass = implode(',', $fieldClass);
                     $html .= '<label for="jform_' . $el->alias . $i . '">' . '<input id="jform_' . $el->alias . $i . '" data-fields="' . $fieldClass . '" class="jform_' . $el->alias . '" type="radio" name="user_fields[' . $el->alias . ']" ' . $checked . ' value="' . $group . '">' . $groupList[$group]->text . '</label>';
                 }
             }
             $html .= '</fieldset>';
             $html .= '<script>';
             $html .= 'function changeFields(el){';
             $html .= 'jQuery(el).each(function(){';
             $html .= 'var datafields = jQuery(this).attr("data-fields");';
             $html .= 'if(datafields){';
             $html .= 'if(this.checked){';
             $html .= 'jQuery(datafields).fadeIn().find("input").attr("disabled",false);';
             $html .= '}else{jQuery(datafields).hide().find("input").attr("disabled",true);};';
             $html .= '}';
             $html .= '});';
             $html .= '};';
             $html .= 'jQuery(".jform_' . $el->alias . '").click(function(){';
             $html .= 'changeFields(".jform_' . $el->alias . '")';
             $html .= '});jQuery(".jform_' . $el->alias . '").on("ifClicked", function(event) {setTimeout(function(){changeFields(".jform_' . $el->alias . '");},100);});';
             $html .= 'if(jQuery(".jform_' . $el->alias . ':checked").length==0){jQuery(".jform_' . $el->alias . ':first").attr("checked",true);};jQuery(document).ready(function(){changeFields(".jform_' . $el->alias . '");});';
             $html .= '</script>';
             echo $html;
             break;
         case 'sql':
             echo JHtml::_('select.genericlist', $el->default_values, 'user_fields[' . $el->alias . '][]', $required, 'value', 'text', $el->value);
             break;
     }
 }