215 lines
9.0 KiB
PHP
215 lines
9.0 KiB
PHP
<?php /* Smarty version Smarty-3.1.13, created on 2022-04-20 08:17:21
|
||
compiled from "tpl/tpl_rejt2_anketa.html" */ ?>
|
||
<?php /*%%SmartyHeaderCode:131779516625f9761554f03-83419272%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
|
||
$_valid = $_smarty_tpl->decodeProperties(array (
|
||
'file_dependency' =>
|
||
array (
|
||
'a17c89d6b81bbfd3acca339ab6f6a964137e37c4' =>
|
||
array (
|
||
0 => 'tpl/tpl_rejt2_anketa.html',
|
||
1 => 1603181163,
|
||
2 => 'file',
|
||
),
|
||
),
|
||
'nocache_hash' => '131779516625f9761554f03-83419272',
|
||
'function' =>
|
||
array (
|
||
),
|
||
'variables' =>
|
||
array (
|
||
'itemsnprs' => 0,
|
||
'it' => 0,
|
||
'item' => 0,
|
||
'items' => 0,
|
||
),
|
||
'has_nocache_code' => false,
|
||
'version' => 'Smarty-3.1.13',
|
||
'unifunc' => 'content_625f97615ae5d9_56109904',
|
||
),false); /*/%%SmartyHeaderCode%%*/?>
|
||
<?php if ($_valid && !is_callable('content_625f97615ae5d9_56109904')) {function content_625f97615ae5d9_56109904($_smarty_tpl) {?><br>
|
||
<link href="/tpl/css/rejt_anketa.css" rel="stylesheet" />
|
||
<div class="row-fluid">
|
||
<div class="span6">
|
||
<h1>Индивидуальный план преподавателя</h1>
|
||
</div>
|
||
</div>
|
||
<hr>
|
||
|
||
<div id="page-wrap">
|
||
<div class="row-fluid">
|
||
<div class="span12">
|
||
<form method="POST" name="form_rejt" id="form_rejt" enctype="multipart/form-data">
|
||
<div class="widget blue">
|
||
<div class="widget-title">
|
||
<h4><i class="icon-reorder"></i>Заполнение</h4>
|
||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||
</div>
|
||
<div class="widget-body">
|
||
<form action="" class="form-vertical" method="POST" enctype="multipart/form-data">
|
||
<div class="row-fluid">
|
||
<div class="span4">
|
||
<div class="control-group">
|
||
Или выберите вид работы или напишите свой:
|
||
</div>
|
||
</div>
|
||
<div class="span8">
|
||
<div class="control-group">
|
||
<select id="itemsnprs" class="form-control" style="max-width: 100%;">
|
||
<option value="">Выбрать обязательные виды работ</option>
|
||
<?php $_smarty_tpl->tpl_vars['it'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['it']->_loop = false;
|
||
$_from = $_smarty_tpl->tpl_vars['itemsnprs']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||
foreach ($_from as $_smarty_tpl->tpl_vars['it']->key => $_smarty_tpl->tpl_vars['it']->value){
|
||
$_smarty_tpl->tpl_vars['it']->_loop = true;
|
||
?>
|
||
<option value="<?php echo $_smarty_tpl->tpl_vars['it']->value['id'];?>
|
||
"><?php echo $_smarty_tpl->tpl_vars['it']->value['name'];?>
|
||
</option>
|
||
<?php } ?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="row-fluid">
|
||
<div class="span6">
|
||
<div class="control-group">
|
||
<textarea class="span12 tooltips" data-trigger="hover" data-original-title="Опишите вид работ" name="name" id="name" style="height: 70px;" placeholder="Опишите вид работ"><?php echo $_smarty_tpl->tpl_vars['item']->value['name'];?>
|
||
</textarea>
|
||
</div>
|
||
</div>
|
||
<div class="span3">
|
||
<div class="control-group">
|
||
<input type="text" class="span12 tooltips" data-trigger="hover" data-original-title="Часы планируемые" placeholder="Часы планируемые" id="hour_plan" name="hour_plan" value="<?php echo $_smarty_tpl->tpl_vars['item']->value['hour_plan'];?>
|
||
" /><br>
|
||
<input type="text" class="span12 tooltips" data-trigger="hover" data-original-title="Часы фактические" placeholder="Часы фактические" id="hour_fakt" name="hour_fakt" value="<?php echo $_smarty_tpl->tpl_vars['item']->value['hour_fakt'];?>
|
||
" />
|
||
</div>
|
||
</div>
|
||
<div class="span3">
|
||
<div class="control-group">
|
||
<select class="span12 tooltips" data-trigger="hover" data-original-title="Статус" tabindex="1" name="status" id="status">
|
||
<option value="1"<?php if ($_smarty_tpl->tpl_vars['item']->value['status']==1){?> SELECTED<?php }?>>Выполнено</option>
|
||
<option value="0"<?php if ($_smarty_tpl->tpl_vars['item']->value['status']==0){?> SELECTED<?php }?>>Не выполнено</option>
|
||
</select>
|
||
<br>
|
||
<input type="hidden" id="item_id" value="0">
|
||
<a href="#" class="btn btn-warning save_item">Добавить запись</a>
|
||
<a href="#" class="btn btn-warning edit_item" style="display:none;">Редактировать запись</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<table class="table">
|
||
<thead><tr><th>вид работы</th><th>Часы</th><th>Действия</th></tr></thead>
|
||
<tbody class="rejt2_saves_items">
|
||
<?php $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['item']->_loop = false;
|
||
$_from = $_smarty_tpl->tpl_vars['items']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
|
||
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value){
|
||
$_smarty_tpl->tpl_vars['item']->_loop = true;
|
||
?>
|
||
<tr id="item_<?php echo $_smarty_tpl->tpl_vars['item']->value['id'];?>
|
||
">
|
||
<td><?php echo $_smarty_tpl->tpl_vars['item']->value['name'];?>
|
||
</td>
|
||
<td><span class="label <?php if ($_smarty_tpl->tpl_vars['item']->value['status']==0){?>label-important<?php }else{ ?>label-success<?php }?>"><?php echo $_smarty_tpl->tpl_vars['item']->value['hour_plan'];?>
|
||
/<?php echo $_smarty_tpl->tpl_vars['item']->value['hour_fakt'];?>
|
||
</span></td>
|
||
<td><a href="#" class="btn_edit" id="be_<?php echo $_smarty_tpl->tpl_vars['item']->value['id'];?>
|
||
">Ред.</a> <a href="#" class="btn_del" id="bd_<?php echo $_smarty_tpl->tpl_vars['item']->value['id'];?>
|
||
">Удалить</a></td>
|
||
</tr>
|
||
<?php } ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>$(document).ready(function(){
|
||
$("#itemsnprs").change(function(){
|
||
$("#name").val($("#itemsnprs option:selected").text());
|
||
});
|
||
$(".save_item").click(function(){
|
||
var name = $("#name").val();
|
||
var hour_plan = $("#hour_plan").val();
|
||
var hour_fakt = $("#hour_fakt").val();
|
||
var status = $('#status option:selected').val();
|
||
var item_id = $('#item_id').val();
|
||
$.ajax({
|
||
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_save_item&name='+name+'&hour_plan='+hour_plan+'&hour_fakt='+hour_fakt+'&status='+status,
|
||
success: function(data){
|
||
if(data.err==0){
|
||
var label = 'label-success'; if(data.status==0) label = 'label-important';
|
||
var str='<tr id="item_'+data.id+'"><td>'+name+'</td><td><span class="label '+label+'">'+hour_plan+'/'+hour_fakt+'</span></td><td><a href="#" class="btn_edit" id="be_'+data.id+'">Ред.</a> <a href="#" class="btn_del" id="bd_'+data.id+'">Удалить</a></td></tr>';
|
||
$(".rejt2_saves_items").append(str);
|
||
}
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
$(".edit_item").click(function(){
|
||
var name = $("#name").val();
|
||
var hour_plan = $("#hour_plan").val();
|
||
var hour_fakt = $("#hour_fakt").val();
|
||
var status = $('#status option:selected').val();
|
||
var item_id = $('#item_id').val();
|
||
$.ajax({
|
||
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_editi_item&name='+name+'&hour_plan='+hour_plan+'&hour_fakt='+hour_fakt+'&status='+status+'&item_id='+item_id,
|
||
success: function(data){
|
||
if(data.err==0){
|
||
var label = 'label-success'; if(data.status==0) label = 'label-important';
|
||
var str='<tr id="item_'+data.id+'"><td>'+name+'</td><td><span class="label '+label+'">'+hour_plan+'/'+hour_fakt+'</span></td><td><a href="#" class="btn_edit" id="be_'+data.id+'">Ред.</a> <a href="#" class="btn_del" id="bd_'+data.id+'">Удалить</a></td></tr>';
|
||
$("#item_"+data.id).remove();
|
||
$(".rejt2_saves_items").append(str);
|
||
$('.save_item').show();
|
||
$('.edit_item').hide();
|
||
}
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
|
||
$(document).on("click", ".btn_edit", function(){
|
||
var id =$(this).attr("id").split("_");
|
||
$.ajax({
|
||
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_edit_item&id='+id[1],
|
||
success: function(data){
|
||
if(data.err==0){
|
||
$("#name").val(data.name);
|
||
$("#hour_plan").val(data.hour_plan);
|
||
$("#hour_fakt").val(data.hour_fakt);
|
||
$('#status option[value='+data.status+']').attr('selected','selected');
|
||
$('#item_id').val(data.id);
|
||
$('.save_item').hide();
|
||
$('.edit_item').show();
|
||
//$("#item_"+id[1]).remove();
|
||
}else alert("Ошибка редактирования!");
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
$(document).on("click", ".btn_del", function(){
|
||
var id =$(this).attr("id").split("_");
|
||
$.ajax({
|
||
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_dele_item&id='+id[1],
|
||
success: function(data){
|
||
if(data.err==0){
|
||
$("#item_"+id[1]).remove();
|
||
}else alert("Ошибка удаления!");
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
|
||
function f(){
|
||
$.ajax({url: '/json.php', dataType:'json', type:'POST', async:false, data: 'ajdes=empty_post',success: function(data){}});
|
||
}
|
||
setInterval(f, 150000);
|
||
});</script>
|
||
|
||
<?php }} ?>
|