• メインページ
  • データ構造
  • ファイル
  • ファイル一覧

PageBodyNearHotels.php

00001 <?php
00002 /*
00003  * PageBodyNearHotels.php
00004  * 
00005  * Copyright (c) 2010 ValueCommerce, Co. Ltd.
00006  */
00007 require_once('PageSectionBase.php');
00008 require_once('FormattedItem.php');
00009 require_once('Pagination.php');
00010 
00012 if (!defined('VCSDBSAMPLE_NO_RESULTS')) define('VCSDBSAMPLE_NO_RESULTS','検索結果がありません');
00013 
00015 if (!defined('VCSDBSAMPLE_HTTP_FAILURE')) define('VCSDBSAMPLE_HTTP_FAILURE','ウェブサービスデータベースが異常な値を返しました。');
00016 
00018 if (!defined('VCSDBSAMPLE_XML_PARSE_ERROR')) define('VCSDBSAMPLE_XML_PARSE_ERROR','ウェブサービスデータベースのXMLに異常があります。');
00019 
00021 if (!defined('VCSDBSAMPLE_DATA_STRUCT_ERROR')) define('VCSDBSAMPLE_DATA_STRUCT_ERROR','ウェブサービスデータベースから受け取ったデータに構造上の問題があります。');
00022 
00024 if (!defined('VCSDBSAMPLE_UNKNOWN_EROR')) define('VCSDBSAMPLE_UNKNOWN_EROR','不明なエラー');
00025 
00031 class PageBodyNearHotels extends PageSectionBase {
00032 
00034         protected $view;        
00035         
00037         private $items;
00038         
00040         private $pagination;
00041         
00043         private $errorMessage;
00044 
00051         public function __construct($itemViewFile,$response, $is_mobile=false) {
00052                 $itemView = $this->loadFile($itemViewFile);
00053 
00054                 if (gettype($response) != "object") {
00055                         $this->items = null;
00056 
00057                         switch ($response) {
00058                         case VCSDBDriverBase::STATUS_HTTP_CONNECTION_FAILURE:
00059                           $this->errorMessage = VCSDBSAMPLE_HTTP_FAILURE;
00060                           break;
00061                         case VCSDBDriverBase::STATUS_XML_PARSE_ERROR:
00062                           $this->errorMessage = VCSDBSAMPLE_XML_PARSE_ERROR;
00063                           break;
00064                         case VCSDBDriverBase::STATUS_DATA_STRUCTURAL_ERROR:
00065                           $this->errorMessage = VCSDBSAMPLE_DATA_STRUCT_ERROR;
00066                           break;
00067                         case VCSDBDriverBase::STATUS_NO_PARAMETER_ERROR:
00068                           $this->errorMessage = "";
00069                           break;
00070                         default:
00071                           $this->errorMessage = VCSDBSAMPLE_UNKNOWN_EROR;
00072                         }
00073                 } else {
00074                         $this->items = FormattedItem::getItems($itemView,$response);
00075                 }
00076         }
00077 
00084         function render_bk($show_container=true) {
00085                 $output = '';
00086                 
00087                 if (gettype($this->items) == "array") {
00088                         if (count($this->items) > 0 ) {
00089                                 error_log("count ".count($this->items));
00090                                 
00091                                 if ($show_container) {
00092                                         $output .= '<div class="results" style="float:left; width:100%">';
00093                                 }
00094                                 
00095                                 foreach ($this->items as $item) {
00096                                         $output .= $item->toString();
00097                                 }
00098                                 
00099                                 if ($show_container) {
00100                                         $output .= '</div>';
00101                                 }
00102                                 
00103                         } else {
00104                                 $output .= VCSDBSAMPLE_NO_RESULTS;
00105                         }       
00106                 } else {
00107                   $output .= $this->errorMessage;
00108                 }
00109                         
00110                 return $output;
00111         }       
00112         
00113         
00114         function render($show_container=true) {
00115                 $output = '';
00116                 $i = 0;
00117                 
00118                 if (gettype($this->items) == "array") {
00119                         if (count($this->items) > 0 ) {
00120                                 error_log("count ".count($this->items));
00121                                 
00122                                 if ($show_container) {
00123                                         $output .= '<table class="results"><tr>';
00124                                 }
00125                                 
00126                                 
00127                                 foreach ($this->items as $item) {
00128                                         if(0 < $i){
00129                                                 $output .= $item->toString();
00130                                         }
00131                                         $i++;
00132                                 }
00133                                 
00134                                 if ($show_container) {
00135                                         $output .= '</tr></table>';
00136                                 }
00137                                 
00138                         } else {
00139                                 $output .= VCSDBSAMPLE_NO_RESULTS;
00140                         }       
00141                 } else {
00142                   $output .= $this->errorMessage;
00143                 }
00144                         
00145                 return $output;
00146         }               
00147         
00151         public function show($show_container=true) {
00152                 print $this->render($show_container);
00153         }
00154 }
00155 ?>

バリューコマース ウェブサービス トラベルAPIサンプル ドキュメンテーションに対してTue Jan 11 2011 19:25:16に生成されました。  doxygen 1.7.2