t3lib_pageSelect Class Reference

List of all members.

Public Member Functions

 init ($show_hidden)
 getPage ($uid, $disableGroupAccessCheck=FALSE)
 getPage_noCheck ($uid)
 getFirstWebPage ($uid)
 getPageIdFromAlias ($alias)
 getPageOverlay ($pageInput, $lUid=-1)
 getRecordOverlay ($table, $row, $sys_language_content, $OLmode='')
 getMenu ($uid, $fields='*', $sortField='sorting', $addWhere='', $checkShortcuts=1)
 getDomainStartPage ($domain, $path='', $request_uri='')
 getRootLine ($uid, $MP= '', $ignoreMPerrors=false)
 getPathFromRootline ($rl, $len=20)
 getExtURL ($pagerow, $disable=0)
 getMountPointInfo ($pageId, $pageRec=FALSE, $prevMountPids=array(), $firstPageUid=0)
 checkRecord ($table, $uid, $checkPage=0)
 getRawRecord ($table, $uid, $fields='*', $noWSOL=FALSE)
 getRecordsByField ($theTable, $theField, $theValue, $whereClause='', $groupBy='', $orderBy='', $limit='')
 getHash ($hash, $expTime=0)
 storeHash ($hash, $data, $ident)
 deleteClause ($table)
 enableFields ($table, $show_hidden=-1, $ignore_array=array(), $noVersionPreview=FALSE)
 getMultipleGroupsWhereClause ($field, $table)
 fixVersioningPid ($table, &$rr)
 versionOL ($table, &$row, $unsetMovePointers=FALSE, $bypassEnableFieldsCheck=FALSE)
 movePlhOL ($table, &$row)
 getMovePlaceholder ($table, $uid, $fields='*')
 getWorkspaceVersionOfRecord ($workspace, $table, $uid, $fields='*', $bypassEnableFieldsCheck=FALSE)
 checkWorkspaceAccess ($wsid)

Public Attributes

 $urltypes = Array('','http://','ftp://','mailto:','https://')
 $where_hid_del = ' AND pages.deleted=0'
 $where_groupAccess = ''
 $sys_language_uid = 0
 $versioningPreview = FALSE
 $versioningWorkspaceId = 0
 $workspaceCache = array()
 $error_getRootLine = ''
 $error_getRootLine_failPid = 0

Protected Attributes

 $cache_getRootLine = array()
 $cache_getPage = array()
 $cache_getMountPointInfo = array()


Detailed Description

Definition at line 109 of file class.t3lib_page.php.


Member Function Documentation

t3lib_pageSelect.checkRecord ( table,
uid,
checkPage = 0 
)

Checks if a record exists and is accessible. The row is returned if everything's OK.

Parameters:
string The table name to search
integer The uid to look up in $table
boolean If checkPage is set, it's also required that the page on which the record resides is accessible
Returns:
mixed Returns array (the record) if OK, otherwise blank/0 (zero)

