/branches/messigdp/include/Object/Messo.class.php
PHP | 375 lines | 203 code | 17 blank | 155 comment | 0 complexity | eb0af0eed84b3b43e1c2e2282a2ab420 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-3.0
- <?php
- /**
- * File Messo.class.php
- *
- * This file contains the definition of the class object
- * type Messo 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 Messo
- */
- class Messo {
- /**
- * $resourceLinkID
- * @access private
- * @var resource
- */
- private $resourceLinkID;
-
- /**
- * id
- * @access private
- * @var integer
- */
- private $id;
- /**
- * nome
- * @access private
- * @var string
- */
- private $nome;
- /**
- * idUtente
- * @access private
- * @var integer
- */
- private $idUtente;
- /**
- * idUtente_denomination
- * @access private
- * @var string
- */
- private $idUtente_denomination;
- /**
- * 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 nome
- * @param string $nome
- */
- function setNome($nome){
- $this->nome=$nome;
- }
- /**
- * Gets the value of field nome
- * @return string
- */
- function getNome(){
- return $this->nome;
- }
- /**
- * Sets the value of field idUtente
- * @param integer $idUtente
- */
- function setIdUtente($idUtente){
- $this->idUtente=$idUtente;
- }
- /**
- * Gets the value of field idUtente
- * @return integer
- */
- function getIdUtente(){
- return $this->idUtente;
- }
- /**
- * Sets the value of foreign field idUtente_denomination
- * @param string $idUtente_denomination
- */
- function setIdUtente_denomination($idUtente_denomination){
- $this->idUtente_denomination=$idUtente_denomination;
- }
- /**
- * Gets the value of foreign field idUtente_denomination
- * @return string
- */
- function getIdUtente_denomination(){
- return $this->idUtente_denomination;
- }
- /**
- * 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='',
- $nome='',
- $idUtente='',
- $idUtente_denomination='',
- $active='',
- $deleted='') {
- $this->resourceLinkID = $resourceLinkID;
- $this->id = $id;
- $this->nome = $nome;
- $this->idUtente = $idUtente;
- $this->idUtente_denomination = $idUtente_denomination;
- $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"."Nome: ".$this->getNome()."\n"."Utente: ".$this->getIdUtente()."\n"."Active: ".$this->getActive()."\n"."Deleted: ".$this->getDeleted()."\n"."");
- }
-
- /**
- * Persistence selectById method (try to select)
- * @return true|false
- */
- function selectById(){
- $query='SELECT "ant_Messo".*,
- "ant_Utente"."denomination"
- FROM "ant_Messo"
- LEFT JOIN "ant_Utente" ON "ant_Utente"."id" = "ant_Messo"."idUtente"
- WHERE "ant_Messo"."id" = '.$this->getId();
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_array=oci_fetch_array($result);
- $this->id = $messo_array['id'];
- $this->nome = $messo_array['nome'];
- $this->idUtente = $messo_array['idUtente'];
- $this->idUtente_denomination = $messo_array['denomination'];
- $this->active = $messo_array['active'];
- $this->deleted = $messo_array['deleted'];
- }
-
- /**
- * Persistence selectAsArrayById method (try to select)
- * @return true|false
- */
- function selectAsArrayById(){
- $query='SELECT "ant_Messo".*,
- "ant_Utente"."denomination"
- FROM "ant_Messo"
- LEFT JOIN "ant_Utente" ON "ant_Utente"."id" = "ant_Messo"."idUtente"
- WHERE "ant_Messo"."id" = '.$this->getId();
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_array=oci_fetch_array($result);
- return $messo_array;
- }
-
- /**
- * Persistence listSelectablesByAndFields method (try to select)
- * @param array with filedName as key and fieldValue as value
- * @return list/array
- */
- function listSelectablesByAndFields($fieldsArray){
- foreach($fieldsArray as $key => $value)
- $whereString.=' AND "'.$key.'"="'.str_replace("'","''",$value).'"';
-
- $query='SELECT "ant_Messo".*,
- "ant_Utente"."denomination"
- FROM "ant_Messo"
- LEFT JOIN "ant_Utente" ON "ant_Utente"."id" = "ant_Messo"."idUtente"
- WHERE "ant_Messo"."active"=1
- AND "ant_Messo"."deleted"=0
- '.$whereString;
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $listRow=array();
- while($arrayRow=oci_fetch_array($result)){
- array_push($listRow,$arrayRow);
- }
- return $listRow;
- }
-
- /**
- * Persistence listSelectablesByOrFields method (try to select)
- * @param array with filedName as key and fieldValue as value
- * @return list/array
- */
- function listSelectablesByOrFields($fieldsArray){
- foreach($fieldsArray as $key => $value)
- $whereString.=' OR "'.$key.'"="'.str_replace("'","''",$value).'"';
-
- $query='SELECT "ant_Messo".*,
- "ant_Utente"."denomination"
- FROM "ant_Messo"
- LEFT JOIN "ant_Utente" ON "ant_Utente"."id" = "ant_Messo"."idUtente"
- WHERE "ant_Messo"."active"=1
- AND "ant_Messo"."deleted"=0
- AND (0 '.$whereString.');';
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $listRow=array();
- while($arrayRow=oci_fetch_array($result)){
- array_push($listRow,$arrayRow);
- }
- return $listRow;
- }
-
- /**
- * Persistence selectFiles method (try to select)
- * @return array
- */
- function selectFiles(){
- $query='SELECT "ant_Messo_File".*
- FROM "ant_Messo_File"
- WHERE "ant_Messo_File"."idTableObject"= '.$this->getId().'
- AND "ant_Messo_File"."tableObject"=\'ant_Messo\'';
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo_File`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $filesList=array();
- while($messo_File_array=oci_fetch_array($result)){
- array_push($filesList, $messo_File_array);
- }
- return $filesList;
- }
-
- /**
- * Persistence selectFileById method (try to select)
- * @return array
- */
- function selectFileById($fileId){
- $query='SELECT "ant_Messo_File".*
- FROM "ant_Messo_File"
- WHERE "ant_Messo_File"."id"='.$fileId;
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection file in table `ant_Messo_File`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_File_array=oci_fetch_array($result);
- return $messo_File_array;
- }
-
- /**
- * Persistence selectCountFiles method (try to select)
- * @return array
- */
- function selectCountFiles(){
- $query='SELECT COUNT(*)
- FROM "ant_Messo_File"
- WHERE "ant_Messo_File"."idTableObject"= '.$this->getId().'
- AND "ant_Messo_File"."tableObject"=\'ant_Messo\'';
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo_File`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_File_array=oci_fetch_array($result);
- return $messo_File_array[0];
- }
-
- /**
- * Persistence selectCountLogs method (try to select count)
- * @return integer
- */
- function selectCountLogs(){
- $query='SELECT COUNT(*)
- FROM "ant_Messo_Log"';
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during select count from table `ant_Messo_Log`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_Log_array=oci_fetch_array($result);
- return $messo_Log_array[0];
- }
-
- /**
- * Persistence selectCountTrashes method (try to select count)
- * @return integer
- */
- function selectCountTrashes(){
- $query='SELECT COUNT(*)
- FROM "ant_Messo"
- WHERE "deleted" = 1';
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during select count from table `ant_Messo`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- $messo_array=oci_fetch_array($result);
- return $messo_array[0];
- }
-
- /**
- * Persistence selectByFileId method (try to select)
- * @return true|false
- */
- function selectByFileId($idFile){
- $query='SELECT "ant_Messo_File".*
- FROM "ant_Messo_File"
- WHERE "ant_Messo_File"."id" = '.$idFile;
- $result = oci_parse($this->getResourceLinkId(), $query) or die('Query:<hr/> '.$query.'<hr/>Error during selection in table `ant_Messo_File`: '.var_dump(oci_error()));
- oci_execute($result, OCI_DEFAULT);
- return oci_fetch_array($result);
- }
-
- }
- ?>