src/snac/server/database/DBUtil.php
/**
     * Most recent constellation list by status current user only
     *
     * List constellations that meet all these criteria: 1) most recent,  2) current user, 3) given status
     *
     * This function returns valid, partial, summary constellations. The last arg to readConstellation() is
     * $summary and we pass true.
     *
     * Status defaults to 'locked editing'. The default is: user has the constellation locked for edit. Note:
     * 'locked editing' and 'currently editing' are different with different meanings.
     *
     * The constellations returned will always be owned by the current user, and will be the most recent
     * version, period. The returned constellations will be the absolutely most recent version for that
     * constellation. This will not return any constellation for which the most recent version does not match
     * status and user.
     *
     * Mar 29 2016 Robbie suggests we only return partial, summary constellations here with enough data to build
     * UI. Partial means: table nrd and table name_entry. We tried returning the full constellations, but that
     * was simply too much data to send to the web browser. The return values here are valid constellations
     * and can be treated as normal constellations which keeps all the code consistent. However, by only
     * containing a fraction of the data, the returned list is manageable.
     *
     * Was named listConstellationsLockedToUser().
     *
     * Defaults are: \snac\Config::$SQL_LIMIT (probably 42), \snac\Config::$SQL_OFFSET (probably 0).

     * Note about default paramter values: Unfortunately, we have to accept null and default to null since php
     * cannot default to a constant or variable in a function signature. Also, php does not allow optional
     * parameters except the last parameter, so we have to accept null for $limit regardless.
     *
     * From the php manual: "The default value must be a constant expression, not (for example) a variable, a
     * class member or a function call."
     *
     * @param \snac\data\User $user The user to get the list of constellationsf or
     *
     * @param string optional $status A single status for the list of constellations. Not implemented, but
     * planned to support status values in addition to 'locked editing'
     *
     * @param integer $limit optional Limit to the number of records. Not optional here. Must be -1 for all, or an
     * integer . Default to the config when missing.
     *
     * @param integer $offset optional An offset to jump into the list of records in the database. Optional defaults to
     * a config value. Must be -1 for all, or an integer. Default to the config when missing.
     *
     * @param boolean $secondary optional Whether to search the version_history by secondary user for this status (default false)
     *
     * @return \snac\data\Constellation[] A list of PHP constellation object (which might be summary objects),
     * or an empty array when there are no constellations.
     */
Most recent constellation list by status current user only
List constellations that meet all these criteria: 1) most recent,  2) current user, 3) given status

This function returns valid, partial, summary constellations. The last arg to readConstellation() is
$summary and we pass true.

Status defaults to 'locked editing'. The default is: user has the constellation locked for edit. Note:
'locked editing' and 'currently editing' are different with different meanings.

The constellations returned will always be owned by the current user, and will be the most recent
version, period. The returned constellations will be the absolutely most recent version for that
constellation. This will not return any constellation for which the most recent version does not match
status and user.

Mar 29 2016 Robbie suggests we only return partial, summary constellations here with enough data to build
UI. Partial means: table nrd and table name_entry. We tried returning the full constellations, but that
was simply too much data to send to the web browser. The return values here are valid constellations
and can be treated as normal constellations which keeps all the code consistent. However, by only
containing a fraction of the data, the returned list is manageable.





Note about default paramter values: Unfortunately, we have to accept null and default to null since php
cannot default to a constant or variable in a function signature. Also, php does not allow optional
parameters except the last parameter, so we have to accept null for $limit regardless.

From the php manual: "The default value must be a constant expression, not (for example) a variable, a
class member or a function call."

@param \snac\data\User $user The user to get the list of constellationsf or

@param string optional $status A single status for the list of constellations. Not implemented, but
planned to support status values in addition to 'locked editing'

@param integer $limit optional Limit to the number of records. Not optional here. Must be -1 for all, or an
integer . Default to the config when missing.

@param integer $offset optional An offset to jump into the list of records in the database. Optional defaults to
a config value. Must be -1 for all, or an integer. Default to the config when missing.

@param boolean $secondary optional Whether to search the version_history by secondary user for this status (default false)

