/assicurazioniesinistri_mysql/include/Object/Utente.class.php
PHP | 373 lines | 173 code | 15 blank | 185 comment | 0 complexity | c42e9676f9bb7add41e4282c75f19c20 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-3.0
- <?php
- /**
- * File Utente.class.php
- *
- * This file contains the definition of the class object
- * type Utente and at the end of the file,
- * a way to test the class (simply passing sending test = 1
- * via GET or POST ).
- * @author Marco Novo <mnovo@ncfsistemi.com>
- * @version 1.0
- */
- /**
- * This class defines fields and methods of Utente
- */
- class Utente {
- /**
- * $resourceLinkID
- * @access private
- * @var resource
- */
- private $resourceLinkID;
- /**
- * id
- * @access private
- * @var integer
- */
- private $id;
- /**
- * denomination
- * @access private
- * @var string
- */
- private $denomination;
- /**
- * userName
- * @access private
- * @var string
- */
- private $userName;
- /**
- * userPassword
- * @access private
- * @var string
- */
- private $userPassword;
- /**
- * idMask
- * @access private
- * @var integer
- */
- private $idMask;
- /**
- * idMask_mask
- * @access private
- * @var string
- */
- private $idMask_mask;
- /**
- * email
- * @access private
- * @var string
- */
- private $email;
- /**
- * active
- * @access private
- * @var integer
- */
- private $active;
- /**
- * deleted
- * @access private
- * @var integer
- */
- private $deleted;
- /**
- * Set the value of resourceLinkID
- * @param resource $resourceLinkID
- */
- function setResourceLinkID($resourceLinkID){
- $this->resourceLinkID=$resourceLinkID;
- }
- /**
- * Get the value of resourceLinkID
- * @return resource
- */
- function getResourceLinkID(){
- return $this->resourceLinkID;
- }
- /**
- * Sets the value of field id
- * @param integer $id
- */
- function setId($id){
- $this->id=$id;
- }
- /**
- * Gets the value of field id
- * @return integer
- */
- function getId(){
- return $this->id;
- }
- /**
- * Sets the value of field denomination
- * @param string $denomination
- */
- function setDenomination($denomination){
- $this->denomination=$denomination;
- }
- /**
- * Gets the value of field denomination
- * @return string
- */
- function getDenomination(){
- return $this->denomination;
- }
- /**
- * Sets the value of field userName
- * @param string $userName
- */
- function setUtenteName($userName){
- $this->userName=$userName;
- }
- /**
- * Gets the value of field userName
- * @return string
- */
- function getUtenteName(){
- return $this->userName;
- }
- /**
- * Sets the value of field userPassword
- * @param string $userPassword
- */
- function setUtentePassword($userPassword){
- $this->userPassword=$userPassword;
- }
- /**
- * Gets the value of field userPassword
- * @return string
- */
- function getUtentePassword(){
- return $this->userPassword;
- }
- /**
- * Sets the value of field idMask
- * @param integer $idMask
- */
- function setIdMask($idMask){
- $this->idMask=$idMask;
- }
- /**
- * Gets the value of field idMask
- * @return integer
- */
- function getIdMask(){
- return $this->idMask;
- }
- /**
- * Sets the value of foreign field idMask_mask
- * @param string $idMask_mask
- */
- function setIdMask_mask($idMask_mask){
- $this->idMask_mask=$idMask_mask;
- }
- /**
- * Gets the value of foreign field idMask_mask
- * @return string
- */
- function getIdMask_mask(){
- return $this->idMask_mask;
- }
- /**
- * Sets the value of field email
- * @param string $email
- */
- function setEmail($email){
- $this->email=$email;
- }
- /**
- * Gets the value of field email
- * @return string
- */
- function getEmail(){
- return $this->email;
- }
- /**
- * Sets the value of field active
- * @param integer $active
- */
- function setActive($active){
- $this->active=$active;
- }
- /**
- * Gets the value of field active
- * @return integer
- */
- function getActive(){
- return $this->active;
- }
- /**
- * Sets the value of field deleted
- * @param integer $deleted
- */
- function setDeleted($deleted){
- $this->deleted=$deleted;
- }
- /**
- * Gets the value of field deleted
- * @return integer
- */
- function getDeleted(){
- return $this->deleted;
- }
- /**
- * Constructor of the class
- */
- function __construct($resourceLinkID='',
- $id='',
- $denomination='',
- $userName='',
- $userPassword='',
- $idMask='',
- $idMask_mask='',
- $email='',
- $active='',
- $deleted='') {
- $this->resourceLinkID = $resourceLinkID;
- $this->id = $id;
- $this->denomination = $denomination;
- $this->userName = $userName;
- $this->userPassword = $userPassword;
- $this->idMask = $idMask;
- $this->idMask_mask = $idMask_mask;
- $this->email = $email;
- $this->active = $active;
- $this->deleted = $deleted;
- }
- /**
- * Destructor of the class
- */
- function __destruct() {
- }
- /**
- * Get the value of descriptive field
- * @return string
- */
- function getDescriptiveFields(){
- return trim($this->getUtenteName().' '.' (id: '.$this->getId().')');
- }
- /**
- * Get the name and the value of mail fields
- * @return string
- */
- function getMailFields(){
- return trim("Id: ".$this->getId()."\n"."Denomination: ".$this->getDenomination()."\n"."Utente name: ".$this->getUtenteName()."\n"."Utente password: ".$this->getUtentePassword()."\n"."Mask: ".$this->getIdMask()."\n"."Email: ".$this->getEmail()."\n"."Active: ".$this->getActive()."\n"."Deleted: ".$this->getDeleted()."\n"."");
- }
- /**
- * Persistence selectById method (try to select)
- * @return true|false
- */
- function selectById(){
- $query="SELECT ant_Utente.*,
- ant_Maschera_idMask.mask AS idMask_mask
- FROM ant_Utente
- LEFT JOIN ant_Maschera AS ant_Maschera_idMask ON ant_Maschera_idMask.id = ant_Utente.idMask
- WHERE ant_Utente.id = ".$this->getId()."";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Utente`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- while($user_array=mysql_fetch_array($result)){
- $this->id = $user_array['id'];
- $this->denomination = $user_array['denomination'];
- $this->userName = $user_array['userName'];
- $this->userPassword = $user_array['userPassword'];
- $this->idMask = $user_array['idMask'];
- $this->idMask_mask = $user_array['idMask_mask'];
- $this->email = $user_array['email'];
- $this->active = $user_array['active'];
- $this->deleted = $user_array['deleted'];
- }
- }
- /**
- * Persistence selectFiles method (try to select)
- * @return array
- */
- function selectFiles(){
- $query="SELECT ant_Utente_File.*
- FROM ant_Utente_File
- WHERE ant_Utente_File.idTableObject= ".$this->getId()."
- AND ant_Utente_File.tableObject='ant_Utente'";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Utente_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- $filesList=array();
- while($user_File_array=mysql_fetch_assoc($result)){
- array_push($filesList, $user_File_array);
- }
- return $filesList;
- }
- /**
- * Persistence selectFileById method (try to select)
- * @return array
- */
- function selectFileById($fileId){
- $query="SELECT ant_Utente_File.*
- FROM ant_Utente_File
- WHERE ant_Utente_File.id='$fileId'";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection file in table `ant_Utente_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- $user_File_array=mysql_fetch_assoc($result);
- return $user_File_array;
- }
- /**
- * Persistence selectCountFiles method (try to select)
- * @return array
- */
- function selectCountFiles(){
- $query="SELECT COUNT(*)
- FROM ant_Utente_File
- WHERE ant_Utente_File.idTableObject= ".$this->getId()."
- AND ant_Utente_File.tableObject='ant_Utente'";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Utente_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- $user_File_array=mysql_fetch_array($result);
- return $user_File_array[0];
- }
- /**
- * Persistence selectCountLogs method (try to select count)
- * @return integer
- */
- function selectCountLogs(){
- $query="SELECT COUNT(*)
- FROM ant_Utente_Log";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during select count from table `ant_Utente_Log`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- $user_Log_array=mysql_fetch_array($result);
- return $user_Log_array[0];
- }
- /**
- * Persistence selectCountTrashes method (try to select count)
- * @return integer
- */
- function selectCountTrashes(){
- $query="SELECT COUNT(*)
- FROM ant_Utente
- WHERE deleted = 1";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during select count from table `ant_Utente`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- $user_array=mysql_fetch_array($result);
- return $user_array[0];
- }
- /**
- * Persistence selectByFileId method (try to select)
- * @return true|false
- */
- function selectByFileId($idFile){
- $query="SELECT ant_Utente_File.*
- FROM ant_Utente_File
- WHERE ant_Utente_File.id = '$idFile'";
- $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Utente_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
- return mysql_fetch_array($result);
- }
- }
- ?>