Пример #1
0
 public static function fetchFromParameters($postParams, $fileParams = null)
 {
     global $systemConfiguration;
     SliderImage::$staticErrors = array();
     $sliderImage = new SliderImage();
     $sliderImage->galleryImage = GalleryImage::fetchFromParameters($postParams, $fileParams);
     return $sliderImage;
 }
Пример #2
0
 public static function fetchFromParameters($postParams, $fileParams = null)
 {
     global $systemConfiguration;
     global $logger;
     RoomImage::$staticErrors = array();
     $roomImage = new RoomImage();
     $roomImage->galleryImage = GalleryImage::fetchFromParameters($postParams, $fileParams);
     if (isset($postParams['room_id']) && is_numeric($postParams['room_id'])) {
         $roomImage->roomId = intval($postParams['room_id']);
     } else {
         if (is_null($roomImage->galleryImage)) {
             $logger->LogError("Gallery image is null.");
         }
     }
     return $roomImage;
 }
Пример #3
0
 public static function fetchFromDbWhere($whereSql)
 {
     global $logger;
     $logger->LogInfo("Fetching gallery images using WHERE SQL: {$whereSql}");
     $galleryImages = array();
     $sql = "SELECT * FROM bsi_gallery_images " . $whereSql . " ORDER BY display_order";
     $query = mysql_query($sql);
     if (!$query) {
         $logger->LogFatal("Database error: " . mysql_errno() . ". Message: " . mysql_error());
         $logger->LogError("SQL: " . $sql);
         die("Database error: " . mysql_errno() . ". Message: " . mysql_error());
     }
     while ($row = mysql_fetch_assoc($query)) {
         $galleryImage = GalleryImage::fetchFromParameters($row);
         $galleryImages[] = $galleryImage;
     }
     mysql_free_result($query);
     return $galleryImages;
 }
<?php

// TODO: Uncomment
include "access.php";
include_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$errors = array();
$message = "";
$galleryImage = new GalleryImage();
if (isset($_POST['SBMT_REG'])) {
    $logger->LogInfo("Form has been submitted.");
    $galleryImage = GalleryImage::fetchFromParameters($_POST);
    if (!$galleryImage->save()) {
        $logger->LogError("Error saving news category.");
        foreach ($galleryImage->errors as $error) {
            $logger->LogError($error);
            $errors[] = $error;
        }
    } else {
        $message = "Values were updated successfully!";
    }
} else {
    if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
        $logger->LogInfo("Page was called for edit of id: " . $_REQUEST['id']);
        $id = intval($_REQUEST['id']);
        $logger->LogDebug("Numeric id is: {$id}");
        $galleryImage = GalleryImage::fetchFromDb($id);
        if ($galleryImage == null) {
            $logger->LogError("Invalid request. No gallery image with id: {$id} exists.");
            $errors[] = "Invalid request. No gallery image with id: {$id} exists.";