@return \snac\data\Constellation[] A list of PHP constellation object (which might be summary objects),
or an empty array when there are no constellations.
Most recent constellation list by status current user only List constellations that meet all these criteria : 1 ) most recent 2 ) current user 3 ) given status This function returns valid partial summary constellations . The last arg to readConstellation () is $summary and we pass true . Status defaults to ' locked editing ' . The default is : user has the constellation locked for edit . Note : ' locked editing ' and ' currently editing ' are different with different meanings . The constellations returned will always be owned by the current user and will be the most recent version period . The returned constellations will be the absolutely most recent version for that constellation . This will not return any constellation for which the most recent version does not match status and user . Mar 29 2016 Robbie suggests we only return partial summary constellations here with enough data to build UI . Partial means : table nrd and table name_entry . We tried returning the full constellations but that was simply too much data to send to the web browser . The return values here are valid constellations and can be treated as normal constellations which keeps all the code consistent . However by only containing a fraction of the data the returned list is manageable . Note about default paramter values : Unfortunately we have to accept null and default to null since php cannot default to a constant or variable in a function signature . Also php does not allow optional parameters except the last parameter so we have to accept null for $limit regardless . From the php manual : " The default value must be a constant expression not ( for example ) a variable a class member or a function call . " @param \ snac \ data \ User $user The user to get the list of constellationsf or @param string optional $status A single status for the list of constellations . Not implemented but planned to support status values in addition to ' locked editing ' @param integer $limit optional Limit to the number of records . Not optional here . Must be - 1 for all or an integer . Default to the config when missing . @param integer $offset optional An offset to jump into the list of records in the database . Optional defaults to a config value . Must be - 1 for all or an integer . Default to the config when missing . @param boolean $secondary optional Whether to search the version_history by secondary user for this status ( default false ) @return \ snac \ data \ Constellation [] A list of PHP constellation object ( which might be summary objects ) or an empty array when there are no constellations .
public function listConstellationsWithStatusForUser($user,
                                                        $status='locked editing',
                                                        $limit=null,
                                                        $offset=null,
                                                        $secondary=false)
    {
        if ($user == null || $user->getUserID() == null) {
            return false;
        }
        if ($limit==null || ! is_int($limit))
        {
            $limit = \snac\Config::$SQL_LIMIT;
        }
        if ($offset == null || ! is_int($offset))
        {
            $offset = \snac\Config::$SQL_OFFSET;
        }
        $infoList = $this->sql->selectEditList($user->getUserID(), $status, $limit, $offset, $secondary);
        if ($infoList)
        {
            $constellationList = array();
            foreach ($infoList as $idVer)
            {
                $cObj = $this->readConstellation($idVer['ic_id'], $idVer['version'], DBUtil::$READ_NRD | DBUtil::$READ_PREFERRED_NAME);
                array_push($constellationList, $cObj);
            }
            return $constellationList;
        }
        return array();
    }
public function listConstellationsWithStatusForUser ( $ user , $ status = 'locked editing' , $ limit = null , $ offset = null , $ secondary = false ) { if ( $ user == null || $ user -> getUserID ( ) == null ) { return false ; } if ( $ limit == null || ! is_int ( $ limit ) ) { $ limit = \ snac \ Config :: $ SQL_LIMIT ; } if ( $ offset == null || ! is_int ( $ offset ) ) { $ offset = \ snac \ Config :: $ SQL_OFFSET ; } $ infoList = $ this -> sql -> selectEditList ( $ user -> getUserID ( ) , $ status , $ limit , $ offset , $ secondary ) ; if ( $ infoList ) { $ constellationList = array ( ) ; foreach ( $ infoList as $ idVer ) { $ cObj = $ this -> readConstellation ( $ idVer [ 'ic_id' ] , $ idVer [ 'version' ] , DBUtil :: $ READ_NRD | DBUtil :: $ READ_PREFERRED_NAME ) ; array_push ( $ constellationList , $ cObj ) ; } return $ constellationList ; } return array ( ) ; }
Most recent constellation list by status current user only
 List constellations that meet all these criteria: 1) most recent,  2) current user, 3) given status
Most recent constellation list by status current user only List constellations that meet all these criteria : 1 ) most recent 2 ) current user 3 ) given status