Beispiel #1
0
 public function updateCarLink($carlink)
 {
     $error = false;
     //text
     if (trim($carlink->getText()) == "") {
         $phpError["carlinktext"] = "Text is a required field!";
         $error = true;
     }
     //url
     if (trim($carlink->getURL()) == "") {
         $phpError["carlinkurl"] = "URL is a required field!";
         $error = true;
     } elseif (!isValidURL(trim($carlink->getURL()))) {
         $phpError["carlinkurl"] = "URL link is not valid!";
         $error = true;
     }
     //car
     $dalCar = new DALCar();
     $nrCars = $dalCar->getCarCount($carlink->getCarId());
     if ($nrCars == 0) {
         $phpError["carlinkcar"] = "Car was not found!";
         $error = true;
     }
     if ($error == true) {
         return $phpError;
     } else {
         parent::updateCarLink($carlink);
         $id = $carlink->getId();
         return $id;
     }
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
 public function updateCarMovie($carmovie)
 {
     $error = false;
     //url
     if (trim($carmovie->getUrl()) == "") {
         $phpError["carmovieurl"] = "Url is a required field!";
         $error = true;
     } elseif ($carmovie->getTypeId() == 1) {
         if (strtolower(findexts($carmovie->getUrl())) != "wmv" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
             $phpError["carmovieurl"] = "LR link must be a wmv or mp4 file!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 2) {
         if (strtolower(findexts($carmovie->getUrl())) != "mpg" && strtolower(findexts($carmovie->getUrl())) != "mpeg" && strtolower(findexts($carmovie->getUrl())) != "mov" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
             $phpError["carmovieurl"] = "HR link must be mpg, mpeg, mov or mp4 file!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 3) {
         if (!isValidURL(trim($carmovie->getUrl()))) {
             $phpError["carmovieurl"] = "Not a valid link!";
             $error = true;
         }
     } elseif ($carmovie->getTypeId() == 4) {
         //to be defined
     } elseif ($carmovie->getTypeId() == 5) {
         //to be defined
     } else {
         $phpError["carmovieurl"] = "Type not found!";
         $error = true;
     }
     //text
     if (trim($carmovie->getText()) == "") {
         $phpError["carmovietext"] = "Text is a required field!";
         $error = true;
     }
     //car
     $dalCar = new DALCar();
     $nrCars = $dalCar->getCarCount($carmovie->getCarId());
     if ($nrCars == 0) {
         $phpError["carmoviecar"] = "Car not found!";
         $error = true;
     }
     if ($error == true) {
         return $phpError;
     } else {
         parent::updateCarMovie($carmovie);
         return $carmovie->getId();
     }
 }