public function getAddresses() { $items = ClassSoldierAddress::sqlGetAllItems(false, '1', '100', '', array('id_soldier' => $this->id)); if ($items && is_array($items) && count($items) > 0) { return $items; } return false; }
protected function edit() { // ladowanie klasy $item = new ClassSoldierAddress(ClassTools::getValue('id_address')); // sprawdza czy klasa zostala poprawnie zaladowana if (!$item->load_class) { $this->alerts['danger'] = "Szkoła żołnierza nie istnieje."; } $item->street = ClassTools::getValue('form_street'); $item->postcode = ClassTools::getValue('form_postcode'); $item->city = ClassTools::getValue('form_city'); $item->country = ClassTools::getValue('form_country'); $item->id_address_types = ClassTools::getValue('form_type'); $item->id_soldier = ClassTools::getValue('id_soldier'); $item->id_user = ClassAuth::getCurrentUserId(); // komunikaty bledu if (!$item->update()) { $this->alerts['danger'] = $item->errors; return; } // komunikat $this->alerts['success'] = "Poprawnie zaktualizowano adres żołnierza."; // czyszczeie zmiennych wyswietlania $this->tpl_values = ''; $_POST = array(); return; }