/**
  * 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);
 }
 private function check(Trace $trace, $url, $response)
 {
     $matches = array();
     if (preg_match(self::INTERNAL_ERROR_PATTERN, $response, $matches)) {
         $trace->tlog("Expection encountered");
         throw $this->newException($matches[1], $url);
     }
     if (preg_match(self::APACHE_ERROR_PATTERN, $response, $matches)) {
         $trace->tlog("Expection encountered");
         throw $this->newException($matches[1], $url);
     }
     if (preg_match(self::UNAUTHORIZED, $response)) {
         $trace->tlog("Exception encountered");
         throw new AIS2LoginException("AIS hlási neautorizovaný prístup -\n        pravdepodobne vypršala platnosť cookie");
     }
     return $response;
 }
Пример #3
0
 public function getTableDefinition(Trace $trace, DOMDocument $dom)
 {
     $trace->tlog("finding table definition element");
     $trace->tlogVariable("", $dom->saveXML());
     $element = $dom->getElementById('dataTabColGroup');
     if ($element == null) {
         throw new Exception("Can't find table headers");
     }
     $list = $element->getElementsByTagName('col');
     $columns = array();
     foreach ($list as $node) {
         assert($node->hasAttribute('shortname'));
         $columns[] = $node->getAttribute('shortname');
     }
     $trace->tlogVariable("Parsed columns:", $columns);
     return $columns;
 }
Пример #4
0
 public function post(Trace $trace, $url, $data)
 {
     $trace->tlog("Http POST");
     $trace->tlogVariable("URL", $url);
     $child = $trace->addChild("POST data");
     $child->tlogVariable("post_data", $data);
     curl_setopt($this->curl, CURLOPT_URL, $url);
     curl_setopt($this->curl, CURLOPT_POST, true);
     $newPost = '';
     foreach ($data as $key => $value) {
         $newPost .= urlencode($key) . '=' . urlencode($value) . '&';
     }
     $post = substr($newPost, 0, -1);
     curl_setopt($this->curl, CURLOPT_POSTFIELDS, $post);
     return $this->exec($trace);
 }