Exemplo n.º 1
0
 /**
  * Konštruktor, z html kódu vyrobí dáta.
  *
  * @param array(string) $tableDefinition  názvy stĺpcov
  * @param string        $html             html vygenerované AISom
  */
 public function __construct($tableDefinition, $html)
 {
     $this->definition = $tableDefinition;
     // Ak v tabulke nie su ziadne data, matchAll nic nenajde, ale nemame vyhodit vynimku
     if (trim($html) == '') {
         $this->data = array();
         return;
     }
     $data = matchAll($html, $this->getPattern());
     $this->data = array();
     if ($data !== false) {
         foreach ($data as $row) {
             $this->data[] = removeIntegerIndexesFromArray($row);
         }
     } else {
         throw new Exception("Problém pri parsovaní dát.");
     }
 }
 public function parseIdFromZapisnyListIndexFromResponse($response)
 {
     // FIXME: toto tunak spravit nejak krajsie
     $data = matchAll($response, self::APP_LOCATION_PATTERN, true);
     if ($data === false) {
         return null;
     }
     $data = matchAll($data[2], '@&idZapisnyList\\=(?P<idZapisnyList>[0-9]*)&idStudium\\=(?P<idStudium>[0-9]*)@', true);
     if ($data === false) {
         return null;
     }
     return removeIntegerIndexesFromArray($data);
 }
 public function parseIdFromZapisnyListIndexFromResponse($response)
 {
     $data = util\matchAll(self::APP_LOCATION_PATTERN, $response, true);
     if ($data === false) {
         throw new ParseException("Location of APP_PATTERN failed.");
     }
     $data = util\matchAll(self::ID_PATTERN, $data[2], true);
     if ($data === false) {
         throw new ParseException("Parsing of ids from zapisnyListIndex failed.");
     }
     return removeIntegerIndexesFromArray($data);
 }