/** * Get a list of osoba to be added or remove. Write the osoba to database. * @param int $id * @return int */ public function GetOsoby($id = 0) { if (!$this->WS()) { return null; } try { $params = array('sid' => $this->_sid, 'id' => $id); $result = $this->WS()->getSC()->__soapCall("GetOsoby", array($params)); if ($result->GetOsobyResult->Status != 0) { Errors::LogError("WebService:GetOsoby", "Response: " . $result->GetOsobyResult->Message); return 0; } $xml = simplexml_load_string($result->GetOsobyResult->XMLContent); $cnt = 0; foreach ($xml->children() as $o) { $id_usera = null; if (CheckNumeric($o['id_usera']) > 0) { $id_usera = CheckNumeric($o['id_usera']); } $osoba = new Osoba($o["id"], $o->Imie, $o->Nazwisko, $o->Email, $o['telefon'], $o->Login, $o->Haslo, $o['data_rejestracji'], $id_usera); Osoby::AddEditOsoba($osoba); $cnt++; } return $cnt; } catch (Exception $ex) { Errors::LogError("WebService:GetOsoby", $ex->getMessage()); return 0; } }