src/snac/client/webui/WebUIExecutor.php
/**
     * Display Detailed View Page
     *
     * Loads the detailed view page for a given constellation input into the display.
     *
     * @param string[] $input Post/Get inputs from the webui
     * @param \snac\client\webui\display\Display $display The display object for page creation
     */
Display Detailed View Page
Loads the detailed view page for a given constellation input into the display.


Display Detailed View Page Loads the detailed view page for a given constellation input into the display .
public function displayDetailedViewPage(&$input, &$display) {
        $serverResponse = array();
        if ((isset($input["part"]) && ($input["part"] == "constellationRelations" ||
            $input["part"] == "resourceRelations")) || isset($input["preview"]))
            $serverResponse = $this->getConstellation($input, $display, false);
        else
            $serverResponse = $this->getConstellation($input, $display, "summary_meta");
        if (isset($serverResponse["constellation"])) {
            $editingUser = null;
            if (isset($serverResponse["editing_user"]))
                $editingUser = $serverResponse["editing_user"];
            if (isset($input["part"]))
                $display->setTemplate("detailed_view_tabs/".$input["part"]);
            else if (isset($input["preview"]))
                $display->setTemplate("detailed_preview_page");
            else
                $display->setTemplate("detailed_view_page");
            $constellation = $serverResponse["constellation"];
            if (\snac\Config::$DEBUG_MODE == true) {
                $display->addDebugData("constellationSource", json_encode($serverResponse["constellation"], JSON_PRETTY_PRINT));
                $display->addDebugData("serverResponse", json_encode($serverResponse, JSON_PRETTY_PRINT));
            }
            $this->logger->addDebug("Getting Holding institution information from the resource relations");
            $c = new \snac\data\Constellation($constellation);
            $holdings = array();
            foreach ($c->getResourceRelations() as $resourceRel) {
                if ($resourceRel->getResource() !== null && $resourceRel->getResource()->getRepository() != null) {
                    $repo = $resourceRel->getResource()->getRepository();
                    $holdings[$repo->getID()] = array(
                        "name" => $repo->getPreferredNameEntry()->getOriginal()
                    );
                    foreach ($repo->getPlaces() as $place) {
                        if ($place->getGeoTerm() != null) {
                            $holdings[$repo->getID()]["latitude"] = $place->getGeoTerm()->getLatitude();
                            $holdings[$repo->getID()]["longitude"] = $place->getGeoTerm()->getLongitude();
                        }
                    }
                }
            }
            usort($holdings, function($a, $b) {
                return $a["name"] <=> $b["name"];
            });
            $this->logger->addDebug("Setting constellation data into the page template");
            $display->setData(array_merge(
                $constellation,
                array("preview"=> (isset($input["preview"])) ? true : false,
                    "maybeSameCount"=> (isset($serverResponse["maybesame_count"])) ? $serverResponse["maybesame_count"] : 0,
                    "holdings" => $holdings,
                    "editingUser" => $editingUser)
            ));
        } else {
            $this->logger->addDebug("Error page being drawn");
            $this->drawErrorPage($serverResponse, $display);
        }
    }
public function displayDetailedViewPage ( & $ input , & $ display ) { $ serverResponse = array ( ) ; if ( ( isset ( $ input [ " part " ] ) && ( $ input [ " part " ] == " constellationRelations " || $ input [ " part " ] == " resourceRelations " ) ) || isset ( $ input [ " preview " ] ) ) $ serverResponse = $ this -> getConstellation ( $ input , $ display , false ) ; else $ serverResponse = $ this -> getConstellation ( $ input , $ display , " summary_meta " ) ; if ( isset ( $ serverResponse [ " constellation " ] ) ) { $ editingUser = null ; if ( isset ( $ serverResponse [ " editing_user " ] ) ) $ editingUser = $ serverResponse [ " editing_user " ] ; if ( isset ( $ input [ " part " ] ) ) $ display -> setTemplate ( " detailed_view_tabs/ " . $ input [ " part " ] ) ; else if ( isset ( $ input [ " preview " ] ) ) $ display -> setTemplate ( " detailed_preview_page " ) ; else $ display -> setTemplate ( " detailed_view_page " ) ; $ constellation = $ serverResponse [ " constellation " ] ; if ( \ snac \ Config :: $ DEBUG_MODE == true ) { $ display -> addDebugData ( " constellationSource " , json_encode ( $ serverResponse [ " constellation " ] , JSON_PRETTY_PRINT ) ) ; $ display -> addDebugData ( " serverResponse " , json_encode ( $ serverResponse , JSON_PRETTY_PRINT ) ) ; } $ this -> logger -> addDebug ( " Getting Holding institution information from the resource relations " ) ; $ c = new \ snac \ data \ Constellation ( $ constellation ) ; $ holdings = array ( ) ; foreach ( $ c -> getResourceRelations ( ) as $ resourceRel ) { if ( $ resourceRel -> getResource ( ) !== null && $ resourceRel -> getResource ( ) -> getRepository ( ) != null ) { $ repo = $ resourceRel -> getResource ( ) -> getRepository ( ) ; $ holdings [ $ repo -> getID ( ) ] = array ( " name " => $ repo -> getPreferredNameEntry ( ) -> getOriginal ( ) ) ; foreach ( $ repo -> getPlaces ( ) as $ place ) { if ( $ place -> getGeoTerm ( ) != null ) { $ holdings [ $ repo -> getID ( ) ] [ " latitude " ] = $ place -> getGeoTerm ( ) -> getLatitude ( ) ; $ holdings [ $ repo -> getID ( ) ] [ " longitude " ] = $ place -> getGeoTerm ( ) -> getLongitude ( ) ; } } } } usort ( $ holdings , function ( $ a , $ b ) { return $ a [ " name " ] <=> $ b [ " name " ] ; } ) ; $ this -> logger -> addDebug ( " Setting constellation data into the page template " ) ; $ display -> setData ( array_merge ( $ constellation , array ( " preview " => ( isset ( $ input [ " preview " ] ) ) ? true : false , " maybeSameCount " => ( isset ( $ serverResponse [ " maybesame_count " ] ) ) ? $ serverResponse [ " maybesame_count " ] : 0 , " holdings " => $ holdings , " editingUser " => $ editingUser ) ) ) ; } else { $ this -> logger -> addDebug ( " Error page being drawn " ) ; $ this -> drawErrorPage ( $ serverResponse , $ display ) ; } }
Display Detailed View Page
 Loads the detailed view page for a given constellation input into the display.
Display Detailed View Page Loads the detailed view page for a given constellation input into the display .
// Sort the holding institutions alphabetically