openvk/Web/Presenters/templates/User/Edit.xml
2023-08-02 00:42:03 +03:00

611 lines
30 KiB
XML

{extends "../@layout.xml"}
{if $mode === 'backdrop'}
{var $backdrops = $user->getBackDropPictureURLs()}
{/if}
{block title}{_edit_page}{/block}
{block header}
{_edit_page}
{/block}
{block content}
{var $isMain = $mode === 'main'}
{var $isContacts = $mode === 'contacts'}
{var $isEducation = $mode === 'education'}
{var $isInterests = $mode === 'interests'}
{var $isAvatar = $mode === 'avatar'}
{var $isBackDrop = $mode === 'backdrop'}
<div n:if="$user->hasPendingNumberChange()" class="msg">
<b>Подтверждение номера телефона</b><br/>
Введите код для подтверждения смены номера: <a href="/edit/verify_phone">ввести код</a>.
</div>
<div class="tabs">
<div n:attr="id => ($isMain ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isMain ? 'act_tab_a' : 'ki')" href="/edit">{_main}</a>
</div>
<div n:attr="id => ($isContacts ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isContacts ? 'act_tab_a' : 'ki')" href="/edit?act=contacts">{_contacts}</a>
</div>
<div n:attr="id => ($isEducation ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isEducation ? 'act_tab_a' : 'ki')" href="/edit?act=education">Образование</a>
</div>
<div n:attr="id => ($isInterests ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isInterests ? 'act_tab_a' : 'ki')" href="/edit?act=interests">{_interests}</a>
</div>
<div n:attr="id => ($isAvatar ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isAvatar ? 'act_tab_a' : 'ki')" href="/edit?act=avatar">{_avatar}</a>
</div>
<div n:attr="id => ($isBackDrop ? 'activetabs' : 'ki')" class="tab">
<a n:attr="id => ($isBackDrop ? 'act_tab_a' : 'ki')" href="/edit?act=backdrop">{_backdrop_short}</a>
</div>
</div>
<div class="container_gray">
{if $isMain}
<h4>{_main_information}</h4>
<form action="/edit?act=main" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr>
<td width="120" valign="top">
<span class="nobold">{_name}: </span>
</td>
<td>
<input type="text" name="first_name" value="{$user->getFirstName(true)}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_surname}: </span>
</td>
<td>
<input type="text" name="last_name" value="{$user->getLastName(true)}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_nickname}: </span>
</td>
<td>
<input type="text" name="pseudo" value="{$user->getPseudo()}" />
</td>
</tr>
{if OPENVK_ROOT_CONF['openvk']['credentials']['zadarma']['enable']}
<tr>
<td width="120" valign="top">
<span class="nobold">{_phone}: </span>
</td>
<td>
<input type="phone" name="phone" value="{$user->getPhone()}" />
</td>
</tr>
{/if}
<tr>
<td width="120" valign="top">
<span class="nobold">{_status}: </span>
</td>
<td>
<input type="text" name="status" value="{$user->getStatus()}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_hometown}: </span>
</td>
<td>
<input type="text" name="hometown" value="{$user->getHometown()}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_relationship}: </span>
</td>
<td>
<select name="marialstatus">
<option n:foreach="range(0, 8) as $i" n:attr="selected => ($user->getMaritalStatus() == $i)" value="{$i}">
{if $user->isFemale()}
{var $str = "relationship_$i"}
{if tr($str . "_fem") == ("@$str" . "_fem")}
{_$str}
{else}
{tr($str . "_fem")}
{/if}
{else}
{_"relationship_$i"}
{/if}
</option>
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_politViews}: </span>
</td>
<td>
<select name="politViews">
<option value="0" {if $user->getPoliticalViews() == 0}selected{/if}>{_politViews_0}</option>
<option value="1" {if $user->getPoliticalViews() == 1}selected{/if}>{_politViews_1}</option>
<option value="2" {if $user->getPoliticalViews() == 2}selected{/if}>{_politViews_2}</option>
<option value="3" {if $user->getPoliticalViews() == 3}selected{/if}>{_politViews_3}</option>
<option value="4" {if $user->getPoliticalViews() == 4}selected{/if}>{_politViews_4}</option>
<option value="5" {if $user->getPoliticalViews() == 5}selected{/if}>{_politViews_5}</option>
<option value="6" {if $user->getPoliticalViews() == 6}selected{/if}>{_politViews_6}</option>
<option value="7" {if $user->getPoliticalViews() == 7}selected{/if}>{_politViews_7}</option>
<option value="8" {if $user->getPoliticalViews() == 8}selected{/if}>{_politViews_8}</option>
<option value="9" {if $user->getPoliticalViews() == 9}selected{/if}>{_politViews_9}</option>
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_gender}: </span>
</td>
<td>
<select name="gender">
<option value="1" {if $user->isFemale() == true}selected{/if}>{_female}</option>
<option value="0" {if $user->isFemale() == false}selected{/if}>{_male}</option>
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_birth_date}: </span>
</td>
<td>
<input max={date('Y-m-d')} name="birthday" value={is_null($user->getBirthday()) ? NULL : $user->getBirthday()->format('%Y-%m-%d')} type="date" style="margin-bottom: 7px;" />
<select name="birthday_privacy">
<option value="0" {if $user->getBirthdayPrivacy() == 0}selected{/if}>{_show_my_birthday}</option>
<option value="1" {if $user->getBirthdayPrivacy() == 1}selected{/if}>{_show_only_month_and_day}</option>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
</td>
</tr>
</tbody>
</table>
</form>
{elseif $isContacts}
<h4>{_contact_information}</h4>
<form action="/edit?act=contacts" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr>
<td width="120" valign="top">
<span class="nobold">{_email}: </span>
</td>
<td>
<input type="email" name="email_contact" value="{$user->getContactEmail()}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_telegram}: </span>
</td>
<td>
<input type="text" name="telegram" value="{$user->getTelegram()}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_personal_website}: </span>
</td>
<td>
<input type="text" name="website" value="{$user->getWebsite()}" />
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">Страна: </span>
</td>
<td>
<input type="text" name="country" placeholder="Начните вводить название" id="country"
onInput="onChangeCountryInput()"
{if $user->getCountry()}value='{$user->getCountry()}'{/if} />
</td>
</tr>
<tr id="countries-list-td" style="display: none">
<td width="120" valign="top">
<span class="nobold"></span>
</td>
<td>
<center id="countries-not-found">Ничего не найдено</center>
<select id="countries-list" name="country-id" value="1">
{if $user->getCountry()}
<option value="{$user->getCountry(true)['id']}">{$user->getCountry(true)['native_name']}
({$user->getCountry(true)['name']})
</option>
{/if}
</select>
</td>
</tr>
<tr id="cities-list-td-input" style="display: none">
<td width="120" valign="top">
<span class="nobold">Город: </span>
</td>
<td>
<input type="text" name="city" placeholder="Начните вводить название" id="city" onInput="onChangeCityInput()" {if $user->getCity()}value='{$user->getCity()}'{/if} />
<a onClick="geodbRequest('cities')">Я не могу найти свой город</a>
</td>
</tr>
<tr id="cities-list-td" style="display: none">
<td width="120" valign="top">
<span class="nobold"></span>
</td>
<td>
<center id="cities-not-found">Ничего не найдено</center>
<select id="cities-list" name="city-id" value="1">
{if $user->getCity()}
<option value="{$user->getCity(true)['id']}">{$user->getCity(true)['native_name']}
({$user->getCity(true)['name']})
</option>
{/if}
</select>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_address}: </span>
</td>
<td>
<input type="text" name="address" value="{$user->getPhysicalAddress()}" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
</td>
</tr>
</tbody>
</table>
</form>
{include "../Geodb/GeodbForEdit.js.xml", user => $user}
{elseif $isEducation}
<style>.school-additional { display: none } .university-additional { display: none }</style>
<h4>Школа</h4>
<form action="/edit?act=education&type=school" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr id="school-cities-list-td-input">
<td width="120" valign="top">
<span class="nobold">Город: </span>
</td>
<td>
<input type="text" name="city" placeholder="Начните вводить название" id="city"
onInput="onChangeSchoolCityInput(0)"/>
</td>
</tr>
<tr id="school-cities-list-td" style="display: none">
<td width="120" valign="top">
<span class="nobold"></span>
</td>
<td>
<center id="school-cities-not-found">Ничего не найдено</center>
<select id="school-cities-list" name="city-id" value="1" onchange="onChangeCitySelect(null, 0)">
</select>
</td>
</tr>
<div id="school-info" style="display: none;">
<tr id="schools" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Школа:</span>
</td>
<td id="schools-block">
<center id="schools-not-found" style="padding: 16px;">Ничего не найдено</center>
<select id="schools-list" name="school-id" value="1">
</select>
</td>
</tr>
</div>
<tr class="school-additional-0" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Год начала обучения:</span>
</td>
<td>
<input type="text" name="edu_start"
n:attr="value => $user->getSchoolYears()[0] != 0 ? $user->getSchoolYears()[0] : NULL"/>
</td>
</tr>
<tr class="school-additional-0" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Год окончания обучения:</span>
</td>
<td>
<input type="text" name="edu_end"
n:attr="value => $user->getSchoolYears()[1] != 0 ? $user->getSchoolYears()[1] : NULL"/>
</td>
</tr>
<tr class="school-additional-0" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Год выпуска:</span>
</td>
<td>
<input type="text" name="edu_graduation"
n:attr="value => $user->getSchoolYears()[2] != 0 ? $user->getSchoolYears()[2] : NULL"/>
</td>
</tr>
<tr class="school-additional-0" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Специальность:</span>
</td>
<td>
<input type="text" name="edu_specialization" n:attr="value => $user->getSchoolSpecialization() ?? NULL" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
<div><a onClick="geodbRequest('schools')">Я не могу найти свою школу</a></div>
</td>
</tr>
</tbody>
</table>
</form>
<h4>Университет</h4>
<form action="/edit?act=education&type=university" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr id="university-cities-list-td-input">
<td width="120" valign="top">
<span class="nobold">Город: </span>
</td>
<td>
<input type="text" name="city" placeholder="Начните вводить название" id="university-city"
onInput="onChangeUniversityCityInput()"/>
</td>
</tr>
<tr id="university-cities-list-td" style="display: none">
<td width="120" valign="top">
<span class="nobold"></span>
</td>
<td>
<center id="university-cities-not-found">Ничего не найдено</center>
<select id="university-cities-list" name="city-id" value="1" onchange="onChangeUniversityCitySelect()">
</select>
</td>
</tr>
<div id="university-info">
<tr id="universities" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Университет:</span>
</td>
<td id="universities-block">
<center id="universities-not-found" style="padding: 16px;">Ничего не найдено</center>
<select id="universities-list" name="university-id" value="1">
</select>
</td>
</tr>
</div>
<div id="faculty-info">
<tr id="faculties" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Факультет:</span>
</td>
<td id="faculties-block">
<center id="faculties-not-found" style="padding: 16px;">Ничего не найдено</center>
<select id="faculties-list" name="faculty-id" value="1">
</select>
</td>
</tr>
</div>
<div id="specialization-info">
<tr id="specializations" style="display: none;">
<td width="120" valign="top">
<span class="nobold">Специализация:</span>
</td>
<td id="specializations-block">
<center id="specializations-not-found" style="padding: 16px;">Ничего не найдено</center>
<select id="specializations-list" name="specialization-id" value="1" onchange="onChangeSpecializationsCitySelect()">
</select>
</td>
</tr>
</div>
<tr class="university-additional">
<td width="120" valign="top">
<span class="nobold">Год начала обучения:</span>
</td>
<td>
<input type="text" name="edu_university_start"
n:attr="value => $user->getUniversityYears()[0] != 0 ? $user->getUniversityYears()[0] : NULL"/>
</td>
</tr>
<tr class="university-additional">
<td width="120" valign="top">
<span class="nobold">Год окончания обучения:</span>
</td>
<td>
<input type="text" name="edu_university_end"
n:attr="value => $user->getUniversityYears()[1] != 0 ? $user->getUniversityYears()[1] : NULL"/>
</td>
</tr>
<tr class="university-additional">
<td width="120" valign="top">
<span class="nobold">Год выпуска:</span>
</td>
<td>
<input type="text" name="edu_university_graduation"
n:attr="value => $user->getUniversityYears()[2] != 0 ? $user->getUniversityYears()[2] : NULL"/>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
<div>
<a onClick="geodbRequest('universities')">Я не могу найти свой университет</a>,
<a onClick="geodbRequest('faculties')">факультет</a>,
<a onClick="geodbRequest('specializations')">специальность</a>
</div>
</td>
</tr>
</tbody>
</table>
</form>
{include "../Geodb/GeodbForEdit.js.xml", user => $user}
{elseif $isInterests}
<h4>{_personal_information}</h4>
<form action="/edit?act=interests" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr>
<td width="120" valign="top">
<span class="nobold">{_interests}: </span>
</td>
<td>
<textarea type="text" name="interests">{$user->getInterests()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_music}: </span>
</td>
<td>
<textarea type="text" name="fav_music">{$user->getFavoriteMusic()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_films}: </span>
</td>
<td>
<textarea type="text" name="fav_films">{$user->getFavoriteFilms()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_shows}: </span>
</td>
<td>
<textarea type="text" name="fav_shows">{$user->getFavoriteShows()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_books}: </span>
</td>
<td>
<textarea type="text" name="fav_books">{$user->getFavoriteBooks()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_favorite_quotes}: </span>
</td>
<td>
<textarea type="text" name="fav_quote">{$user->getFavoriteQuote()}</textarea>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_information_about}: </span>
</td>
<td>
<textarea type="text" name="about">{$user->getDescription()}</textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
</td>
</tr>
</tbody>
</table>
</form>
{elseif $isAvatar}
<h4>{_profile_picture}</h4>
<form action="/al_avatars" method="POST" enctype="multipart/form-data">
<table cellspacing="7" cellpadding="0" width="60%" border="0" align="center">
<tbody>
<tr>
<td width="120" valign="top">
<span class="nobold">{_picture}: </span>
</td>
<td>
<label class="button" style="">{_browse}
<input type="file" id="blob" name="blob" style="display: none;" onchange="filename.innerHTML=blob.files[0].name" />
</label>
<div id="filename" style="margin-top: 10px;"></div>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="hidden" name="hash" value="{$csrfToken}" />
<input type="submit" value="{_save}" class="button" />
</td>
</tr>
</tbody>
</table>
</form>
{elseif $isBackDrop}
<h4>{_backdrop}</h4>
<p>{_backdrop_desc}</p>
<form method="POST" enctype="multipart/form-data">
<div id="backdropEditor">
<div id="backdropFilePicker">
<label class="button" style="">Обзор<input type="file" accept="image/*" name="backdrop1" style="display: none;"></label>
<div id="spacer" style="width: 366px;"></div>
<label class="button" style="">Обзор<input type="file" accept="image/*" name="backdrop2" style="display: none;"></label>
<div id="spacer" style="width: 366px;"></div>
</div>
</div>
<p>
<span class="nobold">{_backdrop_warn}</span>
</p>
<p>
<span class="nobold">{_backdrop_about_adding}</span>
</p>
<p><br/></p>
<input type="hidden" name="hash" value="{$csrfToken}" />
<div>
<center>
<button name="subact" value="save" class="button">{_backdrop_save}</button>
<button name="subact" value="remove" class="button">{_backdrop_remove}</button>
</center>
</div>
</form>
{/if}
</div>
{/block}