PageRenderTime 28ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/assicurazioniesinistri_mysql/include/Object/Utente.class.php

http://antilophpe.googlecode.com/
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
  1. <?php
  2. /**
  3. * File Utente.class.php
  4. *
  5. * This file contains the definition of the class object
  6. * type Utente and at the end of the file,
  7. * a way to test the class (simply passing sending test = 1
  8. * via GET or POST ).
  9. * @author Marco Novo <mnovo@ncfsistemi.com>
  10. * @version 1.0
  11. */
  12. /**
  13. * This class defines fields and methods of Utente
  14. */
  15. class Utente {
  16. /**
  17. * $resourceLinkID
  18. * @access private
  19. * @var resource
  20. */
  21. private $resourceLinkID;
  22. /**
  23. * id
  24. * @access private
  25. * @var integer
  26. */
  27. private $id;
  28. /**
  29. * denomination
  30. * @access private
  31. * @var string
  32. */
  33. private $denomination;
  34. /**
  35. * userName
  36. * @access private
  37. * @var string
  38. */
  39. private $userName;
  40. /**
  41. * userPassword
  42. * @access private
  43. * @var string
  44. */
  45. private $userPassword;
  46. /**
  47. * idMask
  48. * @access private
  49. * @var integer
  50. */
  51. private $idMask;
  52. /**
  53. * idMask_mask
  54. * @access private
  55. * @var string
  56. */
  57. private $idMask_mask;
  58. /**
  59. * email
  60. * @access private
  61. * @var string
  62. */
  63. private $email;
  64. /**
  65. * active
  66. * @access private
  67. * @var integer
  68. */
  69. private $active;
  70. /**
  71. * deleted
  72. * @access private
  73. * @var integer
  74. */
  75. private $deleted;
  76. /**
  77. * Set the value of resourceLinkID
  78. * @param resource $resourceLinkID
  79. */
  80. function setResourceLinkID($resourceLinkID){
  81. $this->resourceLinkID=$resourceLinkID;
  82. }
  83. /**
  84. * Get the value of resourceLinkID
  85. * @return resource
  86. */
  87. function getResourceLinkID(){
  88. return $this->resourceLinkID;
  89. }
  90. /**
  91. * Sets the value of field id
  92. * @param integer $id
  93. */
  94. function setId($id){
  95. $this->id=$id;
  96. }
  97. /**
  98. * Gets the value of field id
  99. * @return integer
  100. */
  101. function getId(){
  102. return $this->id;
  103. }
  104. /**
  105. * Sets the value of field denomination
  106. * @param string $denomination
  107. */
  108. function setDenomination($denomination){
  109. $this->denomination=$denomination;
  110. }
  111. /**
  112. * Gets the value of field denomination
  113. * @return string
  114. */
  115. function getDenomination(){
  116. return $this->denomination;
  117. }
  118. /**
  119. * Sets the value of field userName
  120. * @param string $userName
  121. */
  122. function setUtenteName($userName){
  123. $this->userName=$userName;
  124. }
  125. /**
  126. * Gets the value of field userName
  127. * @return string
  128. */
  129. function getUtenteName(){
  130. return $this->userName;
  131. }
  132. /**
  133. * Sets the value of field userPassword
  134. * @param string $userPassword
  135. */
  136. function setUtentePassword($userPassword){
  137. $this->userPassword=$userPassword;
  138. }
  139. /**
  140. * Gets the value of field userPassword
  141. * @return string
  142. */
  143. function getUtentePassword(){
  144. return $this->userPassword;
  145. }
  146. /**
  147. * Sets the value of field idMask
  148. * @param integer $idMask
  149. */
  150. function setIdMask($idMask){
  151. $this->idMask=$idMask;
  152. }
  153. /**
  154. * Gets the value of field idMask
  155. * @return integer
  156. */
  157. function getIdMask(){
  158. return $this->idMask;
  159. }
  160. /**
  161. * Sets the value of foreign field idMask_mask
  162. * @param string $idMask_mask
  163. */
  164. function setIdMask_mask($idMask_mask){
  165. $this->idMask_mask=$idMask_mask;
  166. }
  167. /**
  168. * Gets the value of foreign field idMask_mask
  169. * @return string
  170. */
  171. function getIdMask_mask(){
  172. return $this->idMask_mask;
  173. }
  174. /**
  175. * Sets the value of field email
  176. * @param string $email
  177. */
  178. function setEmail($email){
  179. $this->email=$email;
  180. }
  181. /**
  182. * Gets the value of field email
  183. * @return string
  184. */
  185. function getEmail(){
  186. return $this->email;
  187. }
  188. /**
  189. * Sets the value of field active
  190. * @param integer $active
  191. */
  192. function setActive($active){
  193. $this->active=$active;
  194. }
  195. /**
  196. * Gets the value of field active
  197. * @return integer
  198. */
  199. function getActive(){
  200. return $this->active;
  201. }
  202. /**
  203. * Sets the value of field deleted
  204. * @param integer $deleted
  205. */
  206. function setDeleted($deleted){
  207. $this->deleted=$deleted;
  208. }
  209. /**
  210. * Gets the value of field deleted
  211. * @return integer
  212. */
  213. function getDeleted(){
  214. return $this->deleted;
  215. }
  216. /**
  217. * Constructor of the class
  218. */
  219. function __construct($resourceLinkID='',
  220. $id='',
  221. $denomination='',
  222. $userName='',
  223. $userPassword='',
  224. $idMask='',
  225. $idMask_mask='',
  226. $email='',
  227. $active='',
  228. $deleted='') {
  229. $this->resourceLinkID = $resourceLinkID;
  230. $this->id = $id;
  231. $this->denomination = $denomination;
  232. $this->userName = $userName;
  233. $this->userPassword = $userPassword;
  234. $this->idMask = $idMask;
  235. $this->idMask_mask = $idMask_mask;
  236. $this->email = $email;
  237. $this->active = $active;
  238. $this->deleted = $deleted;
  239. }
  240. /**
  241. * Destructor of the class
  242. */
  243. function __destruct() {
  244. }
  245. /**
  246. * Get the value of descriptive field
  247. * @return string
  248. */
  249. function getDescriptiveFields(){
  250. return trim($this->getUtenteName().' '.' (id: '.$this->getId().')');
  251. }
  252. /**
  253. * Get the name and the value of mail fields
  254. * @return string
  255. */
  256. function getMailFields(){
  257. 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"."");
  258. }
  259. /**
  260. * Persistence selectById method (try to select)
  261. * @return true|false
  262. */
  263. function selectById(){
  264. $query="SELECT ant_Utente.*,
  265. ant_Maschera_idMask.mask AS idMask_mask
  266. FROM ant_Utente
  267. LEFT JOIN ant_Maschera AS ant_Maschera_idMask ON ant_Maschera_idMask.id = ant_Utente.idMask
  268. WHERE ant_Utente.id = ".$this->getId()."";
  269. $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()));
  270. while($user_array=mysql_fetch_array($result)){
  271. $this->id = $user_array['id'];
  272. $this->denomination = $user_array['denomination'];
  273. $this->userName = $user_array['userName'];
  274. $this->userPassword = $user_array['userPassword'];
  275. $this->idMask = $user_array['idMask'];
  276. $this->idMask_mask = $user_array['idMask_mask'];
  277. $this->email = $user_array['email'];
  278. $this->active = $user_array['active'];
  279. $this->deleted = $user_array['deleted'];
  280. }
  281. }
  282. /**
  283. * Persistence selectFiles method (try to select)
  284. * @return array
  285. */
  286. function selectFiles(){
  287. $query="SELECT ant_Utente_File.*
  288. FROM ant_Utente_File
  289. WHERE ant_Utente_File.idTableObject= ".$this->getId()."
  290. AND ant_Utente_File.tableObject='ant_Utente'";
  291. $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()));
  292. $filesList=array();
  293. while($user_File_array=mysql_fetch_assoc($result)){
  294. array_push($filesList, $user_File_array);
  295. }
  296. return $filesList;
  297. }
  298. /**
  299. * Persistence selectFileById method (try to select)
  300. * @return array
  301. */
  302. function selectFileById($fileId){
  303. $query="SELECT ant_Utente_File.*
  304. FROM ant_Utente_File
  305. WHERE ant_Utente_File.id='$fileId'";
  306. $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()));
  307. $user_File_array=mysql_fetch_assoc($result);
  308. return $user_File_array;
  309. }
  310. /**
  311. * Persistence selectCountFiles method (try to select)
  312. * @return array
  313. */
  314. function selectCountFiles(){
  315. $query="SELECT COUNT(*)
  316. FROM ant_Utente_File
  317. WHERE ant_Utente_File.idTableObject= ".$this->getId()."
  318. AND ant_Utente_File.tableObject='ant_Utente'";
  319. $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()));
  320. $user_File_array=mysql_fetch_array($result);
  321. return $user_File_array[0];
  322. }
  323. /**
  324. * Persistence selectCountLogs method (try to select count)
  325. * @return integer
  326. */
  327. function selectCountLogs(){
  328. $query="SELECT COUNT(*)
  329. FROM ant_Utente_Log";
  330. $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()));
  331. $user_Log_array=mysql_fetch_array($result);
  332. return $user_Log_array[0];
  333. }
  334. /**
  335. * Persistence selectCountTrashes method (try to select count)
  336. * @return integer
  337. */
  338. function selectCountTrashes(){
  339. $query="SELECT COUNT(*)
  340. FROM ant_Utente
  341. WHERE deleted = 1";
  342. $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()));
  343. $user_array=mysql_fetch_array($result);
  344. return $user_array[0];
  345. }
  346. /**
  347. * Persistence selectByFileId method (try to select)
  348. * @return true|false
  349. */
  350. function selectByFileId($idFile){
  351. $query="SELECT ant_Utente_File.*
  352. FROM ant_Utente_File
  353. WHERE ant_Utente_File.id = '$idFile'";
  354. $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()));
  355. return mysql_fetch_array($result);
  356. }
  357. }
  358. ?>