/**
  * Nadviaže spojenie, spustí danú "aplikáciu" v AISe
  * a natiahne prvotné dáta do atribútu $data.
  */
 public function requestOpen(Trace $trace, ScreenData $data)
 {
     $trace->tlog("open screen");
     $url = $this->requestBuilder->getAppInitializationUrl($data);
     $response = AIS2Utils::request($trace->addChild("get app id"), $url);
     $this->appId = $this->parseAppIdFromResponse($response);
     $response = $this->doRequest($trace->addChild("Init command"), array('eventClass' => 'avc.ui.event.AVCComponentEvent', 'command' => 'INIT'));
     $this->formName = $this->parseFormNameFromResponse($response);
 }
 public function createTableFromHtml(Trace $trace, $aisResponseHtml, $dataViewName)
 {
     $html = $this->fixProblematicTags($trace->addChild("Fixing html for better DOM parsing."), $aisResponseHtml);
     $domWholeHtml = $this->createDomFromHtml($trace, $html);
     $element = $this->findEnclosingElement($trace, $domWholeHtml, $dataViewName);
     $dom = new DOMDocument();
     $dom->appendChild($dom->importNode($element, true));
     // ok, now we have restricted document
     $headers = $this->getTableDefinition($trace->addChild("Get table definition"), $dom);
     $data = $this->getTableData($trace->addChild("Get table data"), $dom);
     return new DataTable($headers, $data);
 }
 public function openDialogAndGetExecutor(Trace $trace, $dialogUid, DialogData $data)
 {
     $this->openIfNotAlready($trace->addChild("opening dialog parent"));
     if ($this->openedDialog !== null) {
         throw new IllegalStateException('V AIS2 screene "' . $this->formName . '" už existuje otvorený dialog. Pre otvorenie nového treba pôvodný zatvoriť.');
     }
     $this->openedDialog = $dialogUid;
     $executor = $this->executor->spawnChild($data, $this->formName);
     return $executor;
 }
 private function exec(Trace $trace)
 {
     // read cookie file
     curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookieFile);
     $output = curl_exec($this->curl);
     $child = $trace->addChild("Response");
     $child->tlogVariable("Http resonse code", curl_getinfo($this->curl, CURLINFO_HTTP_CODE));
     $child->tlogVariable("Http content type", curl_getinfo($this->curl, CURLINFO_CONTENT_TYPE));
     $child->tlogVariable("Response", $output);
     if (curl_errno($this->curl)) {
         $child->tlog("There was an error receiving data");
         throw new Exception("Chyba pri nadväzovaní spojenia:" . curl_error($this->curl));
     }
     // Do not forget to save current file content
     curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookieFile);
     return $output;
 }