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
Afficher le fichier Open project: paragonie/airship Class Usage Examples

Protected Properties

Свойство Type Description
$photosDir string

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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

createAuthor() public méthode

Create a new Author profile
public createAuthor ( array $post ) : boolean
$post array
Résultat boolean

deleteAuthor() public méthode

Delete an author profile
public deleteAuthor ( integer $authorId, integer $reassignTo ) : boolean
$authorId integer
$reassignTo integer
Résultat boolean

deleteAuthorCascade() protected méthode

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

getAll() public méthode

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

getAuthorIdsForUser() public méthode

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

getAvailablePhotos() public méthode

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
Résultat array

getById() public méthode

Get an author by its ID
public getById ( integer $authorId ) : array
$authorId integer
Résultat array

getForUser() public méthode

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
Résultat array

getName() public méthode

Get the author's name
public getName ( integer $authorId ) : string
$authorId integer
Résultat string

getNumBlogPostsForAuthor() public méthode

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

getNumCommentsForAuthor() public méthode

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

getNumFilesForAuthor() public méthode

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

getNumUsersForAuthor() public méthode

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

getPhotoContextId() public méthode

Get the available photo contexts
public getPhotoContextId ( string $label ) : integer
$label string
Résultat integer

getPhotoContexts() public méthode

Get the available photo contexts
public getPhotoContexts ( ) : array
Résultat array

getPhotoData() public méthode

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
Résultat array

getPhotoDirName() public méthode

Get the name of the photos directory (usually: "photos")
public getPhotoDirName ( ) : string
Résultat string

getPhotoDirectory() protected méthode

Get photos directory ID
protected getPhotoDirectory ( string $slug, string $cabin ) : integer
$slug string
$cabin string
Résultat integer

getSlug() public méthode

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

getUsersForAuthor() public méthode

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

numAuthors() public méthode

Get the number of Authors that exist.
public numAuthors ( ) : integer
Résultat integer

reassignAuthorship() protected méthode

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 méthode

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

savePhotoChoice() public méthode

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
Résultat boolean

toggleOwnerStatus() public méthode

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

updateAuthor() public méthode

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

updateAuthorSlug() public méthode

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

userHasAccess() public méthode

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

userIsOwner() public méthode

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

Property Details

$photosDir protected_oe property

protected string $photosDir
Résultat string