src/snac/client/webui/WebUIExecutor.php
/**
     * Save and Publish Constellation
     *
     * Maps the constellation given on input to a Constellation object, passes that to the server with an
     * update_constellation call.  If successful, it then maps any updates (new ids or version numbers) to the
     * Constellation object and web components from input, and returns the web ui's response (the list of
     * updates that must be made to the web ui GUI).
     *
     * After saving, it also calls to the server to have the constellation published, if the write was successful.
     *
     *
     * @param string[] $input Post/Get inputs from the webui
     * @return string[] The web ui's response to the client (array ready for json_encode)
     */
Save and Publish Constellation
Maps the constellation given on input to a Constellation object, passes that to the server with an
update_constellation call.  If successful, it then maps any updates (new ids or version numbers) to the
Constellation object and web components from input, and returns the web ui's response (the list of
updates that must be made to the web ui GUI).

After saving, it also calls to the server to have the constellation published, if the write was successful.

@param string[] $input Post/Get inputs from the webui
@return string[] The web ui's response to the client (array ready for json_encode)
Save and Publish Constellation Maps the constellation given on input to a Constellation object passes that to the server with an update_constellation call . If successful it then maps any updates ( new ids or version numbers ) to the Constellation object and web components from input and returns the web ui ' s response ( the list of updates that must be made to the web ui GUI ) . After saving it also calls to the server to have the constellation published if the write was successful . @param string [] $input Post / Get inputs from the webui @return string [] The web ui ' s response to the client ( array ready for json_encode )
public function saveAndPublishConstellation(&$input) {
        $mapper = new \snac\client\webui\util\ConstellationPostMapper();
        $constellation = $mapper->serializeToConstellation($input);
        $this->logger->addDebug("writing constellation", $constellation->toArray());
        $request = array (
                "command" => "update_constellation"
        );
        $request["constellation"] = $constellation->toArray();
        if (isset($input['savemessage']) || isset($input["reviewmessage"])) {
            $message = "";
            if (isset($input["reviewmessage"]))
                $message .= $input["reviewmessage"] . "\n\n";
            if (isset($input["savemessage"]))
                $message .= $input["savemessage"];
            $request["message"] = $message;
        }
        $serverResponse = $this->connect->query($request);
        $response = array ();
        $response["server_debug"] = array ();
        $response["server_debug"]["update"] = $serverResponse;
        if (isset($serverResponse["result"]))
            $response["result"] = $serverResponse["result"];
        if (isset($serverResponse["error"]))
            $response["error"] = $serverResponse["error"];
        if (! is_array($serverResponse)) {
            $this->logger->addDebug("server's response: $serverResponse");
        } else {
            if (isset($serverResponse["constellation"])) {
                $this->logger->addDebug("server's response written constellation", $serverResponse["constellation"]);
            }
            if (isset($serverResponse["result"]) && $serverResponse["result"] == "success" &&
                     isset($serverResponse["constellation"])) {
                $request["command"] = "publish_constellation";
                $request["constellation"] = $serverResponse["constellation"];
                $serverResponse = $this->connect->query($request);
                $response["server_debug"]["publish"] = $serverResponse;
                if (isset($serverResponse["result"]))
                    $response["result"] = $serverResponse["result"];
                if (isset($serverResponse["error"]))
                    $response["error"] = $serverResponse["error"];
            }
        }
        return $response;
    }
public function saveAndPublishConstellation ( & $ input ) { $ mapper = new \ snac \ client \ webui \ util \ ConstellationPostMapper ( ) ; $ constellation = $ mapper -> serializeToConstellation ( $ input ) ; $ this -> logger -> addDebug ( " writing constellation " , $ constellation -> toArray ( ) ) ; $ request = array ( " command " => " update_constellation " ) ; $ request [ " constellation " ] = $ constellation -> toArray ( ) ; if ( isset ( $ input [ 'savemessage' ] ) || isset ( $ input [ " reviewmessage " ] ) ) { $ message = " " ; if ( isset ( $ input [ " reviewmessage " ] ) ) $ message .= $ input [ " reviewmessage " ] . " \n \n " ; if ( isset ( $ input [ " savemessage " ] ) ) $ message .= $ input [ " savemessage " ] ; $ request [ " message " ] = $ message ; } $ serverResponse = $ this -> connect -> query ( $ request ) ; $ response = array ( ) ; $ response [ " server_debug " ] = array ( ) ; $ response [ " server_debug " ] [ " update " ] = $ serverResponse ; if ( isset ( $ serverResponse [ " result " ] ) ) $ response [ " result " ] = $ serverResponse [ " result " ] ; if ( isset ( $ serverResponse [ " error " ] ) ) $ response [ " error " ] = $ serverResponse [ " error " ] ; if ( ! is_array ( $ serverResponse ) ) { $ this -> logger -> addDebug ( " server's response:  $ serverResponse " ) ; } else { if ( isset ( $ serverResponse [ " constellation " ] ) ) { $ this -> logger -> addDebug ( " server's response written constellation " , $ serverResponse [ " constellation " ] ) ; } if ( isset ( $ serverResponse [ " result " ] ) && $ serverResponse [ " result " ] == " success " && isset ( $ serverResponse [ " constellation " ] ) ) { $ request [ " command " ] = " publish_constellation " ; $ request [ " constellation " ] = $ serverResponse [ " constellation " ] ; $ serverResponse = $ this -> connect -> query ( $ request ) ; $ response [ " server_debug " ] [ " publish " ] = $ serverResponse ; if ( isset ( $ serverResponse [ " result " ] ) ) $ response [ " result " ] = $ serverResponse [ " result " ] ; if ( isset ( $ serverResponse [ " error " ] ) ) $ response [ " error " ] = $ serverResponse [ " error " ] ; } } return $ response ; }
Save and Publish Constellation
 Maps the constellation given on input to a Constellation object, passes that to the server with an
 update_constellation call.
Save and Publish Constellation Maps the constellation given on input to a Constellation object passes that to the server with an update_constellation call .
// Get the constellation object // Build a data structure to send to the server // Send the query to the server // Add a message if we have it