src/snac/client/webui/WebUIExecutor.php
/**
     * Save 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).
     *
     * @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 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).

@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 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 ) . @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 saveConstellation(&$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"] = $serverResponse;
        if (!is_array($serverResponse)) {
            $this->logger->addDebug("server's response: $serverResponse");
        } else {
            if (isset($serverResponse["result"]))
                $response["result"] = $serverResponse["result"];
                if (isset($serverResponse["error"])) {
                    $response["error"] = $serverResponse["error"];
                }
                if (isset($serverResponse["constellation"])) {
                    $this->logger->addDebug("server's response written constellation", $serverResponse["constellation"]);
                    $updatedConstellation = new \snac\data\Constellation($serverResponse["constellation"]);
                    $mapper->reconcile($updatedConstellation);
                    $response["updates"] = $mapper->getUpdates();
                    $this->logger->addDebug("Requires the following UI updates", array($response["updates"]));
                }
        }
        return $response;
    }
public function saveConstellation ( & $ 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 " ] = $ serverResponse ; if ( ! is_array ( $ serverResponse ) ) { $ this -> logger -> addDebug ( " server's response:  $ serverResponse " ) ; } else { if ( isset ( $ serverResponse [ " result " ] ) ) $ response [ " result " ] = $ serverResponse [ " result " ] ; if ( isset ( $ serverResponse [ " error " ] ) ) { $ response [ " error " ] = $ serverResponse [ " error " ] ; } if ( isset ( $ serverResponse [ " constellation " ] ) ) { $ this -> logger -> addDebug ( " server's response written constellation " , $ serverResponse [ " constellation " ] ) ; $ updatedConstellation = new \ snac \ data \ Constellation ( $ serverResponse [ " constellation " ] ) ; $ mapper -> reconcile ( $ updatedConstellation ) ; $ response [ " updates " ] = $ mapper -> getUpdates ( ) ; $ this -> logger -> addDebug ( " Requires the following UI updates " , array ( $ response [ " updates " ] ) ) ; } } return $ response ; }
Save Constellation
 Maps the constellation given on input to a Constellation object, passes that to the server with an
 update_constellation call.
Save 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 // Get the server's response constellation