Exemple #1
0
 /**
  * Returns informations about a line
  * @return ezcMvcResult
  */
 public function doInfosLigne()
 {
     $result = new ezcMvcResult();
     $scrapperLigne = new tclScraperDetailsLigne($this->ligne);
     $result->variables['ligne'] = $scrapperLigne->get();
     $result->variables['tcl-url'] = $scrapperLigne->url;
     return $result;
 }
Exemple #2
0
 /**
  * Constructor
  * @param int $idLigne
  * @param int $idArret
  * @param string $direction fw|bw
  * @param int $date The date to fetch departures for, as a UNIX timestamp
  */
 public function __construct($idLigne, $idArret, $direction, $date = null)
 {
     $this->params['page'] = 'horaires';
     $this->params['etape'] = 3;
     if ($date === null) {
         $this->params['Date'] = date('Y|m|d');
     } else {
         $this->params['Date'] = date('Y|m|d', $date);
     }
     $this->params['submit'] = 'Valider';
     // use tclScraperLignes to get the line string
     // very bad, this needs some server side storage :)
     // but since the HTML file is cached... so be it
     try {
         $scrapper = new tclScraperDetailsLigne($idLigne);
         $line = $scrapper->get();
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $this->params['Line'] = $line->string;
     $this->params['Direction'] = $line->directions[$direction]['code'];
     $this->params['StopArea'] = $line->arrets[$idArret]->string;
 }