Skip to content
Snippets Groups Projects
Commit 91c3f437 authored by Andrew Rudenets's avatar Andrew Rudenets Committed by RomanSteinberg
Browse files

FIX: редактирование профиля

parent c5a696d1
Branches
Tags
No related merge requests found
...@@ -6,6 +6,7 @@ class Controller_Teacher_Profile extends Controller_UserEnvi { ...@@ -6,6 +6,7 @@ class Controller_Teacher_Profile extends Controller_UserEnvi {
$twig = Twig::factory('profile/settings'); $twig = Twig::factory('profile/settings');
$twig->JobPositions = $this->getJobPositions(); $twig->JobPositions = $this->getJobPositions();
$twig->Faculties = $this->getFaculties(); $twig->Faculties = $this->getFaculties();
$twig->Departments = DataArray::factory('Departments')->byFaculty($this->UserInfo['FacultyID']);
$twig->User = $this->UserInfo; $twig->User = $this->UserInfo;
$this->response->body($twig); $this->response->body($twig);
} }
......
...@@ -28,19 +28,19 @@ ...@@ -28,19 +28,19 @@
<a href="settings.twig"></a> <a href="settings.twig"></a>
<div class="inputGroup_input"> <div class="inputGroup_input">
<select id="jobPositionSelect"> <select id="jobPositionSelect">
<option value="0">--- Академическая должность ---</option>
{% for row in JobPositions %} {% for row in JobPositions %}
<option value="{{ row.ID }}" {% if User.JobPositionName == row.Name %}selected="selected"{% endif %}>{{ row.Name }}</option> <option value="{{ row.ID }}" {% if User.JobPositionName == row.Name %}selected="selected"{% endif %}>{{ row.Name }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="facultySelect"> <select id="facultySelect">
<option value="0">--- Подразделение ЮФУ ---</option>
{% for row in Faculties %} {% for row in Faculties %}
<option value="{{ row.ID }}" {% if User.JobPositionName == row.Name %}selected="selected"{% endif %}>{{ row.Name }} ({{ row.Abbr }})</option> <option value="{{ row.ID }}" {% if User.FacultyName == row.Name %}selected="selected"{% endif %}>{{ row.Name }} ({{ row.Abbr }})</option>
{% endfor %} {% endfor %}
</select> </select>
<select id="departmentSelect"> <select id="departmentSelect">
<option value="0">--- Кафедра ---</option> {% for row in Departments %}
<option value="{{ row.ID }}" {% if User.DepID == row.ID %}selected="selected"{% endif %}>{{ row.Name }}</option>
{% endfor %}
</select> </select>
</div> </div>
</div> </div>
......
...@@ -40,21 +40,8 @@ ...@@ -40,21 +40,8 @@
.inputGroup_submit button .inputGroup_submit button
{ {
border: 0; border: 1px solid #ddd;
width: 80%; padding: 4px;
padding: 6px 20px; width: 95%;
background: #3A84A6;
font-weight: bold;
font-size: 13px;
color: #ffffff;
border-radius: 3px;
moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
}
.inputGroup_submit button:hover {
background: #3399CC;
cursor: pointer;
} }
var URLdir = '/~dev_rating/'; var URLdir = '/~dev_rating/';
\ No newline at end of file var sitePath = 'http://mmcs.sfedu.ru/rating';
\ No newline at end of file
$(function() $(function()
{ {
$("#facultySelect [value='0']").attr('selected', 'selected');
$('#departmentSelect').attr('disabled', 'disabled');
$("#departmentSelect [value='0']").attr('selected', 'selected');
$('#inputGroupSubmit').attr('disabled', 'disabled'); $('#inputGroupSubmit').attr('disabled', 'disabled');
// Выбор факультета // Выбор факультета
$('#facultySelect').change(function(){ $('#facultySelect').change(function(){
if (($('#facultySelect option:selected').val()!= '0')) { if (($('#facultySelect option:selected').val()!= '0')) {
$("#departmentSelect").html('<option value="0">--- Кафедра ---</option>'); $('#inputGroupSubmit').removeAttr('disabled');
$("#departmentSelect").html('');
$('#departmentSelect').attr('disabled', 'disabled'); $('#departmentSelect').attr('disabled', 'disabled');
$.post(URLdir + 'handler/settings/getDepartmentsList', {'facultyID': $('#facultySelect option:selected').val()}, function(data){ $.post(URLdir + 'handler/settings/getDepartmentsList', {'facultyID': $('#facultySelect option:selected').val()}, function(data){
$.each(data, function(i){ $.each(data, function(i){
...@@ -22,12 +20,36 @@ $(function() ...@@ -22,12 +20,36 @@ $(function()
} }
}); });
$('#firstName').change(function(){
if (($('#firstName').val()!= '0')) {
$('#inputGroupSubmit').removeAttr('disabled');
}
});
$('#secondName').change(function(){
if (($('#secondName').val()!= '0')) {
$('#inputGroupSubmit').removeAttr('disabled');
}
});
$('#lastName').change(function(){
if (($('#lastName').val()!= '0')) {
$('#inputGroupSubmit').removeAttr('disabled');
}
});
$('#departmentSelect').change(function(){ $('#departmentSelect').change(function(){
if (($('#departmentSelect option:selected').val()!= '0')) { if (($('#departmentSelect option:selected').val()!= '0')) {
$('#inputGroupSubmit').removeAttr('disabled'); $('#inputGroupSubmit').removeAttr('disabled');
} }
}); });
$('#jobPositionSelect').change(function(){
if (($('#jobPositionSelect option:selected').val()!= '0')) {
$('#inputGroupSubmit').removeAttr('disabled');
}
});
$('#inputGroupSubmit').click(function(){ $('#inputGroupSubmit').click(function(){
$('#inputGroupSubmit').attr('disabled', 'disabled'); $('#inputGroupSubmit').attr('disabled', 'disabled');
$.post(URLdir + 'handler/settings/editProfile', $.post(URLdir + 'handler/settings/editProfile',
...@@ -45,6 +67,7 @@ $(function() ...@@ -45,6 +67,7 @@ $(function()
}); });
$('.inputGroupMessages').append('</ul>'); $('.inputGroupMessages').append('</ul>');
$('#inputGroupSubmit').removeAttr('disabled'); $('#inputGroupSubmit').removeAttr('disabled');
window.location.href = sitePath;
}, "json"); }, "json");
}); });
}); });
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment