PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/assicurazioniesinistri_mysql/include/Object/Authorization.class.php

http://antilophpe.googlecode.com/
PHP | 329 lines | 155 code | 15 blank | 159 comment | 0 complexity | 7c88cbcf9dd774c7bf943e37f6079549 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-3.0
  1. <?php
  2. /**
  3. * File Authorization.class.php
  4. *
  5. * This file contains the definition of the class object
  6. * type Authorization 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 Authorization
  14. */
  15. class Authorization {
  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. * idMask
  30. * @access private
  31. * @var integer
  32. */
  33. private $idMask;
  34. /**
  35. * idMask_mask
  36. * @access private
  37. * @var string
  38. */
  39. private $idMask_mask;
  40. /**
  41. * idAction
  42. * @access private
  43. * @var integer
  44. */
  45. private $idAction;
  46. /**
  47. * idAction_action
  48. * @access private
  49. * @var string
  50. */
  51. private $idAction_action;
  52. /**
  53. * active
  54. * @access private
  55. * @var integer
  56. */
  57. private $active;
  58. /**
  59. * deleted
  60. * @access private
  61. * @var integer
  62. */
  63. private $deleted;
  64. /**
  65. * Set the value of resourceLinkID
  66. * @param resource $resourceLinkID
  67. */
  68. function setResourceLinkID($resourceLinkID){
  69. $this->resourceLinkID=$resourceLinkID;
  70. }
  71. /**
  72. * Get the value of resourceLinkID
  73. * @return resource
  74. */
  75. function getResourceLinkID(){
  76. return $this->resourceLinkID;
  77. }
  78. /**
  79. * Sets the value of field id
  80. * @param integer $id
  81. */
  82. function setId($id){
  83. $this->id=$id;
  84. }
  85. /**
  86. * Gets the value of field id
  87. * @return integer
  88. */
  89. function getId(){
  90. return $this->id;
  91. }
  92. /**
  93. * Sets the value of field idMask
  94. * @param integer $idMask
  95. */
  96. function setIdMask($idMask){
  97. $this->idMask=$idMask;
  98. }
  99. /**
  100. * Gets the value of field idMask
  101. * @return integer
  102. */
  103. function getIdMask(){
  104. return $this->idMask;
  105. }
  106. /**
  107. * Sets the value of foreign field idMask_mask
  108. * @param string $idMask_mask
  109. */
  110. function setIdMask_mask($idMask_mask){
  111. $this->idMask_mask=$idMask_mask;
  112. }
  113. /**
  114. * Gets the value of foreign field idMask_mask
  115. * @return string
  116. */
  117. function getIdMask_mask(){
  118. return $this->idMask_mask;
  119. }
  120. /**
  121. * Sets the value of field idAction
  122. * @param integer $idAction
  123. */
  124. function setIdAction($idAction){
  125. $this->idAction=$idAction;
  126. }
  127. /**
  128. * Gets the value of field idAction
  129. * @return integer
  130. */
  131. function getIdAction(){
  132. return $this->idAction;
  133. }
  134. /**
  135. * Sets the value of foreign field idAction_action
  136. * @param string $idAction_action
  137. */
  138. function setIdAction_action($idAction_action){
  139. $this->idAction_action=$idAction_action;
  140. }
  141. /**
  142. * Gets the value of foreign field idAction_action
  143. * @return string
  144. */
  145. function getIdAction_action(){
  146. return $this->idAction_action;
  147. }
  148. /**
  149. * Sets the value of field active
  150. * @param integer $active
  151. */
  152. function setActive($active){
  153. $this->active=$active;
  154. }
  155. /**
  156. * Gets the value of field active
  157. * @return integer
  158. */
  159. function getActive(){
  160. return $this->active;
  161. }
  162. /**
  163. * Sets the value of field deleted
  164. * @param integer $deleted
  165. */
  166. function setDeleted($deleted){
  167. $this->deleted=$deleted;
  168. }
  169. /**
  170. * Gets the value of field deleted
  171. * @return integer
  172. */
  173. function getDeleted(){
  174. return $this->deleted;
  175. }
  176. /**
  177. * Constructor of the class
  178. */
  179. function __construct($resourceLinkID='',
  180. $id='',
  181. $idMask='',
  182. $idMask_mask='',
  183. $idAction='',
  184. $idAction_action='',
  185. $active='',
  186. $deleted='') {
  187. $this->resourceLinkID = $resourceLinkID;
  188. $this->id = $id;
  189. $this->idMask = $idMask;
  190. $this->idMask_mask = $idMask_mask;
  191. $this->idAction = $idAction;
  192. $this->idAction_action = $idAction_action;
  193. $this->active = $active;
  194. $this->deleted = $deleted;
  195. }
  196. /**
  197. * Destructor of the class
  198. */
  199. function __destruct() {
  200. }
  201. /**
  202. * Get the value of descriptive field
  203. * @return string
  204. */
  205. function getDescriptiveFields(){
  206. return trim(' (id: '.$this->getId().')');
  207. }
  208. /**
  209. * Get the name and the value of mail fields
  210. * @return string
  211. */
  212. function getMailFields(){
  213. return trim("Id: ".$this->getId()."\n"."Mask: ".$this->getIdMask()."\n"."Action: ".$this->getIdAction()."\n"."Active: ".$this->getActive()."\n"."Deleted: ".$this->getDeleted()."\n"."");
  214. }
  215. /**
  216. * Persistence selectById method (try to select)
  217. * @return true|false
  218. */
  219. function selectById(){
  220. $query="SELECT ant_Authorization.*,
  221. ant_Maschera_idMask.mask AS idMask_mask,
  222. ant_Action_idAction.action AS idAction_action
  223. FROM ant_Authorization
  224. LEFT JOIN ant_Maschera AS ant_Maschera_idMask ON ant_Maschera_idMask.id = ant_Authorization.idMask
  225. LEFT JOIN ant_Action AS ant_Action_idAction ON ant_Action_idAction.id = ant_Authorization.idAction
  226. WHERE ant_Authorization.id = ".$this->getId()."";
  227. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Authorization`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  228. while($authorization_array=mysql_fetch_array($result)){
  229. $this->id = $authorization_array['id'];
  230. $this->idMask = $authorization_array['idMask'];
  231. $this->idMask_mask = $authorization_array['idMask_mask'];
  232. $this->idAction = $authorization_array['idAction'];
  233. $this->idAction_action = $authorization_array['idAction_action'];
  234. $this->active = $authorization_array['active'];
  235. $this->deleted = $authorization_array['deleted'];
  236. }
  237. }
  238. /**
  239. * Persistence selectFiles method (try to select)
  240. * @return array
  241. */
  242. function selectFiles(){
  243. $query="SELECT ant_Authorization_File.*
  244. FROM ant_Authorization_File
  245. WHERE ant_Authorization_File.idTableObject= ".$this->getId()."
  246. AND ant_Authorization_File.tableObject='ant_Authorization'";
  247. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Authorization_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  248. $filesList=array();
  249. while($authorization_File_array=mysql_fetch_assoc($result)){
  250. array_push($filesList, $authorization_File_array);
  251. }
  252. return $filesList;
  253. }
  254. /**
  255. * Persistence selectFileById method (try to select)
  256. * @return array
  257. */
  258. function selectFileById($fileId){
  259. $query="SELECT ant_Authorization_File.*
  260. FROM ant_Authorization_File
  261. WHERE ant_Authorization_File.id='$fileId'";
  262. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection file in table `ant_Authorization_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  263. $authorization_File_array=mysql_fetch_assoc($result);
  264. return $authorization_File_array;
  265. }
  266. /**
  267. * Persistence selectCountFiles method (try to select)
  268. * @return array
  269. */
  270. function selectCountFiles(){
  271. $query="SELECT COUNT(*)
  272. FROM ant_Authorization_File
  273. WHERE ant_Authorization_File.idTableObject= ".$this->getId()."
  274. AND ant_Authorization_File.tableObject='ant_Authorization'";
  275. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Authorization_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  276. $authorization_File_array=mysql_fetch_array($result);
  277. return $authorization_File_array[0];
  278. }
  279. /**
  280. * Persistence selectCountLogs method (try to select count)
  281. * @return integer
  282. */
  283. function selectCountLogs(){
  284. $query="SELECT COUNT(*)
  285. FROM ant_Authorization_Log";
  286. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during select count from table `ant_Authorization_Log`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  287. $authorization_Log_array=mysql_fetch_array($result);
  288. return $authorization_Log_array[0];
  289. }
  290. /**
  291. * Persistence selectCountTrashes method (try to select count)
  292. * @return integer
  293. */
  294. function selectCountTrashes(){
  295. $query="SELECT COUNT(*)
  296. FROM ant_Authorization
  297. WHERE deleted = 1";
  298. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during select count from table `ant_Authorization`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  299. $authorization_array=mysql_fetch_array($result);
  300. return $authorization_array[0];
  301. }
  302. /**
  303. * Persistence selectByFileId method (try to select)
  304. * @return true|false
  305. */
  306. function selectByFileId($idFile){
  307. $query="SELECT ant_Authorization_File.*
  308. FROM ant_Authorization_File
  309. WHERE ant_Authorization_File.id = '$idFile'";
  310. $result = mysql_query($query, $this->getResourceLinkId()) or die('Query: '.$query.' Error during selection in table `ant_Authorization_File`: '.mysql_errno($this->getResourceLinkId()).' - '.mysql_error($this->getResourceLinkId()));
  311. return mysql_fetch_array($result);
  312. }
  313. }
  314. ?>