EIOS/inc/design.php

89 lines
3.4 KiB
PHP
Raw Permalink Normal View History

2023-12-28 15:39:22 +03:00
<?
if(isset($_GET['page'])){
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/class_SYSTEM.php';
$SYSTEMclass = new SYSTEMclass();
$page = $_GET['page'];
//загрузка учебного плана
if (isset($_POST['upload'])){
$area = $_POST['area'];
$forma = $_POST['forma'];
$year = $_POST['year'];
$kaf = $_POST['kaf'];
$n = count($kaf);
$kafedra;
for ($i = 0; $i < $n; $i++){
$kafedra .= $kaf[$i].',';
}
$date_cr = date("U");
//загрузка файла на сервер и получение ссылки
if (isset($_FILES['inputfile'])){
$link = $date_cr.'_'.$_FILES['inputfile']['name'];
$url = '/upload/design_up/'.$url;
//move_uploaded_file($_FILES['inputfile']['tmp_name'], $link);
$SYSTEMclass->sysUPLOAD($_FILES['inputfile']['tmp_name'], $link);
/*$sql = 'INSERT INTO '.$ST['dbpf'].'_syllabus (`id_areas`, `file`, `year`, `forma`) VALUES ("'.$area.'", "'.$link.'", "'.$year.'", "'.$forma.'")';
$rez = $DB->QUR($sql);
$id_last = mysql_insert_id();
$kaf = explode(",", $kafedra);
for ($i = 0; $i < count($kaf); $i++){
$sql = 'INSERT INTO '.$ST['dbpf'].'_involved_kaf (`id_syllabus`, `id_kafedra`, `message`, `status`) VALUES ("'.$id_last.'", "'.$kaf[$i].'", "", "0")';
$rez = $DB->QUR($sql);
}*/
$msg['msg'] .= 'Успешно загружен!';
}
}
//ВЫБЕРЕМ ДАННЫЕ УЧИТЕЛЯ
$sql = 'SELECT * FROM '.$ST['dbpf'].'_teachers WHERE id_user='.$_SESSION['user']['id'].' LIMIT 1';
$rez=$DB->QUR_SEL($sql);
if($rez){
$teacher['zvanie']=out_data_fu($rez[1]['zvanie']);
$teacher['dolgnost']=out_data_fu($rez[1]['dolgnost']);
$teacher['stepen']=out_data_fu($rez[1]['stepen']);
$teacher['fakultet']=out_data_fu($rez[1]['fakultet']);
$teacher['kafedra']=out_data_fu($rez[1]['kafedra']);
$teacher['data_u']=date('H:i:s d.m.Y',$rez[1]['data_u']);
if ($rez[1]['status']==0) $teacher['status'] = '<span style="color:red">не подтвержден</span>';
if ($rez[1]['status']==1) $teacher['status'] = '<span style="color:green">подтвержден</span>';
}
//выбираем направления подготовки, которые привязаны к кафедре
$areas = array();
$kafedra = $teacher['kafedra'];
$sql = 'SELECT ar.*, ar.name as naprav, ar.id as ident, ar.code as napr, kaf.* FROM '.$ST['dbpf'].'_areas as ar, '.$ST['dbpf'].'_kafedres as kaf WHERE kaf.name = "'.$kafedra.'" AND ar.id_kafedra = kaf.id';
$rez = $DB->QUR_SEL($sql);
foreach ($rez as $key => $val) if ($key){
//$areas['area'] = $val['area']
$areas[] = $val;
}
//выводим список кафедр, для того, чтобы кафедра, которая загружает план, могла отправить его другим на проверку
$kafedres = array();
$sql = 'SELECT * FROM '.$ST['dbpf'].'_kafedres WHERE NOT (name = "'.$kafedra.'") ORDER BY code';
$rez = $DB->QUR_SEL($sql);
foreach ($rez as $key => $val) if ($key){
$kafedres[] = $val;
}
$smarty->assign('page',$page);
$smarty->assign('teacher',$teacher);
$smarty->assign('areas',$areas);
$smarty->assign('kafedres',$kafedres);
$smarty->assign('msg',$msg); //контейнер для сообщений
$maincontent = $smarty->fetch('tpl_design.html');
}
?>