'.print_r($_POST,1).''; if(isset($_POST['quest'])){ foreach($_POST['quest'] as $id_quest => $id_answer){ $text_q=''; $sql = 'SELECT tip,ocenka,text_q FROM '.$ST['dbpf'].'_test_questions WHERE id='.$id_quest.' AND id_tests='.$id_test.' LIMIT 1'; $rez = $DB->QUR_SEL($sql); if($rez){ $text_q = addslashes($rez[1]['text_q']); $questocenka = $rez[1]['ocenka']; if($questocenka==0) $questocenka = 1; if($rez[1]['tip']==0){//один ответ $text_a=''; $sball=0; $sql1 = 'SELECT ocenka,text_a FROM '.$ST['dbpf'].'_test_answers WHERE id_questions='.$id_quest.' AND id='.$id_answer.' LIMIT 1'; $rez1 = $DB->QUR_SEL($sql1); //$msg['msg'][]='один ответ0:
'.$sql1.print_r($rez1,1).''; if($rez1){ if($rez1[1]['ocenka']==0){ $ball++; //$sball=1; $sball=$questocenka; //27042020-добавил } $text_a = $rez1[1]['text_a']; } $sql3 = 'INSERT INTO '.$ST['dbpf'].'_test_users_otvet VALUES(0,'.time().','.$id_test.','.$id_quest.','.$id_answer.',"'.$text_q.'","'.addslashes($text_a).'","",'.$sball.','.$_SESSION['user']['id'].')'; $rez3 = $DB->QUR($sql3); //$msg['msg'][]='один ответ:
'.print_r($rez3,1).''; } if($rez[1]['tip']==1){//множественный ответ $text_a=''; $sball=0; //выберем кол-во правильных ответов $kol_prav=0; $sql2 = 'SELECT COUNT(id) as kol FROM '.$ST['dbpf'].'_test_answers WHERE id_questions='.$id_quest.' AND ocenka=0'; $rez2 = $DB->QUR_SEL($sql2); //$msg['msg'][]='множественный ответ0:
'.$sql2.print_r($rez2,1).''; //кол-во правильных ответов if($rez2){ $kol_prav=$rez2[1]['kol']; } if($kol_prav){//узнаем ответы пользователя foreach($id_answer as $k => $id_answerm){ $sball=0; $sql1 = 'SELECT ocenka,text_a FROM '.$ST['dbpf'].'_test_answers WHERE id_questions='.$id_quest.' AND id='.$id_answerm.' LIMIT 1'; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ if($rez1[1]['ocenka']==0){//правильный $ball+=(1/$kol_prav); //$sball=(1/$kol_prav); $sball=($questocenka/$kol_prav); //27042020 добавил } else{ $ball+=($rez1[1]['ocenka']/$kol_prav); //$sball=($rez1[1]['ocenka']/$kol_prav); $sball=-($questocenka/$kol_prav); //27042020 добавил } $text_a = $rez1[1]['text_a']; } $sql3 = 'INSERT INTO '.$ST['dbpf'].'_test_users_otvet VALUES(0,'.time().','.$id_test.','.$id_quest.','.$id_answerm.',"'.$text_q.'","'.addslashes($text_a).'","",'.$sball.','.$_SESSION['user']['id'].')'; $rez3 = $DB->QUR($sql3); //$msg['msg'][]='множественный ответ:
'.print_r($rez3,1).''; } } } if($rez[1]['tip']==2){//ответ вводится вручную $text_a=''; $sball=0; $sida = 0; $sql2 = 'SELECT id,text_a FROM '.$ST['dbpf'].'_test_answers WHERE id_questions='.$id_quest.' AND ocenka=1'; $rez2 = $DB->QUR_SEL($sql2); if($rez2){ if($rez2[1]['text_a']==$id_answer) { $ball++; $sbal=1; } $text_a = $rez1[1]['text_a']; $sida = $rez1[1]['id']; } $sql3 = 'INSERT INTO '.$ST['dbpf'].'_test_users_otvet VALUES(0,'.time().','.$id_test.','.$id_quest.','.$sida.',"'.$text_q.'","'.addslashes($text_a).'","'.$id_answer.'",'.$sball.','.$_SESSION['user']['id'].')'; $rez3 = $DB->QUR($sql3); } if($rez[1]['tip']==3){//ответ от 1 до оценки $text_a=''; $sball=0; $sida = 0; $ball+=$id_answer; $sball=$id_answer; $sql3 = 'INSERT INTO '.$ST['dbpf'].'_test_users_otvet VALUES(0,'.time().','.$id_test.','.$id_quest.','.$sida.',"'.$text_q.'","'.$id_answer.'","'.$id_answer.'",'.$sball.','.$_SESSION['user']['id'].')'; $rez3 = $DB->QUR($sql3); } } } } $msg['msg'][]='Тест пройден! Результаты вы можете уточнить у преподавателя.'; unset($_GET['des']); } $regim = 'tests'; $tests=array(); //$maincontent = '
'.print_r($val,1).''.print_r($val1,1).''; $tests[$val['id']]['tests'][]=$val1; } } } } } $smarty->assign('tests',$tests);//'
'.print_r($tests,1).''. } if(isset($_GET['des'])){//Отобразим тест $id_test = (int)$_GET['des']; $test=array(); $regim = 'test'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_test_tests WHERE id='.$id_test.' LIMIT 1'; $rez = $DB->QUR_SEL($sql); if($rez){ $test = $rez[1]; $testsq = ''; if($test['tests']==1){//тестовый if($val1['data_testa']!=0){ if($test['data_testa']<=time()){//контрольный $testsq = ''; }else $testsq = ' AND tests=1'; }else $testsq = ' AND tests=1'; }else{//контрольный $testsq = ''; } if($test['random_q']==1){//случайные вопросы $orderby = ' ORDER BY rand()'; }else{//не случайные вопросы $orderby = ' ORDER BY pos'; } $sql1 = 'SELECT * FROM '.$ST['dbpf'].'_test_questions WHERE id_tests='.$id_test.$testsq.' '.$orderby; $rez1 = $DB->QUR_SEL($sql1); if($rez1){ $questions=array(); foreach($rez1 as $key1 => $val1)if($key1){ $question=$val1; if($question['random_a']==1){//случайные ответы $orderby = ' ORDER BY rand()'; }else{//не случайные ответы $orderby = ' ORDER BY pos'; } $sql2 = 'SELECT * FROM '.$ST['dbpf'].'_test_answers WHERE id_questions='.$val1['id'].''.$orderby; $rez2 = $DB->QUR_SEL($sql2); if($rez2){ $question['answers']=array(); foreach($rez2 as $key2 => $val2)if($key2){ $question['answers'][]=$val2; } } $questions[]=$question; } $test['questions'] = $questions; } } $smarty->assign('test',$test); } $smarty->assign('regim',$regim); $smarty->assign('msg',$msg); //'
'.print_r($test,1).''.'
'.print_r($_POST,1).''. $maincontent = $smarty->fetch('tpl_learn_tests.html'); //} } if($_GET['page']=='ocenki'){//оценки $regim = 'ocenki_view'; if(!isset($_SESSION['user']['student'])) { header('Location: /login/'); exit(); } $id_student = $_SESSION['user']['student']['id']; $id_user = $_SESSION['user']['id']; $ocenki=array(); //$sql = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_student='.$id_student.' ORDER BY FIELD(what, "lection","practich","controln"),id_what,type'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_ocenki WHERE id_student='.$id_student.' ORDER BY FIELD(what, "lection","practich","controln"),id_prepod,id_what'; $rez = $DB->QUR_SEL($sql); //echo '
'.print_r($rez,1).''; if($rez){ foreach($rez as $key => $val)if($key){ $save=false; if($val['what']=='lection'){ if(isset($oc['id'])&&$oc['id']==$val['id_what']){ $oc['oc'][$val['type']] = $val['ocenka']; $save=true; }else{ $rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_what'].''); if($rez1){ $oc = $rez1[1]; $oc['type'] = $val['what']; $oc['oc'][$val['type']] = $val['ocenka']; } } } if($val['what']=='practich'){ if(isset($oc['id'])&&$oc['id']==$val['id_what']){ $oc['oc'][$val['type']] = $val['ocenka']; $save=true; }else{ $rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_practich WHERE id='.$val['id_what'].''); if($rez1){ $oc = $rez1[1]; $oc['type'] = $val['what']; $oc['descrip'] = $rez1[1]['descrip']; //описание материала $oc['oc'][$val['type']] = $val['ocenka']; } } } if($val['what']=='controln'){ if(isset($oc['id'])&&$oc['id']==$val['id_what']){ $oc['oc'][$val['type']] = $val['ocenka']; $save=true; }else{ $rez1 = $DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_controln WHERE id='.$val['id_what'].''); if($rez1){ $oc = $rez1[1]; $oc['type'] = $val['what']; $oc['descrip'] = $rez1[1]['descrip']; //описание материала $oc['oc'][$val['type']] = $val['ocenka']; } } } //$oc['save']=$save; //если нули, то не выводим if ($oc['oc'][1] == '0') $oc['oc'][1] = ''; if ($oc['oc'][2] == '0') $oc['oc'][2] = ''; if($save) $ocenki[]=$oc; } } //ликвидация задолженностей $liquidation = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_liquidation WHERE id_student = "'.$id_student.'" '; $rez = $DB->QUR_SEL($sql); if ($rez){ $i = 0; foreach ($rez as $key => $val) if ($key){ $val['teacher'] = get_user($val['id_teacher']); 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']); $i++; $val['pp'] = $i; $liquidation[] = $val; } } //echo '
'.print_r($ocenki,1).''; $smarty->assign('ocenki',$ocenki); $smarty->assign('regim',$regim); $smarty->assign('liquidation',$liquidation); $maincontent = $smarty->fetch('tpl_learn_ocenki.html'); } if($_GET['page']=='portfolio'){ //АКТУАЛЬНОЕ ПОРТФОЛИО $ST['page']['name'] = 'Портфолио студента'; //сохранение портфолио if (isset($_POST['save_portfolio'])){ /*echo '
'; print_r($_POST); echo '';*/ $about = nl2br(htmlspecialchars($_POST['about'])); $languages = nl2br(htmlspecialchars($_POST['languages'])); $pc = nl2br(htmlspecialchars($_POST['pc'])); $army_is = nl2br(htmlspecialchars($_POST['army_is'])); $family_status = nl2br(htmlspecialchars($_POST['family_status'])); $kind_is = nl2br(htmlspecialchars($_POST['kind_is'])); $com_is = nl2br(htmlspecialchars($_POST['com_is'])); $pereezd_is = nl2br(htmlspecialchars($_POST['pereezd_is'])); $car_category = $_POST['car_category']; $user = (int) nl2br(htmlspecialchars($_POST['user'])); //отображение данных ПОКАЗАТЬ/СКРЫТЬ $show_mark = $_POST['show_mark']; //водительские категории перечисляем через пробел $category = ' '; //print_r($car_category); foreach ($car_category as $key => $val){ //echo $val; $category .= $val.' '; } //INSERT INTO `acs_portfolio` (`id`, `id_user`, `about`, `languages`, `pc`, `army_is`, `family_status`, `kind_is`, `comandirovka_is`, `pereezd_is`, `car_category`, `status`, `date_create`, `date_update`) VALUES (NULL, '0', '123', '123', '123', 'Не служил', 'Холост', 'Нет', 'Не готов', 'Не готов', 'Права отсутствуют', '0', '1', '1'); //удаляем старое портфолио $sql = 'DELETE FROM '.$ST['dbpf'].'_portfolio WHERE id_user = "'.$user.'" '; $rez = $DB->QUR($sql); //вносим новую информацию $sql = 'INSERT INTO '.$ST['dbpf'].'_portfolio (`id_user`, `about`, `languages`, `pc`, `army_is`, `family_status`, `kind_is`, `comandirovka_is`, `pereezd_is`, `car_category`, `status`, `date_update`, `show_mark_is`) VALUES ("'.$user.'", "'.$about.'", "'.$languages.'", "'.$pc.'", "'.$army_is.'", "'.$family_status.'", "'.$kind_is.'", "'.$com_is.'", "'.$pereezd_is.'", "'.$category.'", "0", "'.date("U").'", "'.$show_mark.'")'; $rez = $DB->QUR($sql); //echo $about; } //берем информацию о портфолио $id_user = $_SESSION['user']['id']; $sql = 'SELECT * FROM '.$ST['dbpf'].'_portfolio WHERE id_user = "'.$id_user.'" LIMIT 1'; $rez = $DB->QUR_SEL($sql); $info_portfolio = $rez[1]; /**/ $smarty->assign('user',$_SESSION['user']); $smarty->assign('info_portfolio',$info_portfolio); $maincontent = $smarty->fetch('tpl_learn_portfolio.html'); } if($_GET['page']=='raspis'){ $ST['page']['name'] = 'Расписание студентов'; //echo '
'.print_r($_SESSION['user'],1).''; $sql='SELECT * FROM '.$ST['dbpf'].'_grupp WHERE id='.$_SESSION['user']['student']['id_grupp'].''; $rez=$DB->QUR_SEL($sql); if($rez){ $grname=$rez[1]['sokr'].'-'.$rez[1]['kurs']; $grnume=$_SESSION['user']['student']['num_grupp']; //echo 'http://83.234.195.34/raspisnew/export.php?grupp='.$grname.$grnume.''; $url = 'http://local.mkgtu.ru/raspisnew/export.php?grupp='.urlencode($grname).$grnume.''; //echo $url;exit(); $raspis=file_get_contents($url); echo '';//exit(); //$raspis=file_get_contents('http://83.234.195.34/raspisnew/export.php?grupp=ПИ-11'); if ($raspis!=''){ $raspis=json_decode($raspis); //echo '
'.print_r($raspis,1).''; if(isset($raspis->error)) $smarty->assign('message','ответ от сервера: '.$raspis->error[0]); } else{ $smarty->assign('message','Не получили данные'); } //echo $grname.$grnume.'
'; print_r($raspis); echo ''; //exit(); $smarty->assign('raspis',$raspis); $grname .= $_SESSION['user']['student']['num_grupp']; $smarty->assign('grname',$grname); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_raspis.html'); }else{ $smarty->assign('message','Не определили группу'); $smarty->assign('profile',$_SESSION['user']); $grname .= $_SESSION['user']['student']['num_grupp']; $smarty->assign('grname',$grname); $maincontent = $smarty->fetch('tpl_raspis.html'); } } if($_GET['page']=='kursov'){ $ST['page']['name'] = 'Курсовые студента'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_kursov as c WHERE lg.id_lections=c.id_lection AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY c.data_c DESC,c.data_u DESC, c.name'; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $lections[$i]=$val; /*$rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_lection'].''); if($rez1){ $j=0;foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['le'][$j]=$val1; $j++; } }*/ $i++; } } $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_kursov.html'); } //МОДУЛЬ ДИСЦИПЛИНЫ ПО ВЫБОРУ if ($_GET['page'] == 'elective'){ $id_user = $_SESSION['user']['id']; //определяем группу и прочую информацию $student = get_student($id_user); $gruppa = get_grupp($student['id_grupp']); //только студенту $student_only = get_student_only($id_user); $message = ''; //блок сообщений //ВЫБИРАЕМ ДИСЦИПЛИНЫ if (isset($_POST['changed'])){ $date_create = date("U"); foreach ($_POST['predmet'] as $key => $val){ $sql = 'INSERT INTO '.$ST['dbpf'].'_elective (id_user, id_student, date_create, id_predmet) VALUES ("'.$id_user.'", "'.$student_only['id'].'", "'.$date_create.'", "'.$val.'") '; $rez = $DB->QUR($sql); //echo $val.'
'; print_r($_POST); echo '';*/ $message = 'Выбор успешно сделан.'; } //форма обучения if ($gruppa['fo'] == 'ОФО') $fo = 'очная'; elseif ($gruppa['fo'] == 'ЗФО') $fo = 'заочная'; else $fo = 'очно-заочная'; //смотрим сколько профилей //если профилей, больше, чем один, то смотрим выбрал ли студент какой-то из них $profile_obu = ''; $sql = 'SELECT * FROM '.$ST['dbpf'].'_napr_sel WHERE id_stud = "'.$id_user.'" '; $rez = $DB->QUR_SEL($sql); if ($rez[0] > 1) { $id_profile = $rez[1]['id_napr']; $sql_pr = 'SELECT * FROM '.$ST['dbpf'].'_profile WHERE id_areas = "'.$id_profile.'" '; $rez_pr = $DB->QUR_SEL($sql_pr); if ($rez_pr){ $profile_obu = $rez_pr[1]['name']; } } //определяем учебный план //$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE forobu = "'.$fo.'" AND shifr1 = "'.$gruppa['specialnost'].'" AND godnap = "'.$gruppa['year_start'].'" LIMIT 1'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE forobu = "'.$fo.'" AND shifr1 = "'.$gruppa['specialnost'].'" AND godnap = "'.$gruppa['year_start'].'" AND propodgo LIKE "%'.$profile_obu.'%"'; $rez = $DB->QUR_SEL($sql); if ($rez){ $id_plan = $rez[1]['id']; $plan = $rez; }else{ $message .= 'Необходимо указать форму обучения, специальность, год начала обучения и профиль обучения'; } //если профилей несколько и студент ничего не выбрал $error_change_profile = 0; if ($rez[0] > 1) if ($profile_obu == '') $error_change_profile = 1; //определяем курс группы - берем из названия первую цифру $kurs = courseOfGruppa($student['id_grupp']); //if($id_plan=='') $message .= 'Необходимо указать форму обучения, специальность, год начала обучения и профиль обучения'; //дисциплины учебного плана - берем блоки/модули $predmets = array(); //$sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans = "'.$id_plan.'" AND discid LIKE "%ДВ%" GROUP BY discid'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE kurs = "'.$kurs.'" AND id_plans = "'.$id_plan.'" AND discip LIKE "%по выбору%" GROUP BY discid'; $rez = $DB->QUR_SEL($sql); //echo $sql.'
'.print_r($rez,1).''; exit(); //SELECT * FROM acs_iup_shahtplans_stroki WHERE kurs = "" AND id_plans = "" AND discip LIKE "%по выбору%" GROUP BY discid if ($rez){ foreach ($rez as $key => $val) if ($key){ //теперь определяем какие дисциплины входят в тот или иной учебный блок (модуль) //блок - это группа предметов, из которых студент выбирает только один определенный, на свое усмотрение $val['block'] = array(); $sql_in = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE kurs = "'.$kurs.'" AND id_plans = "'.$id_plan.'" AND discid LIKE "%'.$val['discid'].'.%" '; //точка в конце обязательна - перед процентами, это означает, это значит что "спускаемся" в подраздел модуля $rez_in = $DB->QUR_SEL($sql_in); if ($rez_in){ foreach ($rez_in as $key_in => $val_in) if ($key_in){ //смотрим, выбирал ли пользователь этот вариант ответа уже $val_in['sel'] = 0; //по умолчанию = 0 - не выбирал. Если 1 - значит выбирал $sql_count = 'SELECT * FROM '.$ST['dbpf'].'_elective WHERE id_user = "'.$id_user.'" AND id_predmet = "'.$val_in['id'].'" '; $rez_count = $DB->QUR_SEL($sql_count); if ($rez_count) if ($rez_count[0] > 0) $val_in['sel'] = 1; //смотрим, дисциплина одобрена ли деканатом $val_in['is_click'] = 0; //по умолчанию = нет $sql_click = 'SELECT * FROM '.$ST['dbpf'].'_fakultet_elective WHERE id_stroka = "'.$val_in['id'].'" '; $rez_click = $DB->QUR_SEL($sql_click); if ($rez_click) if ($rez_click > 0) $val_in['is_click'] = 1; //одобрена деканатом // $val['block'][] = $val_in; } } /*** Получается примерно такая структура 1 Дисциплина 1.1 Вариант 1.2 Еще вариант 2 Дисциплина другая 2.1 Вариант 2.2 Другой вариант ... **/ $predmets[] = $val; } }else{ $message .= '
'; print_r($student_info); echo '';*/ //подгружаем форму обучения switch ($student_info['fo']){ case 'ОФО': $fo = 'очная'; break; case 'ЗФО': $fo = 'заочная'; break; case 'ОЗФО': $fo = 'очно-заочная'; break; } $sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE shifr1 = "'.$student_info['kod_podgotovki'].'" AND godnap = "'.$student_info['year_start'].'" AND forobu = "'.$fo.'" '; $rez = $DB->QUR_SEL($sql); if ($rez) $id_plan = $rez[1]['id']; //echo $id_plan; //дисциплины $predmets = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE id_plans = "'.$id_plan.'" AND (discid LIKE "Б2.%" OR discid LIKE "Б3.%" OR krab = 1) ORDER BY sem'; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $predmets[] = $val; } } //список уже загруженных работ $works = array(); $sql = 'SELECT * FROM '.$ST['dbpf'].'_studwork WHERE id_user = "'.$_SESSION['user']['id'].'" '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $works[] = $val; } } /***/ $smarty->assign('works', $works); $smarty->assign('predmets', $predmets); $smarty->assign('user', $_SESSION['user']); $maincontent = $smarty->fetch('tpl_learn_studwork.html'); } //ОБРАЗОВАТЕЛЬНЫЙ ПРОЦЕСС - ВСЕ ЗАДАНИЯ И ЛЕКЦИИ if($_GET['page']=='all'){ $ST['page']['name'] = 'Образовательный процесс'; $maincontent = $smarty->fetch('tpl_learn_all.html'); } //ВЫБОР ПРОФИЛЯ ОБУЧЕНИЯ СТУДЕНТОМ if ($_GET['page'] == 'profile_change'){ $ST['page']['name'] = 'Выбор профиля обучения'; $id_user = $_SESSION['user']['id']; //пользователь - студент //студент выбрал профиль обучения if (isset($_POST['order_profile'])){ $id_napr = $_POST['profile']; //профиль $date_order = date("U"); //дата подачи заявки $sql = 'INSERT INTO '.$ST['dbpf'].'_napr_sel (id_stud, id_napr, date_order) VALUES ("'.$id_user.'", "'.$id_napr.'", "'.$date_order.'") '; $rez = $DB->QUR($sql); } //проверяем, заполнил ли он ее до этого $is_order = 0; $sql = 'SELECT * FROM '.$ST['dbpf'].'_napr_sel WHERE id_stud = "'.$id_user.'" '; $rez = $DB->QUR_SEL($sql); $is_order = $rez[0]; //информация о студенте $info_student = $_SESSION['user']['student']; //делаем выборку по направлению профилей специальности $spec = array(); $sql = 'SELECT ar.*, pr.id as id_profile, pr.* FROM '.$ST['dbpf'].'_areas as ar, '.$ST['dbpf'].'_profile as pr WHERE ar.code LIKE "'.$info_student['kod_podgotovki'][0].$info_student['kod_podgotovki'][1].$info_student['kod_podgotovki'][2].$info_student['kod_podgotovki'][3].$info_student['kod_podgotovki'][4].'%" AND ar.id = pr.id_areas '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $spec[] = $val; } } //echo $info_student['kod_podgotovki'][0].$info_student['kod_podgotovki'][1]; /******/ $smarty->assign('info_student',$info_student); $smarty->assign('spec',$spec); $smarty->assign('is_order',$is_order); $maincontent = $smarty->fetch('tpl_learn_profile_change.html'); } //РАСПИСАНИЕ ЗАНЯТИЙ В РЕЖИМЕ ВЕБИНАРА if ($_GET['page'] == 'timetable_web'){ //выводим само расписание $timetable = ''; $grupp = get_student($_SESSION['user']['id']); //группа студента $grupp_p = $grupp['sokr'].'-'.$grupp['kurs']; $date_start = strtotime(date("Y-m-d")); $sql = 'SELECT * FROM '.$ST['dbpf'].'_timetable_web WHERE day >= "'.$date_start.'" GROUP BY day '; $rez = $DB->QUR_SEL($sql); if ($rez){ foreach ($rez as $key => $val) if ($key){ $date = date('d.m.Y', $val['day']); $timetable .= '
Занятия на '.$date.'
Время |
Группа |
Преподаватель |
Дисциплина |
Ссылка |
'.$couple.' |
'.$v['groups'].' |
'.$v['fio'].' |
'.$v['subject'].' |
'; if ($v['link'] != '') if (stripos($v['groups'], $grupp_p) !== false) $timetable .= 'Перейти'; else $timetable .= 'Нет доступа'; else $timetable .= 'Пока нет'; $timetable .= ' |
'; print_r($_SESSION['user']['student']); echo ''; //$sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable WHERE fakultets LIKE "%'.$facult.'%" AND `course` = "'.$course['kurs'].'" GROUP BY `id_section`'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable WHERE ( fakultets LIKE "%,'.$facult.',%" OR fakultets LIKE "%,'.$facult.'" OR fakultets LIKE "'.$facult.',%" OR fakultets = "'.$facult.'" ) AND `course` = "'.$course['kurs'].'" GROUP BY `id_section`'; //echo $sql; $rez = $DB->QUR_SEL($sql); //echo $sql.'
'.print_r($rez,1).''; exit(); //SELECT * FROM acs_fk_timetable WHERE (fakultets LIKE "%,5,%" OR fakultets LIKE "%,5" OR fakultets LIKE "5,%") AND `course` = "1" GROUP BY `id_section` //Array( // [0] => 9 // [1] => Array( [id] => 1[id_section] => 1[id_teacher] => 142[course] => 1[count] => 27[disability] => 0[fakultets] => 5,8,11,13,14 ) // [2] => Array( [id] => 85 [id_section] => 2 [id_teacher] => 299 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [3] => Array( [id] => 67 [id_section] => 3 [id_teacher] => 304 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [4] => Array( [id] => 143 [id_section] => 4 [id_teacher] => 302 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [5] => Array( [id] => 46 [id_section] => 5 [id_teacher] => 297 [course] => 1 [count] => 27 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [6] => Array( [id] => 103 [id_section] => 6 [id_teacher] => 306 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [7] => Array( [id] => 28 [id_section] => 8 [id_teacher] => 1107 [course] => 1 [count] => 27 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [8] => Array( [id] => 145 [id_section] => 10 [id_teacher] => 303 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) // [9] => Array( [id] => 144 [id_section] => 11 [id_teacher] => 300 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) //) if ($rez){ foreach ($rez as $key => $val) if ($key){ $sql_section = 'SELECT * FROM '.$ST['dbpf'].'_fk_section WHERE `id` = "'.$val['id_section'].'"'; $rez_section = $DB->QUR_SEL($sql_section); $val['name'] = $rez_section[1]['name']; $val['sokr'] = $rez_section[1]['sokr']; $val['id'] = $rez_section[1]['id']; $fk[] = $val; } }else{ $errors[]='Не выбрали дисциплины для "'.$facult.'" и курс "'.$course['kurs'].'"'; } //если выбрана элективная дисциплина if ($page != ''){ $zapis = array(); //возможные записи //$sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable WHERE fakultets LIKE "%'.$facult.'%" AND course = "'.$course['kurs'].'" AND id_section = "'.$page.'" GROUP BY id_teacher, id_section, course'; $sql = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable WHERE ( fakultets LIKE "%,'.$facult.',%" OR fakultets LIKE "%,'.$facult.'" OR fakultets LIKE "'.$facult.',%" OR fakultets = "'.$facult.'" ) AND course = "'.$course['kurs'].'" AND id_section = "'.$page.'" GROUP BY id_teacher, id_section, course'; $rez = $DB->QUR_SEL($sql); //echo $sql.'
'.print_r($rez,1).''; exit(); //SELECT * FROM acs_fk_timetable WHERE (fakultets LIKE "%,5,%" OR fakultets LIKE "%,5" OR fakultets LIKE "5,%") AND course = "1" AND id_section = "4" GROUP BY id_teacher, id_section, course //Array( [0] => 1 // [1] => Array( [id] => 143 [id_section] => 4 [id_teacher] => 302 [course] => 1 [count] => 26 [disability] => 0 [fakultets] => 5,8,11,13,14 ) //) if ($rez){ foreach ($rez as $key => $val) if ($key){ $id_teach = $val['id_teacher']; $sql_teacher = 'SELECT * FROM '.$ST['dbpf'].'_teachers as teach, '.$ST['dbpf'].'_users as user WHERE teach.id = "'.$id_teach.'" AND teach.id_user = user.id'; $rez_teacher = $DB->QUR_SEL($sql_teacher); $val['fio'] = $rez_teacher[1]['fio']; //теперь выводим расписание с этим преподавателем, т.е. в какие дни и в какие пары проводятся занятия //$sql_timetable = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable as timetable, '.$ST['dbpf'].'_fk_details as details WHERE timetable.fakultets LIKE "%'.$facult.'%" AND timetable.course = "'.$page.'" AND timetable.id = details.id_timetable'; $sql_timetable = 'SELECT * FROM '.$ST['dbpf'].'_fk_timetable as timetable, '.$ST['dbpf'].'_fk_details as details WHERE ( timetable.fakultets LIKE "%,'.$facult.',%" OR timetable.fakultets LIKE "%,'.$facult.'" OR timetable.fakultets LIKE "'.$facult.',%" OR timetable.fakultets = "'.$facult.'" ) AND timetable.course = "'.$course['kurs'].'" AND timetable.id_section = "'.$page.'" AND details.id_timetable = timetable.id AND timetable.id_teacher = "'.$val['id_teacher'].'" '; $rez_timetable = $DB->QUR_SEL($sql_timetable); $val['raspis'] = '
'.print_r($rez_details,1).''; exit(); $info_elective['raspis'] = ''; foreach ($rez_details as $key => $val) if ($key){ switch ($val['day']){ case 1: $day = 'Понедельник'; break; case 2: $day = 'Вторник'; break; case 3: $day = 'Среда'; break; case 4: $day = 'Четверг'; break; case 5: $day = 'Пятница'; break; case 6: $day = 'Суббота'; break; case 7: $day = 'Воскресенье'; break; } $info_elective['raspis'] .= $day.', '.$val['couple'].' пара
'; print_r($fk); echo ''; $maincontent = $smarty->fetch('tpl_learn_fk.html'); } //опрос о качестве образовательного процесса if($_GET['page']=='polls'){ $ST['page']['name'] = 'Опрос о качестве образовательного процесса'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_lections as l WHERE lg.id_lections=l.id AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' GROUP BY l.name ORDER BY l.kurs,l.semestr,l.data_c DESC,l.data_u DESC, l.name '; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $val['mfile']=explode('|',$val['file']); $sql_prepod = 'SELECT * FROM '.$ST['dbpf'].'_teachers WHERE `id` = "'.$val['id_teacher'].'"'; $rez_prepod = $DB->QUR_SEL($sql_prepod); $id_user = $rez_prepod[1]['id_user']; $sql_user = 'SELECT * FROM '.$ST['dbpf'].'_users WHERE `id` = "'.$id_user.'"'; $rez_user = $DB->QUR_SEL($sql_user); $val['fio_pr'] = $rez_user[1]['fio']; //$val['fio_pr'] = $rez_prepod[1]["id"]; $i++; $lections[$i]=$val; } } //массив вопросов $criterias = array( '1' => 'Предмет имеет практическую пользу (помощь дисциплины в устройстве на работу, актуальность и новизна информации, полученной в ходе изучения предмета)', '2' => 'Дисциплина способствует развитию мышления (логически рассуждать, думать, принимать решения)', '3' => 'Дисциплина способствует развитию общекультурного кругозора (культурное и духовное обогащение)', '4' => 'Имеет место сочетание теоретического материала с практическим (используются примеры по профилю подготовки)', '5' => 'Преподаватель хорошо объясняет предмет', '6' => 'Преподаватель сделал предмет интересным', '7' => 'Преподаватель с энтузиазмом ведёт занятия', '8' => 'Занятие хорошо структурировано', '9' => 'Преподаватель вовлекает студентов в участие на занятии', '10' => 'Критерии, используемые в оценке экзамена / зачёта, были заранее объяснены' ); $crit=array(); $i=0; foreach($criterias as $key1 => $val1){ $crit[$i]['id']=$key1; $crit[$i]['name']=strip_tags($val1); //if ($id==$key) $crit[$i]['sel']=1; else $crit[$i]['sel']=0; $i++; } $smarty->assign('crit',$crit); $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_learn_polls.html'); } //практика if($_GET['page']=='praktika'){ $ST['page']['name'] = 'Практика студента'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_praktika as c WHERE lg.id_lections=c.id_lection AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY c.data_c DESC,c.data_u DESC, c.name'; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $lections[$i]=$val; /*$rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_lection'].''); if($rez1){ $j=0;foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['le'][$j]=$val1; $j++; } }*/ $i++; } } $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_praktika.html'); } if($_GET['page']=='practic'){ $ST['page']['name'] = 'Практические работы студента'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_practich as c WHERE lg.id_lections=c.id_lection AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY c.data_c DESC,c.data_u DESC, c.name'; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $lections[$i]=$val; /*$rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_lection'].''); if($rez1){ $j=0;foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['le'][$j]=$val1; $j++; } }*/ $i++; } } $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_practic.html'); } if($_GET['page']=='kontrrab'){ $ST['page']['name'] = 'Контрольные работы студента'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_controln as c WHERE lg.id_lections=c.id_lection AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY c.data_c DESC,c.data_u DESC, c.name'; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $lections[$i]=$val; /* $rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_lection'].''); if($rez1){ $j=0;foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['le'][$j]=$val1; $j++; } } */ $i++; } } $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_kontrrab.html'); } if($_GET['page']=='sr'){ //задания для самостоятельной работы студента $ST['page']['name'] = 'Задания для самостоятельной работы студента'; $lections=array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_sr as c WHERE lg.id_lections=c.id_lection AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY c.data_c DESC,c.data_u DESC, c.name'; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $lections[$i]=$val; /* $rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_lections WHERE id='.$val['id_lection'].''); if($rez1){ $j=0;foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['le'][$j]=$val1; $j++; } } */ $i++; } } $smarty->assign('lections',$lections); $smarty->assign('profile',$_SESSION['user']); $maincontent = $smarty->fetch('tpl_sr.html'); } if($_GET['page']=='lection'){ $ST['page']['name'] = 'Лекционные работы студента'; $lections=array(); //$sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_lections as l WHERE lg.id_lections=l.id AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY l.kurs,l.semestr,l.data_c DESC,l.data_u DESC, l.name'; $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_lections as l WHERE lg.id_lections=l.id AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY l.kurs,l.semestr,l.data_c DESC,l.data_u DESC, l.name'; $rez=$DB->QUR_SEL($sql); if($rez){ $i=0; foreach($rez as $key => $val)if($key){ //берем инфу о преподе $teacher_info = get_teacher_user($val['id_teacher']); $val['id_user'] = $teacher_info['id']; $val['fio_prepod'] = $teacher_info['fio']; $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($_SESSION['user']['student']['status']==0) $val['file']='-1'; $val['mfile']=explode('|',$val['file']); $lections[$i]=$val; /* $rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_practich WHERE id_lection='.$val['id'].''); if($rez1){ $j=0; foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['pr'][$j]=$val1; $j++; } } $rez1=$DB->QUR_SEL('SELECT * FROM '.$ST['dbpf'].'_controln WHERE id_lection='.$val['id'].''); if($rez1){ $j=0; foreach($rez1 as $key1 => $val1)if($key1){ $val1['data_c']=date('H:i d.m.Y',$val1['data_c']); $val1['data_u']=date('H:i d.m.Y',$val1['data_u']); if($_SESSION['user']['student']['status']==0) $val1['file']='-1'; $lections[$i]['cr'][$j]=$val1; $j++; } } */ $i++; } } /*Здесь реализуем функционал по выбору предметов, которые будет изучать студент*/ $optional_lectures = array(); $sql='SELECT * FROM '.$ST['dbpf'].'_lections_grupp as lg, '.$ST['dbpf'].'_lections as l WHERE lg.id_lections=l.id AND lg.id_grupp='.$_SESSION['user']['student']['id_grupp'].' ORDER BY l.name, l.kurs,l.semestr,l.data_c DESC,l.data_u DESC, l.name'; $rez=$DB->QUR_SEL($sql); if($rez){ $code = ''; $i=0; foreach($rez as $key => $val) if($key){ if ($i == 0) { $pr = trim($val['name']); $code .= $val['id'].',
'.print_r($json['dbnika'],1).''; $smarty->assign('up',$json['up']); $smarty->assign('dbnika',$json['dbnika']); if($message) $smarty->assign('message',$message); }else{ $message='Не определили группу'; $smarty->assign('message',$message); } //echo '
'.print_r($json,1).''; if(!count($json['dbnika'])) { $message='для отображения образовательных программ, в профиле студента необходимо указать "Код направления подготовки" - только цифры(c точками), без текста!!!'; $smarty->assign('message',$message); } //УЧЕБНЫЙ ПЛАН - на данный момент указан фиксированный $cod_podgotovki = $_SESSION['user']['student']['kod_podgotovki']; $sql_plan = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_plans WHERE `shifr1` = "'.$cod_podgotovki.'"'; $rez_plan = $DB->QUR_SEL($sql_plan); $sql = 'SELECT * FROM '.$ST['dbpf'].'_iup_shahtplans_stroki WHERE `id_plans` = "'.$rez_plan[1]['id'].'" ORDER BY `sem`' ; $rez = $DB->QUR_SEL($sql); foreach ($rez as $key => $value) if ($key){ $value["hours"] = 36*$value["zet"]; if ($value["ekz"] == "") $value["control"] = "зачет"; else $value["control"] = "экзамен"; if ($value["zet"] == "") { $value["zet"] = "-"; $value["hours"] = $value["pr"]; } $uc_plans[] = $value; } //КАЛЕНДАРНЫЙ ГРАФИК $calGr = ''; //УЧЕБНЫЙ ПЛАН РАЗВЕРНУТЫЙ В ПДФ $pdf = ''; //$search = "21.03.02"; $search = $_SESSION['user']['student']['kod_podgotovki']; $url = "http://mkgtu.ru/sveden/education/educationDocs/"; // здесь надо вырезать ссылки (только адреса в href="ТОЛЬКО ЗДЕСЬ") $furl = file_get_contents($url); $furl = preg_replace("''si", "", $furl); // убираем скрипты preg_match_all("#]+>(?!#i",$furl,$out); // вырезает, но целые ссылки, а надо голые адреса, то, что находится в href="!!!!!!!!!!". for($i=0;$i