예제 #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;
     }
 }
예제 #2
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();
     }
 }