Nearest traficar inforations.
This commit is contained in:
@@ -73,6 +73,27 @@ class HtmlToPos
|
||||
return $posText;
|
||||
}
|
||||
|
||||
public function traficar($posText)
|
||||
{
|
||||
$data = $posText;
|
||||
if (strstr($posText, '[traficar]')) {
|
||||
$data = [];
|
||||
$traficar = new Traficar();
|
||||
$nearest = $traficar->nearestCar();
|
||||
|
||||
$data['text'] = "Najbliższy traficar:\n" .
|
||||
'Model: ' . $nearest['car']['model'] . "\n" .
|
||||
'Numer boczny: ' . $nearest['car']['orderNumber'] . "\n" .
|
||||
'Rejestracja: ' . $nearest['car']['regNumber'] . "\n" .
|
||||
'Lokalizacja: ' . $nearest['car']['location'] . "\n" .
|
||||
'Odległość: ' . $nearest['distance'] . "km\n";
|
||||
// $data['image'] = $nearest['imageName'];
|
||||
// $data['image'] = 'https://staticmapmaker.com/img/cartodb_placeholder.png';
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function convert($html = '')
|
||||
{
|
||||
$posText = $this->handleNewLine($html);
|
||||
@@ -80,7 +101,10 @@ class HtmlToPos
|
||||
$posText = $this->pickRandomElement($posText);
|
||||
$posText = $this->randomNumber($posText);
|
||||
$posText = $this->vocabularyWord($posText);
|
||||
$posText = $this->traficar($posText);
|
||||
|
||||
// print_r($posText);
|
||||
// die();
|
||||
return $posText;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user