PHP Class Devise\Pages\PagesRepository

显示文件 Open project: devisephp/cms Class Usage Examples

Public Methods

Method Description
__construct ( DvsPage $Page, DvsField $Field, DvsGlobalField $GlobalField, LanguageDetector $LanguageDetector, CollectionsRepository $CollectionsRepository, null $Input = null, null $Config = null, null $URL = null, $File = null, $ViewOpener = null ) Create a new PageRepostiry instance.
availableLanguagesForPage ( integer $id, $params = [] ) : array List of all the languages available for a page
availableViewsList ( ) : array Get the list of available views
find ( integer $id ) : Page finds a record by it's id
findByRouteName ( $name, string $versionName = null, boolean $editing = false ) : Page finds a record by it's slug
findByRouteNameAndPreviewHash ( string $name, string $previewHash ) : DvsPage Finds the DvsPage by a route name and preview hash
findLocalizedPage ( Page $page ) : Page See if a localized version of this page exists if there is no difference we return null
findPageTemplates ( [type] $page ) : [type] Find the page templates for this given page
findTemplateVariables ( $templates ) : [type] Find the page variables for this given page
findWithVersion ( integer $id, string $versionName = null, boolean $editing = false ) : Page finds a record by it's id and provide version and field data
getLivePageVersion ( Page $page ) : PageVersion Gets the live version of this page
getLivePageVersionByAB ( [type] $page ) : [type] Get the live page using ab testing logic. This will first search for a cookie and if no version is found it will use the dice roll. If no page version is found with this dice roll then it will resort back to using the old "dates" system.
getLivePageVersionByCookie ( [type] $page ) : [type] Checks to see if the page already has a cookie set so this user doesn't see different page versions all the time.
getLivePageVersionByDate ( [type] $page ) : [type] Gets the live version of this page by date
getLivePageVersionByDiceRoll ( [type] $page ) : [type] Gets the live page version by a dice roll
getLivePageVersionById ( [type] $page, [type] $pageVersionId ) : [type] Get the live version of this page by id
getPageVersionByName ( Page $page, string $versionName ) : PageVersion Gets the page version by name
getPageVersions ( integer $pageId, null $selectedPageVersionId = null ) : EloquentCollection[PageVersions] Get the versions of a page
getPageVersionsByAB ( [type] $page ) : [type] Gets all live page versions when we are in a A|B testing mode for a page
getPagesList ( boolean $includeAdmin = false, string $search = null ) : array Gets a list of pages in array format probably used for drop down boxes.
getRouteList ( ) : Collection Get the route list for all the non admin pages
getUnUsedLanguageList ( integer $pageId, array $languages ) : array Gets a list of languages that the page has not been translated to or originates from
pages ( ) : Page Finds lots of pages in the system that are not admin pages and belong to the current language

Protected Methods

Method Description
getPageVersionByPreviewHash ( $page, $previewHash ) * Gets the page version by a hash
toHumanDateFormat ( Datetime $timestamp, string $to = 'm/d/y H:i:s' ) : string To human date format converts this to a readable human format
updateUrlsInField ( [type] $field ) : [type] [updateUrlsInField description]
wrapFieldsAroundPage ( Page $page, $pageVersion ) : Page Wrap all fields around the page
wrapLanguagesAroundPages ( Collection $pages ) : Collection Wraps the available languages for a page
wrapPageVersionStatusByAB ( [type] $version, [type] $page, [type] $liveVersions ) : [type] Wrap the status around a single page version
wrapPageVersionStatusByDate ( DvsPageVersion $version, DvsPage $page, DvsPageVersion $liveVersion ) : DvsPageVersion Wraps the status around a single page version
wrapPageVersionStatuses ( $versions, $page ) : Collection Wraps the statues around page versions
wrapPageVersionStatusesByAB ( [type] $versions, [type] $page ) : [type] Wraps AB Page Version Statuses on all versions for the page
wrapPageVersionStatusesByDate ( [type] $versions, [type] $page ) : [type] [wrapPageVersionStatusesByDate description]
wrapTheseCollectionsAroundThisPage ( $collections, Page $page ) : Page Takes a list of collections and wraps the page with those collections so we can access them dynamically.
wrapTheseFieldsAroundThisPage ( array $fields, Page $page ) : Page Takes a list of fields and a page and puts those field values onto a page object to return

Method Details

__construct() public method

Create a new PageRepostiry instance.
public __construct ( DvsPage $Page, DvsField $Field, DvsGlobalField $GlobalField, LanguageDetector $LanguageDetector, CollectionsRepository $CollectionsRepository, null $Input = null, null $Config = null, null $URL = null, $File = null, $ViewOpener = null )
$Page DvsPage
$Field DvsField
$GlobalField DvsGlobalField
$LanguageDetector Devise\Languages\LanguageDetector
$CollectionsRepository Devise\Pages\Collections\CollectionsRepository
$Input null
$Config null
$URL null

availableLanguagesForPage() public method

List of all the languages available for a page
public availableLanguagesForPage ( integer $id, $params = [] ) : array
$id integer
return array

availableViewsList() public method

Get the list of available views
public availableViewsList ( ) : array
return array

find() public method

finds a record by it's id
public find ( integer $id ) : Page
$id integer
return Page

findByRouteName() public method

finds a record by it's slug
public findByRouteName ( $name, string $versionName = null, boolean $editing = false ) : Page
$name
$versionName string
$editing boolean
return Page

findByRouteNameAndPreviewHash() public method

Finds the DvsPage by a route name and preview hash
public findByRouteNameAndPreviewHash ( string $name, string $previewHash ) : DvsPage
$name string
$previewHash string
return DvsPage

