public function updateCar($car) { $error = false; //type if (trim($car->getType()) == "") { $phpError["type"] = "Type is a required field!"; $error = true; } /* $dalCar = new DALCar(); $nrCars=$dalCar->getCarByTypeExcludeId($car->getType(),$car->getId()); if ($nrCars != 0) { $phpError["type"] = "This type is allready used!"; $error = true; } */ //previewlink if (trim($car->getPreviewLink()) == "") { $phpError["previewlink"] = "Preview link is a required field!"; $error = true; } elseif (!isValidURL($car->getPreviewLink())) { $phpError["previewlink"] = "Preview link must be a youtube link!"; $error = true; } //releasedate $date = $car->getReleaseDate(); if (substr($date, 0, 4) == "0000" || substr($date, 5, 2) == "00") { $phpError["releasedate"] = "Release date is a required field!"; $error = true; } //presscontact $dalPressContact = new DALPressContact(); $nrpresscontacts = $dalPressContact->getPressContactCount($car->getPressContactId()); if ($nrpresscontacts == 0) { $phpError["presscontact"] = "Presscontact was not found!"; $error = true; } if ($error == true) { return $phpError; } else { parent::updateCar($car); $id = $car->getId(); return $id; } }
public function updatePressContact($presscontact) { $error = false; //name if (trim($presscontact->getName()) == "") { $phpError["presscontactname"] = "Name is a required field!"; $error = true; } $html = nl2br($presscontact->getHTMLcontent()); $html = str_replace("<br />", "", $html); if (trim($html) == "") { $phpError["presscontacthtml"] = "HTML is a required field!"; $error = true; } if ($error == true) { return $phpError; } else { parent::updatePressContact($presscontact); return $presscontact->getId(); } }