#active_d:hover {}
</style> 
<?php 
include "class/function.php";
include "auth.php";
if ($_SESSION['name_sesion_a'] == "admin") {
    include "menu.php";
    include "navigate.php";
    require_once "class/class_firebird.php";
    require_once "class/mysql_class_local.php";
    require_once "class/mysql_class_moodle2.php";
    echo "<center><h2>Звязок дисциплін контингенту та мудлу по кафедрам</h2></center><b>";
    $contingent = new class_ibase();
    $base_local = new class_mysql_base_local();
    $base_moodle = new class_mysql_base_moodle();
    $zagalne = $base_moodle->select("SELECT id,name FROM mdl_course_categories WHERE id NOT IN (65,66,67,68,38,45,58);");
    //------------Відрізати після "(" у назвах кафедр -----------------------------
    for ($i = 0; $i < count($zagalne); $i++) {
        $parts = explode("(", strip_tags($zagalne[$i][1]));
        $zagalne[$i][1] = $parts[0];
    }
    navigate('Виберіть кафедру', $zagalne, 'kaf');
    //------------Якщо вибрана кафедра получити звязки дисциплін ----------------------------
    if ($_GET['kaf']) {
        echo "<br><img id='active_d' act='Y' src='http://market.auto.ria.ua/img/plus.gif'>Показати прикріплені дисципліни до кафедри та мудла";
        if ($_GET['del']) {
            $dis = $base_local->ins("DELETE FROM `dis_for_kaf`.`discipline` WHERE id=" . (int) $_GET['del'] . ";");
        }
        if ($_POST['ins_old']) {
            $dis_cont = $contingent->select("SELECT DISTINCT guide_discipline.DISCIPLINEID,guide_discipline.DISCIPLINE FROM guide_discipline  WHERE guide_discipline.DISCIPLINEID=" . (int) $_POST['dis_cont'] . " order by guide_discipline.DISCIPLINE");
            $dis = $base_local->ins("INSERT INTO  `dis_for_kaf`.`discipline` (`id_moodle` , `name_moodle` , `id_kontingent` , `name_kontingent` , `id_kaf_moodle`)VALUES ('1000000',  '<font color=red><b>Предмет добавлений на пряму з контингенту</b></font>',  '" . $_POST['dis_cont'] . "',  '<font color=red><b>" . $dis_cont[0][1] . "</b></font>',  '" . $_GET['kaf'] . "');");
Example #2
0
     $sem_sql = $contingent->for_sql($sem_v);
     $year_sql = $contingent->for_sql($year_v);
     if ($sem_sql != '') {
         $sem_sql = "AND BT.SEMESTER in (" . $sem_sql . ")";
     }
     if ($year_sql != '') {
         $year_sql = "and BT.EDUYEAR in (" . $year_sql . ")";
     }
 } else {
     $sem_sql = '';
     $year_sql = '';
 }
 $zag_mas = $contingent->select("select DISTINCT BVI_V.VARIANTID,\n(select count (iBVI_M.VARIANTID)\nfrom B_VARIANT_ITEMS iBVI_M\ninner join B_VARIANT_MODULE iBVM\n  on (iBVM.VARIANTID = iBVI_M.VARIANTID)\ninner join B_VARIANT_ITEMS iBVI_V\n  on (iBVI_V.VARIANTID = iBVI_M.PARENTVARIANTID)\nwhere iBVI_V.VARIANTID = BVI_V.VARIANTID\n  group by iBVI_M.PARENTVARIANTID) total_modules,GE.EDUYEARSTR,BT.SEMESTER,bvm.modulenum,bvm.moduletheme from B_TESTLIST BT inner join B_VARIANT_ITEMS BVI_M on (BVI_M.VARIANTID = BT.VARIANTID) inner join b_variant_module bvm on (BVI_M.VARIANTID = bvm.VARIANTID) inner join B_VARIANT_ITEMS BVI_V on (BVI_V.VARIANTID = BVI_M.PARENTVARIANTID) inner join GUIDE_EDUYEAR GE on (BT.EDUYEAR = GE.EDUYEAR) where BVI_V.DISCIPLINEID = " . $_GET['DISCIPLINE'] . " and BVI_V.SPECIALITYID = " . $_GET['SPECIALITY'] . " and BT.DEPARTMENTID = " . $_GET['DEPARTMENT'] . " " . $sem_sql . " " . $year_sql . " order by BVI_V.VARIANTID,GE.EDUYEARSTR,BT.SEMESTER,bvm.modulenum");
 echo "</td></tr><tr><td colspan=2><br>";
 $discipl = $base_local->select("SELECT DISTINCT id_kaf_moodle FROM discipline WHERE id_kontingent='" . (int) $_GET['DISCIPLINE'] . "';");
 $kaf = $base_moodle->select("SELECT id,name FROM mdl_course_categories WHERE id = '" . (int) $discipl[0][0] . "';");
 $parts = explode("(", strip_tags($kaf[0][1]));
 if ($parts[0] != '') {
     echo "<center style='background-color:white;'>Кафедра (<font color=green >" . $parts[0] . "</font>)</center>";
 } else {
     echo "<center style='background-color:white;'><font color=red>Ця дисципліна не зв'язана з кафедрою, зверніться до адміністратора!</font></center>";
 }
 echo "\n  <table bgcolor='white' border=1 width=100% class='ser2'><tr style='text-align:center' bgcolor=gray><td width=3%>\n  <input type='checkbox' id='toggle' value='S' onClick='do_this()' /></td><td>Номер варіанту</td><td>Сум</td><td>Рік</td><td>Семестер</td><td>Номер<br>модуля</td><td>Назва модуля</td>";
 //prepare variables to the paint row with different eduplanid by different colors
 $prev_eduplanid = $zag_mas[0][0];
 $first_row_bgcolor = "pink";
 $second_row_bgcolor = "yellow";
 $row_bgcolor = $first_row_bgcolor;
 for ($i = 0; $i < count($zag_mas); $i++) {
     //repaint row with different eduplanid by different colors
     if ($zag_mas[$i][0] != $prev_eduplanid) {