findLocalizedPage() public method

See if a localized version of this page exists if there is no difference we return null
public findLocalizedPage ( Page $page ) : Page
$page Page
return Page

findPageTemplates() public method

Find the page templates for this given page
public findPageTemplates ( [type] $page ) : [type]
$page [type]
return [type]

findTemplateVariables() public method

Find the page variables for this given page
public findTemplateVariables ( $templates ) : [type]
return [type]

findWithVersion() public method

finds a record by it's id and provide version and field data
public findWithVersion ( integer $id, string $versionName = null, boolean $editing = false ) : Page
$id integer
$versionName string
$editing boolean
return Page

getLivePageVersion() public method

Gets the live version of this page
public getLivePageVersion ( Page $page ) : PageVersion
$page Page
return PageVersion

getLivePageVersionByAB() public method

Get the live page using ab testing logic. This will first search for a cookie and if no version is found it will use the dice roll. If no page version is found with this dice roll then it will resort back to using the old "dates" system.
public getLivePageVersionByAB ( [type] $page ) : [type]
$page [type]
return [type]

getLivePageVersionByCookie() public method

..
public getLivePageVersionByCookie ( [type] $page ) : [type]
$page [type]
return [type]

getLivePageVersionByDate() public method

Gets the live version of this page by date
public getLivePageVersionByDate ( [type] $page ) : [type]
$page [type]
return [type]

getLivePageVersionByDiceRoll() public method

Gets the live page version by a dice roll
public getLivePageVersionByDiceRoll ( [type] $page ) : [type]
$page [type]
return [type]

getLivePageVersionById() public method

Get the live version of this page by id
public getLivePageVersionById ( [type] $page, [type] $pageVersionId ) : [type]
$page [type]
$pageVersionId [type]
return [type]

getPageVersionByName() public method

Gets the page version by name
public getPageVersionByName ( Page $page, string $versionName ) : PageVersion
$page Page
$versionName string
return PageVersion

getPageVersionByPreviewHash() protected method

* Gets the page version by a hash
protected getPageVersionByPreviewHash ( $page, $previewHash )
$page
$previewHash

getPageVersions() public method

Get the versions of a page
public getPageVersions ( integer $pageId, null $selectedPageVersionId = null ) : EloquentCollection[PageVersions]
$pageId integer
$selectedPageVersionId null
return EloquentCollection[PageVersions]

getPageVersionsByAB() public method

Gets all live page versions when we are in a A|B testing mode for a page
public getPageVersionsByAB ( [type] $page ) : [type]
$page [type]
return [type]

getPagesList() public method

Gets a list of pages in array format probably used for drop down boxes.
public getPagesList ( boolean $includeAdmin = false, string $search = null ) : array
$includeAdmin boolean
$search string
return array

getRouteList() public method

Get the route list for all the non admin pages
public getRouteList ( ) : Collection
return Collection

getUnUsedLanguageList() public method

Gets a list of languages that the page has not been translated to or originates from
public getUnUsedLanguageList ( integer $pageId, array $languages ) : array
$pageId integer
$languages array
return array

pages() public method

Finds lots of pages in the system that are not admin pages and belong to the current language
public pages ( ) : Page
return Page

toHumanDateFormat() protected method

To human date format converts this to a readable human format
protected toHumanDateFormat ( Datetime $timestamp, string $to = 'm/d/y H:i:s' ) : string
$timestamp Datetime
$to string
return string

updateUrlsInField() protected method

[updateUrlsInField description]
protected updateUrlsInField ( [type] $field ) : [type]
$field [type]
return [type]

wrapFieldsAroundPage() protected method

Wrap all fields around the page
protected wrapFieldsAroundPage ( Page $page, $pageVersion ) : Page
$page Page
$pageVersion
return Page

wrapLanguagesAroundPages() protected method

Wraps the available languages for a page
protected wrapLanguagesAroundPages ( Collection $pages ) : Collection
$pages Collection
return Collection

wrapPageVersionStatusByAB() protected method

Wrap the status around a single page version
protected wrapPageVersionStatusByAB ( [type] $version, [type] $page, [type] $liveVersions ) : [type]
$version [type]
$page [type]
$liveVersions [type]
return [type]

wrapPageVersionStatusByDate() protected method

Wraps the status around a single page version
protected wrapPageVersionStatusByDate ( DvsPageVersion $version, DvsPage $page, DvsPageVersion $liveVersion ) : DvsPageVersion
$version DvsPageVersion
$page DvsPage
$liveVersion DvsPageVersion
return DvsPageVersion

wrapPageVersionStatuses() protected method

Wraps the statues around page versions
protected wrapPageVersionStatuses ( $versions, $page ) : Collection
$versions
$page
return Collection

wrapPageVersionStatusesByAB() protected method

Wraps AB Page Version Statuses on all versions for the page
protected wrapPageVersionStatusesByAB ( [type] $versions, [type] $page ) : [type]
$versions [type]
$page [type]
return [type]

wrapPageVersionStatusesByDate() protected method

[wrapPageVersionStatusesByDate description]
protected wrapPageVersionStatusesByDate ( [type] $versions, [type] $page ) : [type]
$versions [type]
$page [type]
return [type]

wrapTheseCollectionsAroundThisPage() protected method

Takes a list of collections and wraps the page with those collections so we can access them dynamically.
protected wrapTheseCollectionsAroundThisPage ( $collections, Page $page ) : Page
$collections
$page Page
return Page

wrapTheseFieldsAroundThisPage() protected method

Takes a list of fields and a page and puts those field values onto a page object to return
protected wrapTheseFieldsAroundThisPage ( array $fields, Page $page ) : Page
$fields array
$page Page
return Page