/assicurazioniesinistri_mysql/include/Object/Authorization.class.php
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
- <?php
- /**
- * File Authorization.class.php
- *
- * This file contains the definition of the class object
- * type Authorization 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 Authorization
- */
- class Authorization {
- /**
- * $resourceLinkID
- * @access private
- * @var resource
- */
- private $resourceLinkID;
- /**
- * id
- * @access private
- * @var integer
- */
- private $id;
- /**
- * idMask
- * @access private
- * @var integer
- */
- private $idMask;
- /**
- * idMask_mask
- * @access private
- * @var string
- */
- private $idMask_mask;
- /**
- * idAction
- * @access private
- * @var integer
- */
- private $idAction;
- /**
- * idAction_action
- * @access private
- * @var string
- */
- private $idAction_action;
- /**
- * 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 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 idAction
- * @param integer $idAction
- */
- function setIdAction($idAction){
- $this->idAction=$idAction;
- }
- /**
- * Gets the value of field idAction
- * @return integer
- */
- function getIdAction(){
- return $this->idAction;
- }
- /**
- * Sets the value of foreign field idAction_action
- * @param string $idAction_action
- */
- function setIdAction_action($idAction_action){
- $this->idAction_action=$idAction_action;
- }
- /**
- * Gets the value of foreign field idAction_action
- * @return string
- */
- function getIdAction_action(){
- return $this->idAction_action;
- }
- /**
- * 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='',
- $idMask='',
- $idMask_mask='',
- $idAction='',
- $idAction_action='',
- $active='',
- $deleted='') {
- $this->resourceLinkID = $resourceLinkID;
- $this->id = $id;
- $this->idMask = $idMask;
- $this->idMask_mask = $idMask_mask;
- $this->idAction = $idAction;
- $this->idAction_action = $idAction_action;
- $this->active = $active;
- $this->deleted = $deleted;
- }
- /**
- * Destructor of the class
- */
- function __destruct() {
- }
- /**
- * Get the value of descriptive field
- * @return string
- */
- function getDescriptiveFields(){
- return trim(' (id: '.$this->getId().')');
- }
- /**
- * Get the name and the value of mail fields
- * @return string
- */
- function getMailFields(){
- return trim("Id: ".$this->getId()."\n"."Mask: ".$this->getIdMask()."\n"."Action: ".$this->getIdAction()."\n"."Active: ".$this->getActive()."\n"."Deleted: ".$this->getDeleted()."\n"."");
- }
- /**
- * Persistence selectById method (try to select)
- * @return true|false
- */
- function selectById(){
- $query="SELECT ant_Authorization.*,
- ant_Maschera_idMask.mask AS idMask_mask,
- ant_Action_idAction.action AS idAction_action
- FROM ant_Authorization
- LEFT JOIN ant_Maschera AS ant_Maschera_idMask ON ant_Maschera_idMask.id = ant_Authorization.idMask
- LEFT JOIN ant_Action AS ant_Action_idAction ON ant_Action_idAction.id = ant_Authorization.idAction
- WHERE ant_Authorization.id = ".$this->getId()."";
- $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()));
- while($authorization_array=mysql_fetch_array($result)){
- $this->id = $authorization_array['id'];
- $this->idMask = $authorization_array['idMask'];
- $this->idMask_mask = $authorization_array['idMask_mask'];
- $this->idAction = $authorization_array['idAction'];
- $this->idAction_action = $authorization_array['idAction_action'];
- $this->active = $authorization_array['active'];
- $this->deleted = $authorization_array['deleted'];
- }
- }
- /**
- * Persistence selectFiles method (try to select)
- * @return array
- */
- function selectFiles(){
- $query="SELECT ant_Authorization_File.*
- FROM ant_Authorization_File
- WHERE ant_Authorization_File.idTableObject= ".$this->getId()."
- AND ant_Authorization_File.tableObject='ant_Authorization'";
- $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()));
- $filesList=array();
- while($authorization_File_array=mysql_fetch_assoc($result)){
- array_push($filesList, $authorization_File_array);
- }
- return $filesList;
- }
- /**
- * Persistence selectFileById method (try to select)
- * @return array
- */
- function selectFileById($fileId){
- $query="SELECT ant_Authorization_File.*
- FROM ant_Authorization_File
- WHERE ant_Authorization_File.id='$fileId'";
- $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()));
- $authorization_File_array=mysql_fetch_assoc($result);
- return $authorization_File_array;
- }
- /**
- * Persistence selectCountFiles method (try to select)
- * @return array
- */
- function selectCountFiles(){
- $query="SELECT COUNT(*)
- FROM ant_Authorization_File
- WHERE ant_Authorization_File.idTableObject= ".$this->getId()."
- AND ant_Authorization_File.tableObject='ant_Authorization'";
- $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()));
- $authorization_File_array=mysql_fetch_array($result);
- return $authorization_File_array[0];
- }
- /**
- * Persistence selectCountLogs method (try to select count)
- * @return integer
- */
- function selectCountLogs(){
- $query="SELECT COUNT(*)
- FROM ant_Authorization_Log";
- $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()));
- $authorization_Log_array=mysql_fetch_array($result);
- return $authorization_Log_array[0];
- }
- /**
- * Persistence selectCountTrashes method (try to select count)
- * @return integer
- */
- function selectCountTrashes(){
- $query="SELECT COUNT(*)
- FROM ant_Authorization
- WHERE deleted = 1";
- $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()));
- $authorization_array=mysql_fetch_array($result);
- return $authorization_array[0];
- }
- /**
- * Persistence selectByFileId method (try to select)
- * @return true|false
- */
- function selectByFileId($idFile){
- $query="SELECT ant_Authorization_File.*
- FROM ant_Authorization_File
- WHERE ant_Authorization_File.id = '$idFile'";
- $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()));
- return mysql_fetch_array($result);
- }
- }
- ?>