src/snac/server/database/DBUtil.php
/**
     * List the Version History Information
     *
     * Gets the version history information of the given Constellation ID (mainID).  If
     * given a version, it only returns the history up to that version number, else it will
     * return all the history.  If the publicOnly flag is set to true, it only returns
     * the history at publicly-viewable points, i.e. Ingest CPF, Publish, Delete, Tombstone.
     *
     * @param int $mainID The Constellation ID to list
     * @param int $version optional The latest version of the history to return (else returns all)
     * @param boolean $publicOnly optional Only return the publicly available versionings (default true)
     * @return string[] Version History information for the Constellation
     */
List the Version History Information
Gets the version history information of the given Constellation ID (mainID).  If
given a version, it only returns the history up to that version number, else it will
return all the history.  If the publicOnly flag is set to true, it only returns
the history at publicly-viewable points, i.e. Ingest CPF, Publish, Delete, Tombstone.

@param int $mainID The Constellation ID to list
@param int $version optional The latest version of the history to return (else returns all)
@param boolean $publicOnly optional Only return the publicly available versionings (default true)
@return string[] Version History information for the Constellation
List the Version History Information Gets the version history information of the given Constellation ID ( mainID ) . If given a version it only returns the history up to that version number else it will return all the history . If the publicOnly flag is set to true it only returns the history at publicly - viewable points i . e . Ingest CPF Publish Delete Tombstone . @param int $mainID The Constellation ID to list @param int $version optional The latest version of the history to return ( else returns all ) @param boolean $publicOnly optional Only return the publicly available versionings ( default true ) @return string [] Version History information for the Constellation
public function listVersionHistory($mainID, $version=null, $publicOnly=true) {
        $fromVersion = $version;
        if (!$version || !is_int($version)) {
            $fromVersion = $this->sql->selectCurrentVersion($mainID);
        }
        $vhInfo = array ("ic_id" => $mainID, "version" => $fromVersion);
        $history = $this->sql->selectVersionHistory($vhInfo, !$publicOnly);
        $result = array();
        foreach ($history as $h) {
            $event = [
                'date' => $h['update_date'],
                'userName' => $h['username'],
                'fullName' => $h['fullname'],
                'version' => $h['version'],
                'status' => $h['status'],
                'note' => $h['note']
            ];
            if ($event['status'] == 'ingest cpf' || $event['status'] == 'merge split') {
                $event['data'] = json_decode($event['note'], true);
                $event['note'] = "";
            }
            array_push($result, $event);
        }
        usort($result,
            function ($a, $b) {
                return $b['version'] <=> $a['version'];
            });
        return $result;
    }
public function listVersionHistory ( $ mainID , $ version = null , $ publicOnly = true ) { $ fromVersion = $ version ; if ( ! $ version || ! is_int ( $ version ) ) { $ fromVersion = $ this -> sql -> selectCurrentVersion ( $ mainID ) ; } $ vhInfo = array ( " ic_id " => $ mainID , " version " => $ fromVersion ) ; $ history = $ this -> sql -> selectVersionHistory ( $ vhInfo , ! $ publicOnly ) ; $ result = array ( ) ; foreach ( $ history as $ h ) { $ event = [ 'date' => $ h [ 'update_date' ] , 'userName' => $ h [ 'username' ] , 'fullName' => $ h [ 'fullname' ] , 'version' => $ h [ 'version' ] , 'status' => $ h [ 'status' ] , 'note' => $ h [ 'note' ] ] ; if ( $ event [ 'status' ] == 'ingest cpf' || $ event [ 'status' ] == 'merge split' ) { $ event [ 'data' ] = json_decode ( $ event [ 'note' ] , true ) ; $ event [ 'note' ] = " " ; } array_push ( $ result , $ event ) ; } usort ( $ result , function ( $ a , $ b ) { return $ b [ 'version' ] <=> $ a [ 'version' ] ; } ) ; return $ result ; }
List the Version History Information
 Gets the version history information of the given Constellation ID (mainID).
List the Version History Information Gets the version history information of the given Constellation ID ( mainID ) .
//TODO Eventually this should be changed to an object // give the results back in reverse order