![]() |
PGroup offers a general fundament for implementing a data and object container. PGroup is an abstract class, providing functions, which allow to add, to delete and to filter entries as well as to sort them by criteria. Moreover, repeat and loop functions are provided, with which you can access single or pre-selected elements comfortably. The basic concept of PGroup is much more flexible than the concepts of arrays or simple lists are. Furthermore PGroup builds the basis for specialized object types like, for instance, PGroupCategory or PGroupIndexkeywords. This object is derived from > PObject.
function PGroup () [CONSTRUCTOR]
The constructor calls the ancestor’s constructor as well as the object function RemoveAll in order to set internal variables well-defined.
function CallForEach ($sActionfunction,$sParameter="")
Calls the function, passed by the parameter $sActionfunction, once for all elements. The function, which is to be called, always gets the particular element’s identification number as first parameter. The optional parameter $sParameter contains further parameters - which are simply passed - for the function, which is to be called. Indeed, internally the object function CallForEachSelected is called with the parameter Mode=-1 !
function CallForEachSelected ($sActionfunction,$sParameter="",$fMode=1)
Calls the function, passed by the parameter $sActionfunction, once. The function, which is to be called, always gets the particular element’s identification number as first parameter. The optional parameter $sParameter contains further parameters - which are simply passed - for the function, which is to be called. You can define if all elements shall be considered with the third parameter $fMode. (=-1), all non-selected (=0) or all selected (=1).
function DefineSortableField ($sFieldName)
Adds the passed field name to the list of allowed field names. Later it may be sorted by these names. Usually this function is called by the constructor from derived classes.
function EOF ()
returns a "1" if the dataset pointer is behind the last element – otherwise it returns a "0".
function ExecuteSQL ()
Removes all elements and afterwards repeats the data request to the SQL server afresh and reads in the identification numbers.
function GetCurrent ()
Returns the internal identification number of the current element’s dataset.
function GetCurrentNumber ()
Returns the number of the element, the dataset pointer currently points at.
function ListCount ()
Returns the number of elements. If "0" is returnded, there are no elements.
function MoveFirst ()
Moves the data pointer before the first element.
function MoveLast ()
Moves the data pointer before the last element, in so far as there is minimum one element. Otherwise the data pointer is set to EOF.
function MoveNext ()
Moves the data pointer to the next element, in so far as there is a next element.
function MovePrevious ()
Moves the data pointer to the previous element, in so far as the pointer is not already before the first element.
function OrderBy ($sField, $sDirection=PS_GroupOrder_Direction_ASC,$iPriority=1)
Defines a new sorting order for the field, which is passed in the parameter $sField, in so far as the field, which is passed, is allowed. The sorting direction can be passed in the parameter $sDirection (Default setting is ascending). The sorting priority can be set in the parameter $iPriority by figures from 1 to 3, whereat 1 represents the highest priority (primary sorting order, =Default). Afterwards the object function ExecuteSQL is called automatically, whereby the data are requested afresh from the SQL server.
function RemoveCurrent ()
Removes the current element from the group. Afterwards the internal dataset pointer is at the next element or at EOF if there is no further element.
function RemoveAll ()
Removes all element’s entries from the group by setting the internal number of datasets as well as the dataset pointer to "0".