public static function fetchFromParameters($params) { $pageContents = new PageContents(); if (isset($params['id']) && is_numeric($params['id'])) { $pageContents->id = intval($params['id']); } $pageContents->title = LocalizedText::fetchFromParameters($params, "title_"); $pageContents->contents = LocalizedText::fetchFromParameters($params, "contents_"); if (isset($params['status'])) { $pageContents->isVisible = strtoupper(trim($params['status'])) == "Y"; } if (isset($params['parent_id']) && is_numeric($params['parent_id'])) { $pageContents->parentId = intval($params['parent_id']); } if (isset($params['file'])) { $pageContents->file = trim($params['file']); } if (isset($params['url'])) { $pageContents->url = trim($params['url']); } if (isset($params['ord'])) { $pageContents->displayOrder = intval($params['ord']); } if (isset($params['template_type'])) { $pageContents->templateType = intval($params['template_type']); } return $pageContents; }
public static function fetchFromParameters($params) { $paymentGateway = new PaymentGateway(); if (isset($params['id']) && is_numeric($params['id'])) { $paymentGateway->id = intval($params['id']); } $paymentGateway->gatewayName = LocalizedText::fetchFromParameters($params, "gateway_name_"); if (isset($params['gateway_code'])) { $paymentGateway->gatewayCode = $params['gateway_code']; } if (isset($params['account'])) { $paymentGateway->account = $params['account']; } if (isset($params['production_url'])) { $paymentGateway->productionUrl = $params['production_url']; } if (isset($params['test_url'])) { $paymentGateway->testUrl = $params['test_url']; } if (isset($params['is_production_mode'])) { $paymentGateway->isProductionMode = intval($params['is_production_mode']) == 1; } if (isset($params['enabled'])) { $paymentGateway->isEnabled = intval($params['enabled']) == 1; } if (isset($params['is_admin'])) { $paymentGateway->isAdmin = intval($params['is_admin']) == 1; } if (isset($params['display_order']) && is_numeric($params['display_order'])) { $paymentGateway->displayOrder = intval($params['display_order']); } return $paymentGateway; }
public static function fetchFromParameters($params) { $newsCategory = new NewsCategory(); if (isset($params['id']) && is_numeric($params['id'])) { $newsCategory->id = intval($params['id']); } $newsCategory->title = LocalizedText::fetchFromParameters($params, NewsCategory::$titlePrefix); return $newsCategory; }
public static function fetchFromParameters($params, $isDatabaseRow = false) { NewsPost::$staticErrors = array(); $newsPost = new NewsPost(); if (isset($params['id']) && is_numeric($params['id'])) { $newsPost->id = intval($params['id']); } if (isset($params['category_id']) && is_numeric($params['category_id'])) { $newsPost->categoryId = intval($params['category_id']); } $newsPost->title = LocalizedText::fetchFromParameters($params, NewsPost::$titlePrefix); $newsPost->contents = LocalizedText::fetchFromParameters($params, NewsPost::$contentsPrefix); if ($isDatabaseRow && isset($params['image_small'])) { $newsPost->imageSmall = $params['image_small']; } else { if (!$isDatabaseRow && isset($_FILES['image_small']['name']) && trim($_FILES['image_small']['name']) != "") { $imageName = NULL; if (!UploadImage::upload($_FILES, "image_small", "../images", $imageName)) { NewsPost::$staticErrors = UploadImage::$errors; return null; } $newsPost->imageSmall = $imageName; } } if ($isDatabaseRow && isset($params['image_medium'])) { $newsPost->imageMedium = $params['image_medium']; } else { if (!$isDatabaseRow && isset($_FILES['image_medium']['name']) && trim($_FILES['image_medium']['name']) != "") { $imageName = NULL; if (!UploadImage::upload($_FILES, "image_medium", "../images", $imageName)) { NewsPost::$staticErrors = UploadImage::$errors; return null; } $newsPost->imageMedium = $imageName; } } if ($isDatabaseRow && isset($params['image_large'])) { $newsPost->imageLarge = $params['image_large']; } else { if (!$isDatabaseRow && isset($_FILES['image_large']['name']) && trim($_FILES['image_large']['name']) != "") { $imageName = NULL; if (!UploadImage::upload($_FILES, "image_large", "../images", $imageName)) { NewsPost::$staticErrors = UploadImage::$errors; return null; } $newsPost->imageLarge = $imageName; } } if (isset($params['poster_name'])) { $newsPost->posterName = trim($params['poster_name']); } if (isset($params['date_posted'])) { $newsPost->postedDate = Date::parse(trim($params['date_posted'])); } return $newsPost; }
public static function fetchFromParameters($params) { $faq = new Faq(); if (isset($params['id']) && is_numeric($params['id'])) { $faq->id = intval($params['id']); } $faq->question = LocalizedText::fetchFromParameters($params, Faq::$questionPrefix); $faq->answer = LocalizedText::fetchFromParameters($params, Faq::$answerPrefix); if (isset($params['display_order']) && is_numeric($params['display_order'])) { $faq->displayOrder = intval($params['display_order']); } return $faq; }
public static function fetchFromParameters($params) { $emailContents = new EmailContents(); if (isset($params['id']) && is_numeric($params['id'])) { $emailContents->id = intval($params['id']); } if (isset($params['email_code'])) { $emailContents->emailCode = $params['email_code']; } $emailContents->emailSubject = LocalizedText::fetchFromParameters($params, "email_subject_"); $emailContents->emailText = LocalizedText::fetchFromParameters($params, "email_text_"); return $emailContents; }
public static function fetchFromParameters($params) { global $logger; $logger->LogDebug(__METHOD__ . " Creating new " . __CLASS__ . " object from parameters ..."); $logger->LogDebug("Parameters are:"); $logger->LogDebug($params); $content = new Content(); if (isset($params['id']) && is_numeric($params['id'])) { $content->id = intval($params['id']); } if (isset($params['cont_title'])) { $content->title = trim($params['cont_title']); } $content->contents = LocalizedText::fetchFromParameters($params, "contents_"); if (isset($params['status'])) { $content->isVisible = strtoupper(trim($params['status'])) == "Y"; } return $content; }
public static function fetchFromParameters($postParams, $fileParams = null, $uploadLocation = "../images") { global $systemConfiguration; global $logger; GalleryImage::$staticErrors = array(); $galleryImage = new GalleryImage(); if (isset($postParams['id']) && is_numeric($postParams['id'])) { $galleryImage->id = intval($postParams['id']); } if (isset($postParams['image_name'])) { $galleryImage->imageFileName = $postParams['image_name']; } else { if ($fileParams != null && isset($fileParams['image_name']) && strlen(trim($fileParams['image_name']['name'])) > 0) { $imageName = ""; if (!UploadImage::upload($fileParams, 'image_name', $uploadLocation, $imageName)) { GalleryImage::$staticErrors = UploadImage::$errors; return null; } $galleryImage->imageFileName = $imageName; } } if (isset($postParams['thumb_image_name'])) { $galleryImage->thumbImageFileName = $postParams['thumb_image_name']; } else { if ($fileParams != null && isset($fileParams['thumb_image_name']) && strlen(trim($fileParams['thumb_image_name']['name'])) > 0) { $imageName = ""; if (!UploadImage::upload($fileParams, 'thumb_image_name', $uploadLocation, $imageName)) { GalleryImage::$staticErrors = UploadImage::$errors; return null; } $galleryImage->thumbImageFileName = $imageName; } } $galleryImage->description = LocalizedText::fetchFromParameters($postParams, GalleryImage::$descriptionPrefix); if (isset($postParams['link'])) { $galleryImage->link = $postParams['link']; } if (isset($postParams['display_order']) && is_numeric($postParams['display_order'])) { $galleryImage->displayOrder = intval($postParams['display_order']); } return $galleryImage; }