XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
RMObject Class Reference
Inheritance diagram for RMObject:
Inheritance graph

Public Member Functions

 _loadFilters ()
 
 assignVar ($key, $value)
 
 assignVars ($var_arr)
 
 cleanVars ()
 
 errors ($html=true)
 
 getErrors ()
 
 getHtmlErrors ()
 
 getLogger ($ashtml=true)
 
 getValues ($keys=null, $format= 's', $maxDepth=1)
 
 getVar ($key, $format= 's')
 
 getVars ($formated=false, $format= 's')
 
 id ()
 
 initVar ($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')
 
 isDirty ()
 
 isNew ()
 
 registerFilter ($filtername)
 
 rmClone ()
 
 setDirty ()
 
 setErrors ($err_str)
 
 setFormVars ($var_arr=null, $pref='xo_', $not_gpc=false)
 
 setNew ()
 
 setVar ($key, $value, $not_gpc=false)
 
 setVarLen ($var, $len=null)
 
 setVarRequired ($var, $required)
 
 setVars ($var_arr, $not_gpc=false)
 
 setVarType ($var, $type)
 
 unsetDirty ()
 
 unsetNew ()
 

Public Attributes

 $cleanVars = array()
 

Protected Member Functions

 addError ($text)
 
 clear_vars ()
 
 clearLogger ()
 
 deleteFromTable ()
 
 getColumns ()
 
 initVarsFromTable ()
 
 loadValues ($id)
 
 loadValuesArray ($values)
 
 loadValuesFiltered ($filter='')
 
 logger ($event, $style='')
 
 saveToTable ()
 
 updateTable ()
 
 varIsset ($var)
 

Protected Attributes

 $_dbtable = ''
 
 $_log = array()
 
 $db = null
 
 $primary = 'id'
 
 $vars = array()
 

Private Attributes

 $_errors = array()
 
 $_filters = array()
 
 $_isDirty = false
 
 $_isNew = false
 
 $_tblcolumns = array()
 
 $_uniquefield = ''
 
 $objectColumns = array()
 
 $primaryCols = array()
 

Detailed Description

Basado en el archivo kernel/object.php de XOOPS creado por Kazumi Ono (AKA onokazu) Base class for all objects in the Xoops kernel (and beyond)

Definition at line 21 of file object.php.

Member Function Documentation

RMObject::_loadFilters ( )

load all additional filters that have been registered to the object

private

Definition at line 549 of file object.php.

RMObject::addError (   $text)
protected

Agrega una entrada a nuestro array de errores.

Parameters
string$textDescripcin del error

Definition at line 611 of file object.php.

References setErrors().

Referenced by RMBlockPosition\delete(), RMComment\delete(), RMPlugin\delete(), RMInternalBlock\delete(), deleteFromTable(), RMPlugin\insert_configs(), RMInternalBlock\save(), saveToTable(), and updateTable().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::assignVar (   $key,
  $value 
)

assign a value to a variable

public

Parameters
string$keyname of the variable to assign
mixed$valuevalue to assign

Definition at line 179 of file object.php.

Referenced by assignVars().

Here is the caller graph for this function:

RMObject::assignVars (   $var_arr)

assign values to multiple variables in a batch

private

Parameters
array$var_arrayassociative array of values to assign

Definition at line 192 of file object.php.

References assignVar(), and unsetNew().

Referenced by loadValuesFiltered().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::cleanVars ( )

clean values of all variables of the object for storage. also add slashes whereever needed

Returns
bool true if successful public

Definition at line 439 of file object.php.

References getErrors(), TextCleaner\getInstance(), setErrors(), TextCleaner\stripslashes(), and unsetDirty().

Referenced by saveToTable(), and updateTable().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::clear_vars ( )
protected

Clear all vars to start a new object

Definition at line 524 of file object.php.

RMObject::clearLogger ( )
protected

Limpiamos el log de eventos

Definition at line 668 of file object.php.

RMObject::deleteFromTable ( )
protected

Elimina un registro de la base de datos

Definition at line 936 of file object.php.

References $sql, and addError().

Referenced by RMBlockPosition\delete(), RMImageCategory\delete(), RMComment\delete(), RMImage\delete(), RMPlugin\delete(), and RMInternalBlock\delete().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::errors (   $html = true)

Obtenemos los errores almacenados. Estos pueden obtenerse de dos maneras dependiendo del parmetro $html. false Nos devuelve un array y true nos devuelve una cadena HTML frmateada.

Parameters
bol$htmlDevolver cadena HTML o array
Returns
array
string

Definition at line 622 of file object.php.

References $_errors, and $ret.

Referenced by RMInternalBlock\delete(), getErrors(), and RMInternalBlock\save().

Here is the caller graph for this function:

RMObject::getColumns ( )
protected

Funcin para obtener todas las columnas de una tabla de la base de datos la variable $_dbtable debe ser inicializada Devuelve un array con los nombres y datos de las columnas

Returns
array

Definition at line 704 of file object.php.

References $_tblcolumns, $objectColumns, $primaryCols, and $result.

Referenced by initVarsFromTable(), and updateTable().

Here is the caller graph for this function:

RMObject::getErrors ( )

return the errors for this object as an array

Returns
array an array of errors public

Definition at line 592 of file object.php.

References errors().

Referenced by cleanVars().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::getHtmlErrors ( )

return the errors for this object as html

Returns
string html listing the errors public

Definition at line 603 of file object.php.

RMObject::getLogger (   $ashtml = true)

Recuperamos el log de elementos. Si es pasado como parmetro "false" devuelve un array. Si se pasa el valor "true" devuelve HTML

Parameters
bol$ashtmlTrue o False
Returns
array
string

Definition at line 679 of file object.php.

References $_log, and $rtn.

RMObject::getValues (   $keys = null,
  $format = 's',
  $maxDepth = 1 
)

Returns the values of the specified variables

Parameters
mixed$keysAn array containing the names of the keys to retrieve, or null to get all of them
string$formatFormat to use (see getVar)
int$maxDepthMaximum level of recursion to use if some vars are objects themselves
Returns
array associative array of key->value pairs

Definition at line 283 of file object.php.

References $vars, and getVar().

Here is the call graph for this function:

RMObject::getVar (   $key,
  $format = 's' 
)

returns a specific variable for the object in a proper format

public

Parameters
string$keykey of the object's variable to be returned
string$formatformat to use for the output
Returns
mixed formatted value of the variable

Definition at line 309 of file object.php.

References $i, $image, $options, $ret, and TextCleaner\getInstance().

Referenced by RMPlugin\__construct(), RMInternalBlock\buildBlock(), RMComment\delete(), RMImage\delete(), RMImage\get_sizes_data(), RMInternalBlock\getContent(), RMUser\getGroups(), RMInternalBlock\getOptions(), RMImage\getOriginal(), getValues(), getVars(), RMImageCategory\id(), RMComment\id(), RMCommentUser\id(), RMImage\id(), RMInternalBlock\id(), RMPlugin\id(), id(), RMInternalBlock\isCustom(), RMComment\load_user(), RMImageCategory\max_file_size(), RMPlugin\plugin(), RMUser\save(), RMImage\url(), and RMImageCategory\user_allowed_toupload().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::getVars (   $formated = false,
  $format = 's' 
)

returns all variables for the object

Parameters
boolReturn formated vars?
stringFormat type (s,e,p,f)
Returns
array associative array of key->value pairs

Definition at line 261 of file object.php.

References $ret, $vars, and getVar().

Here is the call graph for this function:

RMObject::id ( )

Definition at line 87 of file object.php.

References getVar().

Referenced by RMBlockPosition\delete().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::initVar (   $key,
  $data_type,
  $value = null,
  $required = false,
  $maxlength = null,
  $options = '' 
)

#@- initialize variables for the object

public

Parameters
string$key
int$data_typeset to one of XOBJ_DTYPE_XXX constants (set to XOBJ_DTYPE_OTHER if no data type ckecking nor text sanitizing is required)
mixed
bool$requiredrequire html form input?
int$maxlengthfor XOBJ_DTYPE_TXTBOX type only
string$optiondoes this data have any select options?

Definition at line 140 of file object.php.

References $options.

Referenced by initVarsFromTable().

Here is the caller graph for this function:

RMObject::initVarsFromTable ( )
protected

Funcin para inicializar las variables a partir de las columnas de una tabla

Definition at line 731 of file object.php.

References $type, getColumns(), and initVar().

Referenced by RMCommentUser\__construct(), RMBlockPosition\__construct(), RMUser\__construct(), RMImageCategory\__construct(), RMComment\__construct(), RMPlugin\__construct(), RMImage\__construct(), and RMInternalBlock\__construct().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::isDirty ( )

Definition at line 123 of file object.php.

References $_isDirty.

RMObject::loadValues (   $id)
protected

Cargaa los valores de un objeto desde la base de datos en base a su clave primaria

Parameters
mixed$idValor a buscar en la clave primaria
Returns
bool

Definition at line 808 of file object.php.

References $id, $result, $sql, and setVar().

Referenced by RMCommentUser\__construct(), RMBlockPosition\__construct(), RMUser\__construct(), RMImageCategory\__construct(), RMComment\__construct(), RMPlugin\__construct(), RMImage\__construct(), RMInternalBlock\__construct(), and RMImage\load_from_params().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::loadValuesArray (   $values)
protected

Carga valores de la base de datos

Parameters
array$valuesArray de valores

limpiamos los valores

Definition at line 850 of file object.php.

References $result, $sql, TextCleaner\getInstance(), and setVar().

Here is the call graph for this function:

RMObject::loadValuesFiltered (   $filter = '')
protected

Load the object values from database with a filtered query

Definition at line 830 of file object.php.

References $result, $sql, and assignVars().

Here is the call graph for this function:

RMObject::logger (   $event,
  $style = '' 
)
protected

Funcin para agregar una entrada al log de eventos

Parameters
string$eventTexto del evento
string$styleEstilo css del evento

Definition at line 659 of file object.php.

References $rtn.

RMObject::registerFilter (   $filtername)

dynamically register additional filter for the object

Parameters
string$filternamename of the filter public

Definition at line 539 of file object.php.

RMObject::rmClone ( )

create a clone(copy) of the current object

public

Returns
object clone

Definition at line 563 of file object.php.

References $class.

RMObject::saveToTable ( )
protected

Almacena los valores como un registro nuevo en una tabla

Definition at line 882 of file object.php.

References $sql, addError(), cleanVars(), TextCleaner\getInstance(), setVar(), and unsetNew().

Referenced by RMImageCategory\save(), RMBlockPosition\save(), RMCommentUser\save(), RMComment\save(), RMUser\save(), RMImage\save(), RMPlugin\save(), and RMInternalBlock\save().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::setDirty ( )

#@- #@+ mark modified objects as dirty

used for modified objects only public

Definition at line 115 of file object.php.

Referenced by setVar().

Here is the caller graph for this function:

RMObject::setErrors (   $err_str)

add an error

Parameters
string$valueerror to add public

Definition at line 581 of file object.php.

Referenced by addError(), and cleanVars().

Here is the caller graph for this function:

RMObject::setFormVars (   $var_arr = null,
  $pref = 'xo_',
  $not_gpc = false 
)

Assign values to multiple variables in a batch

Meant for a CGI contenxt:

  • prefixed CGI args are considered save
  • avoids polluting of namespace with CGI args

private

Parameters
array$var_arrassociative array of values to assign
string$prefprefix (only keys starting with the prefix will be set)

Definition at line 244 of file object.php.

References setVar().

Here is the call graph for this function:

RMObject::setNew ( )

#@+ used for new/clone objects

public

Definition at line 95 of file object.php.

Referenced by RMCommentUser\__construct(), RMBlockPosition\__construct(), RMUser\__construct(), RMImageCategory\__construct(), RMComment\__construct(), RMPlugin\__construct(), RMImage\__construct(), and RMInternalBlock\__construct().

Here is the caller graph for this function:

RMObject::setVar (   $key,
  $value,
  $not_gpc = false 
)

assign a value to a variable

public

Parameters
string$keyname of the variable to assign
mixed$valuevalue to assign
bool$not_gpc

Definition at line 209 of file object.php.

References setDirty().

Referenced by RMPlugin\load_from_dir(), loadValues(), loadValuesArray(), save_comment(), saveToTable(), setFormVars(), and setVars().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::setVarLen (   $var,
  $len = null 
)

Establece la longitud de un campo

Parameters
string$varNombre de la variable
int$lenLongitud del campo o null

Definition at line 159 of file object.php.

RMObject::setVarRequired (   $var,
  $required 
)

Establece la obligatoriedad de una variable

Parameters
string$varNombre de la variable
bool$required

Definition at line 168 of file object.php.

RMObject::setVars (   $var_arr,
  $not_gpc = false 
)

assign values to multiple variables in a batch

private

Parameters
array$var_arrassociative array of values to assign
bool$not_gpc

Definition at line 226 of file object.php.

References setVar().

Here is the call graph for this function:

RMObject::setVarType (   $var,
  $type 
)

Establece el tipo de dato para una variable

Parameters
string$varNombre de la variable
int$typeTipo de Dato

Definition at line 150 of file object.php.

References $type.

Referenced by RMImageCategory\__construct(), and RMInternalBlock\__construct().

Here is the caller graph for this function:

RMObject::unsetDirty ( )

Definition at line 119 of file object.php.

Referenced by cleanVars().

Here is the caller graph for this function:

RMObject::updateTable ( )
protected

Almacena las modificaciones hechas a un registro de una tabla

Definition at line 909 of file object.php.

References $sql, addError(), cleanVars(), getColumns(), and TextCleaner\getInstance().

Referenced by RMImageCategory\save(), RMBlockPosition\save(), RMCommentUser\save(), RMComment\save(), RMUser\save(), RMImage\save(), RMPlugin\save(), and RMInternalBlock\save().

Here is the call graph for this function:

Here is the caller graph for this function:

RMObject::varIsset (   $var)
protected

Comrpobamos si ha sido inicializada una variable.

Parameters
string$varNombre de la variable

Definition at line 647 of file object.php.

Member Data Documentation

RMObject::$_dbtable = ''
protected

Definition at line 77 of file object.php.

RMObject::$_errors = array()
private

Definition at line 62 of file object.php.

Referenced by errors().

RMObject::$_filters = array()
private

additional filters registered dynamically by a child class object

private

Definition at line 69 of file object.php.

RMObject::$_isDirty = false
private

Definition at line 54 of file object.php.

Referenced by isDirty().

RMObject::$_isNew = false
private

Definition at line 46 of file object.php.

Referenced by isNew().

RMObject::$_log = array()
protected

Definition at line 76 of file object.php.

Referenced by getLogger().

RMObject::$_tblcolumns = array()
private

Definition at line 78 of file object.php.

Referenced by getColumns().

RMObject::$_uniquefield = ''
private

Definition at line 79 of file object.php.

RMObject::$cleanVars = array()

Definition at line 38 of file object.php.

RMObject::$db = null
protected

Definition at line 75 of file object.php.

Referenced by RMPlugin\delete(), RMPlugin\insert_configs(), and RMComment\load_user().

RMObject::$objectColumns = array()
private

Almacena las columnas (variables) de un objeto

Definition at line 84 of file object.php.

Referenced by getColumns().

RMObject::$primary = 'id'
protected

Almacena el nombre de la clave primaria en la base de datos (columna) esta por defecto es 'id'

Definition at line 74 of file object.php.

RMObject::$primaryCols = array()
private

Definition at line 85 of file object.php.

Referenced by getColumns().

RMObject::$vars = array()
protected

Definition at line 30 of file object.php.

Referenced by getValues(), and getVars().


The documentation for this class was generated from the following file: