'.print_r($arr,1).''; if(!isset($arr['propusk'])) $arr['propusk']=''; if(!isset($arr['upv'])) $arr['upv']=''; $sql = 'SELECT id FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod='.$arr['id_prepod'].' AND id_student='.$arr['id_student'].' AND id_grupp='.$arr['id_grupp'].' AND id_what='.$arr['id_lection'].' AND what="'.$arr['what'].'" AND type='.$arr['type'].''; $rez = $DB->QUR_SEL($sql); $tip=0; if($rez){ $sql='UPDATE '.$ST['dbpf'].'_ocenki SET data_c='.time().',ocenka="'.$arr['occenka'].'",propusk="'.$arr['propusk'].'",upv="'.$arr['upv'].'" WHERE id='.$rez[1]['id'].''; $tip=1; }else{ $sql='INSERT INTO '.$ST['dbpf'].'_ocenki VALUES(0,'.time().','.$arr['id_prepod'].','.$arr['id_student'].','.$arr['id_grupp'].','.$arr['id_lection'].',"'.$arr['what'].'","'.$arr['occenka'].'","'.$arr['propusk'].'","'.$arr['upv'].'",'.$arr['type'].')'; $tip=0; } $rez = $DB->QUR($sql); if($rez){ if($tip==1) { save_logs('Выставление оценки Обновление: '.mysql_insert_id().' Студент:'.$arr['id_student'].';Что:'.$arr['what'].';Оценка:'.$arr['occenka']); }else { save_logs('Выставление оценки СОЗДАНИЕ: '.mysql_insert_id().' Студент:'.$arr['id_student'].';Что:'.$arr['what'].';Оценка:'.$arr['occenka']); } }else{ } return $out; } function check_lection($arr){ GLOBAL $ST,$DB; $sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' AND spec="'.$arr['spec'].'" AND kurs='.$arr['kurs'].' AND semestr='.$arr['semestr'].' AND name_disp="'.$arr['name_disp'].''; $rez = $DB->QUR($sql); if($rez){ $sql = 'INSERT INTO '.$ST['dbpf'].'_lections VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].',"'.$arr['spec'].'",'.$arr['kurs'].','.$arr['semestr'].',"'.$arr['name_disp'].'","Лекции","")'; $rez = $DB->QUR($sql); $id_lection = mysql_insert_id(); }else $id_lection = $rez[1]['id']; return $id_lection; } function get_data_startsemestr(){//определяем даты начала отсчета для оценок $file = 'tmp/ocenki/dataC_'.$_SESSION['user']['id']; if(!file_exists($file)){ if(date('n')>=1 AND date('n')<9){//месяц второго семестра $data_c1 = mktime(0,0,0,1,1-20,date('Y'));//считаем от начала года за минусом 20 дней,с 11 декабря }else{ $data_c1 = mktime(0,0,0,9,1,date('Y'));//первое сенятбря } file_put_contents($file,$data_c1); }else{ $data_c1 = trim(file_get_contents($file)); } return $data_c1; } /** * Выставление оценок * @param $data * @return array */ function fk_attest_set($data){ GLOBAL $ST,$DB,$CCONF; $out = array(); //$data = iduser idgrupp idteacher ocenka propusk if($data['ajdes']=='fk_att_tek_set') {//ТЕКУЩАЯ АТТЕСТАЦИЯ $data['idstudent'] = (int)$data['iduser']; $data['idgrupp'] = (int)$data['idgrupp']; $data['idteacher'] = (int)$data['idteacher']; $data['ocenka'] = $DB->rescape($data['ocenka']); $data['propusk'] = (int)$data['propusk']; $sql = 'SELECT kurs,sokr FROM ' . $ST['dbpf'] . '_grupp WHERE id=' . $data['idgrupp']; $rez = $DB->QUR_SEL($sql); if ($rez) { $grupp = $rez[1]; $tmp = explode('-', $grupp['sokr']); $grupp['kurs'] = substr($tmp[1], 0, 1);//курсу не доверяем, берем из названия группы первое число $mes = date('m'); if ($mes > 8) $sem = ($grupp['kurs'] - 1) * 2 + 1; else $sem = ($grupp['kurs'] - 1) * 2 + 2; $id_lection = 0; //1. Проверим есть ли лекции по элективной //$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$data['idteacher'].' AND (name="'.implode('" OR name="',$CCONF['discip']).'") AND type="лек" AND kurs='.$grupp['kurs'].' AND semestr='.$sem; $sql = 'SELECT le.id FROM ' . $ST['dbpf'] . '_lections as le, ' . $ST['dbpf'] . '_lections_grupp as leg WHERE le.id_teacher=' . $data['idteacher'] . ' AND (le.name="' . implode('" OR le.name="', $CCONF['discip']) . '") AND le.type="лек" AND le.kurs=' . $grupp['kurs'] . ' AND le.semestr=' . $sem . ' AND leg.id_lections=le.id AND leg.id_grupp=' . $data['idgrupp']; $rez = $DB->QUR_SEL($sql); if ($rez) { $id_lection = $rez[1]['id']; } else { $sql = 'INSERT INTO ' . $ST['dbpf'] . '_lections VALUES(0,' . time() . ',' . time() . ',' . $data['idteacher'] . ',"",' . $grupp['kurs'] . ',' . $sem . ',"' . $CCONF['discip'][0] . '","лекция","","лек");'; $rez = $DB->QUR($sql); $id_lection = $rez['id']; $DB->QUR('INSERT INTO ' . $ST['dbpf'] . '_lections_grupp VALUES(0,' . time() . ',' . $id_lection . ',' . $data['idgrupp'] . ');'); } if ($id_lection) { $sql = 'SELECT id FROM ' . $ST['dbpf'] . '_ocenki WHERE id_prepod=' . $data['idteacher'] . ' AND id_student=' . $data['idstudent'] . ' AND id_grupp=' . $data['idgrupp'] . ' AND id_what=' . $id_lection . ' AND what="lection" AND type=1';//TODO определить type??? текущая или промежуточная $rez = $DB->QUR_SEL($sql); if ($rez) {//Оценка есть обновим! $id_ocenka = $rez[1]['id']; $sql = 'UPDATE ' . $ST['dbpf'] . '_ocenki SET data_c=' . time() . ',ocenka="' . $data['ocenka'] . '",propusk="' . $data['propusk'] . '" WHERE id=' . $id_ocenka . ';'; $rez = $DB->QUR($sql); if (!$rez['err']) { $out['err'] = 0; $out['msg'] = 'Оценку обновили'; } else { $out['err'] = 1; $out['msg'] = 'Оценку не обновили'; } } else { $sql = 'INSERT INTO ' . $ST['dbpf'] . '_ocenki VALUES(0,' . time() . ',' . $data['idteacher'] . ',' . $data['idstudent'] . ',' . $data['idgrupp'] . ',' . $id_lection . ',"lection","' . $data['ocenka'] . '","' . $data['propusk'] . '","",1);'; $rez = $DB->QUR($sql); if (!$rez['err']) { $out['err'] = 0; $out['msg'] = 'Оценку выставили'; } else { $out['err'] = 1; $out['msg'] = 'Оценку не выставили'; } } //$id_practich=0; //2. Определим практические //$sql = 'SELECT id FROM '.$ST['dbpf'].'_practich WHERE id_lection='.$id_lection; //$rez = $DB->QUR_SEL($sql); //if($rez){ // $id_practich = $rez[1]['id']; //}else{ // $sql = 'INSERT INTO '.$ST['dbpf'].'_practich VALUES(0,'.time().','.time().','.$data['idteacher'].','.$id_lection.',"'.$CCONF['discip'][0].'","практические занятия","");'; // $rez = $DB->QUR($sql); // $id_practich = $rez['id']; //} //if($id_practich){ // $sql = 'SELECT id FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod='.$data['idteacher'].' AND id_student='.$data['idstudent'].' AND id_grupp='.$data['idgrupp'].' AND id_what='.$id_practich.' AND what="practich"';//TODO определить type??? текущая или промежуточная // $rez = $DB->QUR_SEL($sql); // if($rez){//Оценка есть обновим! // $id_ocenka = $rez[1]['id']; // $sql = 'UPDATE '.$ST['dbpf'].'_ocenki SET data_c='.time().',ocenka="'.$data['ocenka'].'",propusk="'.$data['propusk'].'" WHERE id='.$id_ocenka.';'; // $rez = $DB->QUR($sql); // if(!$rez['err']){ // $out['err'] = 0; // $out['msg'] = 'Оценку обновили'; // }else{ // $out['err'] = 1; // $out['msg'] = 'Оценку не обновили'; // } // }else{ // $sql = 'INSERT INTO '.$ST['dbpf'].'_ocenki VALUES(0,'.time().','.$data['idteacher'].','.$data['idstudent'].','.$data['idgrupp'].','.$id_practich.',"practich","'.$data['ocenka'].'","'.$data['propusk'].'","",1);'; // $rez = $DB->QUR($sql); // if(!$rez['err']){ // $out['err'] = 0; // $out['msg'] = 'Оценку выставили'; // }else{ // $out['err'] = 1; // $out['msg'] = 'Оценку не выставили'; // } // } //}else{ // $out['err']=1; // $out['html']='Не определили/создали практическую'; //} } else { $out['err'] = 1; $out['html'] = 'Не определили/создали лекцию'; } } else { $out['err'] = 1; $out['html'] = 'Не определили группу'; } } if($data['ajdes']=='fk_att_pro_set') {//ПРОМЕЖУТОЧНАЯ АТТЕСТАЦИЯ $data['idstudent'] = (int)$data['iduser']; $data['idgrupp'] = (int)$data['idgrupp']; $data['idteacher'] = (int)$data['idteacher']; $data['ocenka'] = $DB->rescape($data['ocenka']); $data['propusk'] = (int)$data['propusk']; $sql = 'SELECT kurs,sokr FROM ' . $ST['dbpf'] . '_grupp WHERE id=' . $data['idgrupp']; $rez = $DB->QUR_SEL($sql); if ($rez) { $grupp = $rez[1]; $tmp = explode('-', $grupp['sokr']); $grupp['kurs'] = substr($tmp[1], 0, 1);//курсу не доверяем, берем из названия группы первое число $mes = date('m'); if ($mes > 8) $sem = ($grupp['kurs'] - 1) * 2 + 1; else $sem = ($grupp['kurs'] - 1) * 2 + 2; $id_lection = 0; //1. Проверим есть ли лекции по элективной //$sql = 'SELECT id FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$data['idteacher'].' AND (name="'.implode('" OR name="',$CCONF['discip']).'") AND type="лек" AND kurs='.$grupp['kurs'].' AND semestr='.$sem; $sql = 'SELECT le.id FROM ' . $ST['dbpf'] . '_lections as le, ' . $ST['dbpf'] . '_lections_grupp as leg WHERE le.id_teacher=' . $data['idteacher'] . ' AND (le.name="' . implode('" OR le.name="', $CCONF['discip']) . '") AND le.type="лек" AND le.kurs=' . $grupp['kurs'] . ' AND le.semestr=' . $sem . ' AND leg.id_lections=le.id AND leg.id_grupp=' . $data['idgrupp']; $rez = $DB->QUR_SEL($sql); if ($rez) { $id_lection = $rez[1]['id']; } else { $sql = 'INSERT INTO ' . $ST['dbpf'] . '_lections VALUES(0,' . time() . ',' . time() . ',' . $data['idteacher'] . ',"",' . $grupp['kurs'] . ',' . $sem . ',"' . $CCONF['discip'][0] . '","лекция","","лек");'; $rez = $DB->QUR($sql); $id_lection = $rez['id']; $DB->QUR('INSERT INTO ' . $ST['dbpf'] . '_lections_grupp VALUES(0,' . time() . ',' . $id_lection . ',' . $data['idgrupp'] . ');'); } if ($id_lection) { $sql = 'SELECT id FROM ' . $ST['dbpf'] . '_ocenki WHERE id_prepod=' . $data['idteacher'] . ' AND id_student=' . $data['idstudent'] . ' AND id_grupp=' . $data['idgrupp'] . ' AND id_what=' . $id_lection . ' AND what="lection" AND type=2';//TODO определить type??? текущая или промежуточная $rez = $DB->QUR_SEL($sql); if ($rez) {//Оценка есть обновим! $id_ocenka = $rez[1]['id']; $sql = 'UPDATE ' . $ST['dbpf'] . '_ocenki SET data_c=' . time() . ',ocenka="' . $data['ocenka'] . '",propusk="' . $data['propusk'] . '" WHERE id=' . $id_ocenka . ';'; $rez = $DB->QUR($sql); if (!$rez['err']) { $out['err'] = 0; $out['msg'] = 'Оценку обновили'; } else { $out['err'] = 1; $out['msg'] = 'Оценку не обновили'; } } else { $sql = 'INSERT INTO ' . $ST['dbpf'] . '_ocenki VALUES(0,' . time() . ',' . $data['idteacher'] . ',' . $data['idstudent'] . ',' . $data['idgrupp'] . ',' . $id_lection . ',"lection","' . $data['ocenka'] . '","' . $data['propusk'] . '","",2);';//TODO определить type??? 1-текущая или 2-промежуточная $rez = $DB->QUR($sql); if (!$rez['err']) { $out['err'] = 0; $out['msg'] = 'Оценку выставили'; } else { $out['err'] = 1; $out['msg'] = 'Оценку не выставили'; } } //$id_practich=0; //2. Определим практические //$sql = 'SELECT id FROM '.$ST['dbpf'].'_practich WHERE id_lection='.$id_lection; //$rez = $DB->QUR_SEL($sql); //if($rez){ // $id_practich = $rez[1]['id']; //}else{ // $sql = 'INSERT INTO '.$ST['dbpf'].'_practich VALUES(0,'.time().','.time().','.$data['idteacher'].','.$id_lection.',"'.$CCONF['discip'][0].'","практические занятия","");'; // $rez = $DB->QUR($sql); // $id_practich = $rez['id']; //} //if($id_practich){ // $sql = 'SELECT id FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod='.$data['idteacher'].' AND id_student='.$data['idstudent'].' AND id_grupp='.$data['idgrupp'].' AND id_what='.$id_practich.' AND what="practich"';//TODO определить type??? текущая или промежуточная // $rez = $DB->QUR_SEL($sql); // if($rez){//Оценка есть обновим! // $id_ocenka = $rez[1]['id']; // $sql = 'UPDATE '.$ST['dbpf'].'_ocenki SET data_c='.time().',ocenka="'.$data['ocenka'].'",propusk="'.$data['propusk'].'" WHERE id='.$id_ocenka.';'; // $rez = $DB->QUR($sql); // if(!$rez['err']){ // $out['err'] = 0; // $out['msg'] = 'Оценку обновили'; // }else{ // $out['err'] = 1; // $out['msg'] = 'Оценку не обновили'; // } // }else{ // $sql = 'INSERT INTO '.$ST['dbpf'].'_ocenki VALUES(0,'.time().','.$data['idteacher'].','.$data['idstudent'].','.$data['idgrupp'].','.$id_practich.',"practich","'.$data['ocenka'].'","'.$data['propusk'].'","",1);'; // $rez = $DB->QUR($sql); // if(!$rez['err']){ // $out['err'] = 0; // $out['msg'] = 'Оценку выставили'; // }else{ // $out['err'] = 1; // $out['msg'] = 'Оценку не выставили'; // } // } //}else{ // $out['err']=1; // $out['html']='Не определили/создали практическую'; //} } else { $out['err'] = 1; $out['html'] = 'Не определили/создали лекцию'; } } else { $out['err'] = 1; $out['html'] = 'Не определили группу'; } } return $out; } function fk_attest_get($data){ GLOBAL $ST,$DB,$CCONF; $out=array(); $out[1]['id'] = 0; $out[1]['ocenka'] = ''; $out[1]['propusk'] = 0; $out[2]['id'] = 0; $out[2]['ocenka'] = ''; $out[2]['propusk'] = 0; //$data['id_user']; $data['id_grupp']; $data['id_teacher']; $sql = 'SELECT kurs,sokr FROM '.$ST['dbpf'].'_grupp WHERE id='.$data['id_grupp']; $rez = $DB->QUR_SEL($sql); if($rez) { $grupp = $rez[1]; $tmp = explode('-', $grupp['sokr']); $grupp['kurs'] = substr($tmp[1], 0, 1);//курсу не доверяем, берем из названия группы первое число $mes = date('m'); if ($mes > 8) $sem = ($grupp['kurs'] - 1) * 2 + 1; else $sem = ($grupp['kurs'] - 1) * 2 + 2; $id_lection = 0; //1. Проверим есть ли лекции по элективной $sql = 'SELECT le.id FROM ' . $ST['dbpf'] . '_lections as le, ' . $ST['dbpf'] . '_lections_grupp as leg WHERE le.id_teacher=' . $data['id_teacher'] . ' AND (le.name="' . implode('" OR le.name="', $CCONF['discip']) . '") AND le.type="лек" AND le.kurs=' . $grupp['kurs'] . ' AND le.semestr=' . $sem . ' AND leg.id_lections=le.id AND leg.id_grupp=' . $data['id_grupp']; $rez = $DB->QUR_SEL($sql); if ($rez) { $id_lection = $rez[1]['id']; $sql='SELECT id,ocenka,propusk,type FROM '.$ST['dbpf'].'_ocenki WHERE id_prepod='.$data['id_teacher'].' AND id_student='.$data['id_user'].' AND id_grupp='.$data['id_grupp'].' AND id_what='.$id_lection.' AND what="lection"'; $rez = $DB->QUR_SEL($sql); //echo $sql.'
'.print_r($rez,1).'
';exit(); if ($rez) { foreach($rez as $k => $v)if($k){ $out[$v['type']]['id']=$v['id']; $out[$v['type']]['ocenka']=$v['ocenka']; $out[$v['type']]['propusk']=$v['propusk']; } //$out['id'] = $rez[1]['id']; //if($rez[1]['type']==1) { // $out['ocenka'] = $rez[1]['ocenka']; // $out['propusk'] = $rez[1]['propusk']; //} //if($rez[1]['type']==2) { // $out['ocenkaP'] = $rez[1]['ocenka']; // $out['propuskP'] = $rez[1]['propusk']; //} } } } return $out; } //echo '



