code/pagetypes/BrowseCataloguePage.php
/**
     * Gets the details of a record by its ID and displays a page with the information about the record.
     *
     * @param  SS_HTTPRequest $request
     * @return Array
     */
Gets the details of a record by its ID and displays a page with the information about the record.
@param  SS_HTTPRequest $request
@return Array
Gets the details of a record by its ID and displays a page with the information about the record . @param SS_HTTPRequest $request @return Array
public function details(SS_HTTPRequest $request)
    {
        $data = array();
        $id = $request->getVar('id');
        if ($this->CatalogueUrl) {
            if ($id) {
                $record = $this->getRecordByID($id);
                if (!$this->ErrorMessage) {
                    try {
                        $doc = new DOMDocument();
                        $doc->loadXML($record);
                        $mdArray = $this->{'parseDetails' . $this->Format}($doc);
                        if (isset($mdArray[0])) {
                            $data = $mdArray[0];
                        }
                    } catch (Exception $e) {
                        $this->ErrorMessage = "Sorry, there was an error parsing the response from the catalogue.";
                    }
                }
            } else {
                $this->ErrorMessage = "The ID of the record to view was not specified.";
            }
        } else {
            $this->ErrorMessage = "The catalogue to browse has not been configured. Please contact the website administrator.";
        }
        return $this->renderWith(array('CatalogueEntryDetails_' . $this->Format, 'Page'), $data);
    }
public function details ( SS_HTTPRequest $ request ) { $ data = array ( ) ; $ id = $ request -> getVar ( 'id' ) ; if ( $ this -> CatalogueUrl ) { if ( $ id ) { $ record = $ this -> getRecordByID ( $ id ) ; if ( ! $ this -> ErrorMessage ) { try { $ doc = new DOMDocument ( ) ; $ doc -> loadXML ( $ record ) ; $ mdArray = $ this -> { 'parseDetails' . $ this -> Format } ( $ doc ) ; if ( isset ( $ mdArray [ 0 ] ) ) { $ data = $ mdArray [ 0 ] ; } } catch ( Exception $ e ) { $ this -> ErrorMessage = " Sorry, there was an error parsing the response from the catalogue. " ; } } } else { $ this -> ErrorMessage = " The ID of the record to view was not specified. " ; } } else { $ this -> ErrorMessage = " The catalogue to browse has not been configured. Please contact the website administrator. " ; } return $ this -> renderWith ( array ( 'CatalogueEntryDetails_' . $ this -> Format , 'Page' ) , $ data ) ; }
Gets the details of a record by its ID and displays a page with the information about the record.
Gets the details of a record by its ID and displays a page with the information about the record .
// If the catalogue url has been specified then call function to search/browse the catalogue. // Create a new DOM documents and then load the response as XML in to it. // Call function to parse the document. // Check if there is an item in the returned array and if so set the data to that. // Render the page with the data for the record.