127 lines
5.8 KiB
PHP
127 lines
5.8 KiB
PHP
|
<?php
|
|||
|
|
|||
|
class class_SEARCH{
|
|||
|
private $DB = null;
|
|||
|
private $SMARTY = null;
|
|||
|
private $URLS = null;
|
|||
|
function __construct(){
|
|||
|
GLOBAL $DB,$ST;
|
|||
|
$this->DB = $DB;
|
|||
|
$this->TFile = $ST['dbpf'].'_fshp_file';
|
|||
|
}
|
|||
|
/*
|
|||
|
Добрый день! Ирина, можно попросить уточнить у программистов статус этих двух (на фото) РПД. Они были исправлены разработчиком, но не попали в кабинет заведующего кафедрой и зав. кафедрой выпускающей. С моего кабинета они выглядят как на фото и подписат их не получается. Речь идет о РПД по 20.04.01 Техносферная безопасность, разработчик Базалина Е.Н.
|
|||
|
|
|||
|
Это Вавилова пишет. Научите меня искать в системе программы
|
|||
|
* */
|
|||
|
function HTML_init(){
|
|||
|
GLOBAL $WorkDIR;
|
|||
|
$CHPU = new class_CHPU($WorkDIR);
|
|||
|
$this->URLS = $CHPU->uri();
|
|||
|
|
|||
|
$smartyC = new class_smarty();
|
|||
|
$this->SMARTY = $smartyC->config(__DIR__.'\..\tpl');
|
|||
|
}
|
|||
|
|
|||
|
function HTML(){
|
|||
|
$this->HTML_init();
|
|||
|
$out = array();
|
|||
|
|
|||
|
if(isset($_POST['ajdes'])){
|
|||
|
header('Content-Type: application/json; charset=utf-8');
|
|||
|
$out=array();
|
|||
|
if($_POST['ajdes']=='SEASRCH'){
|
|||
|
$word = $this->DB->rescape($_POST['word']);
|
|||
|
$rez = $this->search($word);
|
|||
|
//здесь подключим смарти
|
|||
|
if(count($rez['uchebplans'])){
|
|||
|
$this->SMARTY->assign('uchebplans',$rez['uchebplans']);
|
|||
|
}else{
|
|||
|
$this->SMARTY->assign('uchebplans',array());
|
|||
|
}
|
|||
|
|
|||
|
$out['html'] = $this->SMARTY->fetch('page_search.html');
|
|||
|
}
|
|||
|
echo json_encode($out);
|
|||
|
exit();
|
|||
|
}
|
|||
|
//$out['body'] = $smarty->fetch('page_rpds_signs.html');
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
function search($word){
|
|||
|
$out = array();
|
|||
|
$statuses = $_SESSION['user']['statuses']; //Array([22] => Аттестационная комиссия [23] => Кафедра [30] => Зав.кафедрой )
|
|||
|
$kafedra = $_SESSION['user']['teacher']['kafedra']; //Землеустройства
|
|||
|
$fakultet = $_SESSION['user']['teacher']['fakultet']; //Факультет аграрных технологий
|
|||
|
|
|||
|
$out['uchebplans'] = $this->search_uchebplan($word);
|
|||
|
//$out['html'] .= '<pre>'.print_r($uchebplans,1).'</pre>';
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
function search_uchebplan($word){
|
|||
|
$out = array();
|
|||
|
$sql = 'SELECT up.id,up.id_file,up.index1,up.name,up.kaf_kod,up.kaf_name
|
|||
|
FROM acs_fshp_uchebplans as up
|
|||
|
WHERE up.index1 LIKE "%'.$word.'%" OR up.name LIKE "%'.$word.'%"
|
|||
|
ORDER BY CAST(up.kaf_kod as unsigned),up.name';
|
|||
|
$rez = $this->DB->QUR_SEL($sql);
|
|||
|
if(!$rez['err']&&$rez['kol']){
|
|||
|
foreach($rez['rez'] as $key => $val){
|
|||
|
$sql1 = 'SELECT ff.id_file,ff.shifr,ff.naprav,ff.profil,ff.kafedra,ff.fakultet,ff.kvalif,ff.fo FROM acs_fshp_file as ff WHERE ff.id_file='.$val['id_file'].' ';
|
|||
|
$rez1 = $this->DB->QUR_SEL($sql1);
|
|||
|
$ff = array();
|
|||
|
if(!$rez1['err']&&$rez1['kol']){
|
|||
|
$ff = $rez1['rez'][0];
|
|||
|
$ff['rpds'] = $this->check_rpd($val['id']);
|
|||
|
}
|
|||
|
$val['ups'][] = $ff;
|
|||
|
|
|||
|
$k = $val['index1'].'-'.$val['name'].'-'.$val['kaf_kod'];
|
|||
|
if(!isset($out[$k])) {
|
|||
|
$out[$k] = $val;
|
|||
|
}else{
|
|||
|
$out[$k]['ups'][] = $ff;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Получим РПД
|
|||
|
* @param $id_uchebplan
|
|||
|
* @return array
|
|||
|
*/
|
|||
|
function check_rpd($id_uchebplan){
|
|||
|
$out = array();
|
|||
|
$sql = 'SELECT sa.id,sa.id_discip,us.fio FROM acs_fshp_rpd_save as sa, acs_users as us WHERE sa.id_discip='.$id_uchebplan.' AND us.id=sa.id_prepod';
|
|||
|
$rez = $this->DB->QUR_SEL($sql);
|
|||
|
if(!$rez['err']&&$rez['kol']){
|
|||
|
foreach($rez['rez'] as $key => $val){
|
|||
|
$val['signs']='';
|
|||
|
$sql1 = 'SELECT rs.data_c,rs.sign,rs.descrip,rs.status,us.fio FROM acs_fshp_rpd_signs as rs, acs_users as us WHERE rs.id_rpd='.$val['id_discip'].' AND us.id=rs.id_user ORDER BY rs.data_c ASC';
|
|||
|
$rez1 = $this->DB->QUR_SEL($sql1);
|
|||
|
if(!$rez1['err']&&$rez1['kol']){
|
|||
|
foreach($rez1['rez'] as $key1 => $val1){
|
|||
|
if($val1['status']==1) $cl='[УТВЕР]'; else $cl='[ОТКАЗ]';
|
|||
|
$descr='';
|
|||
|
if(strpos($val1['descrip'],'.pdf')!==FALSE){
|
|||
|
$t=explode('|#|',$val1['descrip']);
|
|||
|
if(isset($t[0])) $descr .= '<a href='.str_replace(' ','%20',$t[0]).' target=_blank>РПД</a>';
|
|||
|
if(isset($t[1])) $descr .= '<a href='.str_replace('fhttps','https',$t[1]).' target=_blank>дбНИКА</a>';
|
|||
|
}else{
|
|||
|
$descr=$val1['descrip'];
|
|||
|
}
|
|||
|
///rabprog/upload/pdfs/1023_Технологическое предпринимательство.pdf|#|fhttps://mkgtu.ru/sveden/files/Texnologicheskoe_predprinimatelystvo(17).pdf
|
|||
|
|
|||
|
$val['signs'] .= '<div>'.$cl.' <b>'.date('H:i d.m.Y',$val1['data_c']).'</b> <u>'.$val1['fio'].'</u> '.$val1['sign'].'(<i>'.$descr.'</i>)</div>';
|
|||
|
}
|
|||
|
}else $val['signs'] = 'нет подписей';
|
|||
|
$out[] = $val;
|
|||
|
}
|
|||
|
}
|
|||
|
return $out;
|
|||
|
}
|
|||
|
}
|