예제 #1
0
 function saveColumn($indexColumn, $indexRow, PHPExcel_Worksheet $sheet, $indexCellDAY)
 {
     $tempLastRow = $this->lastRow($sheet, $indexCellDAY);
     //заносим в новую PHPExcel_Worksheet расписанице
     do {
         $value = $sheet->getCell($indexColumn . $indexRow)->getFormattedValue();
         $day = $sheet->getCellByColumnAndRow(0, $indexRow)->getFormattedValue();
         $time = $sheet->getCellByColumnAndRow(1, $indexRow)->getFormattedValue();
         echo '$value=' . $value;
         echo "day={$day}";
         echo 'time=' . $time;
         print_r($this->db, true);
         $this->db->saveSchedule($day, $time, $value);
         $indexRow++;
     } while ($indexRow !== $tempLastRow);
 }
예제 #2
0
<?php

require_once "../server/appConfig.php";
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'groups':
            require_once "../server/workDB.php";
            $db = new workDB($db_host, $user_name, $password, $db_name, FILE);
            $arr = $db->getGroups();
            $ret = [];
            $lastCourse = null;
            $lastElement = null;
            foreach ($arr as $key => $val) {
                /*  echo $key.'='.$val.'</br>';
                      echo print_r($val);
                    */
                if ($lastCourse != $val['cid']) {
                    if ($lastElement != null) {
                        $ret[] = $lastElement;
                    }
                    $lastElement = array('name' => $val['cname'], 'groups' => []);
                    $lastCourse = $val['cid'];
                }
                //   print_r($ret);
                $lastElement['groups'][] = array('name' => $val['name'], 'id' => $val['id']);
                // print_r($lastElement);
            }
            $ret[] = $lastElement;
            echo json_encode($ret);
            break;
        case 'getschedule':