<?php class Usuarios
{
var $cCodUsuario;
var $cNombreUsuario;
var $cClaveUsuario;
var $cDireccionUsuario;
var $cTelfUsuario;
var $cCorreoUsuario;
var $dNacimUsuario;
var $nHabilitaUsuario;
var $cTpoUsuario;
//--------------- GET METHODS ----------------------------- //
function get_cCodUsuario( ) {
// returns the value of cCodUsuario
return $this->cCodUsuario;
}
function get_cNombreUsuario( ) {
// returns the value of cNombreUsuario
return $this->cNombreUsuario;
}
function get_cClaveUsuario( ) {
// returns the value of cClaveUsuario
return $this->cClaveUsuario;
}
function get_cDireccionUsuario( ) {
// returns the value of cDireccionUsuario
return $this->cDireccionUsuario;
}
function get_cTelfUsuario( ) {
// returns the value of cTelfUsuario
return $this->cTelfUsuario;
}
function get_cCorreoUsuario( ) {
// returns the value of cCorreoUsuario
return $this->cCorreoUsuario;
}
function get_dNacimUsuario( ) {
// returns the value of dNacimUsuario
return $this->dNacimUsuario;
}
function get_nHabilitaUsuario( ) {
// returns the value of nHabilitaUsuario
return $this->nHabilitaUsuario;
}
function get_cTpoUsuario( ) {
// returns the value of cTpoUsuario
return $this->cTpoUsuario;
}
//--------------- SET METHODS ----------------------------- //
function set_cCodUsuario( $cCodUsuario ) {
// sets the value of cCodUsuario
$this->cCodUsuario = $cCodUsuario;
}
function set_cNombreUsuario( $cNombreUsuario ) {
// sets the value of cNombreUsuario
$this->cNombreUsuario = $cNombreUsuario;
}oid
**/
function set_cClaveUsuario( $cClaveUsuario ) {
// sets the value of cClaveUsuario
$this->cClaveUsuario = $cClaveUsuario;
}
function set_cDireccionUsuario( $cDireccionUsuario ) {
// sets the value of cDireccionUsuario
$this->cDireccionUsuario = $cDireccionUsuario;
}
function set_cTelfUsuario( $cTelfUsuario ) {
// sets the value of cTelfUsuario
$this->cTelfUsuario = $cTelfUsuario;
}
function set_cCorreoUsuario( $cCorreoUsuario ) {
// sets the value of cCorreoUsuario
$this->cCorreoUsuario = $cCorreoUsuario;
}
function set_dNacimUsuario( $dNacimUsuario ) {
// sets the value of dNacimUsuario
$this->dNacimUsuario = $dNacimUsuario;
}
function set_nHabilitaUsuario( $nHabilitaUsuario ) {
// sets the value of nHabilitaUsuario
$this->nHabilitaUsuario = $nHabilitaUsuario;
}
function set_cTpoUsuario( $cTpoUsuario ) {
// sets the value of cTpoUsuario
$this->cTpoUsuario = $cTpoUsuario;
}
//--------------- CRUD METHODS ----------------------------- //
function createnew_usuarios( $cCodUsuario, $cNombreUsuario, $cClaveUsuario, $cDireccionUsuario, $cTelfUsuario, $cCorreoUsuario, $dNacimUsuario, $nHabilitaUsuario, $cTpoUsuario) {
// items to be inserted in the database
$_obj = array($cCodUsuario, $cNombreUsuario,
$cClaveUsuario,
$cDireccionUsuario,
$cTelfUsuario,
$cCorreoUsuario,
$dNacimUsuario,
$nHabilitaUsuario,
$cTpoUsuario);
// database object connection
$dbConn = $GLOBALS['dbConn'];
// perform insert in the database
$dbConn->insert("usuarios", $_obj);
}
function get_usuarios( $ ) {
// retrive the data
$dbConn = $GLOBALS['dbConn'];
// retrieved value in the database
$_resultSet = $dbConn->doQuery("SELECT * FROM usuarios WHERE = '$'");
$__usuariosObj = new usuarios();
// return the retrived from the database
// create a new object
$__obj = new Usuarios();
$__obj->set_cCodUsuario($_resultSet[0]['cCodUsuario']);
$__obj->set_cNombreUsuario($_resultSet[0]['cNombreUsuario']);
$__obj->set_cClaveUsuario($_resultSet[0]['cClaveUsuario']);
$__obj->set_cDireccionUsuario($_resultSet[0]['cDireccionUsuario']);
$__obj->set_cTelfUsuario($_resultSet[0]['cTelfUsuario']);
$__obj->set_cCorreoUsuario($_resultSet[0]['cCorreoUsuario']);
$__obj->set_dNacimUsuario($_resultSet[0]['dNacimUsuario']);
$__obj->set_nHabilitaUsuario($_resultSet[0]['nHabilitaUsuario']);
$__obj->set_cTpoUsuario($_resultSet[0]['cTpoUsuario']);
return $__obj;
}
function update_usuarios
( $
, $itemsToBeUpdated = array() ) {
// get database connection
$dbConn = $GLOBALS['dbConn'];
// performs update in the database
foreach($itemsToBeUpdated as $_fName => $_fVal) {
$dbConn->addValuePair($_fName, $_fVal);
}
// perform update operation
$dbConn->update("usuarios", " = '$'");
}
function delete_usuarios( $ ) {
// get database connection
$dbConn = $GLOBALS['dbConn'];
// performs deletion of data
$dbConn->delete("usuarios", " = '$'");
}
function list_usuarios( $conditionalStatement = '' ) {
$dbConn = $GLOBALS['dbConn'];
// check if there is a given parameter list
if(!empty($conditionalStatement)) { $sqlStatement = "SELECT * FROM usuarios WHERE $conditionalStatement";
} else {
$sqlStatement = "SELECT * FROM usuarios";
}
// retrieve the values base on the query result
$__resObj = $dbConn->doQuery($sqlStatement);
$__collectionOfObjects = array(); foreach($__resObj as $__rs) {
$__newObj = new Usuarios();
$__newObj->set_cCodUsuario($__rs['cCodUsuario']);
$__newObj->set_cNombreUsuario($__rs['cNombreUsuario']);
$__newObj->set_cClaveUsuario($__rs['cClaveUsuario']);
$__newObj->set_cDireccionUsuario($__rs['cDireccionUsuario']);
$__newObj->set_cTelfUsuario($__rs['cTelfUsuario']);
$__newObj->set_cCorreoUsuario($__rs['cCorreoUsuario']);
$__newObj->set_dNacimUsuario($__rs['dNacimUsuario']);
$__newObj->set_nHabilitaUsuario($__rs['nHabilitaUsuario']);
$__newObj->set_cTpoUsuario($__rs['cTpoUsuario']);
// add object to collection
}
// return collection of objects
return $__collectionOfObjects;
}
}
?>