slug = $_brandSlug; $this->page = $current; $s = $_SERVER["HTTP_HOST"]; // テスト環境 if($s == 'newdev.celebrities-jewelry.com'){ $this->serverPath = '/home/kir820556/public_html/dev'; // 本番環境 } else { $this->serverPath = '/home/kir820556/public_html/www'; } $this->baseUrl = '/brand/'.$this->slug; $this->topUrl = ''; //ブランドページがあるかどうか $this->hasPage = false; //公開しているかどうか $this->public = false; //各ページ名 $this->pageTitle = array( 'wedding' => 'ウエディング', 'history' => 'ブランドの歴史', 'topics' => 'トピックス' ); if(file_exists($this->serverPath.'/data/'.$_brandSlug.'/inc/config.inc')){ include($this->serverPath.'/data/'.$_brandSlug.'/inc/config.inc'); $this->hasPage = true; $this->config = $caj_brand_config[$_brandSlug]; //全て公開 $this->public = true; if($this->config['public']){ $this->public = true; } } } /* * ブランドヘッダー * -------------------------------- */ public function buildHeader(){ $html = ''; $html = <<< EOD

{$this->config['name']}

{$this->config['kana']}

{$this->config['dec']}

EOD; return $html; } /* * ナビゲーション * -------------------------------- */ public function buildNavigation(){ $html = ''; $c = array( 'top' => null, 'wedding' => null, 'history' => null, 'topics' => null, 'feature' => null ); $c[$this->page] = ' class="activ"'; //ウエディング $weddingNav = ''; if( file_exists($this->serverPath.'/data/'.$this->slug.'/inc/wedding.inc') && file_exists($this->serverPath.'/data/'.$this->slug.'/inc/weddingEngagement.inc') && file_exists($this->serverPath.'/data/'.$this->slug.'/inc/weddingMarriage.inc') ){ $weddingNav = "ウエディングWEDDING"; } //ヒストリー $historyNav = ''; if(file_exists($this->serverPath.'/data/'.$this->slug.'/inc/history.inc')){ $historyNav = "ブランドの歴史HISTORY"; } //名作/アイコンジュエリー $topicsNav = ''; if(file_exists($this->serverPath.'/data/'.$this->slug.'/inc/topics.inc')){ $topicsNav = "トピックスTOPICS"; } //特集 $featureNav = ''; if(!empty($this->config['feature'])){ $featureNav = '
  • 特集FEATURE
  • '; } $html = <<< EOD
    EOD; return $html; } /* * コンテンツページを作る * -------------------------------- */ public function buildContentsPage($c, $type = null, $id = null){ $html = ''; switch($this->page){ case 'history': $html = $this->buildHistoryPage($c); break; case 'wedding': if(!empty($type) && !empty($id)){ $html = $this->buildWeddingDetailPage($c, $type, $id); } else { $html = $this->buildWeddingPage($c); } break; case 'topics': $html = $this->buildTopicsPage($c); break; } return $html; } //WEDDING private function buildWeddingPage($c){ $html = ''; if(!empty($c)){ $html .= $this->buildContentsBlock( array( 'lead' => $c['lead'], 'body' => $c['body'], 'img' => array( 'main' => 'img_main_pc', 'sub01' => 'img_sub01_pc', 'sub02' => 'img_sub02_pc' ), 'caption' => $c['imgCaption'], 'textLeft' => true, 'lastFlag' => false )); $html .= $this->buildBrandLinks(); //アンカー $html .= <<< EOD EOD; $html .= $this->buildRingList($c); } //画像パス $imgPath = $this->topUrl.'/data/'.$this->slug.'/img'; $html = <<< EOD

    {$html}

    EOD; return $html; } //WEDDING - 詳細 private function buildWeddingDetailPage($c, $type, $id){ $id = intval($id); //画像パス $imgPath = $this->topUrl.'/data/'.$this->slug.'/img'; $fileId = sprintf('%03d', $id); $r = $c[$type][$id]; $f = ($type == 'engagement') ? false : true; $list = $this->buildRingList($c, $f); $ringNum = count($c[$type]); $nextID = ($id == $ringNum) ? 1 : $id + 1; $prevID = ($id == 1) ? $ringNum : $id - 1; $nextID = sprintf('%03d', $nextID); $prevID = sprintf('%03d', $prevID); //価格 $price = $this->makePriceLine($r['price']); if(!empty($r['priceText'])){ $price .= '

    '.$r['priceText'].'

    '; } $now_url = $_SERVER['REQUEST_URI']; $ringCategory = ''; if(strstr($now_url,"/engagement")){ $ringCategory = '

    Engagement Ringsエンゲージリング

    '; }else if(strstr($now_url,"/marriage")){ $ringCategory = '

    Wedding Ringsマリッジリング

    '; } $html = <<< EOD
    {$ringCategory}

    {$r['name']}

    {$r['name']}{$r['subName']}

    {$list}
    EOD; return $html; } //指輪一覧 private function buildRingList($c, $marriageFirst = false){ //画像パス $imgPath = $this->topUrl.'/data/'.$this->slug.'/img'; $now_url = $_SERVER['REQUEST_URI']; $multiple = ''; if(strstr($now_url,"/engagement")){ $multiple = 'multiple-item2'; } else if(strstr($now_url,"/marriage")){ $multiple = 'multiple-item2'; } //婚約指輪 $e = $this->buildRingListUnit('engagement', $c, $imgPath); $e = <<< EOD

    Engagement Ringsエンゲージリング

    {$e}
    EOD; //結婚指輪 $w = $this->buildRingListUnit('marriage', $c, $imgPath); $w = <<< EOD

    Wedding Ringsマリッジリング

    {$w}
    EOD; if(!$marriageFirst){ $html = "{$e}\n{$w}\n"; } else { $html = "{$w}\n{$e}\n"; } return $html; } //指輪一覧ユニット private function buildRingListUnit($t, $d, $imgPath){ $html = ''; foreach($d[$t] as $k => $v){ $id = sprintf('%03d', $k); //リスト表示用の価格 if(!empty($v['listPrice']) && !empty($v['price'][$v['listPrice']])){ $p = $this->priceFormat(array('price' => $v['price'][$v['listPrice']]['price'], 'priceKara' => $v['price'][$v['listPrice']]['kara'])); } else { $p = $this->getFirstPrice($v['price']); } $now_url = $_SERVER['REQUEST_URI']; $box = ''; $boxEnd = ''; if(strstr($now_url,"/engagement")){ $box = '
    '; $boxEnd = '
    '; }else if(strstr($now_url,"/marriage")){ $box = '
    '; $boxEnd = '
    '; } $html .= <<< EOD {$box} {$boxEnd} EOD; } return $html; } //HISTORY private function buildHistoryPage($c){ $html = ''; if(!empty($c)){ $html .= $this->buildContentsBlock( array( 'lead' => $c['lead'], 'body' => $c['body'], 'img' => array( '01' => 'img_01_pc', '02' => 'img_02_pc', '03' => 'img_03_pc', '04' => 'img_04_pc' ), 'caption' => $c['imgCaption'], 'textLeft' => true, 'lastFlag' => false )); $html .= $this->buildBrandLinks(); //画像パス $imgPath = $this->topUrl.'/data/'.$this->slug.'/img'; $html = <<< EOD

    {$html}

    EOD; } return $html; } //TOPICS private function buildTopicsPage($c){ $html = ''; if(!empty($c)){ $html .= $this->buildContentsBlock( array( 'lead' => $c['lead'], 'body' => $c['body'], 'img' => array( 'main' => 'img_main_pc', ), 'caption' => $c['imgCaption'], 'textLeft' => true, 'lastFlag' => false )); $html .= $this->buildBrandLinks(); //ジュエリー $j = ''; $imgBaseUrl = $this->topUrl.'/data/'.$this->slug.'/img/'.$this->page; if(!empty($c['jewelry'])){ foreach($c['jewelry'] as $k => $v){ $imgKey = sprintf('%02d', $k); $p = $this->makePriceLine($v['price']); if(!empty($v['priceText'])){ $p .= '

    '.$v['priceText'].'

    '; } $j .= <<< EOD

    {$v['name']}{$v['subName']}

    {$v['dec']}

    素材・価格(税込)

    {$p}
    EOD; } //アクセシブル・ジュエリー $html .= <<< EOD

    今すぐほしい!
    マストハブ ジュエリーMust-have Jewelry

    {$j}
    EOD; } //画像パス $imgPath = $this->topUrl.'/data/'.$this->slug.'/img'; $html = <<< EOD

    {$html}

    EOD; } return $html; } //ContentsBlock private function buildContentsBlock($_data){ $html = ''; //$_data['textLeft'] $_page = $this->page; $imgBaseUrl = $this->topUrl.'/data/'.$this->slug.'/img/'.$_page; $serverImgBaseUrl = $this->serverPath.'/data/'.$this->slug.'/img/'.$_page.'/'; $class = ($_data['lastFlag']) ? ' last' : ''; $html = '
    '."\n"; //リード $class = ($_data['textLeft']) ? '' : ' class="r"'; $html .= ''.nl2br($_data['lead']).''."\n"; $html .= '

    '.nl2br($_data['body']).'

    '."\n"; //画像 $img = ''; foreach($_data['img'] as $k => $v){ if(file_exists($serverImgBaseUrl.$v.'.jpg')){ $c = 'img-'.$k; $c .= $_data['textLeft'] ? ' r' : ' l'; if(!empty($_data['caption'][$k]) && is_array($_data['caption'][$k])){ $caption = '
    '; $caption .= !empty($_data['caption'][$k]['title']) ? '

    '.$_data['caption'][$k]['title'].'

    ' : ''; $caption .= !empty($_data['caption'][$k]['body']) ? '

    '.$_data['caption'][$k]['body'].'

    ' : ''; $caption .= '
    '; $alt = !empty($_data['caption'][$k]['title']) ? $_data['caption'][$k]['title'] : $_data['caption'][$k]['body']; } else { $caption = !empty($_data['caption'][$k]) ? '
    '.$_data['caption'][$k].'
    ' : ''; $alt = !empty($_data['caption'][$k]) ? $_data['caption'][$k] : ''; } $img .= <<< EOD
    {$alt} {$caption}
    EOD; } } $html .= $img; /* //メイン画像 if(file_exists($this->serverPath.'/data/'.$this->slug.'/img/'.$_page.'/'.$_data['img']['main'].'.jpg')){ $class = ($_data['textLeft']) ? 'r' : 'l'; $html .= '

    '."\n"; } $class = ($_data['textLeft']) ? 'l' : 'r'; $html .= '

    '.nl2br($_data['body']).'

    '."\n"; //サブ画像 $subImg = ''; if(file_exists($this->serverPath.'/data/'.$this->slug.'/img/'.$_page.'/'.$_data['img']['sub1'].'.jpg')){ $class = ($_data['lastFlag']) ? 'l spR' : 'l spL'; $subImg = '
  • '."\n"; } if(file_exists($this->serverPath.'/data/'.$this->slug.'/img/'.$_page.'/'.$_data['img']['sub2'].'.jpg')){ $class = ($_data['lastFlag']) ? 'r spL' : 'r spR'; $subImg .= '
  • '."\n"; } $class = ($_data['textLeft']) ? 'r' : 'l'; $html .= '
      '."\n"; $html .= $subImg; $html .= '
    '; */ $html .= '
    '; return $html; } //価格 private function makePriceLine($v){ $html = ''; if(!empty($v) && count($v) > 0){ foreach($v as $k2 => $v2){ if(!empty($v2)){ $p = $this->priceFormat(array('price' => $v2['price'], 'priceKara' => $v2['kara'])); $html .= <<< EOD
  • {$v2['material']}
    {$p}
  • EOD; } } } return '
      '.$html.'
    '; } //Link private function buildBrandLinks(){ $html = ''; $html = <<< EOD EOD; return $html; } //価格のフォーマット private function priceFormat($_d){ $price = ''; $price = number_format($_d['price']); $url = $_SERVER['REQUEST_URI']; if(strstr($url,'/brand/tiffany-and-co/')==true){ $price .= ($_d['priceKara']) ? '円台~' : '円'; }else{ $price .= ($_d['priceKara']) ? '円~' : '円'; } return $price; } //最低価格を表示する /*private function getLowestPrice($_d){ $min = 0; if(!empty($_d)){ foreach($_d as $k => $v){ if(!empty($v['price'])){ if($min === 0) $min = $v['price']; $min = $min > $v['price'] ? $v['price'] : $min; } } } return $this->priceFormat(array('price' => $min, 'priceKara' => true)); }*/ //リストの先頭の価格を表示する private function getFirstPrice($_d){ $min = 0; if(!empty($_d)){ foreach($_d as $k => $v){ if(!empty($v['price'])){ if($min === 0) $min = $v['price']; } } } return $this->priceFormat(array('price' => $min, 'priceKara' => false)); } /* * コンテンツフッター * ページTop / パンくず * -------------------------------- */ public function buildContentsFooter($_page){ $html = ''; $breadCrumb = ''; $breadCrumb .= '
  • '."\n"; $breadCrumb .= '
  • '."\n"; foreach($_page as $k => $v){ $breadCrumb .= '
  • '."\n"; } $html = <<< EOD
    ページトップへ
      {$breadCrumb}
    EOD; return $html; } /* * フッターナビゲーション * -------------------------------- */ public function footerNavi(){ $brandBaseUrl = '/brand/'; include_once('components/footer.inc'); return $cajBrandFooter; } } ?>