[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_page.php (sommaire)

Contains a class with "Page functions" mainly for the frontend $Id: class.t3lib_page.php 2262 2007-04-20 16:43:13Z liels_bugs $ Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj XHTML-trans compliant

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 1243 lignes (51 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_pageSelect:: (25 méthodes):
  init()
  getPage()
  getPage_noCheck()
  getFirstWebPage()
  getPageIdFromAlias()
  getPageOverlay()
  getRecordOverlay()
  getMenu()
  getDomainStartPage()
  getRootLine()
  getPathFromRootline()
  getExtURL()
  getMountPointInfo()
  checkRecord()
  getRawRecord()
  getRecordsByField()
  getHash()
  storeHash()
  deleteClause()
  enableFields()
  getMultipleGroupsWhereClause()
  fixVersioningPid()
  versionOL()
  getWorkspaceVersionOfRecord()
  checkWorkspaceAccess()


Classe: t3lib_pageSelect  - X-Ref

Page functions, a lot of sql/pages-related functions
Mainly used in the frontend but also in some cases in the backend.
It's important to set the right $where_hid_del in the object so that the functions operate properly

init($show_hidden)   X-Ref
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

param: boolean        If $show_hidden is true, the hidden-field is ignored!! Normally this should be false. Is used for previewing.
return: void

getPage($uid, $disableGroupAccessCheck=FALSE)   X-Ref
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.

param: integer        The page id to look up.
param: boolean        If set, the check for group access is disabled. VERY rarely used
return: array        The page row with overlayed localized fields. Empty it no page.

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

param: integer        The page id to look up
return: array        The page row with overlayed localized fields. Empty it no page.

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

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

getPageIdFromAlias($alias)   X-Ref
Returns a pagerow for the page with alias $alias

param: string        The alias to look up the page uid for.
return: integer        Returns page uid (integer) if found, otherwise 0 (zero)

getPageOverlay($pageInput,$lUid=-1)   X-Ref
Returns the relevant page overlay record fields

param: 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.
param: integer        Language UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
return: array        Page row which is overlayed with language_overlay record (or the overlay record alone)

getRecordOverlay($table,$row,$sys_language_content,$OLmode='')   X-Ref
Creates language-overlay for records in general (where translation is found in records from the same table)

param: string        Table name
param: array        Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
param: integer        Pointer to the sys_language uid for content on the site.
param: string        Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)
return: 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.

getMenu($uid,$fields='*',$sortField='sorting',$addWhere='',$checkShortcuts=1)   X-Ref
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.

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

getDomainStartPage($domain, $path='',$request_uri='')   X-Ref
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.

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

getRootLine($uid, $MP='', $ignoreMPerrors=FALSE)   X-Ref
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']

param: integer        The page uid for which to seek back to the page tree root.
param: string        Commalist of MountPoint parameters, eg. "1-2,3-4" etc. Normally this value comes from the GET var, MP
param: boolean        If set, some errors related to Mount Points in root line are ignored.
return: 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.

getPathFromRootline($rl,$len=20)   X-Ref
Creates a "path" string for the input root line array titles.
Used for writing statistics.

param: array        A rootline array!
param: integer        The max length of each title from the rootline.
return: string        The path in the form "/page title/This is another pageti.../Another page"

getExtURL($pagerow,$disable=0)   X-Ref
Returns the URL type for the input page row IF the doktype is 3 and not disabled.

param: array        The page row to return URL type for
param: boolean        A flag to simply disable any output from here.
return: string        The URL type from $this->urltypes array. False if not found or disabled.

getMountPointInfo($pageId, $pageRec=FALSE, $prevMountPids=array()   X-Ref
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.

param: 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...)
param: 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
param: array        Array accumulating formerly tested page ids for mount points. Used for recursivity brake.
param: integer        The first page id.
return: 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.

checkRecord($table,$uid,$checkPage=0)   X-Ref
Checks if a record exists and is accessible.
The row is returned if everything's OK.

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

getRawRecord($table,$uid,$fields='*',$noWSOL=FALSE)   X-Ref
Returns record no matter what - except if record is deleted

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

getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='')   X-Ref
Selects records based on matching a field (ei. other than UID) with a value

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

getHash($hash,$expTime=0)   X-Ref
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. Is also used to store the parsed TypoScript template structures. You can call it directly like t3lib_pageSelect::getHash()

param: string        The hash-string which was used to store the data value
param: 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.
return: string        The "content" field of the "cache_hash" table row.

storeHash($hash,$data,$ident)   X-Ref
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()

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

deleteClause($table)   X-Ref
Returns the "AND NOT deleted" clause for the tablename given IF $TCA configuration points to such a field.

param: string        Tablename
return: string

enableFields($table,$show_hidden=-1,$ignore_array=array()   X-Ref
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.

param: string        Table name found in the $TCA array
param: 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.
param: 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.
param: boolean        If set, enableFields will be applied regardless of any versioning preview settings which might otherwise disable enableFields
return: string        The clause starting like " AND ...=... AND ...=..."

getMultipleGroupsWhereClause($field, $table)   X-Ref
Creating where-clause for checking group access to elements in enableFields function

param: string        Field with group list
param: string        Table name
return: string        AND sql-clause

fixVersioningPid($table,&$rr)   X-Ref
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?

param: string        Table name
param: 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.
return: void        (Passed by ref).

versionOL($table,&$row)   X-Ref
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?

param: string        Table name
param: 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!
return: void        (Passed by ref).

getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*')   X-Ref
Select the version of a record for a workspace

param: integer        Workspace ID
param: string        Table name to select from
param: integer        Record uid for which to find workspace version.
param: string        Field list to select
return: array        If found, return record, otherwise false. Returns 1 if version was sought for but not found, returns -1 if record existed but had enableFields that would disable it.

checkWorkspaceAccess($wsid)   X-Ref
Checks if user has access to workspace.

param: int    $wsid    Workspace ID
return: boolean    <code>true</code> if has access



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics