Example #1
0
 /**
  * Load review information from Content Cafe based on the ISBN
  *
  * @param $id
  * @return array
  */
 function contentcafe($isbn, $id)
 {
     global $library;
     global $locationSingleton;
     $location = $locationSingleton->getActiveLocation();
     $result = null;
     if (isset($library) && $location != null) {
         if ($library->showAmazonReviews == 0 || $location->showStandardReviews == 0) {
             return $result;
         }
     } else {
         if ($location != null && $location->showStandardReviews == 0) {
             //return an empty review
             return $result;
         } else {
             if (isset($library) && $library->showStandardReviews == 0) {
                 //return an empty review
                 return $result;
             }
         }
     }
     //Setup the soap client to load the
     $soapClient = new SoapClient('http://contentcafe.btol.com/ContentCafe/Review.asmx?WSDL', array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));
     $params = array('UserID' => 'EBSMARMOT', 'Password' => $id, 'ItemKey' => $isbn);
     try {
         $response = $soapClient->fnDetailByItemKey($params);
         $reviews = $response->fnDetailByItemKeyResult->Review;
         if (!is_null($reviews)) {
             $review = array();
             $i = 0;
             foreach ($reviews as $reviewData) {
                 $review[$i]['Content'] = $reviewData->ReviewText;
                 $review[$i]['Source'] = $reviewData->ReviewLiteral;
                 $review[$i]['Copyright'] = "Content Cafe Review";
                 $i++;
             }
             return $review;
         }
     } catch (Exception $e) {
         //TODO: Log the error someplace.
     }
 }