PHP Class Airship\Cabin\Bridge\Blueprint\Author

This contains all of the methods used for managing authors. It's mostly used by the Author landing, although some methods are used in Airship\Cabin\Bridge\Landing\Blog as well.
Inheritance: extends BlueprintGear, use trait Common, use trait Orderable, use trait Slug
Show file Open project: paragonie/airship Class Usage Examples

Protected Properties

Property Type Description
$photosDir string

Public Methods

Method Description
addUserByUniqueId ( integer $authorId, string $uniqueId, boolean $inCharge = false ) : boolean Add a user, given its unique id.
createAuthor ( array $post ) : boolean Create a new Author profile
deleteAuthor ( integer $authorId, integer $reassignTo ) : boolean Delete an author profile
getAll ( string $sortby = 'name', string $dir = 'ASC' ) : array Get all authors, sorting by a particular field
getAuthorIdsForUser ( integer $userid ) : array Get all of the authors available for this user to post under
getAvailablePhotos ( integer $authorID, string $cabin = '', boolean $includeId = false ) : array Get all of the photos in the various
getById ( integer $authorId ) : array Get an author by its ID
getForUser ( integer $userId, string $sortby = 'name', string $dir = 'ASC' ) : array Get all of the authors available for this user to post under
getName ( integer $authorId ) : string Get the author's name
getNumBlogPostsForAuthor ( integer $authorId ) : integer Get the number of photos uploaded for this author
getNumCommentsForAuthor ( integer $authorId ) : integer Get the number of photos uploaded for this author
getNumFilesForAuthor ( integer $authorId ) : integer Get the number of files uploaded for this author
getNumUsersForAuthor ( integer $authorId ) : integer Get the number of users that have access to this author
getPhotoContextId ( string $label ) : integer Get the available photo contexts
getPhotoContexts ( ) : array Get the available photo contexts
getPhotoData ( integer $authorID, string $context ) : array Get all of the photos in the various
getPhotoDirName ( ) : string Get the name of the photos directory (usually: "photos")
getSlug ( integer $authorId ) : string Get the slug for a given Author (given its ID)
getUsersForAuthor ( integer $authorId ) : array Get the users that have access to an Author.
numAuthors ( ) : integer Get the number of Authors that exist.
removeUserByUniqueId ( integer $authorId, string $uniqueId ) : boolean Remove a user from this author
savePhotoChoice ( integer $authorId, string $context, string $cabin, string $filename ) : boolean Save the photo to display in a given context.
toggleOwnerStatus ( integer $authorId, string $uniqueId ) : boolean Toggle the 'owner' flag.
updateAuthor ( integer $authorId, array $post ) : boolean Update an author profile
updateAuthorSlug ( integer $authorId, array $post ) : boolean Should we update the author's slug?
userHasAccess ( integer $authorId, integer $userId ) : boolean Is this user an owner of the given
userIsOwner ( integer $authorId, integer $userId ) : boolean Is this user an owner of the given

Protected Methods

Method Description
deleteAuthorCascade ( integer $authorId ) Overloadable. Delete all entries that depend on the authors table in any capacity.
getPhotoDirectory ( string $slug, string $cabin ) : integer Get photos directory ID
reassignAuthorship ( integer $oldAuthorId, integer $newAuthorId ) Overloadable. Reassign all entries that depend on the authors table in any capacity to a differnet author (or NULL).

Method Details

addUserByUniqueId() public method

Add a user, given its unique id.
public addUserByUniqueId ( integer $authorId, string $uniqueId, boolean $inCharge = false ) : boolean
$authorId integer
$uniqueId string
$inCharge boolean
return boolean

createAuthor() public method

Create a new Author profile
public createAuthor ( array $post ) : boolean
$post array
return boolean

deleteAuthor() public method

Delete an author profile
public deleteAuthor ( integer $authorId, integer $reassignTo ) : boolean
$authorId integer
$reassignTo integer
return boolean

deleteAuthorCascade() protected method

Overloadable. Delete all entries that depend on the authors table in any capacity.
protected deleteAuthorCascade ( integer $authorId )
$authorId integer

getAll() public method

Get all authors, sorting by a particular field
public getAll ( string $sortby = 'name', string $dir = 'ASC' ) : array
$sortby string
$dir string
return array

getAuthorIdsForUser() public method

