<br>
	<label></label><input type="submit" name="user_edit_submit_password" value="<?php 
echo $phplogin_lang['Change password'];
?>
" />
</form>
</div>
<br>
<div class="sid-back">
<h2>Keisti profilio nuotrauką</h2>
<?php 
$options = array('fields' => array('user_thumb' => array('inputtype' => 'photo')));
updateUsermeta($options, CUSER, 'users', 'user_id');
echo '</div><br><div class="sid-back"><h2>Keisti profilio duomenis</h2>';
if ($usermeta['user_person'] == 0) {
    $options = array('fields' => array('user_fname' => array('Vardas', 'required' => true), 'user_lname' => array('Pavardė', 'required' => true)));
} elseif ($usermeta['user_person'] == 1) {
    $Core = new Core();
    $legalStatuses = $Core->get('legalStatuses');
    $options = array('fields' => array('user_orgname' => array('Pavadinimas', 'required' => true), 'user_legalstatus' => array('Teisinis statusas', 'inputtype' => 'drop', 'drops' => $legalStatuses, 'required' => true), 'user_code1' => array('Įmonės kodas', 'len' => 9, 'required' => true), 'user_code2' => array('PVM mokėtojo kodas', 'len' => 14), 'user_reg' => array('Registras', 'len' => 128)));
}
$options['fields']['user_address'] = array('Adresas', 'required' => true);
$options['fields']['user_city2'] = array('Savivaldybė', 'inputtype' => 'drop', 'drops' => $citiesList, 'required' => true);
$options['fields']['user_phone'] = array('Telefonas', 'len' => 11, 'required' => true);
$options['fields']['user_desc'] = array($usermeta['user_person'] == 0 ? 'Apie save' : 'Apie organizaciją', 'inputtype' => 'textarea');
$options['fields']['user_subscribed'] = array('Naujienų prenumerata', 'inputtype' => 'bool');
updateUsermeta($options, CUSER, 'users', 'user_id');
?>
</div>
</div></div>
    $options = array('fields' => array('user_parent' => array('Priskirtas tinklo atstovas', 'inputtype' => 'drop', 'drops' => $kuratoriai)));
    updateUsermeta($options, $us, 'users', 'user_id');
    echo '<br>';
}
$usermeta = getRow('users', 'user_id = ' . $us);
$options = array();
$options['fields']['user_active'] = array('Paskyra aktyvuota', 'inputtype' => 'bool', 'required' => true);
$options['fields']['user_email'] = array('El. paštas', 'required' => true);
$options['fields']['user_password_hash'] = array('Slaptažodis', 'inputtype' => 'pass');
if ($usermeta['user_person'] == 0) {
    $options['fields']['user_fname'] = array('Vardas', 'required' => true);
    $options['fields']['user_lname'] = array('Pavardė', 'required' => true);
} elseif ($usermeta['user_person'] == 1) {
    $options['fields']['user_orgname'] = array('Pavadinimas', 'required' => true);
    $options['fields']['user_legalstatus'] = array('Teisinis statusas', 'inputtype' => 'drop', 'drops' => $legalStatuses, 'required' => true);
    $options['fields']['user_code1'] = array('Įmonės kodas', 'len' => 9, 'required' => true);
    $options['fields']['user_code2'] = array('PVM mokėtojo kodas', 'len' => 14);
    $options['fields']['user_reg'] = array('Registras', 'len' => 128);
}
$options['fields']['user_address'] = array('Adresas', 'required' => true);
$options['fields']['user_region'] = array('Apskritis', 'inputtype' => 'drop', 'drops' => $regionsList, 'required' => true);
$options['fields']['user_city'] = array('Savivaldybė', 'inputtype' => 'drop', 'drops' => $citiesList, 'required' => true);
$options['fields']['user_phone'] = array('Telefonas', 'len' => 11, 'required' => true);
if ($usermeta['user_acctype'] > 0) {
    $options['fields']['user_orgname'] = array('Atstovaujama organizacija');
}
$options['fields']['user_desc'] = array($usermeta['user_person'] == 0 ? 'Apie save' : 'Apie organizaciją', 'inputtype' => 'textarea');
$options['fields']['user_thumb'] = array($usermeta['user_person'] == 0 ? 'Nuotrauka' : 'Logotipas', 'inputtype' => 'photo');
$options['fields']['user_subscribed'] = array('Naujienų prenumerata', 'inputtype' => 'bool');
updateUsermeta($options, $us, 'users', 'user_id');
    $cats[$cat[0]] = $cat[1];
}
$getReg = $usermeta['user_region'];
$regionChildren = array();
foreach ($regionsListChildren[$getReg] as $children) {
    $regionChildren[$children] = $citiesList[$children];
}
if (isset($_POST['user_parent'])) {
    updateFieldWhere('needy', 'user_parent_ta', getManagerParent($_POST['user_parent']), 'user_id=' . $us);
}
$options['fields']['user_address'] = array('Adresas', 'required' => true);
$options['fields']['user_cat'] = array('Kategorija', 'required' => true, 'inputtype' => 'drop', 'drops' => $cats);
$options['fields']['user_region'] = array('Apskritis', 'inputtype' => 'drop', 'drops' => $regionsList, 'required' => true);
$options['fields']['user_city'] = array('Miestas', 'inputtype' => 'drop', 'drops' => $regionChildren, 'required' => true);
$options['fields']['user_phone'] = array('Telefonas', 'len' => 11, 'required' => true);
if ($usermeta['user_person'] == 0) {
    $options['fields']['user_email'] = array('El. paštas');
} elseif ($usermeta['user_person'] == 1) {
    $options['fields']['user_email'] = array('El. paštas', 'required' => true);
}
$options['fields']['user_desc'] = array('Aprašymas', 'inputtype' => 'textarea');
$options['fields']['user_thumb'] = array($usermeta['user_person'] == 0 ? 'Nuotrauka' : 'Logotipas', 'inputtype' => 'photo');
if (isAdmin() or isGridManager()) {
    $options['fields']['user_parent'] = array('Priskirtas kuratorius', 'inputtype' => 'drop', 'drops' => $kuratoriai);
}
updateUsermeta($options, $us, 'needy', 'user_id');
$getTA = getRow('needy', 'user_id = ' . $us);
if ($getTA['user_parent_ta'] > 0) {
    $getTA = getRow('users', 'user_id = ' . $getTA['user_parent_ta']);
    echo '<br><label>Priskirtas tinklo atstovas</label> ' . $getTA['user_fname'] . ' ' . $getTA['user_lname'] . ' ' . $getTA['user_orgname'];
}
if ($usermeta['need_type'] == 2) {
    $subkats = array();
    $ops = listData('cats', 'cat_type = ' . $need_cat_type . ' AND deleted = 0 AND cat_level = 1 AND cat_parent = ' . $usermeta['need_subcat']);
    foreach ($ops as $op) {
        $subkats[$op[0]] = $op['cat_name'];
    }
    $options['fields']['need_subcat'] = array('Subkategorija', 'inputtype' => 'drop', 'drops' => $subkats, 'required' => true);
}
$options['fields']['need_name'] = array('Pavadinimas', 'required' => true);
$options['fields']['need_desc'] = array('Aprašymas', 'inputtype' => 'textarea', 'required' => true);
$options['fields']['need_expires'] = array('Galiojimo laikas', 'required' => true);
updateUsermeta($options, $us, 'needs', 'need_id');
echo '<br><hr><br>';
$options = array();
$options['fields']['need_full'] = array('Poreikis patenkintas', 'inputtype' => 'drop', 'drops' => array('Ne', 'Taip'));
updateUsermeta($options, $us, 'needs', 'need_id');
if ($usermeta['need_full'] == 1) {
    echo '<br><hr><br>';
    echo '<b>Aprašymas</b><br><br>';
    if ($usermeta['need_full_desc'] != '') {
        echo $usermeta['need_full_desc'] . '<br><br>';
    } else {
        echo '<i>Poreikį patenkinęs vartotojas neįvedė aprašymo</i><br></br>';
    }
    if ($usermeta['need_full_photo'] != '') {
        echo '<img style="max-height: 200px; max-width: 640px;" src="' . $usermeta['need_full_photo'] . '" alt="" onError="this.style.visibility=\'hidden\'" /><br><br>';
    }
    echo '<br><hr><br>';
    echo '<b>Informacija apie ' . ($need_type == 1 ? 'darbo' : 'daikto') . ' poreikį patenkinusį vartotoją</b><br><br>';
    if ($usermeta['need_full_user'] > 0) {
        $usermeta2 = getRow('users', 'user_id = ' . $usermeta['need_full_user']);