Definition at line 812 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $TCA, $uid, enableFields(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.checkWorkspaceAccess ( wsid  ) 

Checks if user has access to workspace.

Parameters:
int $wsid Workspace ID
Returns:
boolean true if has access

Definition at line 1354 of file class.t3lib_page.php.

References $GLOBALS.

Referenced by fixVersioningPid().

t3lib_pageSelect.deleteClause ( table  ) 

Returns the "AND NOT deleted" clause for the tablename given IF $TCA configuration points to such a field.

Parameters:
string Tablename
Returns:
string
See also:
enableFields()

Definition at line 975 of file class.t3lib_page.php.

References $TCA.

Referenced by getMovePlaceholder(), getPage_noCheck(), getRawRecord(), getRecordsByField(), and getWorkspaceVersionOfRecord().

t3lib_pageSelect.enableFields ( table,
show_hidden = -1,
ignore_array = array(),
noVersionPreview = FALSE 
)

Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Definitely a frontend function. Is using the $TCA arrays "ctrl" part where the key "enablefields" determines for each table which of these features applies to that table.

Parameters:
string Table name found in the $TCA array
integer If $show_hidden is set (0/1), any hidden-fields in records are ignored. NOTICE: If you call this function, consider what to do with the show_hidden parameter. Maybe it should be set? See tslib_cObj->enableFields where it's implemented correctly.
array Array you can pass where keys can be "disabled", "starttime", "endtime", "fe_group" (keys from "enablefields" in TCA) and if set they will make sure that part of the clause is not added. Thus disables the specific part of the clause. For previewing etc.
boolean If set, enableFields will be applied regardless of any versioning preview settings which might otherwise disable enableFields
Returns:
string The clause starting like " AND ...=... AND ...=..."
See also:
tslib_cObj.enableFields(), deleteClause()

Definition at line 995 of file class.t3lib_page.php.

References $GLOBALS, $TYPO3_CONF_VARS, t3lib_div.callUserFunction(), and getMultipleGroupsWhereClause().

Referenced by checkRecord(), getPageOverlay(), getRecordOverlay(), getWorkspaceVersionOfRecord(), and movePlhOL().

Here is the call graph for this function:

t3lib_pageSelect.fixVersioningPid ( table,
&$  rr 
)

Finding online PID for offline version record ONLY active when backend user is previewing records. MUST NEVER affect a site served which is not previewed by backend users!!! Will look if the "pid" value of the input record is -1 (it is an offline version) and if the table supports versioning; if so, it will translate the -1 PID into the PID of the original record Used whenever you are tracking something back, like making the root line. Principle; Record offline! => Find online?

Parameters:
string Table name
array Record array passed by reference. As minimum, "pid" and "uid" fields must exist! "t3ver_oid" and "t3ver_wsid" is nice and will save you a DB query.
Returns:
void (Passed by ref).
See also:
t3lib_BEfunc.fixVersioningPid(), versionOL(), getRootLine()

Definition at line 1113 of file class.t3lib_page.php.

References $TCA, checkWorkspaceAccess(), getMovePlaceholder(), and getRawRecord().

Referenced by getRootLine().

Here is the call graph for this function:

t3lib_pageSelect.getDomainStartPage ( domain,
path = '',
request_uri = '' 
)

Will find the page carrying the domain record matching the input domain. Might exit after sending a redirect-header IF a found domain record instructs to do so.

Parameters:
string Domain name to search for. Eg. "www.typo3.com". Typical the HTTP_HOST value.
string Path for the current script in domain. Eg. "/somedir/subdir". Typ. supplied by t3lib_div.getIndpEnv('SCRIPT_NAME')
string Request URI: Used to get parameters from if they should be appended. Typ. supplied by t3lib_div.getIndpEnv('REQUEST_URI')
Returns:
mixed If found, returns integer with page UID where found. Otherwise blank. Might exit if location-header is sent, see description.
See also:
tslib_fe.findDomainRecord()

Definition at line 497 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, and t3lib_div.locationHeaderUrl().

Here is the call graph for this function:

t3lib_pageSelect.getExtURL ( pagerow,
disable = 0 
)

Returns the URL type for the input page row IF the doktype is 3 and not disabled.

Parameters:
array The page row to return URL type for
boolean A flag to simply disable any output from here.
Returns:
string The URL type from $this->urltypes array. False if not found or disabled.
See also:
tslib_fe.setExternalJumpUrl()

Definition at line 700 of file class.t3lib_page.php.

References t3lib_div.getIndpEnv().

Here is the call graph for this function:

t3lib_pageSelect.getFirstWebPage ( uid  ) 

Returns the $row of the first web-page in the tree (for the default menu...)

Parameters:
integer The page id for which to fetch first subpages (PID)
Returns:
mixed If found: The page record (with overlayed localized fields, if any). If NOT found: blank value (not array!)
See also:
tslib_fe.fetch_the_id()

Definition at line 236 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $uid, getPageOverlay(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.getHash ( hash,
expTime = 0 
)

Returns string value stored for the hash string in the table "cache_hash" Can be used to retrieved a cached value Can be used from your frontend plugins if you like. It is also used to store the parsed TypoScript template structures. You can call it directly like t3lib_pageSelect.getHash()

Parameters:
string The hash-string which was used to store the data value
integer Allowed expiretime in seconds. Basically a record is selected only if it is not older than this value in seconds. If expTime is not set, the hashed value will never expire.
Returns:
string The "content" field of the "cache_hash" table row.
See also:
tslib_TStemplate.start(), storeHash()

Definition at line 933 of file class.t3lib_page.php.

References $GLOBALS, $res, and $row.

Referenced by t3lib_TStemplate.start().

t3lib_pageSelect.getMenu ( uid,
fields = '*',
sortField = 'sorting',
addWhere = '',
checkShortcuts = 1 
)

Returns an array with pagerows for subpages with pid=$uid (which is pid here!). This is used for menus. If there are mount points in overlay mode the _MP_PARAM field is set to the corret MPvar. If the $uid being input does in itself require MPvars to define a correct rootline these must be handled externally to this function.

Parameters:
integer The page id for which to fetch subpages (PID)
string List of fields to select. Default is "*" = all
string The field to sort by. Default is "sorting"
string Optional additional where clauses. Like "AND title like '%blabla%'" for instance.
boolean check if shortcuts exist, checks by default
Returns:
array Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlayed localized fields, if any)
See also:
tslib_fe.getPageShortcut(), tslib_menu.makeMenu(), tx_wizardcrpages_webfunc_2, tx_wizardsortpages_webfunc_2

Definition at line 439 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $uid, getMountPointInfo(), getPage(), getPageOverlay(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.getMountPointInfo ( pageId,
pageRec = FALSE,
prevMountPids = array(),
firstPageUid = 0 
)

Returns MountPoint id for page Does a recursive search if the mounted page should be a mount page itself. It has a run-away break so it can't go into infinite loops.

Parameters:
integer Page id for which to look for a mount pid. Will be returned only if mount pages are enabled, the correct doktype (7) is set for page and there IS a mount_pid (which has a valid record that is not deleted...)
array Optional page record for the page id. If not supplied it will be looked up by the system. Must contain at least uid,pid,doktype,mount_pid,mount_pid_ol
array Array accumulating formerly tested page ids for mount points. Used for recursivity brake.
integer The first page id.
Returns:
mixed Returns FALSE if no mount point was found, "-1" if there should have been one, but no connection to it, otherwise an array with information about mount pid and modes.
See also:
tslib_menu

Definition at line 724 of file class.t3lib_page.php.

References $GLOBALS, $res, and versionOL().

Referenced by getMenu(), and getRootLine().

Here is the call graph for this function:

t3lib_pageSelect.getMovePlaceholder ( table,
uid,
fields = '*' 
)

Returns move placeholder of online (live) version

Parameters:
string Table name
integer Record UID of online version
string Field list, default is *
Returns:
array If found, the record, otherwise nothing.
See also:
t3lib_BEfunc.getMovePlaceholder()

Definition at line 1258 of file class.t3lib_page.php.

References $GLOBALS, $TCA, $uid, and deleteClause().

Referenced by fixVersioningPid().

Here is the call graph for this function:

t3lib_pageSelect.getMultipleGroupsWhereClause ( field,
table 
)

Creating where-clause for checking group access to elements in enableFields function

Parameters:
string Field with group list
string Table name
Returns:
string AND sql-clause
See also:
enableFields()

Definition at line 1067 of file class.t3lib_page.php.

References $GLOBALS, $value, and t3lib_div.intExplode().

Referenced by enableFields().

Here is the call graph for this function:

t3lib_pageSelect.getPage ( uid,
disableGroupAccessCheck = FALSE 
)

Returns the $row for the page with uid = $uid (observing ->where_hid_del) Any pages_language_overlay will be applied before the result is returned. If no page is found an empty array is returned.

Parameters:
integer The page id to look up.
boolean If set, the check for group access is disabled. VERY rarely used
Returns:
array The page row with overlayed localized fields. Empty it no page.
See also:
getPage_noCheck()

Definition at line 188 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $uid, getPageOverlay(), and versionOL().

Referenced by getMenu().

Here is the call graph for this function:

t3lib_pageSelect.getPage_noCheck ( uid  ) 

Return the $row for the page with uid = $uid WITHOUT checking for ->where_hid_del (start- and endtime or hidden). Only "deleted" is checked!

Parameters:
integer The page id to look up
Returns:
array The page row with overlayed localized fields. Empty it no page.
See also:
getPage()

Definition at line 216 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $uid, deleteClause(), getPageOverlay(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.getPageIdFromAlias ( alias  ) 

Returns a pagerow for the page with alias $alias

Parameters:
string The alias to look up the page uid for.
Returns:
integer Returns page uid (integer) if found, otherwise 0 (zero)
See also:
tslib_fe.checkAndSetAlias(), tslib_cObj.typoLink()

Definition at line 257 of file class.t3lib_page.php.

References $GLOBALS, $res, and $row.

t3lib_pageSelect.getPageOverlay ( pageInput,
lUid = -1 
)

Returns the relevant page overlay record fields

Parameters:
mixed If $pageInput is an integer, it's the pid of the pageOverlay record and thus the page overlay record is returned. If $pageInput is an array, it's a page-record and based on this page record the language record is found and OVERLAYED before the page record is returned.
integer Language UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
Returns:
array Page row which is overlayed with language_overlay record (or the overlay record alone)

Definition at line 275 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, enableFields(), and versionOL().

Referenced by getFirstWebPage(), getMenu(), getPage(), getPage_noCheck(), and getRootLine().

Here is the call graph for this function:

t3lib_pageSelect.getPathFromRootline ( rl,
len = 20 
)

Creates a "path" string for the input root line array titles. Used for writing statistics.

Parameters:
array A rootline array!
integer The max length of each title from the rootline.
Returns:
string The path in the form "/page title/This is another pageti.../Another page"
See also:
tslib_fe.getConfigArray()

Definition at line 679 of file class.t3lib_page.php.

t3lib_pageSelect.getRawRecord ( table,
uid,
fields = '*',
noWSOL = FALSE 
)

Returns record no matter what - except if record is deleted

Parameters:
string The table name to search
integer The uid to look up in $table
string The fields to select, default is "*"
boolean If set, no version overlay is applied
Returns:
mixed Returns array (the record) if found, otherwise blank/0 (zero)
See also:
getPage_noCheck()

Definition at line 849 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $TCA, $uid, deleteClause(), and versionOL().

Referenced by fixVersioningPid(), and movePlhOL().

Here is the call graph for this function:

t3lib_pageSelect.getRecordOverlay ( table,
row,
sys_language_content,
OLmode = '' 
)

Creates language-overlay for records in general (where translation is found in records from the same table)

Parameters:
string Table name
array Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
integer Pointer to the sys_language uid for content on the site.
string Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)
Returns:
mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found.

Definition at line 340 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $TCA, enableFields(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.getRecordsByField ( theTable,
theField,
theValue,
whereClause = '',
groupBy = '',
orderBy = '',
limit = '' 
)

Selects records based on matching a field (ei. other than UID) with a value

Parameters:
string The table name to search, eg. "pages" or "tt_content"
string The fieldname to match, eg. "uid" or "alias"
string The value that fieldname must match, eg. "123" or "frontpage"
string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
string Optional GROUP BY field(s), if none, supply blank string.
string Optional ORDER BY field(s), if none, supply blank string.
string Optional LIMIT value ([begin,]max), if none, supply blank string.
Returns:
mixed Returns array (the record) if found, otherwise nothing (void)

Definition at line 879 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $TCA, and deleteClause().

Here is the call graph for this function:

t3lib_pageSelect.getRootLine ( uid,
MP = '',
ignoreMPerrors = false 
)

Returns array with fields of the pages from here ($uid) and back to the root NOTICE: This function only takes deleted pages into account! So hidden, starttime and endtime restricted pages are included no matter what. Further: If any "recycler" page is found (doktype=255) then it will also block for the rootline) If you want more fields in the rootline records than default such can be added by listing them in $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']

Parameters:
integer The page uid for which to seek back to the page tree root.
string Commalist of MountPoint parameters, eg. "1-2,3-4" etc. Normally this value comes from the GET var, MP
boolean If set, some errors related to Mount Points in root line are ignored.
Returns:
array Array with page records from the root line as values. The array is ordered with the outer records first and root record in the bottom. The keys are numeric but in reverse order. So if you traverse/sort the array by the numeric keys order you will get the order from root and out. If an error is found (like eternal looping or invalid mountpoint) it will return an empty array.
See also:
tslib_fe.getPageAndRootline()

Definition at line 548 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $uid, fixVersioningPid(), getMountPointInfo(), getPageOverlay(), t3lib_div.uniqueList(), and versionOL().

Here is the call graph for this function:

t3lib_pageSelect.getWorkspaceVersionOfRecord ( workspace,
table,
uid,
fields = '*',
bypassEnableFieldsCheck = FALSE 
)

Select the version of a record for a workspace

Parameters:
integer Workspace ID
string Table name to select from
integer Record uid for which to find workspace version.
string Field list to select
boolean If true, enablefields are not checked for.
Returns:
mixed If found, return record, otherwise other value: Returns 1 if version was sought for but not found, returns -1/-2 if record (offline/online) existed but had enableFields that would disable it. Returns FALSE if not in workspace or no versioning for record. Notice, that the enablefields of the online record is also tested.
See also:
t3lib_befunc.getWorkspaceVersionOfRecord()

Definition at line 1295 of file class.t3lib_page.php.

References $GLOBALS, $TCA, $uid, deleteClause(), and enableFields().

Referenced by versionOL().

Here is the call graph for this function:

t3lib_pageSelect.init ( show_hidden  ) 

init() MUST be run directly after creating a new template-object This sets the internal variable $this->where_hid_del to the correct where clause for page records taking deleted/hidden/starttime/endtime/t3ver_state into account

Parameters:
boolean If $show_hidden is true, the hidden-field is ignored!! Normally this should be false. Is used for previewing.
Returns:
void
See also:
tslib_fe.fetch_the_id(), tx_tstemplateanalyzer.initialize_editor()

Definition at line 138 of file class.t3lib_page.php.

References $GLOBALS.

t3lib_pageSelect.movePlhOL ( table,
&$  row 
)

Checks if record is a move-placeholder (t3ver_state==3) and if so it will set $row to be the pointed-to live record (and return TRUE) Used from versionOL

Parameters:
string Table name
array Row (passed by reference) - only online records...
Returns:
boolean True if overlay is made.
See also:
t3lib_BEfunc.movePlhOl()

Definition at line 1222 of file class.t3lib_page.php.

References $GLOBALS, $res, $row, $TCA, enableFields(), and getRawRecord().

Referenced by versionOL().

Here is the call graph for this function:

t3lib_pageSelect.storeHash ( hash,
data,
ident 
)

Stores a string value in the cache_hash table identified by $hash. Can be used from your frontend plugins if you like. You can call it directly like t3lib_pageSelect.storeHash()

Parameters:
string 32 bit hash string (eg. a md5 hash of a serialized array identifying the data being stored)
string The data string. If you want to store an array, then just serialize it first.
string $ident is just a textual identification in order to inform about the content! May be 20 characters long.
Returns:
void
See also:
tslib_TStemplate.start(), getHash()

Definition at line 957 of file class.t3lib_page.php.

References $GLOBALS.

Referenced by t3lib_TStemplate.start().

t3lib_pageSelect.versionOL ( table,
&$  row,
unsetMovePointers = FALSE,
bypassEnableFieldsCheck = FALSE 
)

Versioning Preview Overlay ONLY active when backend user is previewing records. MUST NEVER affect a site served which is not previewed by backend users!!! Generally ALWAYS used when records are selected based on uid or pid. If records are selected on other fields than uid or pid (eg. "email = ....") then usage might produce undesired results and that should be evaluated on individual basis. Principle; Record online! => Find offline?

Parameters:
string Table name
array Record array passed by reference. As minimum, the "uid", "pid" and "t3ver_state" fields must exist! The record MAY be set to FALSE in which case the calling function should act as if the record is forbidden to access!
boolean If set, the $row is cleared in case it is a move-pointer. This is only for preview of moved records (to remove the record from the original location so it appears only in the new location)
boolean Unless this option is TRUE, the $row is unset if enablefields for BOTH the version AND the online record deselects it. This is because when versionOL() is called it is assumed that the online record is already selected with no regards to it's enablefields. However, after looking for a new version the online record enablefields must ALSO be evaluated of course. This is done all by this function!
Returns:
void (Passed by ref).
See also:
fixVersioningPid(), t3lib_BEfunc.workspaceOL()

Definition at line 1161 of file class.t3lib_page.php.

References $row, $TCA, getWorkspaceVersionOfRecord(), and movePlhOL().

Referenced by checkRecord(), getFirstWebPage(), getMenu(), getMountPointInfo(), getPage(), getPage_noCheck(), getPageOverlay(), getRawRecord(), getRecordOverlay(), and getRootLine().

Here is the call graph for this function:


Member Data Documentation

t3lib_pageSelect.$cache_getMountPointInfo = array() [protected]

Definition at line 128 of file class.t3lib_page.php.

t3lib_pageSelect.$cache_getPage = array() [protected]

Definition at line 127 of file class.t3lib_page.php.

t3lib_pageSelect.$cache_getRootLine = array() [protected]

Definition at line 126 of file class.t3lib_page.php.

t3lib_pageSelect.$error_getRootLine = ''

Definition at line 122 of file class.t3lib_page.php.

t3lib_pageSelect.$error_getRootLine_failPid = 0

Definition at line 123 of file class.t3lib_page.php.

t3lib_pageSelect.$sys_language_uid = 0

Definition at line 113 of file class.t3lib_page.php.

t3lib_pageSelect.$urltypes = Array('','http://','ftp://','mailto:','https://')

Definition at line 110 of file class.t3lib_page.php.

t3lib_pageSelect.$versioningPreview = FALSE

Definition at line 116 of file class.t3lib_page.php.

t3lib_pageSelect.$versioningWorkspaceId = 0

Definition at line 117 of file class.t3lib_page.php.

t3lib_pageSelect.$where_groupAccess = ''

Definition at line 112 of file class.t3lib_page.php.

t3lib_pageSelect.$where_hid_del = ' AND pages.deleted=0'

Definition at line 111 of file class.t3lib_page.php.

t3lib_pageSelect.$workspaceCache = array()

Definition at line 118 of file class.t3lib_page.php.


The documentation for this class was generated from the following file:
This documentation is part of typo3-unleashed.net.
It's an automatically created code documentation of the TYPO3 Content Management System.
Created with doxygen