Exemplo n.º 1
0
<?php

include "cms_functions.php";
$count = 0;
$src_db_con = mysqli_connect("localhost", "root", "", "kiosk - testing");
$dest_db_con = mysqli_connect("localhost", "root", "", "kiosk - temp");
#Copy subject data
$query_subj_src = mysqli_query($src_db_con, "SELECT * FROM subject_t") or die("Error in save_content.php : line 5 :: " . mysql_error($src_db_con));
while ($row_subj_src = mysqli_fetch_array($query_subj_src)) {
    $subject_code = $row_subj_src['subject_code'];
    $subject_title = $row_subj_src['subject_title'];
    $lec_units = $row_subj_src['lec_units'];
    $lab_units = $row_subj_src['lab_units'];
    $units = $row_subj_src['units'];
    insert_subject($dest_db_con, $subject_code, $subject_title, $units, $lec_units, $lab_units);
    $count++;
}
echo "Copy subject success :: {$count} entries<br>";
$count = 0;
#Copy Course data
$query_course_src = mysqli_query($src_db_con, "SELECT * FROM course_t") or die("Error in save_content.php : line 5 :: " . mysql_error($src_db_con));
while ($row_course_src = mysqli_fetch_array($query_course_src)) {
    $course_code = $row_course_src['course_code'];
    $course_title = $row_course_src['course_title'];
    insert_course($dest_db_con, $course_code, $course_title);
    $count++;
}
echo "Copy course success :: {$count} entries<br>";
$count = 0;
#Copy block data
$query_block_src = mysqli_query($src_db_con, "SELECT * FROM student_block_t") or die("Error in save_content.php : line 5 :: " . mysql_error($src_db_con));
Exemplo n.º 2
0
} else {
    $insert = false;
}
//Insert a subject
if (isset($_POST['coordiId'])) {
    $insert = true;
    $coord = $_POST['coordiId'];
} else {
    $insert = false;
}
if (isset($_POST['subjAddID'])) {
    $insert = true;
    $subjID = $_POST['subjAddID'];
}
if ($insert == true) {
    insert_subject($sName, $coord, $subjID);
    // return $yo;
}
//Edit subject
if (isset($_POST['editSubj'])) {
    $newName = $_POST['editSubj'];
    $insert = true;
    // echo "subj";
} else {
    $insert = false;
}
if (isset($_POST['editCoord'])) {
    $newCoord = $_POST['editCoord'];
    $insert = true;
    // echo "edit";
} else {
Exemplo n.º 3
0
         preg_match('#\\((.*?)\\)#', $subject_title, $match);
         if (count($match) > 0) {
             $str = trim($match[1]);
             if (is_numeric(stripos($str, "lec")) || is_numeric(stripos($str, "lab"))) {
                 $subject_title = preg_replace("/\\([^)]+\\)/", "", $subject_title);
             }
         }
         //echo $subject_title."<br>";
         $faculty_id = verify_faculty_id($temp_db_con, $faculty_id);
         //$block_id     = get_block_id($temp_db_con, $course, get_year_level($block),$course." ".$block, $sem_id);
         $course_code = insert_course($temp_db_con, $course, '');
         $block_id = insert_block($temp_db_con, $course_code, get_year_level($block), $course . " " . $block, $sem_id);
         //$faculty_id   = get_faculty_id($temp_db_con, $faculty);
         //$year_level   = get_year_level($block);
         $block_name = $block;
         $subject_id = insert_subject($temp_db_con, $subject_code, $subject_title, $credit_units, $lec_units, $lab_units);
         //$room_code = insert_room($temp_db_con, $room, NULL, NULL);
         //$subject_title = preg_replace("/\([^)]+\)/","",$subject_title);
         //echo $subject_title."<br> ";
         #check for existing entry with id no.
         if (true || $faculty_id != "") {
             //echo $sem_id."<br>";
             $class_id = insert_class($temp_db_con, $subject_id, $faculty_id, $block_id, $sem_id);
             //echo "class_id =      $class_id     ";
             $schedule_id = insert_schedule_entries($temp_db_con, $class_id, $day, $time, $room);
         }
     }
     echo "Finnished Uploading File.";
     $_SESSION['kiosk']['error'] = 1;
     header("location: " . $referer);
 } else {