Skip to content

Commit

Permalink
Mise à jour le class Candidature et liste candidature pour prendre en…
Browse files Browse the repository at this point in the history
… compte LAT et LNG #37
  • Loading branch information
oceanBigOne authored and ColinMaudry committed Mar 31, 2017
1 parent faf7e96 commit 82aeca7
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 6 deletions.
130 changes: 125 additions & 5 deletions class/Candidature.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class Candidature {
private $bIs_criminal_record;
private $sComment;
private $sKey_edit;
private $nLat;
private $nLng;


/**
Expand Down Expand Up @@ -295,6 +297,16 @@ public function save()
$aData["key_edit"]=$this->getKey_edit();
}

if(isset($this->aDataSet["lat"]))
{
$aData["lat"]=$this->getLat();
}

if(isset($this->aDataSet["lng"]))
{
$aData["lng"]=$this->getLng();
}

if($this->getId()>0)
{
DbLink::getInstance($this->_sDbInstance)->update("candidature",$aData,' id="'.$this->getId().'" ');
Expand Down Expand Up @@ -340,6 +352,8 @@ private function vide()
$this->setIs_criminal_record(0);
$this->setComment(NULL);
$this->setKey_edit(NULL);
$this->setLat(0);
$this->setLng(0);
}

/**
Expand Down Expand Up @@ -375,7 +389,9 @@ public function __toString()
"is_idcard" => $this->getIs_idcard(),
"is_criminal_record" => $this->getIs_criminal_record(),
"comment" => $this->getComment(),
"key_edit" => $this->getKey_edit()
"key_edit" => $this->getKey_edit(),
"lat" => $this->getLat(),
"lng" => $this->getLng()
];

return json_encode($aObjet);
Expand All @@ -384,10 +400,10 @@ public function __toString()


/*
********************************************************************************************
* DEBUT FONCTIONS PERSONNALISES *
********************************************************************************************
*/
********************************************************************************************
* DEBUT FONCTIONS PERSONNALISES *
********************************************************************************************
*/
public function getPresentation_meta()
{
return trim(str_replace(array('"',"\t","\n","\r"),array("'","","",""),$this->getPresentation()));
Expand Down Expand Up @@ -547,6 +563,16 @@ public function saveWithPDOSecure(){
$aData["key_edit"]=$this->getKey_edit();
}

if(isset($this->aDataSet["lat"]))
{
$aData["lat"]=$this->getLat();
}

if(isset($this->aDataSet["lng"]))
{
$aData["lng"]=$this->getLng();
}

if($this->getId()>0)
{
$sSql="";
Expand Down Expand Up @@ -1864,4 +1890,98 @@ public function getKey_edit()
}
}



/**
* Set le champ lat
* @param numeric $nLat nouvelle valeur pour le champ lat
*/
public function setLat($nLat)
{
if( is_null($nLat) ) $nLat='';
if( is_numeric($nLat) || $nLat=='' )
{
$this->nLat = $nLat;
$this->aDataSet["lat"]=1;
}
}



/**
* Get le champ lat
* @return numeric valeur du champ lat
*/
public function getLat()
{
if( !is_null($this->nLat) )
{
if( $this->nLat==='' )
{
return NULL;
}
else
{
return $this->nLat;
}
}
else
{
$this->hydrateFromBDD(array('lat'));
$this->callHydrateFromBDDOnGet++;
if($this->callHydrateFromBDDOnGet>ConfigService::get("maxCallHydrateFromBDDonGet"))
{
echo "<br />WARNING : trop d'appel en base depuis l'accesseur ". __CLASS__ ."::". __FUNCTION__ ."";
}
return $this->nLat;
}
}



/**
* Set le champ lng
* @param numeric $nLng nouvelle valeur pour le champ lng
*/
public function setLng($nLng)
{
if( is_null($nLng) ) $nLng='';
if( is_numeric($nLng) || $nLng=='' )
{
$this->nLng = $nLng;
$this->aDataSet["lng"]=1;
}
}



/**
* Get le champ lng
* @return numeric valeur du champ lng
*/
public function getLng()
{
if( !is_null($this->nLng) )
{
if( $this->nLng==='' )
{
return NULL;
}
else
{
return $this->nLng;
}
}
else
{
$this->hydrateFromBDD(array('lng'));
$this->callHydrateFromBDDOnGet++;
if($this->callHydrateFromBDDOnGet>ConfigService::get("maxCallHydrateFromBDDonGet"))
{
echo "<br />WARNING : trop d'appel en base depuis l'accesseur ". __CLASS__ ."::". __FUNCTION__ ."";
}
return $this->nLng;
}
}

}
4 changes: 3 additions & 1 deletion class/CandidatureListe.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class CandidatureListe extends Liste
"is_idcard",
"is_criminal_record",
"comment",
"key_edit"
"key_edit",
"lat",
"lng"
);

/**
Expand Down

0 comments on commit 82aeca7

Please sign in to comment.