You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
9.7 KiB
202 lines
9.7 KiB
function show_theme_materials(id){
|
|
$('[name=theme_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=theme_materials_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=theme_listing]').hide();
|
|
$('[name=theme_listing][id='+id+']').fadeIn(1000);
|
|
}
|
|
function show_lesson_materials(id){
|
|
$('[name=lesson_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=lesson_materials_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_materials]').html('<img src="/static/img/ui-anim_basic_16x16.gif">');
|
|
$('[name=lesson_materials]').html(write_lesson_material(get_lesson_context(id)));
|
|
}
|
|
function show_homework_materials(id){
|
|
$('[name=lesson_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=lesson_materials_button][id=homework_'+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_materials]').html('<img src="/static/img/ui-anim_basic_16x16.gif">');
|
|
$('[name=lesson_materials]').html(write_homework_material(get_homework_context(id)));
|
|
}
|
|
function show_one_lesson_materials(id){
|
|
$('[name=theme_listing]').hide();
|
|
$('[name=theme_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=theme_materials_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_materials]').html('<img src="/static/img/ui-anim_basic_16x16.gif">');
|
|
$('[name=lesson_materials]').html(write_lesson_material(get_lesson_context(id)));
|
|
}
|
|
function show_homework_students(id){
|
|
$('[name=homework_students_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=homework_students_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=homework_students]').hide();
|
|
$('[name=student_dialog]').hide();
|
|
$('[name=big_lesson_block]').hide();
|
|
$('[name=homework_students][id='+id+']').fadeIn(1000)
|
|
}
|
|
function show_homework_student_dialog(id){
|
|
if (typeof(id) != 'string'){
|
|
var block = $(id);
|
|
$('[name=student_dialog_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=student_dialog_button][id='+block.attr('student_id')+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_comments_block]').attr('lesson_id', block.attr('theme_id'));
|
|
$('[name=USER_ID]').val(block.attr('student_id'));
|
|
$('[name=THEME_ID]').val(block.attr('theme_id'));
|
|
$('[name=comment_for_user_id]').val(block.attr('student_id'));
|
|
$('[name=comment_for_theme_id]').val(block.attr('theme_id'));
|
|
$('[name=student_dialog]').hide();
|
|
$('[name=big_lesson_block]').show();
|
|
reload_lesson_comments()
|
|
} else {
|
|
$('[name=student_dialog_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=student_dialog_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=big_lesson_block]').hide();
|
|
$('[name=student_dialog]').hide();
|
|
$('[name=student_dialog][id='+id+']').fadeIn(1000)
|
|
}
|
|
|
|
}
|
|
function show_one_lesson_comments(id){
|
|
$('[name=theme_listing]').hide();
|
|
$('[name=theme_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=theme_materials_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_comments_block]').attr('lesson_id', id);
|
|
$('[name=LESSON_ID]').val(id);
|
|
$('[name=comment_for_lesson_id]').val(id);
|
|
$('[name=big_lesson_block]').show();
|
|
reload_lesson_comments()
|
|
}
|
|
function show_lesson_comments(id){
|
|
$('[name=lesson_materials_button]').attr('class', 'b-a list-group-item');
|
|
$('[name=lesson_materials_button][id='+id+']').attr('class', 'b-a list-group-item active');
|
|
$('[name=lesson_comments_block]').attr('lesson_id', id);
|
|
$('[name=LESSON_ID]').val(id);
|
|
$('[name=comment_for_lesson_id]').val(id);
|
|
$('[name=big_lesson_block]').show();
|
|
reload_lesson_comments()
|
|
}
|
|
function write_lesson_material(context){
|
|
var data, materials, material;
|
|
if (context['materials']){
|
|
material = '';
|
|
for (var i=0; i<context['materials'].length;i++){
|
|
|
|
material += '<div class="list-group bg-white">' +
|
|
'<a href="'+context['materials'][i]['url']+'" class="list-group-item" target="_blank" id="'+context['materials'][i]['id']+'">' +
|
|
'<i class="'+context['materials'][i]['icon_class']+' text-lg inline text-primary"></i>' +
|
|
'<span class="clear inline">' +
|
|
'<span>'+context['materials'][i]['name_for_user']+'</span>' +
|
|
'<small class="text-muted clear text-ellipsis">'+context['materials'][i]['file_name']+'</small>' +
|
|
'</span>' +
|
|
'</a>' +
|
|
'</div>'
|
|
}
|
|
|
|
materials = '<div class="col-lg-6 col-md-12 col-sm-12" style="margin-top: 10px;">' +
|
|
'<div draggable="true" class="panel panel-info">'+
|
|
'<div class="panel-heading">'+
|
|
'Материалы к уроку'+
|
|
'</div>' + material +
|
|
'</div>' +
|
|
'</div>';
|
|
} else {
|
|
materials = ''
|
|
}
|
|
|
|
|
|
data = '<h2 style="text-align: center;margin-top: 0;background: #23b7e5;padding: 10px;color: #fff;border-radius: 3px;font-weight: bold;">Материалы урока</h2>' +
|
|
'<div class="col-lg-6 col-md-12 col-sm-12" style="padding: 0">'+
|
|
'<div class="panel-heading no-border bg-primary">'+
|
|
'<span class="text-lt ">'+context['title']+'</span>'+
|
|
'</div>'+
|
|
'<div class="item m-l-n-xxs m-r-n-xxs embed-responsive embed-responsive-16by9" name="video_frame">'+
|
|
context['video']+
|
|
'</div>'+
|
|
'</div>' +
|
|
'<div class="col-lg-6 col-md-12 col-sm-12">' +
|
|
'<div class="panel panel-info">' +
|
|
'<div class="panel-heading">' +
|
|
'<h2 class="m-t-none text-black" style="margin-bottom: 5px;">Описание урока</h2>' +
|
|
'</div>' +
|
|
'<div class="wrapper-lg">' +
|
|
'<div>' +
|
|
context['description'] +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</div>' + materials;
|
|
return data
|
|
}
|
|
function write_homework_material(context){
|
|
var data, materials, material;
|
|
if (context['materials']){
|
|
material = '';
|
|
for (var i=0; i<context['materials'].length;i++){
|
|
|
|
material += '<div class="list-group bg-white">' +
|
|
'<a href="'+context['materials'][i]['url']+'" class="list-group-item" target="_blank" id="'+context['materials'][i]['id']+'">' +
|
|
'<i class="'+context['materials'][i]['icon_class']+' text-lg inline text-primary"></i>' +
|
|
'<span class="clear inline">' +
|
|
'<span>'+context['materials'][i]['name_for_user']+'</span>' +
|
|
'<small class="text-muted clear text-ellipsis">'+context['materials'][i]['file_name']+'</small>' +
|
|
'</span>' +
|
|
'</a>' +
|
|
'</div>'
|
|
}
|
|
|
|
materials = '<div class="col-lg-6 col-md-12 col-sm-12" style="margin-top: 10px;">' +
|
|
'<div draggable="true" class="panel panel-info">'+
|
|
'<div class="panel-heading">'+
|
|
'Материалы к заданию'+
|
|
'</div>' + material +
|
|
'</div>' +
|
|
'</div>';
|
|
} else {
|
|
materials = ''
|
|
}
|
|
|
|
var description_cols;
|
|
if (materials){description_cols='6'}else{description_cols='12'}
|
|
data = '<h2 style="text-align: center;margin-top: 0;background: #23b7e5;padding: 10px;color: #fff;border-radius: 3px;font-weight: bold;">Материалы задания</h2>' +
|
|
'<div class="col-lg-'+description_cols+' col-md-12 col-sm-12">' +
|
|
'<div class="panel panel-info">' +
|
|
'<div class="panel-heading">' +
|
|
'<h2 class="m-t-none text-black" style="margin-bottom: 5px;">Описание задания</h2>' +
|
|
'</div>' +
|
|
'<div class="wrapper-lg">' +
|
|
'<div>' +
|
|
context['description'] +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</div>' +
|
|
'</div>' + materials;
|
|
return data
|
|
}
|
|
function get_lesson_context(id){
|
|
var response = {};
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: '/courses/get_lesson_context/',
|
|
data: {'ID': id},
|
|
async: false,
|
|
success: function(data) {
|
|
if (data.code == '1'){
|
|
response = data['data']
|
|
}
|
|
}
|
|
});
|
|
return response;
|
|
}
|
|
function get_homework_context(id){
|
|
// Отправляется ID темы
|
|
var response = {};
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: '/courses/get_homework_context/',
|
|
data: {'ID': id},
|
|
async: false,
|
|
success: function(data) {
|
|
if (data.code == '1'){
|
|
response = data['data']
|
|
}
|
|
}
|
|
});
|
|
return response;
|
|
} |