Get all of the authors available for this user to post under
public getAuthorIdsForUser ( integer $userid ) : array
$userid integer
return array

getAvailablePhotos() public method

1. Get the directories for each cabin. 2. Get all of the file IDs for these directories. Our SQL query should automatically draw in the "context" parameter.
public getAvailablePhotos ( integer $authorID, string $cabin = '', boolean $includeId = false ) : array
$authorID integer
$cabin string
$includeId boolean
return array

getById() public method

Get an author by its ID
public getById ( integer $authorId ) : array
$authorId integer
return array

getForUser() public method

Get all of the authors available for this user to post under
public getForUser ( integer $userId, string $sortby = 'name', string $dir = 'ASC' ) : array
$userId integer
$sortby string
$dir string
return array

getName() public method

Get the author's name
public getName ( integer $authorId ) : string
$authorId integer
return string

getNumBlogPostsForAuthor() public method

Get the number of photos uploaded for this author
public getNumBlogPostsForAuthor ( integer $authorId ) : integer
$authorId integer
return integer

getNumCommentsForAuthor() public method

Get the number of photos uploaded for this author
public getNumCommentsForAuthor ( integer $authorId ) : integer
$authorId integer
return integer

getNumFilesForAuthor() public method

Get the number of files uploaded for this author
public getNumFilesForAuthor ( integer $authorId ) : integer
$authorId integer
return integer

getNumUsersForAuthor() public method

Get the number of users that have access to this author
public getNumUsersForAuthor ( integer $authorId ) : integer
$authorId integer
return integer

getPhotoContextId() public method

Get the available photo contexts
public getPhotoContextId ( string $label ) : integer
$label string
return integer

getPhotoContexts() public method

Get the available photo contexts
public getPhotoContexts ( ) : array
return array

getPhotoData() public method

1. Get the directories for each cabin. 2. Get all of the file IDs for these directories. Our SQL query should automatically draw in the "context" parameter.
public getPhotoData ( integer $authorID, string $context ) : array
$authorID integer
$context string
return array

getPhotoDirName() public method

Get the name of the photos directory (usually: "photos")
public getPhotoDirName ( ) : string
return string

getPhotoDirectory() protected method

Get photos directory ID
protected getPhotoDirectory ( string $slug, string $cabin ) : integer
$slug string
$cabin string
return integer

getSlug() public method

Get the slug for a given Author (given its ID)
public getSlug ( integer $authorId ) : string
$authorId integer
return string

getUsersForAuthor() public method

Get the users that have access to an Author.
public getUsersForAuthor ( integer $authorId ) : array
$authorId integer
return array

numAuthors() public method

Get the number of Authors that exist.
public numAuthors ( ) : integer
return integer

reassignAuthorship() protected method

Overloadable. Reassign all entries that depend on the authors table in any capacity to a differnet author (or NULL).
protected reassignAuthorship ( integer $oldAuthorId, integer $newAuthorId )
$oldAuthorId integer
$newAuthorId integer = 0

removeUserByUniqueId() public method

Remove a user from this author
public removeUserByUniqueId ( integer $authorId, string $uniqueId ) : boolean
$authorId integer
$uniqueId string
return boolean

savePhotoChoice() public method

Save the photo to display in a given context.
public savePhotoChoice ( integer $authorId, string $context, string $cabin, string $filename ) : boolean
$authorId integer
$context string
$cabin string
$filename string
return boolean

toggleOwnerStatus() public method

Toggle the 'owner' flag.
public toggleOwnerStatus ( integer $authorId, string $uniqueId ) : boolean
$authorId integer
$uniqueId string
return boolean

updateAuthor() public method

Update an author profile
public updateAuthor ( integer $authorId, array $post ) : boolean
$authorId integer
$post array
return boolean

updateAuthorSlug() public method

Should we update the author's slug?
public updateAuthorSlug ( integer $authorId, array $post ) : boolean
$authorId integer
$post array
return boolean

userHasAccess() public method

Is this user an owner of the given
public userHasAccess ( integer $authorId, integer $userId ) : boolean
$authorId integer
$userId integer
return boolean

userIsOwner() public method

Is this user an owner of the given
public userIsOwner ( integer $authorId, integer $userId ) : boolean
$authorId integer
$userId integer
return boolean

Property Details

$photosDir protected property

protected string $photosDir
return string