'.print_r($_POST,1).'
'; //echo '
'.print_r($_FILES,1).'
'; //echo '
'.print_r($_SESSION,1).'
'; /*[user][teacher][fakultet][kafedra] Array ( [user] => Array ( [id] => 545 [data_c] => 1494592259 [data_u] => 1524482340 [email] => mirin@list.ru [status] => 0 [fio] => Мальцева Ирина Сергеевна [foto] => [statuses] => Array ( [0] => 0 [21] => 21 ) [teacher] => Array ( [id] => 72 [zvanie] => доцент [dolgnost] => доцент кафедры экономической теории и мировой экономики [stepen] => к.э.н [fakultet] => Факультет экономики и сервиса [kafedra] => Экономической теории и мировой экономики [data_u] => 12:59:16 18.04.2018 [status] => 1 ) [lib] => 23a0acb5364fe8c34591e7ac562bb80b [pm_new] => 0 [pm_kol] => 0 [pm] => Array ( ) ) ) */ if(isset($_GET['page'])){ if($_GET['page']=='workprogram'){//Рабочие программы /* id int(11) data_c int(11) data_u int(11) id_teacher int(11) specialnost varchar(255) kurs tinyint(4) semestr tinyint(4) name varchar(255) descrip text 10 file */ $lections=array(); $forms=array(); if(isset($_POST['lection_edit'])||isset($_POST['lection_save'])){ print_r ($_POST); $specialnost=get_data_fu($_POST['specialnost']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); /*****/ $kurso=array();$kursz=array();$kursoz=array(); if(isset($_POST['kurso'])){ for($i=0;$i<=5;$i++){ if(isset($_POST['kurso'][$i])) $kurso[($i+1)]=1; else $kurso[($i+1)]=0; } }else $kurso=array(0,0,0,0,0,0); if(isset($_POST['kursz'])){ for($i=0;$i<=5;$i++){ if(isset($_POST['kursz'][$i])) $kursz[($i+1)]=1; else $kursz[($i+1)]=0; } }else $kursz=array(0,0,0,0,0,0); if(isset($_POST['kursoz'])){ for($i=0;$i<=5;$i++){ if(isset($_POST['kursoz'][$i])) $kursoz[($i+1)]=1; else $kursoz[($i+1)]=0; } }else $kursoz=array(0,0,0,0,0,0); $kurs = implode(',',$kurso).'|'.implode(',',$kursz).'|'.implode(',',$kursoz); /*****/ $semestro=array();$semestrz=array();$semestroz=array(); if(isset($_POST['semestro'])){ for($i=0;$i<=11;$i++){ if(isset($_POST['semestro'][$i])) $semestro[($i+1)]=1; else $semestro[($i+1)]=0; } }else $semestro=array(0,0,0,0,0,0,0,0,0,0,0,0); if(isset($_POST['semestrz'])){ for($i=0;$i<=11;$i++){ if(isset($_POST['semestrz'][$i])) $semestrz[($i+1)]=1; else $semestrz[($i+1)]=0; } }else $semestrz=array(0,0,0,0,0,0,0,0,0,0,0,0); if(isset($_POST['semestroz'])){ for($i=0;$i<=11;$i++){ if(isset($_POST['semestroz'][$i])) $semestroz[($i+1)]=1; else $semestroz[($i+1)]=0; } }else $semestroz=array(0,0,0,0,0,0,0,0,0,0,0,0); $semestr = implode(',',$semestro).'|'.implode(',',$semestrz).'|'.implode(',',$semestroz); //$kurs=(int)get_data_fu($_POST['kurs']); if($kurs=='') $kurs=0; //$semestr=(int)get_data_fu($_POST['semestr']); if($semestr=='') $semestr=0; $fo=array(); if(isset($_POST['fo1'])) $fo[]='оч'; if(isset($_POST['fo2'])) $fo[]='заоч'; if(isset($_POST['fo3'])) $fo[]='оч-заоч'; if(count($fo)) $fo = implode('|',$fo); else $fo=''; } if(isset($_POST['lection_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $file=upload_lection('file','upload/workprogram/'); if ($file!=''){ unlink('upload/workprogram/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql = 'UPDATE '.$ST['dbpf'].'_workprogram SET data_u='.mktime().',specialnost="'.$specialnost.'",kurs="'.$kurs.'",semestr="'.$semestr.'",name="'.$name.'",descrip="'.$descrip.'",fo="'.$fo.'"'.$sf.' WHERE id='.$id.$aid.' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Программа отредактирована!'; //СОХРАНИМ ДЛЯ КАКИХ ГРУПП $DB->QUR('DELETE FROM '.$ST['dbpf'].'_workprogram_grupp WHERE id_lections='.$id.''); if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ $DB->QUR('INSERT INTO '.$ST['dbpf'].'_workprogram_grupp VALUES (0,'.mktime().','.$id.','.$val.')'); } } } $_GET['des']=''; save_logs('Рабочая программа отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Программа не отредактирована!'.$sql.mysql_error(); } } if(isset($_POST['lection_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА /*$specialnost=get_data_fu($_POST['specialnost']); $kurs=(int)get_data_fu($_POST['kurs']); $semestr=(int)get_data_fu($_POST['semestr']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $fo=get_data_fu($_POST['fo']);*/ $file=upload_lection('file','upload/workprogram/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_workprogram VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].',"'.$specialnost.'","'.$kurs.'","'.$semestr.'","'.$name.'","'.$descrip.'","'.$file.'","'.$fo.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Программа добавлена!'; $id=mysql_insert_id(); //СОХРАНИМ ДЛЯ КАКИХ ГРУПП if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ $DB->QUR('INSERT INTO '.$ST['dbpf'].'_workprogram_grupp VALUES (0,'.mktime().','.$id.','.$val.')'); } } } $_GET['des']=''; save_logs('Рабочая прорамма добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Программа не добавлена!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_workprogram WHERE id='.$id.$aid.''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование рабочей программы'; $form['btn_url']='lection_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; if($rez[1]['fo']=='') $rez[1]['fo']='оч|заоч'; if($rez[1]['fo']!=''){ $t=explode('|',str_replace('/','|',$rez[1]['fo'])); $form['p']['fo1'] = ''; $form['p']['fo2'] = ''; if(count($t)>1){ if($t[0]=='оч') $form['p']['fo1'] = 'оч'; if($t[0]=='заоч') $form['p']['fo2'] = 'заоч'; if($t[0]=='оч-заоч') $form['p']['fo3'] = 'оч-заоч'; if($t[1]=='оч') $form['p']['fo1'] = 'оч'; if($t[1]=='заоч') $form['p']['fo2'] = 'заоч'; if($t[1]=='оч-заоч') $form['p']['fo3'] = 'оч-заоч'; }else{ if($t[0]=='оч') $form['p']['fo1'] = 'оч'; if($t[0]=='заоч') $form['p']['fo2'] = 'заоч'; if($t[0]=='оч-заоч') $form['p']['fo3'] = 'оч-заоч'; } } if($rez[1]['kurs']!=''){ $t=explode('|',$rez[1]['kurs']); if(count($t)>1){ $form['p']['kurso']=explode(',',$t[0]); $form['p']['kursz']=explode(',',$t[1]); $form['p']['kursoz']=explode(',',$t[1]); }else{ if($form['p']['fo1']=='оч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['kurso'][$i]=1; else $form['p']['kurso'][$i]=0; } if($form['p']['fo2']=='заоч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['kursz'][$i]=1; else $form['p']['kursz'][$i]=0; } if($form['p']['fo3']=='оч-заоч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['kursoz'][$i]=1; else $form['p']['kursoz'][$i]=0; } } } if($rez[1]['semestr']!=''){ $t=explode('|',$rez[1]['semestr']); if(count($t)>1){ $form['p']['semestro']=explode(',',$t[0]); $form['p']['semestrz']=explode(',',$t[1]); $form['p']['semestroz']=explode(',',$t[1]); }else{ if($form['p']['fo1']=='оч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['semestro'][$i]=1; else $form['p']['semestro'][$i]=0; } if($form['p']['fo2']=='заоч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['semestrz'][$i]=1; else $form['p']['semestrz'][$i]=0; } if($form['p']['fo2']=='оч-заоч'){ for($i=1;$i<=6;$i++) if($i==$rez[1]['kurs']) $form['p']['semestroz'][$i]=1; else $form['p']['semestroz'][$i]=0; } } } $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['sokr']=out_data_fu($val1['sokr']); $rez2=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_workprogram_grupp WHERE id_grupp='.$val1['id'].' AND id_lections='.$rez[1]['id'].''); if ($rez2) $val1['sel']=1; $form['p']['grupp'][]=$val1; } } } //echo '
'.print_r($form['p'],1).'
'; } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление рабочей программы'; $form['btn_url']='lection_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $form['p']['fo1']='оч'; $sql1='SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY kurs,sokr'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['sokr']=out_data_fu($val1['sokr']); $form['p']['grupp'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление рабочей программы'; $id=(int)$_GET['id']; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_workprogram WHERE id='.$id.$aid.' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/workprogram/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_workprogram WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Рабочая программа удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все рабочие программы'; //if (get_prava_grupp(0)) $aid=''; else $aid=' WHERE id_teacher='.$_SESSION['user']['teacher']['id'].''; //$pagi=pagination('SELECT * FROM '.$ST['dbpf'].'_workprogram'.$aid.'',10); $pagi=pagination('SELECT * FROM '.$ST['dbpf'].'_workprogram'.$aid.'',10); $sql='SELECT * FROM '.$ST['dbpf'].'_workprogram'.$aid.' ORDER BY specialnost, kurs, semestr, fo,name '.$pagi['limit']; //echo $sql; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); if($val['fo']=='') $val['fo']='оч|заоч|оч-заоч'; $f=explode('|',str_replace('/','|',$val['fo'])); $val['fo'] = str_replace('|',', ',str_replace('/','|',$val['fo'])); if(strpos($val['kurs'],'|')===false){ $kurs = $val['kurs']; if($f[0]=='оч') { $val['kurs']=''; for($j=1;$j<=6;$j++) if($kurs==$j) $val['kurs'].='1,'; else $val['kurs'].='0,'; $val['kurs'].='|'; for($j=1;$j<=6;$j++) $val['kurs'].='0,'; } if($f[0]=='заоч') { $val['kurs']=''; for($j=1;$j<=6;$j++) $val['kurs'].='0,'; $val['kurs'].='|'; for($j=1;$j<=6;$j++) if($kurs==$j) $val['kurs'].='1,'; else $val['kurs'].='0,'; } if($f[0]=='оч-заоч') { $val['kurs']=''; for($j=1;$j<=6;$j++) $val['kurs'].='0,'; $val['kurs'].='|'; for($j=1;$j<=6;$j++) if($kurs==$j) $val['kurs'].='1,'; else $val['kurs'].='0,'; } } if(strpos($val['semestr'],'|')===false){ $semestr = $val['semestr']; if($f[0]=='оч') { $val['semestr']=''; for($j=1;$j<=6;$j++) if($semestr==$j) $val['semestr'].='1,'; else $val['semestr'].='0,'; $val['semestr'].='|'; for($j=1;$j<=6;$j++) $val['semestr'].='0,'; } if($f[0]=='заоч') { $val['semestr']=''; for($j=1;$j<=6;$j++) $val['semestr'].='0,'; $val['semestr'].='|'; for($j=1;$j<=6;$j++) if($semestr==$j) $val['semestr'].='1,'; else $val['semestr'].='0,'; } if($f[0]=='оч-заоч') { $val['semestr']=''; for($j=1;$j<=6;$j++) $val['semestr'].='0,'; $val['semestr'].='|'; for($j=1;$j<=6;$j++) if($semestr==$j) $val['semestr'].='1,'; else $val['semestr'].='0,'; } } $k = explode('|',$val['kurs']); $val['kurso'] = explode(',',$k[0]); $val['kursz'] = explode(',',$k[1]); $val['kursoz'] = explode(',',$k[1]); $sh=false; foreach($val['kurso'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['kurs']='Оч: ';foreach($val['kurso'] as $k1 => $v1) if($v1!=0)$val['kurs'] .= $k1.','; $sh=false; foreach($val['kursz'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['kurs'].='| Заоч: ';foreach($val['kursz'] as $k1 => $v1) if($v1!=0)$val['kurs'] .= $k1.','; $sh=false; foreach($val['kursz'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['kurs'].='| Оч-заоч: ';foreach($val['kursoz'] as $k1 => $v1) if($v1!=0)$val['kurs'] .= $k1.','; $s = explode('|',$val['semestr']); $val['semestro'] = explode(',',$s[0]); $val['semestrz'] = explode(',',$s[1]); $val['semestroz'] = explode(',',$s[1]); $sh=false; foreach($val['semestro'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['semestr']='Оч: ';foreach($val['semestro'] as $k1 => $v1) if($v1!=0)$val['semestr'] .= $k1.','; $sh=false; foreach($val['semestrz'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['semestr'].='| Заоч: ';foreach($val['semestrz'] as $k1 => $v1) if($v1!=0)$val['semestr'] .= $k1.','; $sh=false; foreach($val['semestrz'] as $k1 => $v1) if($v1==1)$sh=true; if($sh) $val['semestr'].='| Оч-заоч: ';foreach($val['semestroz'] as $k1 => $v1) if($v1!=0)$val['semestr'] .= $k1.','; $lections[$i]=$val; $i++; } } } //echo '
'.print_r($lections,1).'
'; $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('pagination',$pagi); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_workprogram.html'); } if($_GET['page']=='kursov'){//Курсовые $lections=array(); $forms=array(); if(isset($_POST['kursov_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/kursov/'); if ($file!=''){ unlink('upload/kursov/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; $sql = 'UPDATE '.$ST['dbpf'].'_kursov SET data_u='.mktime().',id_lection='.$id_lection.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал отредактирован!'; $_GET['des']=''; save_logs('Курсовая отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['kursov_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/kursov/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_kursov VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$name.'","'.$descrip.'","'.$file.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал добавлен!'; $_GET['des']=''; save_logs('Курсовая добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование курсовой'; $form['btn_url']='kursov_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); if ($rez[1]['id_lection']==$val1['id']) $val1['sel']=1; $form['p']['lection'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление курсовой'; $form['btn_url']='kursov_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); $form['p']['lection'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление курсовой'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/kursov/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_kursov WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Курсовая удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все курсовые'; $sql='SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY id_lection'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['lection']=get_lection($val['id_lection']); $lections[$i]=$val; $i++; } } } $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_kursov.html'); } if($_GET['page']=='praktika'){//ПРАКТИКА //года и форма обучения $sql = 'SELECT * FROM '.$ST['dbpf'].'_profile_start ORDER BY `id_profile`'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ //выводим профиль подготовки $sql_profile = 'SELECT * FROM '.$ST['dbpf'].'_profile WHERE `id` = "'.$val["id_profile"].'"'; $rez_profile = $DB->QUR_SEL($sql_profile); $val['id_profile'] = $rez_profile[1]["name"]; $val['id_areas'] = $rez_profile[1]["id_areas"]; $sql_area = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE `id` = "'.$val["id_areas"].'"'; $rez_area = $DB->QUR_SEL($sql_area); $val['code'] = $rez_area[1]['code']; if ($val["forma"] == 1) $val["forma"] = "очная"; else $val["forma"] = "заочная"; $profiles_start[] = $val; } } $smarty->assign('profiles_start', $profiles_start); //НИЖЕ ИДЕТ СТАРЫЙ КОД //пока не удаляю $lections=array(); $forms=array(); if(isset($_POST['praktika_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/praktika/'); if ($file!=''){ unlink('upload/praktika/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; $sql = 'UPDATE '.$ST['dbpf'].'_praktika SET data_u='.mktime().',id_lection='.$id_lection.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал отредактирован!'; $_GET['des']=''; save_logs('Практика отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['praktika_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/praktika/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_praktika VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$name.'","'.$descrip.'","'.$file.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал добавлен!'; $_GET['des']=''; save_logs('Практика добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование практики'; $form['btn_url']='praktika_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); if ($rez[1]['id_lection']==$val1['id']) $val1['sel']=1; $form['p']['lection'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление практики'; $form['btn_url']='praktika_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); $form['p']['lection'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление практики'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/praktika/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_praktika WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Практика удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все практики'; if (isset($_SESSION['user']['teacher']['id'])){ $sql='SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY id_lection'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['lection']=get_lection($val['id_lection']); $lections[$i]=$val; $i++; } } } } //все практики $sql = 'SELECT * FROM '.$ST['dbpf'].'_practices'; $rez = $DB->QUR_SEL($sql); if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ //направление (профиль) подготовки $sql_start = 'SELECT * FROM '.$ST['dbpf'].'_profile_start WHERE `id` = "'.$val["id_start"].'"'; $rez_start = $DB->QUR_SEL($sql_start); //year start education //profile education $sql_profile = 'SELECT * FROM '.$ST['dbpf'].'_profile WHERE `id` = "'.$rez_start[1]["id_profile"].'"'; $rez_profile = $DB->QUR_SEL($sql_profile); //areas education $sql_area = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE `id` = "'.$rez_profile[1]["id_areas"].'"'; $rez_area = $DB->QUR_SEL($sql_area); //код направления - профиль направления $val['id_start'] = $rez_area[1]["code"]." ".$rez_profile[1]["name"]; //год подготовки $val['year'] = $rez_start[1]["year"]; //форма обучения $val['forma'] = $rez_start[1]["forma"]; if ($val["forma"] == 1) $val["forma"] = "очная"; else $val["forma"] = "заочная"; $practices[] = $val; } } //ВЫБЕРЕМ ДАННЫЕ УЧИТЕЛЯ $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'] = 'не подтвержден'; if ($rez[1]['status']==1) $teacher['status'] = 'подтвержден'; } $smarty->assign('teacher',$teacher); //практики определенной кафедры $sql = 'SELECT * FROM '.$ST['dbpf'].'_practices'; $rez = $DB->QUR_SEL($sql); if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ //направление (профиль) подготовки $sql_start = 'SELECT * FROM '.$ST['dbpf'].'_profile_start WHERE `id` = "'.$val["id_start"].'"'; $rez_start = $DB->QUR_SEL($sql_start); //year start education //profile education $sql_profile = 'SELECT * FROM '.$ST['dbpf'].'_profile WHERE `id` = "'.$rez_start[1]["id_profile"].'"'; $rez_profile = $DB->QUR_SEL($sql_profile); //areas education $sql_area = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE `id` = "'.$rez_profile[1]["id_areas"].'"'; $rez_area = $DB->QUR_SEL($sql_area); //код направления - профиль направления $val['id_start'] = $rez_area[1]["code"]." ".$rez_profile[1]["name"]; //год подготовки $val['year'] = $rez_start[1]["year"]; //форма обучения $val['forma'] = $rez_start[1]["forma"]; if ($val["forma"] == 1) $val["forma"] = "очная"; else $val["forma"] = "заочная"; $practices_kafedra[] = $val; } } //практики определенной кафедры из учебных планов - для экономии времени $pract_plans = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_kafedres WHERE name = "'.$teacher['kafedra'].'"'; $rez = $DB->QUR_SEL($sql); //достаем одну кафедру $id_kaf = $rez[1]["id"]; //айдишник кафедры $sql_areas = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE `id_kafedra` = "'.$id_kaf.'"'; $rez_areas = $DB->QUR_SEL($sql_areas); if ($rez_areas){ $code = $rez_areas[1]["code"]; $sql_plans = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE `shifr1` = "'.$code.'"'; $sql_plans = $DB->QUR_SEL($sql_plans); foreach ($sql_plans as $key => $value) if ($key){ $name = $value["shifr1"].' '.$value['nappodgo']; $id_plan = $value["id"]; $year = $value["godnap"]; $forma = $value["forobu"]; $sql_stroki = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE `id_plans` = "'.$id_plan.'" AND `discip` LIKE "%Практика%"'; $rez_stroki = $DB->QUR_SEL($sql_stroki); foreach ($rez_stroki as $key_str => $value_str) if ($key_str){ //перебираем все практики определенного учебного плана для кафедры, которая указана у пользователя if ($value_str['ekz'] != '') $value_str['control'] = 'экзамен'; else $value_str['control'] = 'зачет'; $value_str['year'] = $year; $value_str['forma'] = $forma; $value_str['name'] = $name; $pract_plans[] = $value_str; } } } $smarty->assign('pract_plans', $pract_plans); //************************************ENDD*************************** $smarty->assign('practices',$practices); $smarty->assign('practices_kafedra',$practices_kafedra); $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_praktika.html'); } if($_GET['page']=='controln'){//контрольные материалы $lections=array(); $forms=array(); if(isset($_POST['controln_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/controln/'); if ($file!=''){ unlink('upload/controln/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; $sql = 'UPDATE '.$ST['dbpf'].'_controln SET data_u='.mktime().',id_lection='.$id_lection.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал отредактирован!'; $_GET['des']=''; save_logs('Контрольная отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['controln_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/controln/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_controln VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$name.'","'.$descrip.'","'.$file.'")'; $rez = $DB->QUR($sql); //echo $sql; if(!$rez['err']){ $form['msg']='Материал добавлен!'; $_GET['des']=''; save_logs('Контрольная добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_controln WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование контрольной'; $form['btn_url']='controln_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); if ($rez[1]['id_lection']==$val1['id']) $val1['sel']=1; $form['p']['lection'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление контрольной'; $form['btn_url']='controln_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); $form['p']['lection'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление контрольной'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_controln WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/controln/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_controln WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Контрольная удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все контрольные'; $sql='SELECT * FROM '.$ST['dbpf'].'_controln WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY id_lection'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['lection']=get_lection($val['id_lection']); $lections[$i]=$val; $i++; } } } $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_controln.html'); } if($_GET['page']=='sr'){//задания для самостоятельной работы студентов $lections=array(); $forms=array(); if(isset($_POST['sr_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/sr/'); if ($file!=''){ unlink('upload/sr/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; $sql = 'UPDATE '.$ST['dbpf'].'_sr SET data_u='.mktime().',id_lection='.$id_lection.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал отредактирован!'; $_GET['des']=''; save_logs('Задание для самостоятельной работы отредактировано '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['sr_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/sr/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_sr VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$name.'","'.$descrip.'","'.$file.'")'; $rez = $DB->QUR($sql); //echo $sql; if(!$rez['err']){ $form['msg']='Материал добавлен!'; $_GET['des']=''; save_logs('Самостоятельная добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_sr WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование контрольной'; $form['btn_url']='sr_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); if ($rez[1]['id_lection']==$val1['id']) $val1['sel']=1; $form['p']['lection'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление самостоятельной работы'; $form['btn_url']='sr_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); $form['p']['lection'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление контрольной'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_sr WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/sr/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_sr WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Задание для сам. работы удалено '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все контрольные'; $sql='SELECT * FROM '.$ST['dbpf'].'_sr WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY id_lection'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['lection']=get_lection($val['id_lection']); $lections[$i]=$val; $i++; } } } $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_sr.html'); } if($_GET['page']=='practic'){//практические материалы /* id int(11) data_c int(11) data_u int(11) id_teacher int(11) specialnost varchar(255) kurs tinyint(4) semestr tinyint(4) name varchar(255) descrip text 10 file */ $lections=array(); $forms=array(); if(isset($_POST['practic_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/practic/'); if ($file!=''){ unlink('upload/practic/'.$_POST['ofile']); $sf=',file="'.$file.'"'; }else $sf=''; $sql = 'UPDATE '.$ST['dbpf'].'_practich SET data_u='.mktime().',id_lection='.$id_lection.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал отредактирован!'; $_GET['des']=''; save_logs('Практическя отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['practic_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $id_lection=0; if($_POST['id_lection']!='') $id_lection=get_data_fu($_POST['id_lection']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $file=upload_lection('file','upload/practic/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_practich VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$name.'","'.$descrip.'","'.$file.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Материал добавлен!'; $_GET['des']=''; save_logs('Практическая добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_practich WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование практической'; $form['btn_url']='practic_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); if ($rez[1]['id_lection']==$val1['id']) $val1['sel']=1; $form['p']['lection'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление практической'; $form['btn_url']='practic_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY name'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['specialnost']=out_data_fu($val1['specialnost']); $val1['name']=out_data_fu($val1['name']); $val1['kurs']=out_data_fu($val1['kurs']); $val1['semestr']=out_data_fu($val1['semestr']); $form['p']['lection'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление практической'; $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_practich WHERE id='.$id.' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/practic/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_practich WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('практическая удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все практические'; $sql='SELECT * FROM '.$ST['dbpf'].'_practich WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' ORDER BY id_lection'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['lection']=get_lection($val['id_lection']); $lections[$i]=$val; $i++; } } } //echo '
'.print_r($lections,1).'
'; $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_practic.html'); } if($_GET['page']=='lection'){//лекционные материалы /* id int(11) data_c int(11) data_u int(11) id_teacher int(11) specialnost varchar(255) kurs tinyint(4) semestr tinyint(4) name varchar(255) descrip text 10 file */ $lections=array(); $forms=array(); if(isset($_POST['lection_edit'])){//РЕДАКТИРОВАНИЕ МАТЕРИАЛА $id=(int)$_POST['id']; $specialnost=get_data_fu($_POST['specialnost']); $kurs=(int)get_data_fu($_POST['kurs']); if($kurs=='') $kurs=0; $semestr=(int)get_data_fu($_POST['semestr']); if($semestr=='') $semestr=0; $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $type=get_data_fu($_POST['type']); if(isset($_POST['del_file'])){ $df=explode('|',$_POST['ofile']); foreach($_POST['del_file'] as $k => $v){ if($v!=''){ if(in_array($v,$df)){ $key = array_search($v,$df); unlink('upload/lections/'.$v); unset($df[$key]); } } } } $file=upload_lection('file','upload/lections/'); if ($file!=''){ //unlink('upload/lections/'.$_POST['ofile']); $sf=',file="'.$file.'|'.implode('|',$df).'"'; }else { $sf=',file="'.implode('|',$df).'"'; } if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; //$sql = 'UPDATE '.$ST['dbpf'].'_lections SET data_u='.mktime().',specialnost="'.$specialnost.'",kurs='.$kurs.',semestr='.$semestr.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.$aid.' LIMIT 1'; $sql = 'UPDATE '.$ST['dbpf'].'_lections SET data_u='.mktime().',specialnost="'.$specialnost.'",type="'.$type.'",kurs='.$kurs.',semestr='.$semestr.',name="'.$name.'",descrip="'.$descrip.'"'.$sf.' WHERE id='.$id.$aid.' LIMIT 1'; $rez = $DB->QUR($sql); //echo $sql; if(!$rez['err']){ $form['msg']='Материал отредактирован!'; //СОХРАНИМ ДЛЯ КАКИХ ГРУПП $DB->QUR('DELETE FROM '.$ST['dbpf'].'_lections_grupp WHERE id_lections='.$id.''); if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ $DB->QUR('INSERT INTO '.$ST['dbpf'].'_lections_grupp VALUES (0,'.mktime().','.$id.','.$val.')'); } } } $_GET['des']=''; save_logs('Лекция отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Материал не отредактирован!'.$sql.mysql_error(); } } if(isset($_POST['lection_save'])){//ДОБАВЛЕНИЕ МАТЕРИАЛА $specialnost=get_data_fu($_POST['specialnost']); $kurs=(int)get_data_fu($_POST['kurs']); $semestr=(int)get_data_fu($_POST['semestr']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); $type=get_data_fu($_POST['type']); $file=upload_lection('file','upload/lections/'); $sql = 'INSERT INTO '.$ST['dbpf'].'_lections VALUES (0,'.mktime().','.mktime().','.$_SESSION['user']['teacher']['id'].',"'.$specialnost.'",'.$kurs.','.$semestr.',"'.$name.'","'.$descrip.'","'.$file.'","'.$type.'")'; $rez = $DB->QUR($sql); //echo $sql.'
'.print_r($rez,1).'
'; if(!$rez['err']){ $form['msg']='Материал добавлен!'; $id=mysql_insert_id(); //СОХРАНИМ ДЛЯ КАКИХ ГРУПП if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ $DB->QUR('INSERT INTO '.$ST['dbpf'].'_lections_grupp VALUES (0,'.mktime().','.$id.','.$val.')'); } } } $_GET['des']=''; save_logs('Лекция добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Материал не добавлен!'; } } if(isset($_POST['import_add_teach_mat'])){//ИМПОРТ МАТЕРИАЛОВ ИЗ РАСЧЕТА ЧАСОВ //echo '
'.print_r($_POST,1).'
'; $fmetka = $_POST['fmetka']; $json = file_get_contents('tmp/materials/'.$_SESSION['user']['teacher']['id'].'_'.$fmetka.'.json'); foreach($_POST['import_add'] as $key => $val){//обходим все выбранные материалы $import_tip = $_POST['import_tip'][$key]; $arr = json_decode($json,1); $sql = 'SELECT id FROM '.$ST['dbpf'].'_'.$import_tip.' WHERE name="'.$arr['raspred'][$key]['name_disp'].'" AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez = $DB->QUR_SEL($sql); $isset=false;if($rez)$isset=true; if(!$isset){ //$form['html'] .=$sql.'
'.print_r($rez,1).'
'; $sql = 'SELECT id FROM '.$ST['dbpf'].'_grupp WHERE sokr="'.$arr['raspred'][$key]['spec'].'" AND kurs='.$arr['raspred'][$key]['kurs'].' AND fo="'.$arr['raspred'][$key]['fo'].'"'; $rez = $DB->QUR_SEL($sql); if(!$rez){ $sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES(0,'.time().','.time().',"","","",'.$arr['raspred'][$key]['kurs'].',"'.$arr['raspred'][$key]['spec'].'","'.$arr['raspred'][$key]['fo'].'",0)'; $rez = $DB->QUR($sql); $id_grupp = mysql_insert_id(); }else{ $id_grupp = $rez[1]['id']; } if($import_tip=='lections'){/*id data_c data_u id_teacher specialnost kurs semestr name descrip file*/ $sql = 'INSERT INTO '.$ST['dbpf'].'_lections VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].',"'.$arr['raspred'][$key]['spec'].'",'.$arr['raspred'][$key]['kurs'].','.$arr['raspred'][$key]['semestr'].',"'.$arr['raspred'][$key]['name_disp'].'","Лекции","")'; $rez = $DB->QUR($sql); } if($import_tip=='practich'){/*id data_c data_u id_teacher id_lection name descrip file */ $id_lection=check_lection($arr['raspred'][$key]); $sql = 'INSERT INTO '.$ST['dbpf'].'_practich VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$arr['raspred'][$key]['name_disp'].'","Практические занятия","")'; $rez = $DB->QUR($sql); } if($import_tip=='controln'){/*id data_c data_u id_teacher id_lection name descrip file */ $id_lection=check_lection($arr['raspred'][$key]); $sql = 'INSERT INTO '.$ST['dbpf'].'_controln VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$arr['raspred'][$key]['name_disp'].'","Контрольные работы","")'; $rez = $DB->QUR($sql); } if($import_tip=='kursov'){/*id data_c data_u id_teacher id_lection name descrip file */ $id_lection=check_lection($arr['raspred'][$key]); $sql = 'INSERT INTO '.$ST['dbpf'].'_kursov VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$arr['raspred'][$key]['name_disp'].'","Курсовые работы","")'; $rez = $DB->QUR($sql); } if($import_tip=='praktika'){/*id data_c data_u id_teacher id_lection name descrip file */ $id_lection=check_lection($arr['raspred'][$key]); $sql = 'INSERT INTO '.$ST['dbpf'].'_praktika VALUES(0,'.time().','.time().','.$_SESSION['user']['teacher']['id'].','.$id_lection.',"'.$arr['raspred'][$key]['name_disp'].'","Практика","")'; $rez = $DB->QUR($sql); } } } $_GET['des'] = 'show'; } $regim='show'; if (isset($_GET['des'])){ if ($_GET['des']=='link'){//привязка лекций к своему аккаунту $id=(int)$_GET['id']; $sql='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$id.''; $rez=$DB->QUR_SEL($sql); if($rez){ $l=$rez[1]; $sql = 'INSERT INTO '.$ST['dbpf'].'_lections VALUES(0,'.$l['data_c'].','.$l['data_u'].','.$_SESSION['user']['teacher']['id'].',"'.$l['specialnost'].'",'.$l['kurs'].','.$l['semestr'].',"'.$l['name'].'","'.$l['descrip'].'","'.$l['file'].'")'; $rez=$DB->QUR($sql); if(!$rez['err']){ $id_lection = mysql_insert_id(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp WHERE id_lections='.$id.''; $rez=$DB->QUR_SEL($sql); foreach($rez as $key => $val)if($key){ $sql1 = 'INSERT INTO '.$ST['dbpf'].'_lections_grupp VALUES(0,'.$val['data_c'].','.$id_lection.','.$val['id_grupp'].')'; $rez1=$DB->QUR($sql1); } } } } if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$id.$aid.''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование лекции'; $form['btn_url']='lection_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; $form['p']['ofile']=''; $form['p']['mfile']=explode('|',$rez[1]['file']); $sql1='SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['sokr']=out_data_fu($val1['sokr']); $rez2=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections_grupp WHERE id_grupp='.$val1['id'].' AND id_lections='.$rez[1]['id'].''); if ($rez2) $val1['sel']=1; $form['p']['grupp'][]=$val1; } } } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление лекции'; $form['btn_url']='lection_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_grupp WHERE NOT sokr LIKE "%Выпуск%" ORDER BY kurs,sokr'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['sokr']=out_data_fu($val1['sokr']); $val['fo']=out_data_fu($val1['fo']); $form['p']['grupp'][]=$val1; } } } if ($_GET['des']=='del'){//удаление $id=(int)$_GET['id']; $ST['page']['name'] = 'Удаление лекции'; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$id.$aid.' LIMIT 1'; $rez=$DB->QUR_SEL($sql); if($rez){ if($rez[1]['file']!='') unlink('upload/lections/'.$rez[1]['file']); $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_lections WHERE id='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Материал успешно удален.'; save_logs('Лекция удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такого материала!'; } if($_GET['des']=='ch_import'){ $regim='ch_import'; if(!isset($_SESSION['learn_teach_import'])){ $json = file_get_contents('http://local.mkgtu.ru/calchour_2017/get_json.php?json=ln_teach_lection&prepod='.urlencode($_SESSION['user']['fio']).''); }else{ $json = file_get_contents('tmp/materials/'.$_SESSION['user']['teacher']['id'].'_'.$_SESSION['learn_teach_import'].'.json'); } if($json!=''){ if(!isset($_SESSION['learn_teach_import'])){ $fmetka = $_SESSION['learn_teach_import'] = time(); file_put_contents('tmp/materials/'.$_SESSION['user']['teacher']['id'].'_'.$fmetka.'.json',$json); }else $fmetka = $_SESSION['learn_teach_import']; $arr = json_decode($json,1); $isset=array(); if(!isset($arr['err'])){ //$form['html'].='
'.print_r($arr,1).'
'; $form['html'].='Результат импорта:
'; $form['html'].=''; $mater=array(); foreach($arr['raspred'] as $key => $val){ if(!in_array($val['name_disp'],$mater)){ $mater[]=$val['name_disp']; $type=''; if($val['lekcii']!=0) { $type='ЛЕКЦИИ'; $st='lections'; } if($val['prakt_sem_zan']!=0) { $type='Практические и семинарские занятия'; $st='practich'; } if($val['lab_zan']!=0) { $type='Лабораторные занятия'; $st='practich'; } if($val['kr']!=0) { $type='Контрольные работы'; $st='controln'; } if($val['kur']!=0) { $type='Курсовые работы'; $st='kursov'; } if($val['kup']!=0) { $type='Курсовые проекты'; $st='kursov'; } if($val['uch_pr']!=0) { $type='Учебная практика'; $st='praktika'; } if($val['uch_pr_p']!=0) { $type='Полевая практика'; $st='praktika'; } if($val['proizv_pr']!=0) { $type='Производственная практика'; $st='praktika'; } if($val['preddip_pr']!=0) { $type='Преддипломная практика'; $st='praktika'; } $isset=false; $sql = 'SELECT id FROM '.$ST['dbpf'].'_'.$st.' WHERE name="'.$val['name_disp'].'" AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez = $DB->QUR_SEL($sql); if($rez)$isset=true; $form['html'].=''; } } $form['html'].=''; $form['html'].='
Предмет Группа Курс/Семестр Форма обуч. Тип материала
'.$val['cikl_dis'].' '.$val['name_disp'].' '.$val['spec'].' '.$val['kurs'].'/'.$val['semestr'].' '.$val['fo'].' '.$type.' '; if(!$isset){ $form['html'] .= ' добавить'; $form['html'] .= ''; }else $form['html'] .= 'предмет уже есть'; $form['html'] .= '
'; $form['html'].='
'; }else $form['err'][]='Не найден преподаватель. Измените свое ФИО в профиле и попробуйте еще раз.'; }else $form['err'][]='Импортирование! Пустой ответ от сервера!'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все лекции'; //if (get_prava_grupp(0)) $aid=''; else //смывсла нет в этом все лекции без поиска и т.д. $aid=' WHERE id_teacher='.$_SESSION['user']['teacher']['id'].''; $pagi=pagination('SELECT * FROM '.$ST['dbpf'].'_lections'.$aid.'',500); //$sql='SELECT * FROM '.$ST['dbpf'].'_lections'.$aid.' ORDER BY kurs,semestr, name '.$pagi['limit']; $sql='SELECT * FROM '.$ST['dbpf'].'_lections'.$aid.' ORDER BY specialnost '.$pagi['limit']; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $sql1='SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND g.id=lg.id_grupp'; $rez1=$DB->QUR_SEL($sql1); $val['grups']=array(); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['grups'][]=$val1; } } $val['mfile']=explode('|',$val['file']); $lections[$i]=$val; $i++; } } $leckaf=array(); //выберем все лекции у кафедры!!! $_SESSION['user']['teacher']['kafedra'] $sql = 'SELECT l.* FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_lections as l WHERE l.id_teacher=t.id AND t.kafedra="'.$_SESSION['user']['teacher']['kafedra'].'"'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $sql1='SELECT g.* FROM '.$ST['dbpf'].'_lections_grupp as lg,'.$ST['dbpf'].'_grupp as g WHERE lg.id_lections='.$val['id'].' AND g.id=lg.id_grupp'; $rez1=$DB->QUR_SEL($sql1); $val['grups']=array(); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['grups'][]=$val1; } } $leckaf[]=$val; } } } //список дисциплин из расчета часов - из карточки $url = 'http://local.mkgtu.ru/calchour_2023/get_json.php?json=get_info_prepod&fio='.urlencode($_SESSION['user']['fio']).''; //echo $url.'
'; $json = file_get_contents($url); //file_put_contents($file,$json); $json = json_decode($json,1); //$json['db'] = getUniqueArray('name_disp', $json['db']); //echo '
'; print_r ($json); echo '
';exit(); $disc = array(); foreach ($json['db'] as $key => $val) if ($key){ $val['name_disp'] = trim(preg_replace('/[\t\n\r\s]+/', ' ', $val['name_disp'])); $disc[] = $val; } //********************// $smarty->assign('leckaf',$leckaf); $smarty->assign('regim',$regim); $smarty->assign('lections',$lections); $smarty->assign('pagination',$pagi); $smarty->assign('form',$form); $smarty->assign('disc',$disc); $maincontent = $smarty->fetch('tpl_teacher_lection.html'); } //ОТМЕНА ПРИВЯЗКИ ГРУПП К ЛЕКЦИЯМ ОПРЕДЕЛЕННОГО ПРЕПОДАВАТЕЛЯ, т.е. под которым сейчас авторизованы if ($_GET['page'] == 'cancel_binding'){ $sql = 'SELECT * FROM '.$ST['dbpf'].'_lections WHERE id_teacher='.$_SESSION['user']['teacher']['id'].''; $rez=$DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $sql2 = 'DELETE FROM '.$ST['dbpf'].'_lections_grupp WHERE id_lections='.$val['id'].' LIMIT 1'; $rez2 = $DB->QUR_SEL($sql2); } } save_logs('Отменена привязка к лекциям учебных групп у преподавателя (!)'.$_SESSION['user']['teacher']['id'].' '); $smarty->assign('message',"Привязка лекций к группам отменена"); $smarty->assign('link',"/teach/lection/"); $maincontent = $smarty->fetch('tpl_refresh.html'); } if($_GET['page']=='tests'){ $TS['view']='teacher'; include 'tests.php'; } //if($_GET['page']=='ocenki' && false){//оценки if($_GET['page']=='ocenki'){//оценки $id_prepod=$_SESSION['user']['teacher']['id']; $data_c1 = get_data_startsemestr(); $smarty->assign('data_c1',$data_c1); if(!isset($_GET['des'])){ $regim = 'ocenki_grupps'; $grupps = array(); //выберем все группы $sql = 'SELECT g.* FROM '.$ST['dbpf'].'_grupp as g, '.$ST['dbpf'].'_grupp_teachers as gt WHERE gt.id_teacher='.$id_prepod.' AND gt.id_grupp=g.id'; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $rez1 = $DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].''); if (isset($_GET["podgruppa"])){ //если указана подгруппа, то выводим только студентов этой подгруппы $podgruppa = $_GET["podgruppa"]; //$rez1 = $DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].' AND num_grupp='.$podgruppa.''); $rez1 = $DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].' AND status = 1 AND num_grupp='.$podgruppa.''); //НЕ ОТЧИСЛЕННЫЕ!!! } if($rez1){ $val['students'] = $rez1[0]; } else $val['students'] = 0; $rez1 = $DB->QUR_SEL('SELECT l.id FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$val['id'].' AND lg.id_lections=l.id AND l.id_teacher='.$id_prepod.''); if($rez1){ $val['lekcii'] = $rez1[0]; } else $val['lekcii'] = 0; $grupps[]=$val; } } $smarty->assign('grupps',$grupps); } //if($_GET['des']=='grupp'||$_GET['des']=='gruppo'){ if($_GET['des']=='grupp'||$_GET['des']=='gruppo'){ $regim = 'ocenki_gruppa'; $id_grupp = (int)$_GET['id']; if(isset($_POST['save'])){ //echo '
'.print_r($_POST,1).'
'; foreach($_POST['ol'] as $id_lection => $students){ foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='lection'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } foreach($_POST['pr'] as $id_lection => $students){ foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='practich'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } foreach($_POST['co'] as $id_lection => $students){ foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='controln'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } foreach($_POST['pra'] as $id_lection => $students){ foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='praktika'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } foreach($_POST['kur'] as $id_lection => $students){ foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='kursov'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } foreach($_POST['sr'] as $id_lection => $students){ //самостоятельные foreach($students as $id_student => $ocenki){ $o1=0; if($ocenki[1]!='') $o1 = trim(str_replace(',','.',$ocenki[1])); $o2=0; if($ocenki[2]!='') $o2 = trim(str_replace(',','.',$ocenki[2])); $arr['id_prepod']=$id_prepod; $arr['id_student']=$id_student; $arr['id_grupp']=$id_grupp; $arr['id_lection']=$id_lection; $arr['what']='sr'; $arr['propusk']=$_POST['propusk'][$id_lection][$id_student]; $arr['upv']=$_POST['upv'][$id_lection][$id_student]; $arr['occenka']=$o1; $arr['type']=1; save_ocenki($arr); $arr['occenka']=$o2; $arr['type']=2; save_ocenki($arr); } } } $ocenki = get_ocenki($id_grupp,$id_prepod); //$ocenki = array_merge($ocenki,$tmpocenki); //echo '
'.print_r($ocenki,1).'
1'; /* $ocenki['grupp']=array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$id_grupp.''; $rez = $DB->QUR_SEL($sql); if($rez){ $ocenki['grupp']=$rez[1]; } $ocenki['students']=array(); //выберем всех студентов $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$id_grupp.''; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_users WHERE id='.$val['id_user'].' LIMIT 1'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ $val['user'] = $rez1[1]; } else $val['user'] = array(); $ocenki['students'][]=$val; } } //выберем все дисциплины $ocenki['lections']=array(); $sql = 'SELECT l.* FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$id_grupp.' AND lg.id_lections=l.id AND l.id_teacher='.$id_prepod.' ORDER BY l.kurs,l.semestr'; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['practich'][] = $val1; } } else $val['controln'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_controln WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['controln'][] = $val1; } } else $val['controln'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['praktika'][] = $val1; } } else $val['praktika'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['kursov'][] = $val1; } } else $val['kursov'] = array(); $ocenki['lections'][]=$val; } } //выберем все оценки $sql = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_grupp='.$id_grupp.' AND id_prepod='.$id_prepod; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $ocenki['saves']['propusk'][$val['id_what']][$val['id_student']]=$val['propusk']; $ocenki['saves']['upv'][$val['id_what']][$val['id_student']]=$val['upv']; if($val['what']=='lection') { $ocenki['saves']['ol'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; } if($val['what']=='practich') { $ocenki['saves']['pr'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; } if($val['what']=='controln') { $ocenki['saves']['co'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; } if($val['what']=='praktika') { $ocenki['saves']['pra'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; } if($val['what']=='kursov') { $ocenki['saves']['kur'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; } } } //echo '
'.print_r($ocenki,1).'
'; */ $smarty->assign('ocenki',$ocenki); } $typeatt=1; if($_GET['des']=='fakultet1'){//текущая аттестация $_GET['des']='fakultet'; $typeatt = 1; } if($_GET['des']=='fakultet2'){//итоговая аттестация $_GET['des']='fakultet'; $typeatt = 2; } if($_GET['des']=='fakultet3'){//сводная текущая $_GET['des']='fakultet'; $typeatt = 3; } if($_GET['des']=='fakultet4'){//сводная итоговая $_GET['des']='fakultet'; $typeatt = 4; } $ssl_ind = 0; if($_GET['des']=='fakultet'){ $regim = 'ocenki_fakultet'; //тут надо получать все группы факультета! if(!isset($_GET['id'])){ $fak = $_SESSION['user']['teacher']['fakultet'];//[kafedra] $gruppss = array(); //собираем всех преподов с факультета $sql = 'SELECT t.id,u.fio FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE NOT(u.status = -1) AND u.id=t.id_user AND t.fakultet="'.$fak.'" '; $rez =$DB->QUR_SEL($sql); foreach($rez as $key => $val)if($key){ //собираем группы от преподов $sql1 = 'SELECT g.id,g.sokr,g.fo,g.kurs FROM '.$ST['dbpf'].'_grupp_teachers as gt,'.$ST['dbpf'].'_grupp as g WHERE gt.id_teacher='.$val['id'].' AND gt.id_grupp=g.id'; $rez1 =$DB->QUR_SEL($sql1); foreach($rez1 as $key1 => $val1)if($key1){ $val1['fio'] = $val['fio']; $sql2 = 'SELECT count(id) as ks FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val1['id'].''; $rez2 =$DB->QUR_SEL($sql2); if($rez2){ $val1['kolstud']=$rez2[1]['ks']; }else $val1['kolstud']=0; $sql2 = 'SELECT count(id) as ks FROM '.$ST['dbpf'].'_ocenki WHERE id_grupp='.$val1['id'].' AND data_c>='.$data_c1.''; $rez2 =$DB->QUR_SEL($sql2); if($rez2){ $val1['kolocenki']=$rez2[1]['ks']; }else $val1['kolocenki']=0; $add=true; foreach($gruppss as $k => $v){ $id_grupp = $val1['id']; //выводим количество преподаваемых дисциплин для этой группы //$sql3 = 'SELECT l.* FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$id_grupp.' AND lg.id_lections=l.id AND l.id_teacher='.$val['id'].' ORDER BY l.kurs,l.semestr'; $sql3 = 'SELECT l.* FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$id_grupp.' AND lg.id_lections=l.id AND l.id_teacher='.$val['id'].' ORDER BY l.kurs,l.semestr'; $rez3 = $DB->QUR_SEL($sql3); $i = 0; foreach ($rez3 as $key3 => $val3) { if ($key3) $i++; } if($v['id']==$val1['id']) { $gruppss[$k]['fio'] .= ' (0 из '.$i.');
'.$val1['fio']; $add=false; } //if($v['id']==$val1['id']) { $gruppss[$k]['fio'] .= $str.'12'; $add=false; } } if($add) $gruppss[]=$val1; } } $smarty->assign('gruppss',$gruppss); //echo '
'.print_r($gruppss,1).'
1'; } else{//выбираем все оценки для группы $id_grupp = (int)$_GET['id']; $ocenki = get_ocenki($id_grupp,0); $smarty->assign('ocenki',$ocenki); $page['name'] = $ocenki['grupp']['sokr'].'-'.$ocenki['grupp']['kurs']; $site['name'] = 'Промежуточная аттестация и результаты освоения программы'; $smarty->assign('Gdata',date('H:i d.m.Y')); $smarty->assign('typeatt',$typeatt); $smarty->assign('page',$page); $smarty->assign('site',$site); $smarty->assign('regim',$regim); if($typeatt==1||$typeatt==2) $smarty->display('tpl_teacher_ocenki_fakultet.html'); if($typeatt==3||$typeatt==4) $smarty->display('tpl_teacher_ocenki_fakultet_svodnaya.html'); //echo '
'.print_r($ocenki,1).'
1'; exit(); } } if($_GET['des']=='gruppo'){//отображение отчетов $regim = 'ocenki_grupps'; $page['name'] = $ocenki['grupp']['sokr'].'-'.$ocenki['grupp']['kurs']; $site['name'] = 'Промежуточная аттестация и результаты освоения программы'; $smarty->assign('page',$page); $smarty->assign('site',$site); $smarty->assign('regim',$regim); //echo '
'.print_r($ocenki['saves'],1).'
'; $smarty->display('tpl_teacher_ocenki_print.html'); exit(); } else{ $smarty->assign('regim',$regim); $maincontent = $smarty->fetch('tpl_teacher_ocenki.html'); } } if($_GET['page']=='grupp'){//группы //id int(11), data_c int(11), data_u int(11), name varchar(255), descrip text, specialnost varchar(255), kurs int(11), sokr varchar(255), fo varchar(255) $items=array(); $forms=array(); if(isset($_POST['grupp_edit'])){//РЕДАКТИРОВАНИЕ Группа $id=(int)$_POST['id']; $id_facult=(int)$_POST['id_facult']; $specialnost=get_data_fu($_POST['specialnost']); $kurs=(int)get_data_fu($_POST['kurs']); if($kurs=='') $kurs=0; $sokr=get_data_fu($_POST['sokr']); $year_start=get_data_fu($_POST['year_start']); //$name=get_data_fu($_POST['name']); //$descrip=get_data_fu($_POST['descrip']); if(isset($_POST['fo'])) $fo=get_data_fu($_POST['fo']); else $fo='оч'; if($_SESSION['user']['status']==99){ $id_teacher=get_data_fu($_POST['id_teacher']); $idt = ',id_teacher='.$id_teacher; }else $idt = ',id_teacher='.$_SESSION['user']['teacher']['id']; //$sql = 'UPDATE '.$ST['dbpf'].'_grupp SET data_u='.mktime().',specialnost="'.$specialnost.'",id_facult = "'.$id_facult.'", kurs='.$kurs.',sokr="'.$sokr.'",name="'.$name.'",descrip="'.$descrip.'",fo="'.$fo.'"'.$idt.' WHERE id='.$id.' LIMIT 1'; $sql = 'UPDATE '.$ST['dbpf'].'_grupp SET data_u='.mktime().',specialnost="'.$specialnost.'",id_facult = "'.$id_facult.'", kurs='.$kurs.',sokr="'.$sokr.'",year_start="'.$year_start.'",fo="'.$fo.'"'.$idt.' WHERE id='.$id.' LIMIT 1'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Группа отредактирована!'; $_GET['des']=''; save_logs('Группа отредактирована '.$id.' : '.$name.''); }else{ $form['err'][]='Группа не отредактирована!'; } } if(isset($_POST['grupp_save'])){//ДОБАВЛЕНИЕ Группа $specialnost=get_data_fu($_POST['specialnost']); $kurs=(int)get_data_fu($_POST['kurs']); if($kurs=='') $kurs=0; $id_facult=(int)$_POST['id_facult']; $sokr=get_data_fu($_POST['sokr']); $year_start=get_data_fu($_POST['year_start']); $name=get_data_fu($_POST['name']); $descrip=get_data_fu($_POST['descrip']); //$fo=get_data_fu($_POST['fo']); if($_SESSION['user']['status']==99){ $id_teacher=get_data_fu($_POST['id_teacher']); $idt = ','.$id_teacher; }else $idt = ','.$_SESSION['user']['teacher']['id']; if(isset($_POST['fo1'])) { $fo='ОФО'; //$sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$name.'","'.$descrip.'","'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.', "'.$id_facult.'")'; $sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.', "'.$id_facult.'", "'.$year_start.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Группа добавлена!'; $_GET['des']=''; save_logs('Группа добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Группа не добавлена!'; } } if(isset($_POST['fo2'])) { $fo='ЗФО'; //$sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$name.'","'.$descrip.'","'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.')'; $sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.', "'.$id_facult.'", "'.$year_start.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Группа добавлена!'; $_GET['des']=''; save_logs('Группа добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Группа не добавлена!'; } } if(isset($_POST['fo3'])) { //$fo='оч-заоч'; $fo='ОЗФО'; //$sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$name.'","'.$descrip.'","'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.')'; $sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES (0,'.mktime().','.mktime().',"'.$specialnost.'",'.$kurs.',"'.$sokr.'","'.$fo.'"'.$idt.', "'.$id_facult.'", "'.$year_start.'")'; $rez = $DB->QUR($sql); if(!$rez['err']){ $form['msg']='Группа добавлена!'; $_GET['des']=''; save_logs('Группа добавлена '.mysql_insert_id().' : '.$name.''); }else{ $form['err'][]='Группа не добавлена!'; } } } if(isset($_POST['grupp_connect_save'])){//Привязка Группа //echo '
'.print_r($_POST,1).'
'; if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ $rez=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_grupp_teachers WHERE id_grupp='.$val.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez){ $DB->QUR('INSERT INTO '.$ST['dbpf'].'_grupp_teachers VALUES (0,'.$val.','.$_SESSION['user']['teacher']['id'].')'); } } } } $_GET['des']=''; $form['msg']='Группа привязаны!'; save_logs('Группа привязаны'); } if(isset($_POST['grupp_pass'])){//ОТОБРАЖЕНИЕ ПАРОЛЕЙ СТУДЕНТОВ ГРУППЫ $gr=array(); if(isset($_POST['l_g'])){ if(count($_POST['l_g'])){ foreach($_POST['l_g'] as $key => $val){ //$DB->QUR('INSERT INTO '.$ST['dbpf'].'_lections_grupp VALUES (0,'.mktime().','.$id.','.$val.')'); $gr[]=$val; } $sql = 'SELECT u.*,s.num_grupp,s.id_grupp FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE (s.id_grupp='.implode(' OR s.id_grupp=',$gr).') AND u.id=s.id_user'; $rez = $DB->QUR_SEL($sql); //echo $sql.mysql_error(); if($rez){ $passs=array(); foreach($rez as $key => $val)if($key){ $val['fio'] = out_data_fu($val['fio']); $val['email'] = out_data_fu($val['email']); $val['pass'] = out_data_fu($val['pass']); $rez0 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$val['id_grupp'].''); $val['grupp'] = out_data_fu($rez0[1]['sokr'].'-'.$rez0[1]['kurs']); $val['num_grupp'] = out_data_fu($val['num_grupp']); $passs[] = $val; } $smarty->assign('passs',$passs); } }else $form['err'][]='Надо выбрать хотя бы 1 группу!'; }else $form['err'][]='Группа не выбрана!'; } //echo '
'.print_r($_POST,1).'
'; if(isset($_POST['import_add'])||isset($_POST['import_del'])){//обрабатываем форму после подтверждения! //$form['html'] = '
'.print_r($_POST,1).'
'; if(isset($_POST['import_add'])&&count($_POST['import_add'])){//Добавляем группы foreach($_POST['import_add'] as $key=> $val){ $sokr = $val['sokr']; $kurs = $val['kurs']; $fo = $val['fo']; $sql = 'SELECT id FROM '.$ST['dbpf'].'_grupp WHERE kurs='.$kurs.' AND sokr="'.$sokr.'" AND fo="'.$fo.'"'; $rez = $DB->QUR_SEL($sql); if(!$rez){ $sql = 'INSERT INTO '.$ST['dbpf'].'_grupp VALUES(0,'.time().','.time().',"","","",'.$kurs.',"'.$sokr.'","'.$fo.'",0)'; $rez = $DB->QUR_SEL($sql); if(!$rez['err']) $form['html'].='Группа '.$sokr.'-'.$kurs.' добавлена!
'; else $form['html'].='Группа '.$sokr.'-'.$kurs.' не добавлена!
'; } } } if(isset($_POST['import_del'])&&count($_POST['import_del'])){//Удаляем группы foreach($_POST['import_del'] as $key=> $val){ $sql = 'DELETE FROM '.$ST['dbpf'].'_grupp WHERE id='.$key.' LIMIT 1'; $rez = $DB->QUR_SEL($sql); if(!$rez['err']) $form['html'].='Группа ID='.$key.' удалена!
'; else $form['html'].='Группа ID='.$key.' не удалена!
'; } } } if(isset($_POST['grupp_import'])){ $json = file_get_contents('http://local.mkgtu.ru/raspisnew/export.php?grupp_import'); if($json!=''){ $arr = json_decode($json,1); $isset=array(); $form['html']='Результат импорта:
';//.'
'.print_r($arr,1).'
'; foreach($arr as $key => $val){ $sokr = $val['name']; $kurs = substr($val['numer'],0,1); if($kurs=='') $kurs=0; if($val['fo']=='ОФО') $fo = 'оч'; if($val['fo']=='ЗФО') $fo = 'заоч'; $sql = 'SELECT id FROM '.$ST['dbpf'].'_grupp WHERE kurs='.$kurs.' AND sokr="'.$sokr.'" AND fo="'.$fo.'"'; $rez = $DB->QUR_SEL($sql); if($rez){//есть такая группа foreach($rez as $k => $v)if($k){ $form['html'].=''; $isset[]=$v['id']; } }else{//нет такой группы $form['html'].=''; if($sokr!='') $form['html'] .= ''; } } if(count($isset)){//отобразим группы которые есть в системе но нет в распсиании $sql = 'SELECT id,sokr,kurs,fo FROM '.$ST['dbpf'].'_grupp WHERE (id!='.implode(' AND id!=',$isset).')'; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $k => $v)if($k){ $form['html'].=''; } } } $form['html'].=''; $form['html'].='
Группа '.$sokr.'-'.$kurs.'существует! удалить
Группа '.$sokr.'-'.$kurs.' не существует! добавить '; else $form['html'] .= ' добавить(не указано имя!) '; $form['html'] .= '
Группа '.$v['sokr'].'-'.$v['kurs'].'не существует, в расписаниях! удалить
'; $form['html'].='
'; }else $form['err'][]='Импортирование! Пустой ответ от сервера!'; } $regim='show'; if (isset($_GET['des'])){ //ФАКУЛЬТЕТЫ $faculties = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties '; $rez = $DB->QUR_SEL($sql); if ($rez) foreach ($rez as $key => $val){ $faculties[] = $val; } if ($_GET['des']=='edit'){//редактирование $regim='aded'; $id=(int)$_GET['id']; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$id.$aid.''; $rez=$DB->QUR_SEL($sql); if($rez){ $form['title']=$ST['page']['name'] = 'Редактирование группы'; $form['btn_url']='grupp_edit'; $form['btn_name']='Редактировать'; $form['id']=''; $form['p']=$rez[1]; //$user = get_teacher_user($rez[1]['id_teacher']); $form['p']['id_teacher']=get_teacher_inf($rez[1]['id_teacher'],1); } } if ($_GET['des']=='add'){//добавление $regim='aded'; $form['title']=$ST['page']['name'] = 'Добавление группы'; $form['btn_url']='grupp_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $form['p']['fo1']='ОФО'; $form['p']['fo2']='ЗФО'; $form['p']['fo3']='ОЗФО'; $form['p']['id_teacher']=get_teacher_inf(0,1); $form['p']['sel_grupp']=get_sel_grupp(); } if ($_GET['des']=='connect'){//Привязка $regim='connect'; $form['title']=$ST['page']['name'] = 'Привязка к группам'; $form['btn_url']='grupp_connect_save'; $form['btn_name']='Сохранить'; $form['id']=''; $form['p']=array(); $form['p']['sel_grupp']=get_sel_grupp(); } if ($_GET['des']=='del'){//удаление $ST['page']['name'] = 'Удаление группы'; $id=(int)$_GET['id']; if (get_prava_grupp(0)) $aid=''; else $aid=' AND id_teacher='.$_SESSION['user']['teacher']['id'].''; $sql='SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$id.$aid.' LIMIT 1'; $rez=$DB->QUR_SEL($sql); //echo $sql.'
'.mysql_error(); if($rez){ $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_grupp WHERE id='.$id.$aid.' LIMIT 1'); if(!$rez['err']){ $form['msg']='Группа успешно удалена.'; save_logs('Группа удалена '.$id.''); }else $form['err'][]='Ошибка при удалении!'; }else $form['err'][]='Нету такой группы!'; } if ($_GET['des']=='unconnect'){//отвязка $ST['page']['name'] = 'Отсоединение группы'; $id=(int)$_GET['id']; $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_grupp_teachers WHERE id_grupp='.$id.' AND id_teacher='.$_SESSION['user']['teacher']['id'].''); if(!$rez['err']){ $form['msg']='Группа успешно отвязана.'; save_logs('Группа отвязана '.$id.''); }else $form['err'][]='Ошибка при отвязке!'; } if ($_GET['des']=='pass'){//пароли $id=(int)$_GET['id']; $regim='pass'; $form['title']=$ST['page']['name'] = 'Пароли'; $form['btn_url']='grupp_pass'; $form['btn_name']='Отобразить'; $form['id']=''; $form['p']=array(); $sql1='SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez1=$DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val1['sokr']=out_data_fu($val1['sokr']); $form['p']['grupp'][]=$val1; } } } if ($_GET['des']=='import'){//импортировать из расчета часов $regim='import'; $form['btn_url']='grupp_import'; $form['btn_name']='получить данные'; $ST['page']['name'] = 'Импортирование'; } } if ($regim=='show'){//Все записи $ST['page']['name'] = 'Все записи'; if ($_SESSION['user']['status']==99) { $sql='SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY kurs,sokr'; //админка $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['teacher']=get_teacher_user($val['id_teacher']); $rez1=$DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].''); if($rez1) $val['students']=$rez1[0]; else $val['students']=0; if (get_prava_grupp($val['id_teacher'])) $val['edde']=1; else $val['edde']=0; $items[$val['sokr']][]=$val; $i++; } } $smarty->assign('items0',$items); $items = grupp_teachers(); $smarty->assign('items',$items); }else { //$sql='SELECT g.* FROM '.$ST['dbpf'].'_grupp as g,'.$ST['dbpf'].'_grupp_teachers as gt WHERE gt.id_teacher='.$_SESSION['user']['teacher']['id'].' AND gt.id_grupp=g.id ORDER BY g.kurs,g.sokr'; //$rez=$DB->QUR_SEL($sql); //if($rez){ // $i=0; foreach($rez as $key => $val)if($key){ // $val['data_c']=date('H:i d.m.Y',$val['data_c']); // $val['data_u']=date('H:i d.m.Y',$val['data_u']); // $val['teacher']=get_teacher_user($val['id_teacher']); // $rez1=$DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].''); // if($rez1) $val['students']=$rez1[0]; else $val['students']=0; // if (get_prava_grupp($val['id_teacher'])) $val['edde']=1; else $val['edde']=0; // $items[$i]=$val; // $i++; // } //} $items = grupp_teachers(); $smarty->assign('items',$items); } } //СПЕЦИАЛЬНОСТИ $areas = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_areas WHERE NOT (code = " ") ORDER BY name,code'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $areas[] = $val; } } /***/ $smarty->assign('faculties',$faculties); $smarty->assign('regim',$regim); $smarty->assign('form',$form); $smarty->assign('areas',$areas); $smarty->assign('user',$_SESSION['user']); //echo '
'.print_r($_SESSION['user'],1).'
'; $maincontent = $smarty->fetch('tpl_teacher_grupp.html'); } if($_GET['page']=='grupp_transport'){//перевод группы $id_grupp = (int)$_GET['des']; $debug = ''; if(isset($_POST['grupp_transport_save'])){ $oid_grupp = (int)$_POST['oid_grupp']; $nid_grupp = (int)$_POST['id_grupp']; $sts = array(); foreach($_POST['pere_st'] as $key => $val){ $sts[] = $val; } if(count($sts)){ $sql = 'UPDATE '.$ST['dbpf'].'_students SET id_grupp='.$nid_grupp.' WHERE id_grupp='.$oid_grupp.' AND (id_user='.implode(' OR id_user=',$sts).')'; $rez = $DB->QUR($sql); if(!$rez['err']){ $tmsg['msg'] = 'Студентов перенесли!'; save_logs('Перенос студентов новая группа:'.$nid_grupp.' старая группа: '.$oid_grupp.' Список студентов: '.implode(';',$sts)); }else $tmsg['err'][] = 'Ошибка БД!'; $debug .= $sql; }else{ $tmsg['err'][] = 'Необходимо выбрать студентов!'; } } $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id="'.$id_grupp.'"'; $rez = $DB->QUR_SEL($sql); $rez[1]['data_c'] = date('H:i d.m.Y',$rez[1]['data_c']); $rez[1]['data_u'] = date('H:i d.m.Y',$rez[1]['data_u']); $grupp = $rez[1]; //выберем студентов из группы //$sql = 'SELECT s.id as sid,s.data_c as sdata_c, s.data_u as sdata_u, s.status as sstatus, s.num_zach as snum_zach, s.num_stud as snum_stud, s.num_grupp as snum_grupp,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.fio as ufio FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE s.id_grupp='.$id_grupp.' AND u.id=s.id_user ORDER BY s.data_c DESC'; //$sql = 'SELECT s.id as sid,s.data_c as sdata_c, s.data_u as sdata_u, s.status as sstatus, s.num_zach as snum_zach, s.num_stud as snum_stud, s.num_grupp as snum_grupp,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.fio as ufio FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE NOT(u.status = -1) AND s.id_grupp='.$id_grupp.' AND u.id=s.id_user ORDER BY u.fio, s.data_c DESC'; $sql = 'SELECT s.id as sid,s.data_c as sdata_c, s.data_u as sdata_u, s.status as sstatus, s.num_zach as snum_zach, s.num_grupp as snum_grupp,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.fio as ufio FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE NOT(u.status = -1) AND s.id_grupp='.$id_grupp.' AND u.id=s.id_user ORDER BY u.fio, s.data_c DESC'; $rez = $DB->QUR_SEL($sql); $students=array(); if($rez){ foreach($rez as $key => $val)if($key){ if($val['sdata_c']<=mktime(0,0,0,8,1,date('Y'))) $val['perevod']=1; else $val['perevod']=0; $val['sdata_c'] = date('H:i d.m.Y',$val['sdata_c']); $val['sdata_u'] = date('H:i d.m.Y',$val['sdata_u']); $val['udata_c'] = date('H:i d.m.Y',$val['udata_c']); $val['udata_u'] = date('H:i d.m.Y',$val['udata_u']); $students[]=$val; } } $debug .= '
'.print_r($_POST,1).'
'; //$smarty->assign('debug',$debug); $smarty->assign('tmsg',$tmsg); $grupps=get_sel_grupp_tr($id_grupp); $smarty->assign('id_grupp',$id_grupp); $smarty->assign('grupps',$grupps); $smarty->assign('grupp',$grupp); $smarty->assign('students',$students); $maincontent = $smarty->fetch('tpl_teacher_grupp_transport.html'); } //ЛИКВИДАЦИЯ ЗАДОЛЖЕННОСТЕЙ, ИУП if ($_GET['page'] == 'liquidation_prepod'){ $fakultet = $_SESSION['user']['teacher']['fakultet']; //направления факультета $napr = array(); $sql = 'SELECT liq.*, liq.id as id_liq, us.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_users as us WHERE liq.id_teacher = "'.$_SESSION['user']['id'].'" AND liq.id_stat = 0 AND liq.id_teacher = us.id AND liq.mark IS NULL '; $rez = $DB->QUR_SEL($sql); if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ $i++; $val['i'] = $i; switch ($val['control']){ case 1: $val['control'] = 'Экзамен'; break; case 2: $val['control'] = 'Зачет'; break; case 3: $val['control'] = 'Курсовая работа'; break; case 4: $val['control'] = 'Курсовая проект'; break; case 5: $val['control'] = 'Отчет по практике'; break; case 6: $val['control'] = 'Зачет с оценкой'; break; } switch ($val['type']){ case 1: $val['type'] = 'Досрочная'; break; case 2: $val['type'] = 'Первичная'; break; case 3: $val['type'] = 'Повторная'; break; case 4: $val['type'] = 'С комиссией'; break; } switch ($val['iup']){ case 0: $val['iup'] = 'УП'; break; case 1: $val['iup'] = 'ИУП'; break; } $val['date_create'] = date('d.m.Y', $val['date_create']); $val['date_end'] = date('d.m.Y', $val['date_end']); $val['date_mark'] = date('d.m.Y', $val['date_mark']); $id_student = $val['id_student']; $student = get_student($val['id_student']); $sql_user = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user'; $rez_user = $DB->QUR_SEL($sql_user); $val['id_student'] = $rez_user[1]['fio']; $student = get_student($rez_user[1]['id']); $val['gruppa'] = $student['sokr'].'-'.$student['kurs'].$student['num_grupp'].' '.$student['fo']; // $val['id_user'] = $rez_user[1]['id']; $napr[] = $val; } } //ведомости для преподавателя $statements = array(); $sql = 'SELECT liq.*, liq.id as id_liq, us.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_users as us WHERE liq.id_teacher = "'.$_SESSION['user']['id'].'" AND NOT (liq.id_stat = 0) AND liq.id_teacher = us.id AND liq.mark IS NULL GROUP BY liq.id_stat'; $rez = $DB->QUR_SEL($sql); //echo '
'.print_r($rez,1).'
'; if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ $i++; $val['i'] = $i; $id = $val['id_stat']; $val['students'] = array(); $sql_liq = 'SELECT liq.*, liq.id as id_liq, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_teacher='.$_SESSION['user']['id'].' AND liq.id_stat = "'.$id.'" AND liq.id_student = st.id'; $rez_liq = $DB->QUR_SEL($sql_liq); if ($rez_liq){ $j = 0; foreach ($rez_liq as $kk => $val_liq) if ($kk){ $j++; $student = get_user($val_liq['id_user']); $student['j'] = $j; $student['id_liq'] = $val_liq['id_liq']; $student['mark'] = $val_liq['mark']; $val['students'][] = $student; } $info_group = get_student($val_liq['id_user']); $val['gruppa'] = $info_group['sokr'].'-'.$info_group['kurs'].$info_group['num_grupp']; } switch ($val['control']){ case 1: $val['control'] = 'Экзамен'; break; case 2: $val['control'] = 'Зачет'; break; case 3: $val['control'] = 'Курсовая работа'; break; case 4: $val['control'] = 'Курсовая проект'; break; case 5: $val['control'] = 'Отчет по практике'; break; case 6: $val['control'] = 'Зачет с оценкой'; break; } switch ($val['type']){ case 1: $val['type'] = 'Досрочная'; break; case 2: $val['type'] = 'Первичная'; break; case 3: $val['type'] = 'Повторная'; break; case 4: $val['type'] = 'С комиссией'; break; } switch ($val['iup']){ case 0: $val['iup'] = 'УП'; break; case 1: $val['iup'] = 'ИУП'; break; } $val['date_create'] = date('d.m.Y', $val['date_create']); $val['date_end'] = date('d.m.Y', $val['date_end']); $val['date_mark'] = date('d.m.Y', $val['date_mark']); $id_student = $val['id_student']; $info_group = get_student($val_liq['id_user']); $val['gruppa'] = $info_group['sokr'].'-'.$info_group['kurs'].$info_group['num_grupp']; $val['fo'] = $info_group['fo']; $sql_user = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user'; $rez_user = $DB->QUR_SEL($sql_user); $val['id_student'] = $rez_user[1]['fio']; $val['id_user'] = $rez_user[1]['id']; $statements[] = $val; } } /************************/ $smarty->assign('naprs', $napr); $smarty->assign('statements', $statements); $maincontent = $smarty->fetch('tpl_teacher_liquidation_prepod.html'); } if ($_GET['page'] == 'liquidation'){ $mgs = 0; $fakultet = $_SESSION['user']['teacher']['fakultet']; //сформировать направление if (isset($_POST['add_liq'])){ $student = $_POST['student']; $teacher = $_POST['teacher']; $fakultet = $_POST['fakultet']; $type = $_POST['type']; $iup = $_POST['iup']; $name = $_POST['name']; $control = $_POST['control']; $date_create = strtotime($_POST['date_create']); $date_end = strtotime($_POST['date_end']); $semestr = $_POST['semestr']; //$date_create = date("U"); //проверяем есть ли такое направление в системе уже $rez_is = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$student.'" AND id_teacher = "'.$teacher.'" AND type = "'.$type.'" AND iup = "'.$iup.'" AND name = "'.$name.'" AND control = "'.$control.'" AND semestr = "'.$semestr.'" AND date_end = "'.$date_end.'" LIMIT 1'); if ($rez_is[0] > 0) $msg = -1; //ошибка при создании направление else{ $rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`) VALUES ("'.$student.'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'") '); $date_end = date('d.m.Y', $date_end); write_message($teacher, '[ОПОВЕЩЕНИЕ]
У Вас появилось новое направление по дисциплине '.$name.'. Срок действия направления до '.$date_end); save_logs('Создано новое направление для студента '.$student.' и преподавателя '.$teacher.' по дисциплине '.$name); $msg = 1; } } //сформировать ведомость if (isset($_POST['add_ved'])){ $students = $_POST['students']; if(empty($students)){ //echo("Вы не выбрали."); } else{ $N = count($students); $teacher = $_POST['teacher']; $fakultet = $_POST['fakultet']; $type = $_POST['type']; $iup = $_POST['iup']; $name = $_POST['name']; $control = $_POST['control']; $date_end = strtotime($_POST['date_end']); $semestr = $_POST['semestr']; $date_create = date("U"); $rez = $DB->QUR_SEL('INSERT INTO '.$ST['dbpf'].'_statement (`date_create`, `fakultet`) VALUES ("'.$date_create.'", "'.$fakultet.'") '); $id = mysql_insert_id(); write_message($teacher, '[ОПОВЕЩЕНИЕ]
У Вас появилась новая ведомость по дисциплине '.$name); save_logs('Создана зачетно-экзаменнационная ведомость №'.$id); $msg = 2; for($i=0; $i < $N; $i++){ //echo($aDoor[$i] . " "); $rez = $DB->QUR('INSERT INTO '.$ST['dbpf'].'_liquidation (`id_student`, `id_teacher`, `fakultet`, `type`, `iup`, `name`, `control`, `date_create`, `date_end`, `semestr`, `id_stat`) VALUES ("'.$students[$i].'", "'.$teacher.'", "'.$fakultet.'", "'.$type.'", "'.$iup.'", "'.$name.'", "'.$control.'", "'.$date_create.'", "'.$date_end.'", "'.$semestr.'", "'.$id.'") '); } } } //ГРУППЫ $grupp = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez=$DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val){ $grupp[] = $val; } } //активные преподаватели $teachers = array(); $sql = 'SELECT teach.*, us.* FROM '.$ST['dbpf'].'_teachers as teach, '.$ST['dbpf'].'_users as us WHERE NOT (teach.status = "-1") AND NOT (us.status = "-1") AND us.id = teach.id_user '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $teachers[] = $val; } } //направления факультета $napr = array(); $sql = 'SELECT liq.*, liq.id as id_liq, us.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_users as us WHERE liq.fakultet = "'.$fakultet.'" AND liq.id_teacher = us.id AND liq.id_stat = 0 ORDER BY id_liq DESC '; $rez = $DB->QUR_SEL($sql); if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ $i++; $val['i'] = $i; $val['date_create'] = date('d.m.Y', $val['date_create']); $val['date_end'] = date('d.m.Y', $val['date_end']); $val['date_mark'] = date('d.m.Y', $val['date_mark']); switch ($val['control']){ case 1: $val['control'] = 'экзамен'; break; case 2: $val['control'] = 'зачет'; break; case 3: $val['control'] = 'курсовая работа'; break; case 4: $val['control'] = 'курсовой проект'; break; case 5: $val['control'] = 'отчет по практике'; break; case 6: $val['control'] = 'зачет с оценкой'; break; } $id_student = $val['id_student']; $sql_user = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE st.id = "'.$id_student.'" AND us.id = st.id_user'; $rez_user = $DB->QUR_SEL($sql_user); $val['id_student'] = $rez_user[1]['fio']; $napr[] = $val; } } //ведомости факультета на этот семестра $statements = array(); //если эти два значения совпадают, то отображаем, что ведомость заполнена полностью, если второе значение отлично от нуля -неполностью заполнена, если второе значение = 0, ничего не выводим $sql = 'SELECT st.*, st.print_st as print_st, liq.* FROM '.$ST['dbpf'].'_statement as st, '.$ST['dbpf'].'_liquidation as liq WHERE st.fakultet = "'.$fakultet.'" AND liq.id_stat = st.id GROUP BY liq.id_stat'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $val['date_create'] = date('d.m.Y', $val['date_create']); //$val['print_st'] = $val['print_st']; $id = $val['id_stat']; $val['students'] = array(); switch ($val['control']){ case 1: $val['control'] = 'экзамен'; break; case 2: $val['control'] = 'зачет'; break; case 3: $val['control'] = 'курсовая работа'; break; case 4: $val['control'] = 'курсовой проект'; break; case 5: $val['control'] = 'отчет по практике'; break; case 6: $val['control'] = 'зачет с оценкой'; break; } $val['teacher'] = get_user($val['id_teacher']); $val['all'] = 0; //общее количество студентов, подлежающих оцениванию на экзамене/зачете $val['marked'] = 0; //количество оценененных студентов $sql_liq = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_stat = "'.$id.'" AND liq.id_student = st.id'; $rez_liq = $DB->QUR_SEL($sql_liq); if ($rez_liq){ $sem = 0; foreach ($rez_liq as $kk => $val_liq) if ($kk){ $val['all'] += 1; //увеличиваем общее количество студентов, присутствующих на экзамене/зачете if ($val_liq['mark'] != NULL) $val['marked'] += 1; //увеличиваем количество оцененных студентов на данном экзамене/зачете $student = get_user($val_liq['id_user']); $val['students'][]['fio'] = $student['fio']; $sem = $val_liq['semestr']; } $info_group = get_student($val_liq['id_user']); //$val['gruppa'] = $info_group['sokr'].'-'.$info_group['kurs'].$info_group['num_grupp']; $val['gruppa'] = $info_group['sokr'].'-'.round($sem/2).$info_group['num_grupp']; $val['fo'] = $info_group['fo']; } $statements[] = $val; } } if (isset($_GET['des'])){ $id = $_GET['des']; $sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE `id` = "'.$id.'" '; $rez = $DB->QUR_SEL($sql); switch ($rez[1]['control']){ case 1: $control = 'экзамена'; break; case 2: $control = 'зачета'; break; case 3: $control = 'курсовой работы'; break; case 4: $control = 'курсового проекта'; break; case 5: $control = 'отчета по практике'; break; case 6: $control = 'зачета с оценкой'; break; } switch ($rez[1]['type']){ case 1: $type = 'досрочную'; break; case 2: $type = 'первичную'; break; case 3: $type = 'повторную'; break; case 4: $type = 'с комиссией'; break; } switch ($rez[1]['iup']){ case 0: $iup = 'УП'; break; case 1: $iup = 'ИУП'; break; } /*$val['date_create'] = date('d.m.Y', $val['date_create']); $val['date_end'] = date('d.m.Y', $val['date_end']); $val['date_mark'] = date('d.m.Y', $val['date_mark']);*/ //инфа о студенте $id_student = $rez[1]['id_student']; $sql_stud = 'SELECT us.*, stud.* FROM '.$ST['dbpf'].'_students as stud, '.$ST['dbpf'].'_users as us WHERE stud.id = "'.$id_student.'" AND us.id = stud.id_user '; $rez_stud = $DB->QUR_SEL($sql_stud); $teacher = get_user($rez[1]['id_teacher']); $grupp = get_grupp($rez_stud[1]['id_grupp']); if ($grupp['fo'] == 'оч') $grupp['fo'] = 'очная'; else $grupp['fo'] = 'заочная'; $smarty->assign('day_create', date('d', $rez[1]['date_create'])); $smarty->assign('month_create', numberToMonth(date('m', $rez[1]['date_create']))); $smarty->assign('year_create', date('Y', $rez[1]['date_create'])); $smarty->assign('student_fio', $rez_stud[1]['fio']); $smarty->assign('student_gr', $rez_stud[1]['num_grupp']); //$smarty->assign('student_grupp', $rez_stud[1]['fio']); $smarty->assign('day_end', date('d', $rez[1]['date_end'])); $smarty->assign('month_end', numberToMonth(date('m', $rez[1]['date_end']))); $smarty->assign('year_end', date('Y', $rez[1]['date_end'])); $smarty->assign('day_mark', date('d', $rez[1]['date_mark'])); $smarty->assign('month_mark', numberToMonth(date('m', $rez[1]['date_mark']))); $smarty->assign('year_mark', date('Y', $rez[1]['date_mark'])); $smarty->assign('teacher', $teacher['fio']); $smarty->assign('mark', $rez[1]['mark']); $smarty->assign('name', $rez[1]['name']); $smarty->assign('sem', $rez[1]['semestr']); $smarty->assign('print', $rez[1]['print']); $smarty->assign('type', $type); $smarty->assign('iup', $iup); $smarty->assign('grupp', $grupp); $smarty->assign('fakultet', $fakultet); $smarty->assign('stat', $rez[1]['id_stat']); if ($rez[1]['id_stat'] == 0) { //направление //Распечатали $sql = 'UPDATE '.$ST['dbpf'].'_liquidation SET print = "1" WHERE id = "'.$id.'" '; $rez = $DB->QUR($sql); //на вывод $smarty->assign('control', $control); $smarty->display('tpl_teacher_liquidation_print_nap.html'); } else { //ведомость switch ($rez[1]['control']){ case 1: $control = 'экзамен'; break; case 2: $control = 'зачет'; break; case 3: $control = 'курсовая работа'; break; case 4: $control = 'курсовой проект'; break; case 5: $control = 'отчет по практике'; break; case 6: $control = 'зачет с оценкой'; break; } $sql_list = 'SELECT liq.*, st.* FROM '.$ST['dbpf'].'_liquidation as liq, '.$ST['dbpf'].'_students as st WHERE liq.id_stat = "'.$rez[1]['id_stat'].'" AND st.id = liq.id_student '; $rez_list = $DB->QUR_SEL($sql_list); $list_student = array(); $count_otl = 0; $count_hor = 0; $count_udov = 0; $count_neud = 0; $count_neyvka = 0; $id_stat = 0; if ($rez_list){ $i = 0; foreach ($rez_list as $key => $val) if ($key){ $i++; $id_stat = $val['id_stat']; $val['i'] = $i; $student = get_user($val['id_user']); $val['fio'] = $student['fio']; if (($val['mark'] == 'отлично')||($val['mark'] == 'зачтено')) $count_otl++; if (($val['mark'] == 'хорошо')) $count_hor++; if (($val['mark'] == 'удовлетворительно')) $count_udov++; if (($val['mark'] == 'неудовлетворительно')||($val['mark'] == 'не зачтено')) $count_neud++; if (($val['mark'] == 'не явился')) $count_neyvka++; $list_student[] = $val; } } //Распечатали $sql = 'UPDATE '.$ST['dbpf'].'_statement SET print_st = "1" WHERE id = "'.$id_stat.'" '; $rez = $DB->QUR($sql); /***********/ $smarty->assign('count', $i); $smarty->assign('count_otl', $count_otl); $smarty->assign('count_hor', $count_hor); $smarty->assign('count_udov', $count_udov); $smarty->assign('count_neud', $count_neud); $smarty->assign('count_neyvka', $count_neyvka); $smarty->assign('list_student', $list_student); $smarty->assign('control', $control); $smarty->display('tpl_teacher_liquidation_print_ved.html'); } exit; } else{ $smarty->assign('fakultet', $fakultet); $smarty->assign('naprs', $napr); $smarty->assign('statements', $statements); $smarty->assign('teachers', $teachers); $smarty->assign('grupps', $grupp); $smarty->assign('msg', $msg); $smarty->assign('status', $_SESSION['user']['status']); $maincontent = $smarty->fetch('tpl_teacher_liquidation.html'); } } //СВОДНАЯ ВЕДОМОСТЬ ПО ГРУППАМ И СЕМЕСТРАМ if ($_GET['page'] == 'consolidated'){ $fakultet = $_SESSION['user']['teacher']['fakultet']; //формируем список групп $grupps = array(); $sql = 'SELECT gr.* FROM '.$ST['dbpf'].'_grupp as gr WHERE gr.kurs < 7 AND NOT (gr.name LIKE "%выпуск%") ORDER BY gr.sokr, gr.kurs '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $grupps[] = $val; } } //если указана конкретная группа, номер группы в потоке, а также семестр, по которому нужно формировать сводную ведомость if ((isset($_GET['grupp']))&&(isset($_GET['num']))&&(isset($_GET['sem']))){ $id_grupp = $_GET['grupp']; //группа $num = $_GET['num']; //номер группы в потоке $sem = $_GET['sem']; //семестр //достаем список студентов группы $students = array(); $sql = 'SELECT gr.*, st.*, us.*, st.id as id_stud FROM '.$ST['dbpf'].'_grupp as gr, '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE us.id = st.id_user AND st.id_grupp = gr.id AND gr.id = "'.$id_grupp.'" AND st.num_grupp = "'.$num.'" AND NOT(us.status = "-1") ORDER BY us.fio'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ /*$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student="'.$val['id_stud'].'" AND semestr = "'.$sem.'" '; $rez_mark = $DB->QUR_SEL($sql_mark); foreach ($rez_mark as $key_mark => $val_mark){ $val['mark'] = $val_mark; }*/ $id_student = $val['id_stud']; $gruppa = $val['sokr']; $fo = $val['fo']; $students[] = $val; } } //достаем уникальный список направлений/ведомостей для данной группы для указанного семестра $disc = array(); //$date_create; $sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$id_student.'" AND semestr = "'.$sem.'" '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $fakultet = $val['fakultet']; $date_create = $val['date_create']; //первая цифра $val['marked'][0] = 5; $val['marked']; $sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE date_create = "'.$date_create.'" AND semestr = "'.$sem.'" '; $rez_mark = $DB->QUR_SEL($sql_mark); if ($rez_mark){ foreach ($rez_mark as $key_mark => $val_mark){ $val['marked'][$val_mark['id_student']] = $val_mark['mark']; } } //$sql_mark = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id = "''" '; $disc[] = $val; } } //отметки /*********************************/ $smarty->assign('fakultet', $fakultet); $smarty->assign('disc', $disc); $smarty->assign('gruppa', $gruppa); $smarty->assign('fo', $fo); $smarty->assign('num', $num); $smarty->assign('sem', $sem); $smarty->assign('students', $students); $smarty->display('tpl_teach_consolidated_print.html'); exit; } else{ //просто выводим список всех групп, где будем выбирать, какую конкретно группу необходимо вывести $smarty->assign('grupps', $grupps); $maincontent = $smarty->fetch('tpl_teacher_consolidated.html'); } } //РАСПИСАНИЕ ЗАНЯТИЙ В РЕЖИМЕ ВЕБИНАРА //$API; if ($_GET['page'] == 'timetable_web'){ //выводим само расписание $timetable = ''; //формируем список каналов $channel = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_timetable_zoom '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $API['key'] = $val['key_zoom']; $API['secret'] = $val['secret']; $API['url'] = $val['url']; $API['JWTToken'] = $val['token']; $users = zoom_getUsers(); $meetings = zoom_meetingList($users[0]); $date = date('H:i d.m.Y'); foreach($meetings['meetings'] as $key2 => $val2){ $start_time = strtotime($val2['start_time']); //$val['p1'] = date('H:i d.m.Y',$start_time); if (date('H:i d.m.Y',$start_time) == '08:00 '.date('d.m.Y')) $val['p1'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '09:40 '.date('d.m.Y')) $val['p2'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '11:30 '.date('d.m.Y')) $val['p3'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '13:10 '.date('d.m.Y')) $val['p4'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '15:00 '.date('d.m.Y')) $val['p5'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '16:40 '.date('d.m.Y')) $val['p6'] = $val2['topic']; if (date('H:i d.m.Y',$start_time) == '18:20 '.date('d.m.Y')) $val['p7'] = $val2['topic']; /*$meet = getMeeting($val['uuid']); echo ' '.date('H:i d.m.Y',$start_time).' '.$val['topic'].' '.$meet['id'].' '.$meet['password'].' Перейти '.$val['join_url'].' длит: '.$val['duration'].'мин. ';*/ } /*$val['p1'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p2'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p3'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p4'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p5'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p6'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)"; $val['p7'] = "[ПИ-11] Алгебра и геометрия (Иванов И.И.)";*/ $channel[] = $val; } } $smarty->assign('channel', $channel); $smarty->assign('timetable', $timetable); $maincontent = $smarty->fetch('tpl_teach_timetable_web.html'); } if ($_GET['page'] == 'zamdekan'){ $maincontent = $smarty->fetch('tpl_teacher_zamdekan.html'); } //Элективные дисциплины по физической культуре и спорту if ($_GET['page'] == 'fk'){ $message = ''; //контейнер для сообщений //echo '
'.print_r($_GET,1).'
'; exit(); //Array( [teach] => [page] => fk [des] => prepods [id] => 35) if(isset($_GET['delstudent'])){//удаляем студента из записи на ЭД $id = (int)$_GET['id']; $sql = 'DELETE FROM '.$ST['dbpf'].'_fk_order WHERE id='.$id.' LIMIT 1'; $rez = $DB->QUR($sql); header('location: https://eios.mkgtu.ru/teach/fk/prepods/');exit(); } //добавляем в расписание if (isset($_POST['save_fk'])){ $code = $_POST['code']; //в виде (день-номерпары-преподаватель) $facult = $_POST['facult']; //массив факультетов $section = $_POST['section']; //элективная дисциплина по физической культуре и спорту $course = $_POST['course']; //курс студентов $count = $_POST['count']; //возможное количество студентов для записи $disability = $_POST['disability']; //для студентов, имеющих инвалидность if ($disability == 'on') $disability = 1; else $disability = 0; $facults = ''; //массив факультетов в строке, чтобы удобно было в будущем заносить в БД или перебирать (2,6,9 - например) $i = 0; while ($i <= (count($facult)-1)){ if ($i != 0) $facults .= ','; $facults .= $facult[$i]; $i++; } //разбиваем день, номер пары и преподавателя $past = explode('-', $code); $day = $past[0]; switch ($day){ case 'Пн': $day = 1; break; case 'Вт': $day = 2; break; case 'Ср': $day = 3; break; case 'Чт': $day = 4; break; case 'Пт': $day = 5; break; case 'Сб': $day = 6; break; } $couple = $past[1]; $teacher = $past[2]; //добавляем расписание $sql = 'INSERT INTO '.$ST['dbpf'].'_fk_timetable (`id_section`, `id_teacher`, `course`, `count`, `disability`, `fakultets`) VALUES ("'.$section.'", "'.$teacher.'", "'.$course.'", "'.$count.'", "'.$disability.'", "'.$facults.'")'; //$message .= $sql; $rez = $DB->QUR($sql); //теперь добавляем день и номер пары, к которому относится данная дисциплина $sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable ORDER BY `id` DESC LIMIT 1'; $rez = $DB->QUR_SEL($sql); $timetable = $rez[1]['id']; $sql = 'INSERT INTO '.$ST['dbpf'].'_fk_details (`id_timetable`, `day`, `couple`) VALUES ("'.$timetable.'", "'.$day.'", "'.$couple.'")'; $rez = $DB->QUR($sql); $message .= 'Расписание успешно отредактировано'; save_logs('Преподаватель '.$_SESSION['user']['id'].' : '.$_SESSION['user']['fio'].' сделал изменения в расписании элективных дисциплин по физической культуре (День: '.$day.', Номер пары: '.$couple.', Преподаватель: '.$teacher.') '); } //Редактируем расписание if (isset($_POST['edit_fk'])){ //echo '
'.print_r($_POST,1).'
';//exit(); //Array( // [code] => 124 [section] => 1 [course] => 2 [count] => 22 // [facult] => Array([0] => 6) [edit_fk] => Редактировать //) //Array( // [code] => 47 [section] => 1 [course] => 2 [count] => 27 // [facult] => Array( [0]=>5 [1]=>8 [2]=>11 [3]=>13 [4]=>14 ) // [edit_fk] => Редактировать //) if(isset($_POST['disability'])) $disability = ',disability=1'; else $disability=''; $sql = 'UPDATE acs_fk_timetable SET id_section='.(int)$_POST['section'].',course='.(int)$_POST['course'].',count='.(int)$_POST['count'].',fakultets="'.$DB->rescape(implode(',',$_POST['facult'])).'"'.$disability.' WHERE id='.(int)$_POST['code']; $rez = $DB->QUR($sql); //echo $sql.'
'.print_r($rez,1).'
'; exit(); } /*=================================*/ //формируем таблицу с расписанием $sql = 'SELECT teach.id as id_teach, teach.*, user.* FROM '.$ST['dbpf'].'_teachers as teach, '.$ST['dbpf'].'_users as user WHERE teach.id_user = user.id AND teach.kafedra = "Физического воспитания"'; $rez = $DB->QUR_SEL($sql); $teachers = array(); if ($rez){ foreach ($rez as $key => $val) if ($key){ $val['id_teach'] = $val['id_teach']; $teachers[] = $val; } } //выводим секции $sections = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_section'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key) $sections[] = $val; } //выводим факультеты $m1=array(''); $faculties = array(); $faculties_arr = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_faculties'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key) { $faculties[] = $val; $faculties_arr[$val['id']] = $val['abbreviated']; } } //для вывода расписания $days = array( 'Пн' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' ), 'Вт' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' ), 'Ср' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' ), 'Чт' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' ), 'Пт' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' )/*, 'Сб' => array( '1' => '8.00 - 9.30', '2' => '9.40 - 11.10', '3' => '11.30 - 13.00', '4' => '13.10 - 14.40', '5' => '15.00 - 16.30', '6' => '16.40 - 18.10', '7' => '18.20 - 19.50' )*/ ); //смотрим, какое время и где забронировано уже - чтобы не выводить "плюсики" $zanyato = array(); $mesta = array(); $ident = array(); //Таблица: acs_fk_details: id,id_timetable,day,couple //Таблица: acs_fk_timetable: id,id_section,id_teacher,course,count,disability,fakultets $sql = 'SELECT det.*, tim.*,tim.id as timid FROM '.$ST['dbpf'].'_fk_details as det, '.$ST['dbpf'].'_fk_timetable as tim WHERE tim.id = det.id_timetable'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ //преобразовываем день в число switch ($val['day']){ case 1: $val['day'] = 'Пн'; break; case 2: $val['day'] = 'Вт'; break; case 3: $val['day'] = 'Ср'; break; case 4: $val['day'] = 'Чт'; break; case 5: $val['day'] = 'Пт'; break; case 6: $val['day'] = 'Сб'; break; } $sql_section = 'SELECT * FROM '.$ST['dbpf'].'_fk_section WHERE `id` = "'.$val["id_section"].'"'; $rez_section = $DB->QUR_SEL($sql_section); $section = $rez_section[1]['sokr']; $fak_names = array(); $tmp_f = explode(',',$val['fakultets']); foreach($tmp_f as $kf => $vf){ $fak_names[] = $faculties_arr[$vf]; } $sql1 = 'SELECT id FROM '.$ST['dbpf'].'_fk_order WHERE id_timetable = '.$val['timid']; $rez1 = $DB->QUR_SEL($sql1); $zan=0; if ($rez1){ $zan=$rez1[0]; } //$mesta[$val['day']][$val['couple']][$val['id_teacher']]['count'] = $val['count']; //$mesta[$val['day']][$val['couple']][$val['id_teacher']]['zanyt'] = $zan; $md5fak = md5($val['fakultets']); if(!isset($mesta[$md5fak][$val['id_section']][$val['course']][$val['id_teacher']]['count'])) $mesta[$md5fak][$val['id_section']][$val['course']][$val['id_teacher']]['count'] = $val['count']; if(!isset($mesta[$md5fak][$val['id_section']][$val['course']][$val['id_teacher']]['zanyt'])) $mesta[$md5fak][$val['id_section']][$val['course']][$val['id_teacher']]['zanyt'] = $zan; else $mesta[$md5fak][$val['id_section']][$val['course']][$val['id_teacher']]['zanyt'] -= $zan; //занято в определенный день в определенное время определенным преподавателем - название дисциплины, курс и факультеты $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['text'] = $section.' ('.$val["course"].' курс)
'.implode(', ',$fak_names); $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['section'] = $section; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['id_section'] = $val['id_section']; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['course'] = $val["course"]; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['fak_names'] = $fak_names; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['fakultets'] = $md5fak; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['timid'] = $val['timid']; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['zanyato'] = $zan; $zanyato[$val['day']][$val['couple']][$val['id_teacher']]['count'] = $val['count']; $ident[$val['day']][$val['couple']][$val['id_teacher']] = $val['timid']; } } $zanyato_new = array(); foreach($zanyato as $day22 => $times_couple22){ foreach($times_couple22 as $time_couple22 => $teachers22) { foreach($teachers22 as $teacher_id22 => $data22) { if(!isset($zanyato_new[$teacher_id22][$data22['id_section']][$data22['course']][$data22['fakultets']])) { $zanyato_new[$teacher_id22][$data22['id_section']][$data22['course']][$data22['fakultets']]['zanyato'] = $data22['zanyato']; $zanyato_new[$teacher_id22][$data22['id_section']][$data22['course']][$data22['fakultets']]['count'] = $data22['count']; }else{ if($zanyato_new[$teacher_id22][$data22['id_section']][$data22['course']][$data22['fakultets']]['zanyato']<$data22['zanyato']) $zanyato_new[$teacher_id22][$data22['id_section']][$data22['course']][$data22['fakultets']]['zanyato'] = $data22['zanyato']; } } } } //echo '
'.print_r($zanyato_new,1).'
';exit(); //секции, которые доступны определенному преподавателю $id_teacher = $_SESSION['user']['teacher']['id']; $sections_teacher = array(); $sql_timetable = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable WHERE `id_teacher` = "'.$id_teacher.'" GROUP BY id_section, course, fakultets'; //Если статус заведующего кафедрой, то доступ ко всем записанным есть if (($_GET["des"] == 'zavkaf')&&($_SESSION['user']['status'] == 30)) $sql_timetable = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable GROUP BY id_section, course, id_teacher'; //----------------------------- //print_r($faculties); $rez_timetable = $DB->QUR_SEL($sql_timetable); foreach ($rez_timetable as $key => $val) if ($key){ /*преподаватель - имя пользователя*/ $teach = $rez_timetable['id_teacher']; $sql_teach = 'SELECT us.*, teach.* FROM '.$ST['dbpf'].'_users as us, '.$ST['dbpf'].'_teachers as teach WHERE teach.id = "'.$val["id_teacher"].'" AND us.id = teach.id_user'; $rez_teach = $DB->QUR_SEL($sql_teach); $val['teacher'] = $rez_teach[1]['fio']; //***************** $sql_sect = 'SELECT * FROM '.$ST['dbpf'].'_fk_section WHERE `id` = "'.$val["id_section"].'"'; $rez_sect = $DB->QUR_SEL($sql_sect); $val['name'] = $fk_section['name'] = $rez_sect[1]['name']; $val['content'] = '';// $val['content'] .= ''; $val['content'] .= ''; $sql_student = 'SELECT * FROM '.$ST['dbpf'].'_fk_order WHERE id_timetable = "'.$val['id'].'"'; $rez_student = $DB->QUR_SEL($sql_student); foreach ($rez_student as $key_s => $val_s) if ($key_s){ $sql_user = 'SELECT * FROM '.$ST['dbpf'].'_users as users, '.$ST['dbpf'].'_students as students WHERE users.id = "'.$val_s['id_student'].'" AND students.id_user = users.id'; $rez_user = $DB->QUR_SEL($sql_user); // $sql_grupp = 'SELECT sokr FROM '.$ST['dbpf'].'_grupp WHERE id = '.$rez_user[1]['id_grupp']; $rez_grupp = $DB->QUR_SEL($sql_grupp); //$val['content'] .= '
  • '.$rez_user[1]['fio'].' (Группа: ЛД-'.$val['course'].$rez_user[1]['num_grupp'].')
  • '; $adel = ' Удалить запись студента'; //$val['content'] .= '
  • '.$rez_user[1]['fio'].' (Группа: '.$rez_grupp[1]['sokr'].')'.$adel.'
  • '; $val['content'] .= ''; $val['content'] .= ''; $val['content'] .= ''; $val['content'] .= ''; $ocenka = fk_attest_get(array('id_user'=>$rez_user[1]['id'],'id_grupp'=>$rez_user[1]['id_grupp'],'id_teacher'=>$id_teacher)); $val['content'] .= ''; //$val['content'] .= ''; $val['content'] .= ''; $val['content'] .= ''; } //$val['content'] .= ''; //$val['content'] .= ''; //$val['content'] .= ''; //$val['content'] .= ''; //$val['content'] .= ''; $val['content'] .= '
    Промеж.атт (Оценка, пропуски)
    СтудентГруппаТекущ.атт (Оценка, пропуски)Действие
    '.$key_s.''.$rez_user[1]['fio'].''.$rez_grupp[1]['sokr'].''; $val['content'] .= ''; $val['content'] .= ''; $val['content'] .= ''; $val['content'] .= '
    Выставить
    '; //$val['content'] .= ''; //$val['content'] .= ''; //$val['content'] .= ''; //$val['content'] .= '
    Выставить
    '.$adel.'
    После того как нажмете "Закрыть ведомость" нельзя будет изменить выставленные оценки!Закрыть ведомость
    '; //теперь смотрим какие факультеты могут записываться к этому преподавателю на секцию $facultet_section = explode(",", $val['fakultets']); $val['fac_name'] = array(); foreach ($facultet_section as $key_f => $val_f){ $sql_ff = 'SELECT * FROM '.$ST['dbpf'].'_faculties WHERE id = "'.$val_f.'"'; $rez_ff = $DB->QUR_SEL($sql_ff); $val['fac_name'][] = $rez_ff[1]['name']; } //print_r($val['fac_name']); $sections_teacher[] = $val; } //список незаписавшихся преподавателей $no_order_list_students = array(); $sql_no_order = 'SELECT st.*, us.* FROM '.$ST['dbpf'].'_students as st, '.$ST['dbpf'].'_users as us WHERE (st.id_grupp = 171 OR st.id_grupp = 236 OR st.id_grupp = 301) AND st.id_user = us.id'; $rez_no_order = $DB->QUR_SEL($sql_no_order); foreach ($rez_no_order as $key => $val) if ($key){ $id_user = $val['id_user']; $sql_is_order = 'SELECT * FROM '.$ST['dbpf'].'_fk_order WHERE `id_student` = "'.$id_user.'"'; $rez_is_order = $DB->QUR_SEL($sql_is_order); //если нет записи, значит студент еще не записывался if ($rez_is_order[0] == 0){ $no_order_list_students[] = $val; } } /************************/ $smarty->assign('page', $_GET["des"]); $smarty->assign('message', $message); $smarty->assign('teacher', $teachers); $smarty->assign('faculties', $faculties); $smarty->assign('sections', $sections); $smarty->assign('sections_teacher', $sections_teacher); $smarty->assign('days', $days); $smarty->assign('zanyato', $zanyato); $smarty->assign('zanyato_new', $zanyato_new); $smarty->assign('mesta', $mesta); $smarty->assign('students_no_order', $no_order_list_students); $smarty->assign('ident', $ident); $smarty->assign('kaf', $_SESSION['user']['teacher']['kafedra']); $maincontent = $smarty->fetch('tpl_teacher_fk.html'); } if($_GET['page']=='students'){//студенты $items=array(); $regim='show'; if(isset($_POST['grupp_change_submit'])){ //echo '
    '.print_r($_POST,1).'
    '; foreach($_POST['grupp_change'] as $id => $val){ $sql = 'UPDATE '.$ST['dbpf'].'_students SET id_grupp='.$val['grupp'].', num_grupp="'.$val['pgrupp'].'", status=1 WHERE id='.$id.''; $rez = $DB->QUR($sql); } } $ST['page']['name'] = 'Список студентов'; if (isset($_GET['des'])){ if ($_GET['des']=='del'){//удаление $id=(int)$_GET['id']; $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_students WHERE id='.$id.''); if(!$rez['err']){ $form['msg']='Анкета успешно удалена.'; save_logs('Анкета студента удалена '.$id.''); //надо подчистить оценки $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_ocenki WHERE id_student='.$id.''); }else $form['err'][]='Ошибка при удалении!'; } if ($_GET['des']=='dec'){//отказ $id=(int)$_GET['id']; $ST['page']['name'] = 'Отказ студенту'; $rez=$DB->QUR('UPDATE '.$ST['dbpf'].'_students SET id_grupp=0 WHERE id='.$id.''); if(!$rez['err']){ $form['msg']='Статус анкеты ОТКАЗ.'; save_logs('Анкета студента отказ '.$id.''); //надо подчистить оценки $rez=$DB->QUR('DELETE FROM '.$ST['dbpf'].'_ocenki WHERE id_student='.$id.''); }else $form['err'][]='Ошибка при установки статуса анкеты'; } if ($_GET['des']=='ace'){//соглас $id=(int)$_GET['id']; $ST['page']['name'] = 'Подтверждение студенту'; $rez=$DB->QUR('UPDATE '.$ST['dbpf'].'_students SET status=1 WHERE id='.$id.''); if(!$rez['err']){ $form['msg']='Статус анкеты ПРИНЯЛИ.'; save_logs('Анкета студента принята '.$id.''); }else $form['err'][]='Ошибка при установки статуса анкеты'; } } $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=-2 ORDER BY data_u'; if($_SESSION['user']['status']==99) //В ОЖИДАНИИ $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=0 ORDER BY data_u DESC LIMIT 10';//очень много выходит! else { $s='SELECT * FROM '.$ST['dbpf'].'_grupp_teachers WHERE id_teacher='.$_SESSION['user']['teacher']['id'].''; $r=$DB->QUR_SEL($s);if ($r){ $idgrupps =array(); foreach($r as $k => $v)if($k){ $idgrupps[] = $v['id_grupp']; } if(count($idgrupps)){ $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=0 AND (id_grupp='.implode(' OR id_grupp=',$idgrupps).') ORDER BY data_u'; } } } $rez = $DB->QUR_SEL($sql);//МОДЕРИРОВАНИЕ АНКЕТ if($rez){ foreach($rez as $key => $val)if($key){ $val['data_с']=date('H:i d.m.Y',$val['data_с']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['user']=get_user($val['id_user']); $val['grupp']=get_grupp($val['id_grupp']); $items[]=$val; } } //$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 ORDER BY data_u';//ОДОБРЕННЫЕ //$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=-2 ORDER BY data_u'; if(isset($_POST['search_go'])){//результат поиска $search_fio = addslashes($_POST['search_fio']); $sql = 'SELECT s.* FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE u.id=s.id_user AND u.fio LIKE "%'.$search_fio.'%"'; }else{//отображение своих студентов if($_SESSION['user']['status']==99) //В ОЖИДАНИИ $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 ORDER BY id_grupp,num_grupp,data_u DESC LIMIT 10'; else { /*$s='SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id_teacher='.$_SESSION['user']['teacher']['id'].' LIMIT 1'; $r=$DB->QUR_SEL($s);if ($r){ $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 AND id_grupp='.$r[1]['id'].' ORDER BY data_u'; }*/ $s='SELECT * FROM '.$ST['dbpf'].'_grupp_teachers WHERE id_teacher='.$_SESSION['user']['teacher']['id'].''; $r=$DB->QUR_SEL($s);if ($r){ $idgrupps =array(); foreach($r as $k => $v)if($k){ $idgrupps[] = $v['id_grupp']; } if(count($idgrupps)){ $sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 AND (id_grupp='.implode(' OR id_grupp=',$idgrupps).') ORDER BY id_grupp,num_grupp,data_u LIMIT 25'; //если выбрана группа if (isset($_GET['gr'])) { $id_gr = $_GET['gr']; //$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 AND id_grupp='.$id_gr).' ORDER BY id_grupp,num_grupp,data_u '; //$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE status=1 AND id_grupp='.$id_gr.' LIMIT 10'; } } } } } $rez = $DB->QUR_SEL($sql);//ОДОБРЕННЫЕ СТУДЕНТЫ //echo $sql.'
    '.print_r($rez,1).'
    ';exit(); if($rez){ foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['user']=get_user($val['id_user']); $val['grupp']=get_grupp($val['id_grupp']); $items1[]=$val; } } /*!-- BEGIN ПРИВЯЗАННЫЕ ГРУППЫ К ПРЕПОДАВАТЕЛЮ --*/ $id_prepod=$_SESSION['user']['teacher']['id']; $sql = 'SELECT g.* FROM '.$ST['dbpf'].'_grupp as g, '.$ST['dbpf'].'_grupp_teachers as gt WHERE gt.id_teacher='.$id_prepod.' AND gt.id_grupp=g.id'; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val) if($key){ $grupp[]=$val; } } $smarty->assign('grupp', $grupp); /*!-- END --*/ //echo '
    '.print_r($grupp, 1).'
    '; $id_gr = $_GET["gr"]; $smarty->assign('gr', $id_gr); $ggg = get_sel_grupp(); //echo '
    '.print_r($ggg,1).'
    '; $smarty->assign('sel_grupp',$ggg); $smarty->assign('regim',$regim); $smarty->assign('items',$items); $smarty->assign('items1',$items1); $smarty->assign('form',$form); $maincontent = $smarty->fetch('tpl_teacher_students.html'); } } function grupp_teachers(){ GLOBAL $ST,$DB; $items = array(); $sql='SELECT g.* FROM '.$ST['dbpf'].'_grupp as g,'.$ST['dbpf'].'_grupp_teachers as gt WHERE gt.id_teacher='.$_SESSION['user']['teacher']['id'].' AND gt.id_grupp=g.id ORDER BY g.kurs,g.sokr'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ $val['data_c']=date('H:i d.m.Y',$val['data_c']); $val['data_u']=date('H:i d.m.Y',$val['data_u']); $val['teacher']=get_teacher_user($val['id_teacher']); $rez1=$DB->QUR_SEL('SELECT id FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].' AND status!=0'); if($rez1) $val['students']=$rez1[0]; else $val['students']=0; if (get_prava_grupp($val['id_teacher'])) $val['edde']=1; else $val['edde']=0; $items[$i]=$val; $i++; } } return $items; } //для парсинга текста function getSslPage($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close($ch); return $result; } //сортировка массива function aasort (&$array, $key) { $sorter=array(); $ret=array(); reset($array); foreach ($array as $ii => $va) { $sorter[$ii]=$va[$key]; } asort($sorter); foreach ($sorter as $ii => $va) { $ret[$ii]=$array[$ii]; } $array=$ret; } function get_ocenki($id_grupp,$id_prepod){ GLOBAL $ST,$DB; $ocenki['grupp']=array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$id_grupp.''; $rez = $DB->QUR_SEL($sql); if($rez){ $ocenki['grupp']=$rez[1]; } $ocenki['students']=array(); //выберем всех студентов /*$sql = 'SELECT * FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$id_grupp.' '; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_users WHERE id='.$val['id_user'].' AND status>-1 LIMIT 1'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ $val['user'] = $rez1[1]; $ocenki['students'][]=$val; } else { $val['user'] = array(); } //$ocenki['students']['user']['fio'] = trim($ocenki['students']['user']['fio']); } } */ //$sql = 'SELECT s.*,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.email as uemail,u.pass as upass,u.status as ustatus,u.fio as ufio,u.foto as ufoto FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE s.id_grupp='.$id_grupp.' AND u.status>-1 AND u.id=s.id_user ORDER BY u.fio'; $sql = 'SELECT s.*,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.email as uemail,u.pass as upass,u.status as ustatus,u.fio as ufio,u.foto as ufoto FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE s.id_grupp='.$id_grupp.' AND s.status = 1 AND u.status>-1 AND u.id=s.id_user ORDER BY u.fio'; if (isset($_GET["podgruppa"])){ //если указана подгруппа, то выводим только студентов этой подгруппы $podgruppa = $_GET["podgruppa"]; //$sql = 'SELECT s.*,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.email as uemail,u.pass as upass,u.status as ustatus,u.fio as ufio,u.foto as ufoto FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE s.id_grupp='.$id_grupp.' AND s.num_grupp='.$podgruppa.' AND u.status>-1 AND u.id=s.id_user ORDER BY u.fio'; $sql = 'SELECT s.*,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.email as uemail,u.pass as upass,u.status as ustatus,u.fio as ufio,u.foto as ufoto FROM '.$ST['dbpf'].'_students as s,'.$ST['dbpf'].'_users as u WHERE s.id_grupp='.$id_grupp.' AND s.status = 1 AND s.num_grupp='.$podgruppa.' AND u.status>-1 AND u.id=s.id_user ORDER BY u.fio'; } $rez = $DB->QUR_SEL($sql); //echo $sql.'
    '.print_r($rez,1).'
    '; //SELECT s.*,u.id as uid,u.data_c as udata_c,u.data_u as udata_u,u.email as uemail,u.pass as upass,u.status as ustatus,u.fio as ufio,u.foto as ufoto FROM acs_students as s,acs_users as u WHERE s.id_grupp=780 AND s.status = 1 AND u.status>-1 AND u.id=s.id_user ORDER BY u.fio //Array() if($rez){ foreach($rez as $key => $val)if($key){ $val['user'] = array('id'=>$val['uid'],'data_c'=>$val['udata_c'],'data_u'=>$val['udata_u'],'email'=>$val['uemail'],'pass'=>$val['upass'],'status'=>$val['ustatus'],'fio'=>$val['ufio'],'foto'=>$val['ufoto']); $ocenki['students'][]=$val; } } //сортируем массив //aasort($ocenki['students'], 'fio'); //выберем все дисциплины $ocenki['lections']=array(); //lections if($id_prepod!=0) $sql = 'SELECT l.* FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$id_grupp.' AND lg.id_lections=l.id AND l.id_teacher='.$id_prepod.' ORDER BY l.kurs,l.semestr'; else $sql = 'SELECT l.* FROM '.$ST['dbpf'].'_lections as l,'.$ST['dbpf'].'_lections_grupp as lg WHERE lg.id_grupp='.$id_grupp.' AND lg.id_lections=l.id ORDER BY l.kurs,l.semestr'; $rez = $DB->QUR_SEL($sql); //echo $sql.'
    '.print_r($rez,1).'
    ';exit(); // [50] => Array( [id] => 60743 [data_c] => 1699872431 [data_u] => 1699872431 [id_teacher] => 295 // [specialnost] => [kurs] => 3 [semestr] => 5 [name] => Элективные дисциплины по физической культуре и спорту // [descrip] => лекция [file] => [type] => лек ) if($rez){ foreach($rez as $key => $val)if($key){ if($id_prepod==0){ $sql1 = 'SELECT u.fio FROM '.$ST['dbpf'].'_teachers as t,'.$ST['dbpf'].'_users as u WHERE NOT(u.status = -1) AND u.id=t.id_user AND t.id='.$val['id_teacher'].''; $rez1 =$DB->QUR_SEL($sql1); $val['fioprep']=$rez1[1]['fio']; $val["prepod_name"] = $val['fioprep']; }else{ $val['fioprep']=$_SESSION['user']['fio']; } $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_practich WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['practich'][] = $val1; } } else $val['practich'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_sr WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['sr'][] = $val1; } } else $val['sr'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_controln WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['controln'][] = $val1; } } else $val['controln'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_praktika WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['praktika'][] = $val1; } } else $val['praktika'] = array(); $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_kursov WHERE id_lection='.$val['id'].' ORDER BY name'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ foreach($rez1 as $key1 => $val1)if($key1){ $val['kursov'][] = $val1; } } else $val['kursov'] = array(); $ocenki['lections'][]=$val; } } //echo '
    '.print_r($ocenki,1).'
    ';exit(); //[49] => Array( // [id] => 60743 [data_c] => 1699872431 [data_u] => 1699872431 [id_teacher] => 295 // [specialnost] => [kurs] => 3 [semestr] => 5 // [name] => Элективные дисциплины по физической культуре и спорту // [descrip] => лекция [file] => [type] => лек // [fioprep] => Двойникова Елена Сергеевна [prepod_name] => Двойникова Елена Сергеевна // [practich] => Array ( // [0] => Array ( // [id] => 13395 [data_c] => 1699872431 [data_u] => 1699872431 // [id_teacher] => 295 [id_lection] => 60743 // [name] => Элективные дисциплины по физической культуре и спорту // [descrip] => практические занятия // [file] => // ) // ) $data_c1 = get_data_startsemestr(); if ($data_c1 < 10) $data_c1 = 0; //выберем все оценки if($id_prepod!=0) $sql = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_grupp='.$id_grupp.' AND id_prepod='.$id_prepod.' AND data_c>='.$data_c1.''; else $sql = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_grupp='.$id_grupp.' AND data_c>='.$data_c1.''; $rez = $DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $ocenki['saves']['propusk'][$val['id_what']][$val['id_student']]=$val['propusk']; $ocenki['saves']['upv'][$val['id_what']][$val['id_student']]=$val['upv']; if($val['what']=='lection') { $ocenki['saves']['ol'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; $ocenki['datas']['ol'][$val['id_what']]=date('d.m.Y',$val['data_c']); } if($val['what']=='practich') { $ocenki['saves']['pr'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; $ocenki['datas']['pr'][$val['id_what']]=date('d.m.Y',$val['data_c']); } if($val['what']=='controln') { $ocenki['saves']['co'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; $ocenki['datas']['co'][$val['id_what']]=date('d.m.Y',$val['data_c']); } if($val['what']=='praktika') { $ocenki['saves']['pra'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; $ocenki['datas']['pra'][$val['id_what']]=date('d.m.Y',$val['data_c']); } if($val['what']=='kursov') { $ocenki['saves']['kur'][$val['id_what']][$val['id_student']][$val['type']]=$val['ocenka']; $ocenki['datas']['kur'][$val['id_what']]=date('d.m.Y',$val['data_c']); } } } //echo $sql.'
    '.print_r($ocenki,1).'
    ';exit(); //SELECT * FROM acs_ocenki WHERE id_grupp=168 AND data_c>=1576098000 //удалим лекции у которых нет оценок - тогда преподы не могут выставлять /*foreach ($ocenki['lections'] as $k => $v){ $del=1; if(isset($ocenki['saves']['propusk'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['upv'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['ol'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['pr'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['co'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['pra'][$v['id']])){ $del=0;} if(isset($ocenki['saves']['kur'][$v['id']])){ $del=0;} if($del==1) unset($ocenki['lections'][$k]); }*/ return $ocenki; } /* function get_sel_grupp0($id){ GLOBAL $ST,$DB; $out=array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez=$DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $out[$key]=$val; if($id==$val['id']) $out[$key]['active']=1; } } return $out; }*/ function get_lection($id){//Получение лекций GLOBAL $ST,$DB; $out=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$id.''; $rez=$DB->QUR_SEL($sql); if($rez){ $out=$rez[1]; } return $out; } /* function get_user($id){ GLOBAL $ST,$DB; $out=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_users WHERE id='.$id.''; $rez=$DB->QUR_SEL($sql); if($rez){ $out=$rez[1]; unset($out['pass']); } return $out; } */ function upload_lection($name,$dir_dest){ $file=''; $tmpfile=array(); //if(count($_FILES[$name]['name'])>0){//загружаем массив файлов if(is_array($_FILES[$name]['name'])){//загружаем массив файлов //echo '1'; $masf = $_FILES[$name]; foreach($masf['name'] as $k => $v){ $_FILES[$name]['name']=$v; $_FILES[$name]['type']=$masf['type'][$k]; $_FILES[$name]['tmp_name']=$masf['tmp_name'][$k]; $_FILES[$name]['error']=$masf['error'][$k]; $_FILES[$name]['size']=$masf['size'][$k]; $handle = new Upload($_FILES[$name]); if ($handle->uploaded) { $handle->file_new_name_body = $_SESSION['user']['id'].'_'.$_SESSION['user']['teacher']['id'].'_'.date('HisdmY').'_'.$k; $handle->Process($dir_dest); if ($handle->processed) { $tmpfile[]=$handle->file_dst_name; } $handle-> Clean(); } } /*Array([file] => Array( [name] => Array([0] => 25letmgtu.png[1] => геом1.jpg[2] => геом0.jpg) [type] => Array([0] => image/png[1] => image/jpeg[2] => image/jpeg) [tmp_name] => Array([0] => /tmp/phpqPxIbC[1] => /tmp/phpmkGpHH[2] => /tmp/phpUSXpCN) [error] => Array([0] => 0[1] => 0[2] => 0) [size] => Array([0] => 151792[1] => 455902[2] => 490560) ))*/ if(count($tmpfile)){ $file = implode('|',$tmpfile); } }else{ //echo '2'; $handle = new Upload($_FILES[$name]); if ($handle->uploaded) { echo '3'; $handle->file_new_name_body = $_SESSION['user']['id'].'_'.$_SESSION['user']['teacher']['id'].'_'.date('HisdmY'); $handle->Process($dir_dest); if ($handle->processed) { //echo '4'; $file=$handle->file_dst_name; }else{ //echo '5'; } $handle-> Clean(); } } //echo $file; return $file; } function get_sel_grupp_tr($id){ GLOBAL $ST,$DB; $out=array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_grupp ORDER BY sokr,kurs'; $rez=$DB->QUR_SEL($sql); if($rez){ foreach($rez as $key => $val)if($key){ $rez1=$DB->QUR_SEL('SELECT count(id) as kol FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].''); //$rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_students WHERE id_grupp='.$val['id'].''); $val['kol'] = $rez1[1]['kol']; //$val['kol'] = $rez1[0]; $out[$key]=$val; if($id==$val['id']) $out[$key]['active']=1; } } return $out; } ?>