示例#1
0
function createNewCanvas()
{
    require_once '../config.php';
    require_once "Canvas.php";
    require_once "Chart.php";
    global $current_user;
    $canvas = Canvas::createNewCanvas($_REQUEST['name'], $userid = $current_user->user_id, $_REQUEST['note'], 0);
    $_SESSION['Canvases'][$canvas->vid] = serialize($canvas);
    //$rst = array();
    $RST['charts'] = array();
    //var_dump($canvas->charts );
    if (isset($canvas->charts)) {
        foreach ($canvas->charts as $chart) {
            array_push($RST['charts'], $chart->printToArray());
        }
    }
    $RST['vid'] = $canvas->vid;
    $RST['name'] = $canvas->name;
    $RST['privilege'] = $canvas->privilege;
    $RST['authorization'] = $canvas->authorization;
    $RST['mdate'] = $canvas->mdate;
    $RST['cdate'] = $canvas->cdate;
    $RST['note'] = $canvas->note;
    $RST['isSave'] = $canvas->getIsSave();
    echo json_encode($RST);
    error_reporting(E_ALL);
}