예제 #1
0
<?php

require_once "../framework.php";
if (isset($_POST["type"])) {
    $type = $_POST["type"];
    if ($type == "order") {
        getLastNum();
    } else {
        if ($type == "getpin") {
            getPin();
        } else {
            if ($type == "load") {
                loadNote();
            } else {
                if ($type != "lecturecourse") {
                    header("HTTP/1.1 400 Invalid Request");
                    die("HTTP/1.1 400 Invalid Request - you passed in a wrong type parameter.");
                }
            }
        }
    }
} else {
    if (isset($_POST["lecturecourse"])) {
        if (isset($_POST["lecturenumber"])) {
            if (isset($_POST["page"])) {
                loadimage();
            } else {
                pageList();
            }
        } else {
            lectureList();
예제 #2
0
function processAction()
{
    $action = assign_input('action', 'R');
    $folderID = assign_input('folderID', 'R');
    $noteID = assign_input('noteID', 'R');
    $parentFolder = assign_input('parentFolder', 'R');
    $date = assign_input('date', 'R');
    $name = assign_input('name', 'R');
    $note = assign_input('note', 'P', 1);
    $sortByDate = assign_input('sortByDate', 'R');
    switch ($action) {
        case 'newFolder':
            $res = newFolder($name, $parentFolder);
            break;
        case 'newNote':
            $res = newNote($name, $note, $parentFolder);
            break;
        case 'toNewFolder':
            $res = addToNewFolder($parentFolder, $noteID);
            break;
        case 'delete':
            $res = delete_($noteID ? $noteID : $folderID, $folderID);
            break;
        case 'rename':
            $res = rename_($name, $noteID ? $noteID : $folderID, $folderID);
            break;
        case 'save':
            $res = save($noteID, $note);
            break;
        case 'get':
            $res = getContent($parentFolder, $sortByDate ? 1 : 0);
            break;
        case 'loadNote':
            $res = loadNote($noteID);
            break;
        case 'search':
            break;
        default:
            $res = array("error" => "no action");
    }
    /*
    if(( isset($res['error']))&&($res['error'])){echo 'Error occured : '.$res['error'].'<br/>';}
    
    if($action=='get'){
    
    	echo json_encode($res);
    }
    */
    echo json_encode($res);
}
예제 #3
0
function loadBagCheckDay($selectedDate)
{
    // Make connection to the database.
    $dbInfo = initialize_db_info();
    $dbLink = db_connect($dbInfo);
    db_select($dbLink, $dbInfo);
    $loadDaySql = generateLoadDaySql($selectedDate);
    $result = mysql_query($loadDaySql, $dbLink);
    if (!$result) {
        echo $loadDaySql;
        throw new Exception('Query Day Info Failed: ' . $loadDaySql);
    } else {
        $resultCount = mysql_num_rows($result);
        if ($resultCount == 1) {
            // We found an exact match
            $bagCheckInfo = new bagCheckInfo();
            $row = mysql_fetch_assoc($result);
            setDayInfoWithRow($bagCheckInfo, $row);
            loadNote($bagCheckInfo);
            // Load Each Blind
            loadBagCheckBlinds($bagCheckInfo);
            //exit;
            //bagCheckDump("After SET DAY", $bagCheckInfo, true);
        } else {
            if ($resultCount == 0) {
                // We found no matches
                $bagCheckInfo = createNewBagCheckInfo($selectedDate);
            } else {
                throw new Exception('More than one day found: ' . $resultCount);
            }
        }
        setBagCheckInfoInSession($bagCheckInfo);
    }
}